[rygel] core: bitrate should be in bytes/second



commit 030f1ddec312fbb94607deb5385b35fd1f7f41ec
Author: James Henstridge <james jamesh id au>
Date:   Tue Jul 28 15:34:51 2009 +0300

    core: bitrate should be in bytes/second
    
    Set the bitrate for transcoded resources in bytes/second.

 src/rygel/rygel-l16-transcoder.vala   |    4 ++++
 src/rygel/rygel-mp2ts-transcoder.vala |    5 ++++-
 src/rygel/rygel-mp3-transcoder.vala   |    3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-l16-transcoder.vala b/src/rygel/rygel-l16-transcoder.vala
index 374ddb0..0b8b5c2 100644
--- a/src/rygel/rygel-l16-transcoder.vala
+++ b/src/rygel/rygel-l16-transcoder.vala
@@ -70,6 +70,10 @@ internal class Rygel.L16Transcoder : Rygel.Transcoder {
         res.sample_freq = L16Transcoder.FREQUENCY;
         res.n_audio_channels = L16Transcoder.CHANNELS;
         res.bits_per_sample = L16Transcoder.WIDTH;
+        // Set bitrate in bytes/second
+        res.bitrate = L16Transcoder.FREQUENCY *
+                      L16Transcoder.CHANNELS *
+                      L16Transcoder.WIDTH / 8;
 
         return res;
     }
diff --git a/src/rygel/rygel-mp2ts-transcoder.vala b/src/rygel/rygel-mp2ts-transcoder.vala
index 6282e42..4f65f1f 100644
--- a/src/rygel/rygel-mp2ts-transcoder.vala
+++ b/src/rygel/rygel-mp2ts-transcoder.vala
@@ -34,6 +34,8 @@ internal enum Rygel.MP2TSProfile {
  * This element uses MP2TSTrancoderBin for actual transcoding.
  */
 internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
+    private const int VIDEO_BITRATE = 3000;
+
     // HD
     private const int[] WIDTH = {640, 1280};
     private const int[] HEIGHT = {480, 720};
@@ -63,6 +65,7 @@ internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
 
         res.width = WIDTH[profile];
         res.height = HEIGHT[profile];
+        res.bitrate = (VIDEO_BITRATE + MP3Transcoder.BITRATE) * 1000 / 8;
 
         return res;
     }
@@ -77,7 +80,7 @@ internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
         dynamic Element encoder = GstUtils.create_element (VIDEO_ENCODER,
                                                            VIDEO_ENCODER);
 
-        encoder.bitrate = (int) 3000000;
+        encoder.bitrate = (int) VIDEO_BITRATE * 1000;
 
         var bin = new Bin ("video-encoder-bin");
         bin.add_many (videorate, videoscale, convert, encoder);
diff --git a/src/rygel/rygel-mp3-transcoder.vala b/src/rygel/rygel-mp3-transcoder.vala
index ce5350b..67c85a5 100644
--- a/src/rygel/rygel-mp3-transcoder.vala
+++ b/src/rygel/rygel-mp3-transcoder.vala
@@ -53,7 +53,8 @@ internal class Rygel.MP3Transcoder : Rygel.Transcoder {
                                                       throws Error {
         var res = base.create_resource (item, manager);
 
-        res.bitrate = BITRATE;
+        // Convert bitrate to bytes/second
+        res.bitrate = BITRATE * 1000 / 8;
 
         return res;
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]