diff options
author | Max Kellermann <max@duempel.org> | 2009-11-03 21:01:56 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-03 21:01:56 +0100 |
commit | 6c78c21fb80d101fc2ddcebe9b5dcff3463fadc4 (patch) | |
tree | 83b1c45fb82de7306647185cbe89ee2b60c91c18 /src | |
parent | 7fd2097a44901a85df51bb989ddfa6d234cee279 (diff) | |
download | mpd-6c78c21fb80d101fc2ddcebe9b5dcff3463fadc4.tar.gz mpd-6c78c21fb80d101fc2ddcebe9b5dcff3463fadc4.tar.xz mpd-6c78c21fb80d101fc2ddcebe9b5dcff3463fadc4.zip |
player_thread: moved code to player_dc_start()
Diffstat (limited to '')
-rw-r--r-- | src/player_thread.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index fa02a2e0e..e6c7ea761 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -124,6 +124,22 @@ static void player_command_finished(void) } /** + * Start the decoder. + * + * Player lock is not held. + */ +static void +player_dc_start(struct player *player) +{ + struct decoder_control *dc = player->dc; + + assert(player->queued); + assert(pc.next_song != NULL); + + dc_start(dc, pc.next_song); +} + +/** * Stop the decoder and clears (and frees) its music pipe. * * Player lock is not held. @@ -323,7 +339,7 @@ static bool player_seek_decoder(struct player *player) dc->pipe = player->pipe; /* re-start the decoder */ - dc_start(dc, pc.next_song); + player_dc_start(player); ret = player_wait_for_decoder(player); if (!ret) { /* decoder failure */ @@ -688,7 +704,7 @@ static void do_play(struct decoder_control *dc) .buffering = true, .decoder_starting = false, .paused = false, - .queued = false, + .queued = true, .song = NULL, .xfade = XFADE_UNKNOWN, .cross_fading = false, @@ -702,7 +718,7 @@ static void do_play(struct decoder_control *dc) dc->buffer = player_buffer; dc->pipe = player.pipe; - dc_start(dc, pc.next_song); + player_dc_start(&player); if (!player_wait_for_decoder(&player)) { player_dc_stop(&player); player_command_finished(); @@ -781,9 +797,8 @@ static void do_play(struct decoder_control *dc) assert(pc.next_song != NULL); assert(dc->pipe == NULL || dc->pipe == player.pipe); - player.queued = false; dc->pipe = music_pipe_new(); - dc_start(dc, pc.next_song); + player_dc_start(&player); } if (dc->pipe != NULL && dc->pipe != player.pipe && |