From acad13ed68338c5bd6ff5f2348bc31b4028952b6 Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Sat, 21 Mar 2009 13:56:29 +0000 Subject: [PATCH] Transcoder classes dictate the mimetype and DLNA profile. svn path=/trunk/; revision=715 --- src/rygel/rygel-mp2ts-transcoder.vala | 3 +++ src/rygel/rygel-mp3-transcoder.vala | 3 +++ src/rygel/rygel-transcode-manager.vala | 12 ++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/rygel/rygel-mp2ts-transcoder.vala b/src/rygel/rygel-mp2ts-transcoder.vala index f4d2eed..3501cdc 100644 --- a/src/rygel/rygel-mp2ts-transcoder.vala +++ b/src/rygel/rygel-mp2ts-transcoder.vala @@ -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"; diff --git a/src/rygel/rygel-mp3-transcoder.vala b/src/rygel/rygel-mp3-transcoder.vala index 5f61760..8ba41a0 100644 --- a/src/rygel/rygel-mp3-transcoder.vala +++ b/src/rygel/rygel-mp3-transcoder.vala @@ -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"}; diff --git a/src/rygel/rygel-transcode-manager.vala b/src/rygel/rygel-transcode-manager.vala index 20c2494..1089fac 100644 --- a/src/rygel/rygel-transcode-manager.vala +++ b/src/rygel/rygel-transcode-manager.vala @@ -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 ( -- 2.7.4