aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-11-05 17:42:08 +0100
committerMax Kellermann <max@duempel.org>2010-11-05 19:18:44 +0100
commitcc261872c25be3a5792be8ae160e070d1bbedf0b (patch)
tree6261d4dc29ad8c8e7b189585c4d0583f1727b664
parent5223261f1907a642ebe741518b7981830c094924 (diff)
downloadmpd-cc261872c25be3a5792be8ae160e070d1bbedf0b.tar.gz
mpd-cc261872c25be3a5792be8ae160e070d1bbedf0b.tar.xz
mpd-cc261872c25be3a5792be8ae160e070d1bbedf0b.zip
decoder_control: pass music_pipe to dc_start()
More abstraction for decoder_control.pipe.
-rw-r--r--src/decoder_control.c15
-rw-r--r--src/decoder_control.h4
-rw-r--r--src/player_thread.c11
3 files changed, 18 insertions, 12 deletions
diff --git a/src/decoder_control.c b/src/decoder_control.c
index 44bb63e15..618c78e7e 100644
--- a/src/decoder_control.c
+++ b/src/decoder_control.c
@@ -18,6 +18,7 @@
*/
#include "decoder_control.h"
+#include "pipe.h"
#include <assert.h>
@@ -58,22 +59,28 @@ static void dc_command_async(enum decoder_command cmd)
}
void
-dc_start(struct notify *notify, struct song *song)
+dc_start(struct notify *notify, struct song *song, struct music_pipe *pipe)
{
- assert(dc.pipe != NULL);
+ assert(dc.pipe == NULL);
assert(song != NULL);
+ assert(pipe != NULL);
+ assert(music_pipe_empty(pipe));
dc.next_song = song;
+ dc.pipe = pipe;
dc_command(notify, DECODE_COMMAND_START);
}
void
-dc_start_async(struct song *song)
+dc_start_async(struct song *song, struct music_pipe *pipe)
{
- assert(dc.pipe != NULL);
+ assert(dc.pipe == NULL);
assert(song != NULL);
+ assert(pipe != NULL);
+ assert(music_pipe_empty(pipe));
dc.next_song = song;
+ dc.pipe = pipe;
dc_command_async(DECODE_COMMAND_START);
}
diff --git a/src/decoder_control.h b/src/decoder_control.h
index 6a04a1617..febf53335 100644
--- a/src/decoder_control.h
+++ b/src/decoder_control.h
@@ -118,10 +118,10 @@ void
dc_command_wait(struct notify *notify);
void
-dc_start(struct notify *notify, struct song *song);
+dc_start(struct notify *notify, struct song *song, struct music_pipe *pipe);
void
-dc_start_async(struct song *song);
+dc_start_async(struct song *song, struct music_pipe *pipe);
void
dc_stop(struct notify *notify);
diff --git a/src/player_thread.c b/src/player_thread.c
index a827e7505..3d2ebcb42 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -324,10 +324,9 @@ static bool player_seek_decoder(struct player *player)
/* clear music chunks which might still reside in the
pipe */
music_pipe_clear(player->pipe, player_buffer);
- dc.pipe = player->pipe;
/* re-start the decoder */
- dc_start_async(pc.next_song);
+ dc_start_async(pc.next_song, player->pipe);
ret = player_wait_for_decoder(player);
if (!ret) {
/* decoder failure */
@@ -665,8 +664,7 @@ static void do_play(void)
player.pipe = music_pipe_new();
dc.buffer = player_buffer;
- dc.pipe = player.pipe;
- dc_start(&pc.notify, pc.next_song);
+ dc_start(&pc.notify, pc.next_song, player.pipe);
if (!player_wait_for_decoder(&player)) {
player_dc_stop(&player);
player_command_finished();
@@ -735,9 +733,10 @@ static void do_play(void)
assert(pc.next_song != NULL);
assert(!player_dc_at_next_song(&player));
+ dc.pipe = NULL;
+
player.queued = false;
- dc.pipe = music_pipe_new();
- dc_start_async(pc.next_song);
+ dc_start_async(pc.next_song, music_pipe_new());
}
if (player_dc_at_next_song(&player) &&