diff options
author | Jens Georg <jensg@openismus.org> | 2012-08-31 15:41:43 +0200 |
---|---|---|
committer | Jens Georg <jensg@openismus.com> | 2012-10-05 17:33:28 +0200 |
commit | 948ca2c717c68e3acd666d288809230fca07676e (patch) | |
tree | 6fb417576d9df7458ebc1cf51fd49328a15fa929 /src | |
parent | 6a21745ce346dde83e714b77f9fb1fea4a5da1dd (diff) | |
download | rygel-948ca2c717c68e3acd666d288809230fca07676e.tar.gz |
core,data,doc: Drop transcoder options
Add a new [MediaEngine] section and add a "transcoders" list.
Diffstat (limited to 'src')
-rw-r--r-- | src/librygel-core/rygel-configuration.vala | 15 | ||||
-rw-r--r-- | src/librygel-core/rygel-meta-config.vala | 116 | ||||
-rw-r--r-- | src/librygel-server/rygel-gst-media-engine.vala | 67 | ||||
-rw-r--r-- | src/rygel/rygel-cmdline-config.vala | 69 | ||||
-rw-r--r-- | src/rygel/rygel-environment-config.vala | 33 | ||||
-rw-r--r-- | src/rygel/rygel-user-config.vala | 33 | ||||
-rw-r--r-- | src/ui/rygel-writable-user-config.vala | 18 |
7 files changed, 39 insertions, 312 deletions
diff --git a/src/librygel-core/rygel-configuration.vala b/src/librygel-core/rygel-configuration.vala index f60fd61f..6dfbd26a 100644 --- a/src/librygel-core/rygel-configuration.vala +++ b/src/librygel-core/rygel-configuration.vala @@ -1,11 +1,12 @@ /* * Copyright (C) 2008,2009 Nokia Corporation. * Copyright (C) 2008,2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>. - * Copyright (C) 2012 Intel Corporation + * Copyright (C) 2012 Intel Corporation. * * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org> * <zeeshan.ali@nokia.com> * Krzesimir Nowak <krnowak@openismus.com> + * Jens Georg <jensg@openismus.com> * * This file is part of Rygel. * @@ -80,18 +81,6 @@ public interface Rygel.Configuration : GLib.Object { public abstract bool get_transcoding () throws GLib.Error; - public abstract bool get_mp3_transcoder () throws GLib.Error; - - public abstract bool get_mp2ts_transcoder () throws GLib.Error; - - public abstract bool get_lpcm_transcoder () throws GLib.Error; - - public abstract bool get_wmv_transcoder () throws GLib.Error; - - public abstract bool get_aac_transcoder () throws GLib.Error; - - public abstract bool get_avc_transcoder () throws GLib.Error; - public abstract bool get_allow_upload () throws GLib.Error; public abstract bool get_allow_deletion () throws GLib.Error; diff --git a/src/librygel-core/rygel-meta-config.vala b/src/librygel-core/rygel-meta-config.vala index 2ce4be36..02f3aa05 100644 --- a/src/librygel-core/rygel-meta-config.vala +++ b/src/librygel-core/rygel-meta-config.vala @@ -1,7 +1,7 @@ /* * Copyright (C) 2008,2009 Nokia Corporation. * Copyright (C) 2008,2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>. - * Copyright (C) 2012 Openismus GmbH. + * Copyright (C) 2012 Intel Corporation. * Copyright (C) 2012 Intel Corporation * * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org> @@ -150,120 +150,6 @@ public class Rygel.MetaConfig : GLib.Object, Configuration { return val; } - public bool get_mp3_transcoder () throws GLib.Error { - bool val = true; - bool unavailable = true; - - foreach (var config in MetaConfig.configs) { - try { - val = config.get_mp3_transcoder (); - unavailable = false; - break; - } catch (GLib.Error err) {} - } - - if (unavailable) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } - - return val; - } - - public bool get_mp2ts_transcoder () throws GLib.Error { - bool val = true; - bool unavailable = true; - - foreach (var config in MetaConfig.configs) { - try { - val = config.get_mp2ts_transcoder (); - unavailable = false; - break; - } catch (GLib.Error err) {} - } - - if (unavailable) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } - - return val; - } - - public bool get_lpcm_transcoder () throws GLib.Error { - bool val = true; - bool unavailable = true; - - foreach (var config in MetaConfig.configs) { - try { - val = config.get_lpcm_transcoder (); - unavailable = false; - break; - } catch (GLib.Error err) {} - } - - if (unavailable) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } - - return val; - } - - public bool get_wmv_transcoder () throws GLib.Error { - bool val = true; - bool unavailable = true; - - foreach (var config in MetaConfig.configs) { - try { - val = config.get_wmv_transcoder (); - unavailable = false; - break; - } catch (GLib.Error err) {} - } - - if (unavailable) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } - - return val; - } - - public bool get_aac_transcoder () throws GLib.Error { - bool val = true; - bool unavailable = true; - - foreach (var config in MetaConfig.configs) { - try { - val = config.get_aac_transcoder (); - unavailable = false; - break; - } catch (GLib.Error err) {} - } - - if (unavailable) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } - - return val; - } - - public bool get_avc_transcoder () throws GLib.Error { - bool val = true; - bool unavailable = true; - - foreach (var config in MetaConfig.configs) { - try { - val = config.get_avc_transcoder (); - unavailable = false; - break; - } catch (GLib.Error err) {} - } - - if (unavailable) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } - - return val; - } - public bool get_allow_upload () throws GLib.Error { bool val = true; bool unavailable = true; diff --git a/src/librygel-server/rygel-gst-media-engine.vala b/src/librygel-server/rygel-gst-media-engine.vala index 58685982..8a7ba700 100644 --- a/src/librygel-server/rygel-gst-media-engine.vala +++ b/src/librygel-server/rygel-gst-media-engine.vala @@ -21,6 +21,7 @@ */ using Gst; +using Gee; internal class Rygel.GstMediaEngine : Rygel.MediaEngine { private GLib.List<DLNAProfile> dlna_profiles = null; @@ -38,51 +39,41 @@ internal class Rygel.GstMediaEngine : Rygel.MediaEngine { this.dlna_profiles.reverse (); var transcoding = true; - var lpcm_transcoder = true; - var mp3_transcoder = true; - var mp2ts_transcoder = true; - var wmv_transcoder = true; - var aac_transcoder = true; - var avc_transcoder = true; + var transcoder_list = new ArrayList<string> (); var config = MetaConfig.get_default (); try { transcoding = config.get_transcoding (); - - if (transcoding) { - lpcm_transcoder = config.get_lpcm_transcoder (); - mp3_transcoder = config.get_mp3_transcoder (); - mp2ts_transcoder = config.get_mp2ts_transcoder (); - wmv_transcoder = config.get_wmv_transcoder (); - aac_transcoder = config.get_aac_transcoder (); - avc_transcoder = config.get_avc_transcoder (); - } + transcoder_list = config.get_string_list ("MediaEngine", + "transcoders"); } catch (Error err) {} if (transcoding) { - if (lpcm_transcoder) { - this.transcoders.prepend (new L16Transcoder ()); - } - - if (mp3_transcoder) { - this.transcoders.prepend (new MP3Transcoder ()); - } - - if (mp2ts_transcoder) { - this.transcoders.prepend (new MP2TSTranscoder(MP2TSProfile.SD)); - this.transcoders.prepend (new MP2TSTranscoder(MP2TSProfile.HD)); - } - - if (wmv_transcoder) { - this.transcoders.prepend (new WMVTranscoder ()); - } - - if (aac_transcoder) { - this.transcoders.prepend (new AACTranscoder ()); - } - - if (avc_transcoder) { - this.transcoders.prepend (new AVCTranscoder ()); + foreach (var transcoder in transcoder_list) { + switch (transcoder) { + case "lpcm": + this.transcoders.prepend (new L16Transcoder ()); + break; + case "mp3": + this.transcoders.prepend (new MP3Transcoder ()); + break; + case "mp2ts": + this.transcoders.prepend (new MP2TSTranscoder(MP2TSProfile.SD)); + this.transcoders.prepend (new MP2TSTranscoder(MP2TSProfile.HD)); + break; + case "wmv": + this.transcoders.prepend (new WMVTranscoder ()); + break; + case "aac": + this.transcoders.prepend (new AACTranscoder ()); + break; + case "avc": + this.transcoders.prepend (new AVCTranscoder ()); + break; + default: + debug ("Unsupported transcoder \"%s\"", transcoder); + break; + } } this.transcoders.reverse (); diff --git a/src/rygel/rygel-cmdline-config.vala b/src/rygel/rygel-cmdline-config.vala index ccf7d97b..ea00324a 100644 --- a/src/rygel/rygel-cmdline-config.vala +++ b/src/rygel/rygel-cmdline-config.vala @@ -1,7 +1,7 @@ /* * Copyright (C) 2008,2009 Nokia Corporation. * Copyright (C) 2008,2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>. - * Copyright (C) 2012 Openismus GmbH. + * Copyright (C) 2012 Intel Corporation. * * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org> * <zeeshan.ali@nokia.com> @@ -39,12 +39,6 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration { private static bool no_upnp; private static bool no_transcoding; - private static bool no_mp3_trans; - private static bool no_mp2ts_trans; - private static bool no_lpcm_trans; - private static bool no_wmv_trans; - private static bool no_aac_trans; - private static bool no_avc_trans; private static bool disallow_upload; private static bool disallow_deletion; @@ -80,19 +74,6 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration { "Port", "PORT" }, { "disable-transcoding", 't', 0, OptionArg.NONE, ref no_transcoding, "Disable transcoding", null }, - { "disable-mp3-transcoder", 'm', 0, OptionArg.NONE, ref no_mp3_trans, - "Disable MP3 transcoder", null }, - { "disable-mp2ts-transcoder", 's', 0, OptionArg.NONE, - ref no_mp2ts_trans, - "Disable mpeg2 transport stream transcoder", null }, - { "disable-lpcm-transcoder", 'l', 0, OptionArg.NONE, ref no_lpcm_trans, - "Disable Linear PCM transcoder", null }, - { "disable-wmv-transcoder", 'w', 0, OptionArg.NONE, ref no_wmv_trans, - "Disable WMV transcoder", null }, - { "disable-aac-transcoder", 'a', 0, OptionArg.NONE, ref no_aac_trans, - "Disable AAC_ISO_320 transcoder", null }, - { "disable-avc-transcoder", 'z', 0, OptionArg.NONE, ref no_avc_trans, - "Disable AVC_MP4 transcoder", null }, { "disallow-upload", 'U', 0, OptionArg.NONE, ref disallow_upload, "Disallow upload", null }, { "disallow-deletion", 'D', 0, OptionArg.NONE, @@ -185,54 +166,6 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration { } } - public bool get_mp3_transcoder () throws GLib.Error { - if (!no_mp3_trans) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } else { - return false; - } - } - - public bool get_mp2ts_transcoder () throws GLib.Error { - if (!no_mp2ts_trans) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } else { - return false; - } - } - - public bool get_lpcm_transcoder () throws GLib.Error { - if (!no_lpcm_trans) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } else { - return false; - } - } - - public bool get_wmv_transcoder () throws GLib.Error { - if (!no_wmv_trans) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } else { - return false; - } - } - - public bool get_aac_transcoder () throws GLib.Error { - if (!no_aac_trans) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } else { - return false; - } - } - - public bool get_avc_transcoder () throws GLib.Error { - if (!no_avc_trans) { - throw new ConfigurationError.NO_VALUE_SET (_("No value available")); - } else { - return false; - } - } - public bool get_allow_upload () throws GLib.Error { if (!disallow_upload) { throw new ConfigurationError.NO_VALUE_SET (_("No value available")); diff --git a/src/rygel/rygel-environment-config.vala b/src/rygel/rygel-environment-config.vala index 35d991b9..75d7d1ff 100644 --- a/src/rygel/rygel-environment-config.vala +++ b/src/rygel/rygel-environment-config.vala @@ -1,9 +1,11 @@ /* * Copyright (C) 2008-2010 Nokia Corporation. * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>. + * Copyright (C) 2012 Intel Corporation. * * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org> * <zeeshan.ali@nokia.com> + * Jens Georg <jensg@openismus.com> * * This file is part of Rygel. * @@ -36,13 +38,6 @@ internal class Rygel.EnvironmentConfig : GLib.Object, Configuration { private static string PORT_ENV = RYGEL_PREFIX + "_PORT"; private static string DISABLE_UPNP_ENV = DISABLE_PREFIX + "_UPNP"; private static string TRANSCODING_ENV = DISABLE_PREFIX + "_TRANSCODING"; - private static string MP3_TRANSCODING_ENV = DISABLE_PREFIX + "_MP3_TRANS"; - private static string LPCM_TRANSCODING_ENV = DISABLE_PREFIX + "_LPCM_TRANS"; - private static string MP2TS_TRANSCODING_ENV = DISABLE_PREFIX + - "_MP2TS_TRANS"; - private static string WMV_TRANSCODING_ENV = DISABLE_PREFIX + "_WMV_TRANS"; - private static string AAC_TRANSCODING_ENV = DISABLE_PREFIX + "_AAC_TRANS"; - private static string AVC_TRANSCODING_ENV = DISABLE_PREFIX + "_AVC_TRANS"; private static string DISALLOW_UPLOAD_ENV = DISABLE_PREFIX + "_UPLOAD"; private static string DISALLOW_DELETION_ENV = DISABLE_PREFIX + "_DELETION"; private static string LOG_LEVELS_ENV = RYGEL_PREFIX + "_LOG"; @@ -75,30 +70,6 @@ internal class Rygel.EnvironmentConfig : GLib.Object, Configuration { return !this.get_bool_variable (TRANSCODING_ENV); } - public bool get_mp3_transcoder () throws GLib.Error { - return !this.get_bool_variable (MP3_TRANSCODING_ENV); - } - - public bool get_mp2ts_transcoder () throws GLib.Error { - return !this.get_bool_variable (MP2TS_TRANSCODING_ENV); - } - - public bool get_wmv_transcoder () throws GLib.Error { - return !this.get_bool_variable (WMV_TRANSCODING_ENV); - } - - public bool get_aac_transcoder () throws GLib.Error { - return !this.get_bool_variable (AAC_TRANSCODING_ENV); - } - - public bool get_avc_transcoder () throws GLib.Error { - return !this.get_bool_variable (AVC_TRANSCODING_ENV); - } - - public bool get_lpcm_transcoder () throws GLib.Error { - return !this.get_bool_variable (LPCM_TRANSCODING_ENV); - } - public bool get_allow_upload () throws GLib.Error { return !this.get_bool_variable (DISALLOW_UPLOAD_ENV); } diff --git a/src/rygel/rygel-user-config.vala b/src/rygel/rygel-user-config.vala index 003714c7..022bc535 100644 --- a/src/rygel/rygel-user-config.vala +++ b/src/rygel/rygel-user-config.vala @@ -1,11 +1,12 @@ /* * Copyright (C) 2008,2009 Nokia Corporation. * Copyright (C) 2008,2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>. - * Copyright (C) 2012 Intel Corporation + * Copyright (C) 2012 Intel Corporation. * * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org> * <zeeshan.ali@nokia.com> * Krzesimir Nowak <krnowak@openismus.com> + * Jens Georg <jensg@openismus.com> * * This file is part of Rygel. * @@ -44,12 +45,6 @@ public class Rygel.UserConfig : GLib.Object, Configuration { public static const string UPNP_ENABLED_KEY = "upnp-" + ENABLED_KEY; public static const string TITLE_KEY = "title"; public static const string TRANSCODING_KEY = "enable-transcoding"; - public static const string MP3_TRANSCODER_KEY = "enable-mp3-transcoder"; - public static const string MP2TS_TRANSCODER_KEY = "enable-mp2ts-transcoder"; - public static const string LPCM_TRANSCODER_KEY = "enable-lpcm-transcoder"; - public static const string WMV_TRANSCODER_KEY = "enable-wmv-transcoder"; - public static const string AAC_TRANSCODER_KEY = "enable-aac-transcoder"; - public static const string AVC_TRANSCODER_KEY = "enable-avc-transcoder"; public static const string ALLOW_UPLOAD_KEY = "allow-upload"; public static const string ALLOW_DELETION_KEY = "allow-deletion"; public static const string LOG_LEVELS_KEY = "log-level"; @@ -168,30 +163,6 @@ public class Rygel.UserConfig : GLib.Object, Configuration { return this.get_bool (GENERAL_SECTION, TRANSCODING_KEY); } - public bool get_mp3_transcoder () throws GLib.Error { - return this.get_bool (GENERAL_SECTION, MP3_TRANSCODER_KEY); - } - - public bool get_mp2ts_transcoder () throws GLib.Error { - return this.get_bool (GENERAL_SECTION, MP2TS_TRANSCODER_KEY); - } - - public bool get_lpcm_transcoder () throws GLib.Error { - return this.get_bool (GENERAL_SECTION, LPCM_TRANSCODER_KEY); - } - - public bool get_wmv_transcoder () throws GLib.Error { - return this.get_bool (GENERAL_SECTION, WMV_TRANSCODER_KEY); - } - - public bool get_aac_transcoder () throws GLib.Error { - return this.get_bool (GENERAL_SECTION, AAC_TRANSCODER_KEY); - } - - public bool get_avc_transcoder () throws GLib.Error { - return this.get_bool (GENERAL_SECTION, AVC_TRANSCODER_KEY); - } - public bool get_allow_upload () throws GLib.Error { return this.get_bool (GENERAL_SECTION, ALLOW_UPLOAD_KEY); } diff --git a/src/ui/rygel-writable-user-config.vala b/src/ui/rygel-writable-user-config.vala index 58417408..ecd30fb5 100644 --- a/src/ui/rygel-writable-user-config.vala +++ b/src/ui/rygel-writable-user-config.vala @@ -1,9 +1,11 @@ /* * Copyright (C) 2008-2011 Nokia Corporation. * Copyright (C) 2008,2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>. + * Copyright (C) 2012 Intel Corporation. * * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org> * <zeeshan.ali@nokia.com> + * Jens Georg <jensg@openismus.com> * * This file is part of Rygel. * @@ -84,22 +86,6 @@ public class Rygel.WritableUserConfig : Rygel.UserConfig { this.set_bool ("general", TRANSCODING_KEY, value); } - public void set_mp3_transcoder (bool value) { - this.set_bool ("general", MP3_TRANSCODER_KEY, value); - } - - public void set_mp2ts_transcoder (bool value) { - this.set_bool ("general", MP2TS_TRANSCODER_KEY, value); - } - - public void set_lpcm_transcoder (bool value) { - this.set_bool ("general", LPCM_TRANSCODER_KEY, value); - } - - public void set_wmv_transcoder (bool value) { - this.set_bool ("general", WMV_TRANSCODER_KEY, value); - } - public void set_allow_upload (bool value) throws GLib.Error { this.set_bool ("general", ALLOW_UPLOAD_KEY, value); } |