Commit 20c4638a authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

added output_buffer_skip()

First patch without camelCase ;) output_buffer_skip() lets us eliminate advanceOutputBufferTo(), and removes yet another external OutputBuffer struct access. git-svn-id: https://svn.musicpd.org/mpd/trunk@7312 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent e20b71ed
...@@ -361,11 +361,6 @@ void decoderInit(void) ...@@ -361,11 +361,6 @@ void decoderInit(void)
FATAL("Failed to spawn decoder task: %s\n", strerror(errno)); FATAL("Failed to spawn decoder task: %s\n", strerror(errno));
} }
static void advanceOutputBufferTo(OutputBuffer * cb, int to)
{
cb->begin = to;
}
static void crossFade(OutputBufferChunk * a, OutputBufferChunk * b, static void crossFade(OutputBufferChunk * a, OutputBufferChunk * b,
AudioFormat * format, AudioFormat * format,
unsigned int fadePosition, unsigned int crossFadeChunks) unsigned int fadePosition, unsigned int crossFadeChunks)
...@@ -576,9 +571,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * ...@@ -576,9 +571,7 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
/* the cross-fade is finished; skip /* the cross-fade is finished; skip
the section which was cross-faded the section which was cross-faded
(and thus already played) */ (and thus already played) */
nextChunk = outputBufferAbsolute(cb, crossFadeChunks); output_buffer_skip(cb, crossFadeChunks);
if (nextChunk >= 0)
advanceOutputBufferTo(cb, nextChunk);
} }
doCrossFade = 0; doCrossFade = 0;
......
...@@ -218,3 +218,9 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, ...@@ -218,3 +218,9 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
return 0; return 0;
} }
void output_buffer_skip(OutputBuffer * cb, unsigned num)
{
int i = outputBufferAbsolute(cb, num);
if (i >= 0)
cb->begin = i;
}
...@@ -99,4 +99,6 @@ int sendDataToOutputBuffer(OutputBuffer * cb, ...@@ -99,4 +99,6 @@ int sendDataToOutputBuffer(OutputBuffer * cb,
float data_time, float data_time,
mpd_uint16 bitRate, ReplayGainInfo * replayGainInfo); mpd_uint16 bitRate, ReplayGainInfo * replayGainInfo);
void output_buffer_skip(OutputBuffer * cb, unsigned num);
#endif #endif
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