]> ToastFreeware Gitweb - gregoa/zavai.git/blobdiff - src/audio.vala
Notes about remotising devices
[gregoa/zavai.git] / src / audio.vala
index 52beeb62fc0f0fcc124dc8fe2fcea7e7fe57cc11..1c3942012a0747a8a0b71e6a31b096e869bb6fb4 100644 (file)
@@ -116,6 +116,7 @@ public class Player: zavai.Resource, Object
     protected Player master;
     protected bool loop;
     protected string uri;
+    public signal void state_changed(Gst.State new_state);
 
     public Player()
     {
@@ -149,26 +150,40 @@ stderr.printf("Playing %s\n", uri);
         this.loop = loop;
     }
 
+    public Gst.State get_state()
+    {
+        Gst.State state;
+        Gst.State pending;
+
+        player.get_state(out state, out pending, (Gst.ClockType)Gst.CLOCK_TIME_NONE);
+
+        return state;
+    }
+
     public void pause()
     {
         player.set_state(Gst.State.PAUSED);
+        state_changed(Gst.State.PAUSED);
     }
 
     public void resume()
     {
         player.set_state(Gst.State.PLAYING);
+        state_changed(Gst.State.PLAYING);
     }
 
     public void restart()
     {
         player.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, 0);
         player.set_state(Gst.State.PLAYING);
+        state_changed(Gst.State.PLAYING);
     }
 
     public void stop()
     {
         playing = false;
         player.set_state(Gst.State.NULL);
+        state_changed(Gst.State.NULL);
 
         // Resume slave after we are done
         if (slave != null && slave.playing)