[rygel] renderer: Simplify PlayerController "EOS" handler
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] renderer: Simplify PlayerController "EOS" handler
- Date: Sat, 14 Dec 2013 16:17:01 +0000 (UTC)
commit c2ae13f249ec7bb55eb887e80eb611631dc73eaf
Author: Jussi Kukkonen <jussi kukkonen intel com>
Date: Mon Dec 2 16:48:06 2013 +0200
renderer: Simplify PlayerController "EOS" handler
https://bugzilla.gnome.org/show_bug.cgi?id=709165
src/librygel-renderer/rygel-player-controller.vala | 30 +++++++------------
1 files changed, 11 insertions(+), 19 deletions(-)
---
diff --git a/src/librygel-renderer/rygel-player-controller.vala
b/src/librygel-renderer/rygel-player-controller.vala
index 886779f..c11bd06 100644
--- a/src/librygel-renderer/rygel-player-controller.vala
+++ b/src/librygel-renderer/rygel-player-controller.vala
@@ -200,13 +200,14 @@ internal class Rygel.PlayerController : Object {
}
public bool next () {
- if (this.track + 1 > this.n_tracks) {
- return false;
- }
+ // Try advancing in playlist
+ if (this.track < this.n_tracks) {
+ this.track++;
- this.track++;
+ return true;
+ }
- return true;
+ return false;
}
public bool previous () {
@@ -276,23 +277,14 @@ internal class Rygel.PlayerController : Object {
private void notify_state_cb (Object player, ParamSpec p) {
var state = this.player.playback_state;
if (state == "EOS") {
- if (this.playlist == null) {
- // Just move to stop
- Idle.add (() => {
- this.playback_state = "STOPPED";
-
- return false;
- });
-
- return;
- } else {
- // Set next playlist item
+ // Play next item in playlist or move to STOPPED
+ Idle.add (() => {
if (!this.next ()) {
- // We were at the end of the list; as per DLNA, move to
- // STOPPED and let current track be 1.
this.reset ();
}
- }
+
+ return false;
+ });
} else if (this._playback_state != state) {
// mirror player value in _playback_state and notify
this._playback_state = state;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]