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
This commit is contained in:
parent
2e648b57f3
commit
b009b2a437
30
src/decode.c
30
src/decode.c
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user