rygel r749 - trunk/src/rygel



Author: zeeshanak
Date: Sat Mar 28 00:44:46 2009
New Revision: 749
URL: http://svn.gnome.org/viewvc/rygel?rev=749&view=rev

Log:
MP2TSTranscoder supports both HD and SD.

Modified:
   trunk/src/rygel/rygel-mp2ts-transcoder.vala
   trunk/src/rygel/rygel-transcode-manager.vala

Modified: trunk/src/rygel/rygel-mp2ts-transcoder.vala
==============================================================================
--- trunk/src/rygel/rygel-mp2ts-transcoder.vala	(original)
+++ trunk/src/rygel/rygel-mp2ts-transcoder.vala	Sat Mar 28 00:44:46 2009
@@ -25,19 +25,29 @@
 using GUPnP;
 using Gee;
 
+internal enum Rygel.MP2TSProfile {
+    SD = 0,
+    HD
+}
+
 internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
     // HD
-    private const int WIDTH = 1920;
-    private const int HEIGHT = 1080;
+    private const int[] WIDTH = {640, 1920};
+    private const int[] HEIGHT = {480, 1080};
+    private const string[] PROFILES = {"MPEG_TS_SD_NA", "MPEG_TS_HD_NA"};
+
+    private MP2TSProfile profile;
+
+    public MP2TSTranscoder (MP2TSProfile profile) {
+        base ("video/mpeg", PROFILES[profile]);
 
-    public MP2TSTranscoder () {
-        base ("video/mpeg", "MPEG_TS_HD_NA");
+        this.profile = profile;
     }
 
     public override Element create_source (Element src) throws Error {
         return new MP2TSTranscoderBin (src,
-                                       MP2TSTranscoder.WIDTH,
-                                       MP2TSTranscoder.HEIGHT);
+                                       MP2TSTranscoder.WIDTH[this.profile],
+                                       MP2TSTranscoder.HEIGHT[this.profile]);
     }
 
     public override void add_resources (ArrayList<DIDLLiteResource?> resources,
@@ -50,9 +60,9 @@
 
         var res = manager.create_resource (item,
                                            this.mime_type,
-                                           this.dlna_profile);
-        res.width = WIDTH;
-        res.height = HEIGHT;
+                                           PROFILES[this.profile]);
+        res.width = WIDTH[profile];
+        res.height = HEIGHT[profile];
 
         resources.add (res);
     }

Modified: trunk/src/rygel/rygel-transcode-manager.vala
==============================================================================
--- trunk/src/rygel/rygel-transcode-manager.vala	(original)
+++ trunk/src/rygel/rygel-transcode-manager.vala	Sat Mar 28 00:44:46 2009
@@ -29,12 +29,14 @@
 internal abstract class Rygel.TranscodeManager : GLib.Object {
     private Transcoder l16_transcoder;
     private Transcoder mp3_transcoder;
-    private Transcoder mp2ts_transcoder;
+    private Transcoder mp2ts_hd_transcoder;
+    private Transcoder mp2ts_sd_transcoder;
 
     internal TranscodeManager () {
         l16_transcoder = new L16Transcoder ();
         mp3_transcoder = new MP3Transcoder (MP3Layer.THREE);
-        mp2ts_transcoder = new MP2TSTranscoder();
+        mp2ts_sd_transcoder = new MP2TSTranscoder(MP2TSProfile.SD);
+        mp2ts_hd_transcoder = new MP2TSTranscoder(MP2TSProfile.HD);
     }
 
     internal abstract string create_uri_for_item
@@ -52,7 +54,8 @@
             this.l16_transcoder.add_resources (resources, item, this);
             this.mp3_transcoder.add_resources (resources, item, this);
         } else {
-            this.mp2ts_transcoder.add_resources (resources, item, this);
+            this.mp2ts_sd_transcoder.add_resources (resources, item, this);
+            this.mp2ts_hd_transcoder.add_resources (resources, item, this);
         }
     }
 
@@ -61,8 +64,10 @@
             return this.mp3_transcoder;
         } else if (this.l16_transcoder.can_handle (target)) {
             return this.l16_transcoder;
-        } else if (this.mp2ts_transcoder.can_handle (target)) {
-            return this.mp2ts_transcoder;
+        } else if (this.mp2ts_sd_transcoder.can_handle (target)) {
+            return this.mp2ts_sd_transcoder;
+        } else if (this.mp2ts_hd_transcoder.can_handle (target)) {
+            return this.mp2ts_hd_transcoder;
         } else {
             throw new HTTPRequestError.NOT_FOUND (
                             "No transcoder available for target format '%s'",



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