[rygel] gst-renderer: Correctly handle EOS



commit f7e3dfdc3ae57700d1bffcc250fbcb4754d9e890
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Oct 14 01:06:11 2009 +0300

    gst-renderer: Correctly handle EOS

 .../gst-renderer/rygel-gst-video-window.vala       |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/gst-renderer/rygel-gst-video-window.vala b/src/plugins/gst-renderer/rygel-gst-video-window.vala
index 9c0ba76..7d7edda 100644
--- a/src/plugins/gst-renderer/rygel-gst-video-window.vala
+++ b/src/plugins/gst-renderer/rygel-gst-video-window.vala
@@ -107,7 +107,9 @@ public class Rygel.GstVideoWindow : GLib.Object {
         this.playbin = ElementFactory.make ("playbin2", null);
         assert (this.playbin != null);
 
-        this.playbin.eos += this.eos_cb;
+        // Bus handler
+        var bus = this.playbin.get_bus ();
+        bus.add_watch (this.bus_handler);
     }
 
     public static GstVideoWindow get_default () {
@@ -118,10 +120,6 @@ public class Rygel.GstVideoWindow : GLib.Object {
         return video_window;
     }
 
-    private void eos_cb (Element playbin) {
-        this.playback_state = "STOPPED";
-    }
-
     public bool seek (string time) {
         debug ("Seeking to %s.", time);
         return this.playbin.seek (1.0,
@@ -132,6 +130,16 @@ public class Rygel.GstVideoWindow : GLib.Object {
                                   Gst.SeekType.NONE,
                                   -1);
     }
+
+    private bool bus_handler (Bus     bus,
+                              Message message) {
+        if (message.type == MessageType.EOS) {
+            debug ("EOS");
+            this.playback_state = "STOPPED";
+        }
+
+        return true;
+    }
 }
 
 // Helper class for converting between Gstreamer time units and string



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