Transcoder classes dictate the mimetype and DLNA profile.
authorZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Sat, 21 Mar 2009 13:56:29 +0000 (13:56 +0000)
committerZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Sat, 21 Mar 2009 13:56:29 +0000 (13:56 +0000)
svn path=/trunk/; revision=715

src/rygel/rygel-mp2ts-transcoder.vala
src/rygel/rygel-mp3-transcoder.vala
src/rygel/rygel-transcode-manager.vala

index f4d2eed..3501cdc 100644 (file)
@@ -24,6 +24,9 @@ using Rygel;
 using Gst;
 
 internal class Rygel.MP2TSTranscoder : Rygel.Transcoder {
+   public const string mime_type = "video/mpeg";
+   public const string dlna_profile = "MP3";
+
    private const string DECODEBIN = "decodebin2";
    private const string VIDEO_ENCODER = "mpeg2enc";
    private const string COLORSPACE_CONVERT = "ffmpegcolorspace";
index 5f61760..8ba41a0 100644 (file)
@@ -29,6 +29,9 @@ internal enum Rygel.MP3Profile {
 }
 
 internal class Rygel.MP3Transcoder : Rygel.Transcoder {
+   public const string mime_type = "audio/mpeg";
+   public const string dlna_profile = "MP3";
+
    private const string DECODEBIN = "decodebin2";
    private const string AUDIO_CONVERT = "audioconvert";
    private const string[] AUDIO_ENCODER = {null, "twolame", "lame"};
index 20c2494..1089fac 100644 (file)
@@ -36,14 +36,17 @@ public abstract class Rygel.TranscodeManager : GLib.Object {
                                          MediaItem                    item)
                                          throws Error {
         string mime_type;
+        string dlna_profile;
 
         if (item.upnp_class.has_prefix (MediaItem.IMAGE_CLASS)) {
             // No  transcoding for images yet :(
             return;
         } else if (item.upnp_class.has_prefix (MediaItem.MUSIC_CLASS)) {
-            mime_type = "audio/mpeg";
+            mime_type = MP3Transcoder.mime_type;
+            dlna_profile = MP3Transcoder.dlna_profile;
         } else {
-            mime_type = "video/mpeg";
+            mime_type = MP2TSTranscoder.mime_type;
+            dlna_profile = MP2TSTranscoder.dlna_profile;
         }
 
         if (item.mime_type == mime_type) {
@@ -55,6 +58,7 @@ public abstract class Rygel.TranscodeManager : GLib.Object {
         DIDLLiteResource res = item.create_res (uri);
         res.mime_type = mime_type;
         res.protocol = protocol;
+        res.dlna_profile = dlna_profile;
         res.dlna_conversion = DLNAConversion.TRANSCODED;
         res.dlna_flags = DLNAFlags.STREAMING_TRANSFER_MODE;
         res.dlna_operation = DLNAOperation.NONE;
@@ -66,9 +70,9 @@ public abstract class Rygel.TranscodeManager : GLib.Object {
     internal Element get_transcoding_src (Element src,
                                           string  target)
                                           throws Error {
-        if (target == "audio/mpeg") {
+        if (target == MP3Transcoder.mime_type) {
             return new MP3Transcoder (src, MP3Profile.LAYER3);
-        } else if (target == "video/mpeg") {
+        } else if (target == MP2TSTranscoder.mime_type) {
             return new MP2TSTranscoder (src);
         } else {
             throw new HTTPRequestError.NOT_FOUND (