[rygel] renderer: Add get_playbin()



commit 102f1b8111888998b7c09839d21087122e805105
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 11 10:57:52 2012 +0200

    renderer: Add get_playbin()
    
    This avoids the need to get the default player just to get the playbin.

 examples/standalone-renderer.c                     |    7 +++----
 .../rygel-playbin-renderer.vala                    |   10 ++++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/examples/standalone-renderer.c b/examples/standalone-renderer.c
index 49bdeb2..2703499 100644
--- a/examples/standalone-renderer.c
+++ b/examples/standalone-renderer.c
@@ -42,8 +42,7 @@
 
 int main(int argc, char *argv[])
 {
-    GstElement *sink, *asink;
-    RygelPlaybinPlayer *player;
+    GstElement *playbin, *sink, *asink;
     RygelPlaybinRenderer *renderer;
     GError *error = NULL;
     GMainLoop *loop;
@@ -54,7 +53,7 @@ int main(int argc, char *argv[])
     g_set_application_name ("Standalone-Renderer");
 
     renderer = rygel_playbin_renderer_new ("LibRygel renderer demo");
-    player = rygel_playbin_player_get_default ();
+    playbin = rygel_playbin_renderer_get_playbin (renderer);
     sink = gst_element_factory_make ("cacasink", NULL);
     g_object_set (G_OBJECT (sink),
                   "dither", 53,
@@ -63,7 +62,7 @@ int main(int argc, char *argv[])
 
     asink = gst_element_factory_make ("pulsesink", NULL);
 
-    g_object_set (G_OBJECT (rygel_playbin_player_get_playbin (player)),
+    g_object_set (G_OBJECT (playbin),
                   "video-sink", sink,
                   "audio-sink", asink,
                   NULL);
diff --git a/src/librygel-renderer-gst/rygel-playbin-renderer.vala b/src/librygel-renderer-gst/rygel-playbin-renderer.vala
index 62bba08..4ec6a39 100644
--- a/src/librygel-renderer-gst/rygel-playbin-renderer.vala
+++ b/src/librygel-renderer-gst/rygel-playbin-renderer.vala
@@ -91,6 +91,16 @@ public class Rygel.Playbin.Renderer : Rygel.MediaDevice {
         this.prepare_upnp (title);
     }
 
+    /**
+     * Get the GstPlaybin2 used by this Renderer.
+     */
+    public Gst.Element? get_playbin () {
+        var player = Rygel.Playbin.Player.get_default ();
+        return_val_if_fail (player != null, null);
+
+        return player.playbin;
+    }
+
     private void prepare_upnp (string title) {
         this.plugin.title = title;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]