[rygel] renderer-gst: Check duration availability



commit ed1f9ea42c63905ebcea9d39c6f2147d0a4f1ff9
Author: Jens Georg <jensg openismus com>
Date:   Thu Nov 22 23:19:49 2012 +0100

    renderer-gst: Check duration availability

 .../rygel-playbin-player.vala                      |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/src/librygel-renderer-gst/rygel-playbin-player.vala b/src/librygel-renderer-gst/rygel-playbin-player.vala
index 9a6ad26..e7388fd 100644
--- a/src/librygel-renderer-gst/rygel-playbin-player.vala
+++ b/src/librygel-renderer-gst/rygel-playbin-player.vala
@@ -81,7 +81,6 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
                                         "video/x-xvid",
                                         "video/x-ms-wmv" };
     private static Player player;
-    bool duration_hint;
 
     private bool is_live;
     private bool foreign;
@@ -327,7 +326,9 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
                               Message message) {
         switch (message.type) {
         case MessageType.DURATION_CHANGED:
-            this.duration_hint = true;
+            if (this.playbin.query_duration (Format.TIME, null)) {
+                this.notify_property ("duration");
+            }
         break;
         case MessageType.STATE_CHANGED:
             if (message.src == this.playbin) {
@@ -337,11 +338,6 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
                                              out new_state,
                                              out pending);
                 if (old_state == State.READY && new_state == State.PAUSED) {
-                    if (this.duration_hint) {
-                        this.notify_property ("duration");
-                        this.duration_hint = false;
-                    }
-
                     if (this.uri_update_hint) {
                         this.uri_update_hint = false;
                         string uri = this.playbin.current_uri;
@@ -461,7 +457,6 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
     }
 
     private void setup_playbin () {
-        this.duration_hint = false;
         // Needed to get "Stop" events from the playbin.
         // We can do this because we have a bus watch
         this.is_live = false;



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