[rygel] playbin: Fix state handling for stop



commit d202ca2ea37b9bea1f289daf504bf8d9862c4baf
Author: Jens Georg <mail jensge org>
Date:   Mon Jun 11 19:48:27 2012 +0200

    playbin: Fix state handling for stop

 src/plugins/playbin/rygel-playbin-player.vala |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/playbin/rygel-playbin-player.vala b/src/plugins/playbin/rygel-playbin-player.vala
index a0a6b5b..6b160c9 100644
--- a/src/plugins/playbin/rygel-playbin-player.vala
+++ b/src/plugins/playbin/rygel-playbin-player.vala
@@ -88,11 +88,12 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
 
             switch (value) {
                 case "STOPPED":
-                    // bgo#TBD: Does not generate a state-change event
                     if (state != State.NULL || pending != State.VOID_PENDING) {
+                        this._playback_state = "TRANSITIONING";
                         this.playbin.set_state (State.NULL);
+                    } else {
+                        this._playback_state = value;
                     }
-                    this._playback_state = value;
                 break;
                 case "PAUSED_PLAYBACK":
                     if (state != State.PAUSED || pending != State.VOID_PENDING) {
@@ -125,7 +126,7 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
         }
 
         set {
-            this.playbin.set_state (State.NULL);
+            this.playbin.set_state (State.READY);
             this.playbin.uri = value;
             if (value != "") {
                 switch (this._playback_state) {
@@ -239,6 +240,9 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
 
     private Player () {
         this.playbin = ElementFactory.make ("playbin2", null);
+        // Needed to get "Stop" events from the playbin.
+        // We can do this because we have a bus watch
+        this.playbin.auto_flush_bus = false;
         assert (this.playbin != null);
 
         playbin.source_setup.connect (this.on_source_setup);
@@ -307,14 +311,13 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
                             this.playback_state = "PAUSED_PLAYBACK";
                             break;
                         case State.NULL:
-                        case State.READY:
                             this.playback_state = "STOPPED";
                             break;
                         case State.PLAYING:
                             this.playback_state = "PLAYING";
                             break;
                         default:
-                            assert_not_reached ();
+                            break;
                     }
                 }
             }



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