media-export,engine-gst: Port to new GUPnP-DLNA
[profile/ivi/rygel.git] / src / media-engines / gstreamer / rygel-gst-media-engine.vala
index af5b4cb..a2d8722 100644 (file)
@@ -35,29 +35,40 @@ public class Rygel.GstMediaEngine : Rygel.MediaEngine {
     private GLib.List<Transcoder> transcoders = null;
 
     public GstMediaEngine () {
-        // Work-around vapi bug, fixed for GStreamer 1.0
         unowned string[] args = null;
 
         Gst.init (ref args);
         gst_preset_set_app_dir (PRESET_DIR);
 
-        var discoverer = new GUPnP.DLNADiscoverer ((ClockTime) SECOND,
-                                                   true,
-                                                   false);
+        /* Get the possible DLNA profiles
+         * to add to the list of DLNA profiles supported by
+         * this media engine, for get_dlna_profiles():
+         */
+        var discoverer = new GUPnPDLNA.ProfileGuesser (true, false);
         foreach (var profile in discoverer.list_profiles ()) {
             var p = new DLNAProfile (profile.name, profile.mime);
+
+            /* TODO: Check that we (via GStreamer) really support this profile
+             * instead of just claiming to support everything.
+             */
             this.dlna_profiles.prepend (p);
         }
+        this.dlna_profiles.prepend (new DLNAProfile ("DIDL_S", "text/xml"));
 
         this.dlna_profiles.reverse ();
 
         var transcoding = true;
         var transcoder_list = new ArrayList<string> ();
 
+        /* Allow some transcoders to be disabled by the Rygel Server configuration.
+         * For instance, some DLNA Renderers might incorrectly prefer inferior transcoded formats,
+         * sometimes even preferring transcoded formats over the original data,
+         * so this forces them to use other formats.
+         */
         var config = MetaConfig.get_default ();
         try {
             transcoding = config.get_transcoding ();
-            transcoder_list = config.get_string_list ("MediaEngine",
+            transcoder_list = config.get_string_list ("GstMediaEngine",
                                                       "transcoders");
         } catch (Error err) {}
 
@@ -71,8 +82,12 @@ public class Rygel.GstMediaEngine : Rygel.MediaEngine {
                         this.transcoders.prepend (new MP3Transcoder ());
                         break;
                     case "mp2ts":
-                        this.transcoders.prepend (new MP2TSTranscoder(MP2TSProfile.SD));
-                        this.transcoders.prepend (new MP2TSTranscoder(MP2TSProfile.HD));
+                        this.transcoders.prepend (new MP2TSTranscoder
+                                        (MP2TSProfile.SD_EU));
+                        this.transcoders.prepend (new MP2TSTranscoder
+                                        (MP2TSProfile.SD_NA));
+                        this.transcoders.prepend (new MP2TSTranscoder
+                                        (MP2TSProfile.HD_NA));
                         break;
                     case "wmv":
                         this.transcoders.prepend (new WMVTranscoder ());