2 * Copyright (C) 2012 Openismus GmbH.
3 * Copyright (C) 2012 Intel Corporation.
5 * Author: Jens Georg <jensg@openismus.com>
7 * Rygel is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * Rygel is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 internal class Rygel.Playbin.WrappingPlugin : Rygel.MediaRendererPlugin {
26 private MediaPlayer player;
28 public WrappingPlugin (Gst.Element playbin) {
29 base ("LibRygel-Renderer", _("LibRygel Renderer"));
31 return_val_if_fail (playbin != null, null);
32 return_val_if_fail (playbin.get_type ().name() == "GstPlayBin2", null);
34 this.player = new Player.wrap (playbin);
38 public override MediaPlayer? get_player () {
44 * A UPnP renderer that uses a GStreamer Playbin2 element.
46 * Using GstPlayBin2 as a model, it reflects any changes done externally, such as
47 * changing the currently played URI, volume, pause/play etc., to UPnP.
49 * Likewise, the playbin can be modified externally using UPnP.
51 * You can retrieve the GstPlayBin2 by calling rygel_playbin_renderer_get_playbin().
52 * You should then set the "video-sink" and "audio-sink" properties of the
55 * Call rygel_media_device_add_interface() on the Renderer to allow it
56 * to be controlled by a control point and to retrieve data streams via that
59 * See the example code in the <link linkend="overview">overview</link>.
61 public class Rygel.Playbin.Renderer : Rygel.MediaDevice {
63 * Create a new instance of Renderer.
65 * Renderer will instantiate its own instance of GstPlayBin2.
66 * The GstPlayBin2 can be accessed by using rygel_playbin_player_get_playbin().
68 * @param title Friendly name of the new UPnP renderer on the network.
70 public Renderer (string title) {
72 this.plugin = new Plugin ();
73 this.prepare_upnp (title);
77 * Create a new instance of Renderer, wrapping an existing GstPlayBin2
80 * @param pipeline Instance of GstPlayBin2 to wrap.
81 * @param title Friendly name of the new UPnP renderer on the network.
83 public Renderer.wrap (Gst.Element pipeline, string title) {
86 return_val_if_fail (pipeline != null, null);
87 return_val_if_fail (pipeline.get_type ().name() == "GstPlayBin2", null);
89 this.plugin = new WrappingPlugin (pipeline);
90 this.prepare_upnp (title);
94 * Get the GstPlaybin2 used by this Renderer.
96 public Gst.Element? get_playbin () {
97 var player = Rygel.Playbin.Player.get_default ();
98 return_val_if_fail (player != null, null);
100 return player.playbin;
103 private void prepare_upnp (string title) {
104 this.plugin.title = title;
106 // Always listen on localhost
107 this.add_interface ("lo");