You need to sign in or sign up before continuing.
Commit b009b2a4 authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

moved code to playChunk()

Similar to the crossFade() patch: pass chunk objects to playChunk(), simplify decodeParent() by removing clutter. git-svn-id: https://svn.musicpd.org/mpd/trunk@7275 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 2e648b57
......@@ -374,6 +374,24 @@ static void crossFade(OutputBufferChunk * a, OutputBufferChunk * b,
a->chunkSize = b->chunkSize;
}
static int playChunk(PlayerControl * pc, OutputBufferChunk * chunk,
AudioFormat * format, double sizeToTime)
{
pc->elapsedTime = chunk->times;
pc->bitRate = chunk->bitRate;
pcm_volumeChange(chunk->data, chunk->chunkSize,
format, pc->softwareVolume);
if (playAudio(chunk->data,
chunk->chunkSize) < 0)
return -1;
pc->totalPlayTime +=
sizeToTime * chunk->chunkSize;
return 0;
}
static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb)
{
int pause = 0;
......@@ -546,17 +564,9 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
}
/* play the current chunk */
pc->elapsedTime = beginChunk->times;
pc->bitRate = beginChunk->bitRate;
pcm_volumeChange(beginChunk->data,
beginChunk->chunkSize,
&(cb->audioFormat),
pc->softwareVolume);
if (playAudio(beginChunk->data,
beginChunk->chunkSize) < 0)
if (playChunk(pc, beginChunk, &(cb->audioFormat),
sizeToTime) < 0)
break;
pc->totalPlayTime +=
sizeToTime * beginChunk->chunkSize;
outputBufferShift(cb);
player_wakeup_decoder_nb();
} else if (!outputBufferEmpty(cb) && cb->begin == next) {
......
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