diff options
author | Max Kellermann <max@duempel.org> | 2011-01-10 20:59:02 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-01-10 21:08:16 +0100 |
commit | 39c5af5dbc1ccf0b103daaaed642c2d8af3210a8 (patch) | |
tree | 4fc8ac4d5119e41824ce816d256e326878d6cfdb /src | |
parent | acca6a799b523b0f068910834f31d9a7056fea2a (diff) | |
download | mpd-39c5af5dbc1ccf0b103daaaed642c2d8af3210a8.tar.gz mpd-39c5af5dbc1ccf0b103daaaed642c2d8af3210a8.tar.xz mpd-39c5af5dbc1ccf0b103daaaed642c2d8af3210a8.zip |
decoder_thread: move code to decoder_command_finished_locked()
Diffstat (limited to '')
-rw-r--r-- | src/decoder_thread.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c index a3af62376..0bed2e81d 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -55,6 +55,22 @@ decoder_lock_get_command(struct decoder_control *dc) } /** + * Marks the current decoder command as "finished" and notifies the + * player thread. + * + * @param dc the #decoder_control object; must be locked + */ +static void +decoder_command_finished_locked(struct decoder_control *dc) +{ + assert(dc->command != DECODE_COMMAND_NONE); + + dc->command = DECODE_COMMAND_NONE; + + player_signal(dc->player_control); +} + +/** * Opens the input stream with input_stream_open(), and waits until * the stream gets ready. If a decoder STOP command is received * during that, it cancels the operation (but does not close the @@ -381,9 +397,8 @@ decoder_run_song(struct decoder_control *dc, decoder.chunk = NULL; dc->state = DECODE_STATE_START; - dc->command = DECODE_COMMAND_NONE; - player_signal(dc->player_control); + decoder_command_finished_locked(dc); pcm_convert_init(&decoder.conv_state); @@ -462,15 +477,11 @@ decoder_task(gpointer arg) case DECODE_COMMAND_SEEK: decoder_run(dc); - dc->command = DECODE_COMMAND_NONE; - - player_signal(dc->player_control); + decoder_command_finished_locked(dc); break; case DECODE_COMMAND_STOP: - dc->command = DECODE_COMMAND_NONE; - - player_signal(dc->player_control); + decoder_command_finished_locked(dc); break; case DECODE_COMMAND_NONE: |