Commit 9521c92f authored by Max Kellermann's avatar Max Kellermann

player_thread: removed decode(), renamed decodeParent()

decode() is a trivial wrapper for decodeParent(). Merge both and rename them to do_play().
parent 70904adf
...@@ -165,7 +165,7 @@ static int playChunk(ob_chunk * chunk, ...@@ -165,7 +165,7 @@ static int playChunk(ob_chunk * chunk,
return 0; return 0;
} }
static void decodeParent(void) static void do_play(void)
{ {
int do_pause = 0; int do_pause = 0;
int buffering = 1; int buffering = 1;
...@@ -181,8 +181,10 @@ static void decodeParent(void) ...@@ -181,8 +181,10 @@ static void decodeParent(void)
/** the position of the first chunk in the next song */ /** the position of the first chunk in the next song */
int next = -1; int next = -1;
ob_clear();
ob_set_lazy(0); ob_set_lazy(0);
dc_start(&pc.notify, pc.next_song);
if (waitOnDecode(&decodeWaitedOn) < 0) { if (waitOnDecode(&decodeWaitedOn) < 0) {
quitDecode(); quitDecode();
return; return;
...@@ -371,19 +373,6 @@ static void decodeParent(void) ...@@ -371,19 +373,6 @@ static void decodeParent(void)
quitDecode(); quitDecode();
} }
/* decode w/ buffering
* this will fork another process
* child process does decoding
* parent process does playing audio
*/
static void decode(void)
{
ob_clear();
dc_start(&pc.notify, pc.next_song);
decodeParent();
}
static void * player_task(mpd_unused void *arg) static void * player_task(mpd_unused void *arg)
{ {
notify_enter(&pc.notify); notify_enter(&pc.notify);
...@@ -391,7 +380,7 @@ static void * player_task(mpd_unused void *arg) ...@@ -391,7 +380,7 @@ static void * player_task(mpd_unused void *arg)
while (1) { while (1) {
switch (pc.command) { switch (pc.command) {
case PLAYER_COMMAND_PLAY: case PLAYER_COMMAND_PLAY:
decode(); do_play();
break; break;
case PLAYER_COMMAND_STOP: case PLAYER_COMMAND_STOP:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment