diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/decode.c | 14 | ||||
-rw-r--r-- | src/outputBuffer.c | 3 | ||||
-rw-r--r-- | src/playlist.c | 6 |
3 files changed, 17 insertions, 6 deletions
diff --git a/src/decode.c b/src/decode.c index 90ec5bd37..e0685e0e9 100644 --- a/src/decode.c +++ b/src/decode.c @@ -166,7 +166,7 @@ static void finalize_per_track_actions(void) /* DEBUG(":%s dc.action(%d): %d\n", __func__,__LINE__, dc.action); */ } -static void decode_start(void) +static int decode_start(void) { int err = -1; int close_instream = 1; @@ -203,7 +203,7 @@ static void decode_start(void) if (openInputStream(&is, path_max_fs) < 0) { DEBUG("couldn't open song: %s\n", path_max_fs); player_seterror(PLAYER_ERROR_FILENOTFOUND, dc.current_song); - return; + return err; } if (isRemoteUrl(path_max_utf8)) { @@ -281,6 +281,7 @@ static void decode_start(void) ERROR("player_error: %s\n", player_strerror()); if (close_instream) closeInputStream(&is); + return err; } static void * decoder_task(mpd_unused void *arg) @@ -300,12 +301,17 @@ static void * decoder_task(mpd_unused void *arg) /* DEBUG("dc.action: %d\n", (int)dc.action); */ if ((dc.current_song = playlist_queued_song())) { char p[MPD_PATH_MAX]; + int err; + ob_advance_sequence(); get_song_url(p, dc.current_song); DEBUG("decoding song: %s\n", p); - decode_start(); + err = decode_start(); DEBUG("DONE decoding song: %s\n", p); - ob_flush(); + if (err) + ob_trigger_action(OB_ACTION_RESET); + else + ob_flush(); dc.current_song = NULL; } finalize_per_track_actions(); diff --git a/src/outputBuffer.c b/src/outputBuffer.c index ac0f420d8..606877dd0 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -115,7 +115,8 @@ void ob_trigger_action(enum ob_action action) if (pthread_equal(pthread_self(), dc.thread)) assert(action == OB_ACTION_PLAY || action == OB_ACTION_SEEK_START || - action == OB_ACTION_SEEK_FINISH); + action == OB_ACTION_SEEK_FINISH || + action == OB_ACTION_RESET); else assert(action != OB_ACTION_PLAY && action != OB_ACTION_SEEK_START && diff --git a/src/playlist.c b/src/playlist.c index d454b4ad2..8b7416d2e 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -528,7 +528,11 @@ static void syncPlaylistWithQueue(void) if (!ob_synced()) return; - if (playlist.queued >= 0 && + if (player_errno != PLAYER_ERROR_NONE) { + DEBUG("playlist: error: %s\n", player_strerror()); + playlist.current = playlist.queued; + player_clearerror(); + } else if (playlist.queued >= 0 && playlist.current != playlist.queued) { DEBUG("playlist: now playing queued song\n"); DEBUG("%s:%d queued: %d\n",__func__,__LINE__,playlist.queued); |