[rygel] renderer-gst: Enable more playspeeds
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] renderer-gst: Enable more playspeeds
- Date: Sun, 10 Nov 2013 13:56:02 +0000 (UTC)
commit 8cab0ca048af736008526f741b22e340cc1e7816
Author: Jussi Kukkonen <jussi kukkonen intel com>
Date: Wed Oct 30 14:45:50 2013 +0200
renderer-gst: Enable more playspeeds
Negative playspeeds do not seem to work with common formats, so they
have not been enabled.
https://bugzilla.gnome.org/show_bug.cgi?id=710368
.../rygel-playbin-player.vala | 31 ++++++++++++++++---
1 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/src/librygel-renderer-gst/rygel-playbin-player.vala
b/src/librygel-renderer-gst/rygel-playbin-player.vala
index 3a9cf4b..129a4c1 100644
--- a/src/librygel-renderer-gst/rygel-playbin-player.vala
+++ b/src/librygel-renderer-gst/rygel-playbin-player.vala
@@ -124,12 +124,18 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
}
break;
case "PLAYING":
- if (state != State.PLAYING ||
- pending != State.VOID_PENDING) {
+ if (this._new_playback_speed != this._playback_speed &&
+ (state == State.PLAYING || state == State.PAUSED) &&
+ pending == State.VOID_PENDING) {
+ /* already playing, but play speed has changed */
this._playback_state = "TRANSITIONING";
+ this.seek (this.position);
+ } else if (state != State.PLAYING ||
+ pending != State.VOID_PENDING) {
// This needs a check if GStreamer and DLNA agree on
// the "liveness" of the source (s0/sn increase in
// protocol info)
+ this._playback_state = "TRANSITIONING";
this.is_live = this.playbin.set_state (State.PLAYING)
== StateChangeReturn.NO_PREROLL;
} else {
@@ -145,13 +151,22 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
}
}
- private string[] _allowed_playback_speeds = {"1"};
+ private string[] _allowed_playback_speeds = {
+ "1/16", "1/8", "1/4", "1/2", "1", "2", "4", "8", "16", "32", "64"
+ };
public string[] allowed_playback_speeds {
owned get {
return this._allowed_playback_speeds;
}
}
+ /**
+ * Actual _playback_speed is updated when playbin seek succeeds.
+ * Until that point, the playback speed set via api is stored in
+ * _new_playback_speed.
+ **/
+ private string _new_playback_speed = "1";
+
private string _playback_speed = "1";
public string playback_speed {
owned get {
@@ -159,7 +174,10 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
}
set {
- this._playback_speed = value;
+ this._new_playback_speed = value;
+ /* theoretically we should trigger a seek here if we were
+ * playing already, but playback state does get changed
+ * after this when "Play" is invoked... */
}
}
@@ -357,7 +375,7 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
private bool seek_with_format (Format format, int64 target) {
bool seeked;
- var speed = this.play_speed_to_double (this._playback_speed);
+ var speed = this.play_speed_to_double (this._new_playback_speed);
if (speed > 0) {
seeked = this.playbin.seek (speed,
format,
@@ -375,6 +393,9 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
Gst.SeekType.SET,
target);
}
+ if (seeked) {
+ this._playback_speed = this._new_playback_speed;
+ }
return seeked;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]