[rygel] playbin: Use NO_MEDIA_PRESENT as initial state



commit b35f99e57e3c568a3018c0f308c593505c4fef12
Author: Jens Georg <mail jensge org>
Date:   Tue May 15 14:40:18 2012 +0200

    playbin: Use NO_MEDIA_PRESENT as initial state

 src/plugins/playbin/rygel-playbin-player.vala |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/playbin/rygel-playbin-player.vala b/src/plugins/playbin/rygel-playbin-player.vala
index 2a1ffc5..be0ff1e 100644
--- a/src/plugins/playbin/rygel-playbin-player.vala
+++ b/src/plugins/playbin/rygel-playbin-player.vala
@@ -64,7 +64,7 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
 
     private dynamic Element playbin;
 
-    private string _playback_state = "STOPPED";
+    private string _playback_state = "NO_MEDIA_PRESENT";
     public string playback_state {
         owned get {
             return this._playback_state;
@@ -101,7 +101,21 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
             this.playbin.set_state (State.NULL);
             this.playbin.uri = value;
             if (value != "") {
-                this.playbin.set_state (State.PLAYING);
+                switch (this._playback_state) {
+                    case "NO_MEDIA_PRESENT":
+                        this.playback_state = "STOPPED";
+                        break;
+                    case "STOPPED":
+                    case "PAUSED_PLAYBACK":
+                        break;
+                    case "PLAYING":
+                        this.playbin.set_state (State.PLAYING);
+                        break;
+                    default:
+                        break;
+                }
+            } else {
+                this.playback_state = "NO_MEDIA_PRESENT";
             }
             debug ("URI set to %s.", value);
         }



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