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.
22 #include "rygel-playbin-renderer.h"
23 #include "rygel-playbin-player.h"
26 #include <glib/gi18n.h>
30 * A UPnP renderer that uses a GStreamer Playbin2 element.
32 * Using GstPlayBin2 as a model, it reflects any changes done externally, such as
33 * changing the currently played URI, volume, pause/play etc., to UPnP.
35 * Likewise, the playbin can be modified externally using UPnP.
37 * You can retrieve the GstPlayBin2 by calling rygel_playbin_renderer_get_playbin().
38 * You should then set the "video-sink" and "audio-sink" properties of the
41 * Call rygel_media_device_add_interface() on the Renderer to allow it
42 * to be controlled by a control point and to retrieve data streams via that
45 * See the <link linkend="implementing-renderers-gst">Implementing GStreamer-based Renderers</link> section.
48 G_DEFINE_TYPE (RygelPlaybinRenderer, rygel_playbin_renderer, RYGEL_TYPE_MEDIA_RENDERER)
51 * Create a new instance of Renderer.
53 * Renderer will instantiate its own instance of GstPlayBin2.
54 * The GstPlayBin2 can be accessed by using rygel_playbin_player_get_playbin().
56 * @param title Friendly name of the new UPnP renderer on the network.
59 rygel_playbin_renderer_new (const gchar *title) {
60 RygelPlaybinPlayer *player = rygel_playbin_player_get_default ();
61 return RYGEL_PLAYBIN_RENDERER (g_object_new (RYGEL_TYPE_PLAYBIN_RENDERER,
68 * Get the GstPlaybin2 used by this Renderer.
71 rygel_playbin_renderer_get_playbin (RygelPlaybinRenderer *self) {
72 RygelPlaybinPlayer *player;
75 g_return_val_if_fail (self != NULL, NULL);
77 player = rygel_playbin_player_get_default (); /* TODO: Do not return a ref from this? */
78 g_return_val_if_fail (player != NULL, NULL);
80 result = rygel_playbin_player_get_playbin (player);
81 g_return_val_if_fail (result != NULL, NULL);
83 g_object_unref (player);
84 gst_object_ref (result);
90 rygel_playbin_renderer_class_init (RygelPlaybinRendererClass *klass) {
91 rygel_playbin_renderer_parent_class = g_type_class_peek_parent (klass);
95 rygel_playbin_renderer_init (RygelPlaybinRenderer *self G_GNUC_UNUSED) {