aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:12:42 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:12:42 +0000
commite626028b41a957d969b93f2d3cb39813eebaac2b (patch)
tree8cdc984c07644ec30594e50276cf2ddf708ad976 /src/decode.c
parenta5464282639e46550f3120126d0ba877dd91a44b (diff)
downloadmpd-e626028b41a957d969b93f2d3cb39813eebaac2b.tar.gz
mpd-e626028b41a957d969b93f2d3cb39813eebaac2b.tar.xz
mpd-e626028b41a957d969b93f2d3cb39813eebaac2b.zip
moved check to outputBufferAbsolute()
decoderParent() uses a lot of OutputBuffer internals to see whether cross-fading should be started. Move these checks to outputBuffer.c, which also simplifies decoderParent(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7262 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/decode.c')
-rw-r--r--src/decode.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/decode.c b/src/decode.c
index 05e4c4a56..fd65dc5ae 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -503,7 +503,6 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
(fadePosition = next - cb->begin +
buffered_chunks) <= crossFadeChunks))) {
/* perform cross fade */
- unsigned int test = end;
if (nextChunk < 0) {
/* beginning of the cross fade
- adjust crossFadeChunks
@@ -512,13 +511,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
chunks in the old song */
crossFadeChunks = fadePosition;
}
- if (end < cb->begin)
- test += buffered_chunks;
- nextChunk = cb->begin + crossFadeChunks;
- if ((unsigned)nextChunk < test) {
- if ((unsigned)nextChunk >= buffered_chunks) {
- nextChunk -= buffered_chunks;
- }
+ nextChunk = outputBufferAbsolute(cb, crossFadeChunks);
+ if (nextChunk >= 0) {
pcm_mix(cb->chunks +
cb->begin * CHUNK_SIZE,
cb->chunks +
@@ -575,16 +569,9 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
/* the cross-fade is finished; skip
the section which was cross-faded
(and thus already played) */
- unsigned int test = end;
- nextChunk = cb->begin + crossFadeChunks;
- if (end < cb->begin)
- test += buffered_chunks;
- if ((unsigned)nextChunk < test) {
- if ((unsigned)nextChunk >= buffered_chunks) {
- nextChunk -= buffered_chunks;
- }
+ nextChunk = outputBufferAbsolute(cb, crossFadeChunks);
+ if (nextChunk >= 0)
advanceOutputBufferTo(cb, nextChunk);
- }
}
/* wait for the decoder to work on the new song */