Update changelog
[profile/ivi/rygel-gst-0-10-fullscreen-renderer.git] / src / rygel-playbin-renderer.c
1 /*
2  * Copyright (C) 2012 Openismus GmbH.
3  * Copyright (C) 2012 Intel Corporation.
4  *
5  * Author: Jens Georg <jensg@openismus.com>
6  *
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.
11  *
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.
16  *
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.
20  */
21
22 #include "rygel-playbin-renderer.h"
23 #include "rygel-playbin-player.h"
24 #include <stdlib.h>
25 #include <string.h>
26 #include <glib/gi18n.h>
27
28
29 /**
30  * A UPnP renderer that uses a GStreamer Playbin2 element.
31  *
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.
34  *
35  * Likewise, the playbin can be modified externally using UPnP.
36  *
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
39  * playbin.
40  *
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
43  * network interface.
44  *
45  * See the <link linkend="implementing-renderers-gst">Implementing GStreamer-based Renderers</link> section.
46  */
47
48 G_DEFINE_TYPE (RygelPlaybinRenderer, rygel_playbin_renderer, RYGEL_TYPE_MEDIA_RENDERER)
49
50 /**
51  * Create a new instance of Renderer.
52  *
53  * Renderer will instantiate its own instance of GstPlayBin2.
54  * The GstPlayBin2 can be accessed by using rygel_playbin_player_get_playbin().
55  *
56  * @param title Friendly name of the new UPnP renderer on the network.
57  */
58 RygelPlaybinRenderer*
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,
62     "title", title,
63     "player", player,
64     NULL));
65 }
66
67 /**
68  * Get the GstPlaybin2 used by this Renderer.
69  */
70 GstElement*
71 rygel_playbin_renderer_get_playbin (RygelPlaybinRenderer *self) {
72   RygelPlaybinPlayer *player;
73   GstElement *result;
74
75   g_return_val_if_fail (self != NULL, NULL);
76
77   player = rygel_playbin_player_get_default ();  /* TODO: Do not return a ref from this? */
78   g_return_val_if_fail (player != NULL, NULL);
79
80   result = rygel_playbin_player_get_playbin (player);
81   g_return_val_if_fail (result != NULL, NULL);
82
83   g_object_unref (player);
84   gst_object_ref (result);
85   return result;
86 }
87
88
89 static void
90 rygel_playbin_renderer_class_init (RygelPlaybinRendererClass *klass) {
91   rygel_playbin_renderer_parent_class = g_type_class_peek_parent (klass);
92 }
93
94 static void
95 rygel_playbin_renderer_init (RygelPlaybinRenderer *self G_GNUC_UNUSED) {
96 }