2 * Copyright (C) 2012 Intel Corporation.
4 * Author: Jens Georg <jensg@openismus.com>
6 * This file is part of Rygel.
8 * Rygel is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Rygel is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 // Remove for GStreamer 1.0
27 [CCode (cname = "PRESET_DIR")]
28 internal extern static const string PRESET_DIR;
30 [CCode (cname="gst_preset_set_app_dir")]
31 extern bool gst_preset_set_app_dir (string app_dir);
33 public class Rygel.GstMediaEngine : Rygel.MediaEngine {
34 private GLib.List<DLNAProfile> dlna_profiles = null;
35 private GLib.List<Transcoder> transcoders = null;
37 public GstMediaEngine () {
38 unowned string[] args = null;
41 gst_preset_set_app_dir (PRESET_DIR);
43 /* Get the possible DLNA profiles
44 * to add to the list of DLNA profiles supported by
45 * this media engine, for get_dlna_profiles():
47 var discoverer = new GUPnPDLNA.Discoverer ((ClockTime) SECOND,
50 foreach (var profile in discoverer.list_profiles ()) {
51 var p = new DLNAProfile (profile.name, profile.mime);
53 /* TODO: Check that we (via GStreamer) really support this profile
54 * instead of just claiming to support everything.
56 this.dlna_profiles.prepend (p);
58 this.dlna_profiles.prepend (new DLNAProfile ("DIDL_S", "text/xml"));
60 this.dlna_profiles.reverse ();
62 var transcoding = true;
63 var transcoder_list = new ArrayList<string> ();
65 var config = MetaConfig.get_default ();
67 transcoding = config.get_transcoding ();
68 transcoder_list = config.get_string_list ("GstMediaEngine",
70 } catch (Error err) {}
73 foreach (var transcoder in transcoder_list) {
76 this.transcoders.prepend (new L16Transcoder ());
79 this.transcoders.prepend (new MP3Transcoder ());
82 this.transcoders.prepend (new MP2TSTranscoder
83 (MP2TSProfile.SD_EU));
84 this.transcoders.prepend (new MP2TSTranscoder
85 (MP2TSProfile.SD_NA));
86 this.transcoders.prepend (new MP2TSTranscoder
87 (MP2TSProfile.HD_NA));
90 this.transcoders.prepend (new WMVTranscoder ());
93 this.transcoders.prepend (new AACTranscoder ());
96 this.transcoders.prepend (new AVCTranscoder ());
99 debug ("Unsupported transcoder \"%s\"", transcoder);
104 this.transcoders.reverse ();
108 public override unowned GLib.List<DLNAProfile> get_dlna_profiles () {
109 return this.dlna_profiles;
112 public override unowned GLib.List<Transcoder>? get_transcoders () {
113 return this.transcoders;
116 public override DataSource? create_data_source (string uri) {
118 return new GstDataSource (uri);
119 } catch (Error error) {
124 public DataSource create_data_source_from_element (Element element) {
125 return new GstDataSource.from_element (element);
129 public static Rygel.MediaEngine module_get_instance () {
130 return new Rygel.GstMediaEngine ();