aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/mp3_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:05 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:05 +0200
commit2a83ccdb8f71d224341ea5a6ddbc002693d887fb (patch)
tree7a6c3f2a480739e2951fe3141c8ca8a1aacc0db7 /src/inputPlugins/mp3_plugin.c
parent8814c0c898162f25ef4851df5cf8c9e68ff83942 (diff)
downloadmpd-2a83ccdb8f71d224341ea5a6ddbc002693d887fb.tar.gz
mpd-2a83ccdb8f71d224341ea5a6ddbc002693d887fb.tar.xz
mpd-2a83ccdb8f71d224341ea5a6ddbc002693d887fb.zip
added decoder_data()
Moved all of the player-waiting code to decoder_data(), to make OutputBuffer more generic.
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/mp3_plugin.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index f91895358..399491d0e 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -812,7 +812,8 @@ static int openMp3FromInputStream(InputStream * inStream, mp3DecodeData * data,
return 0;
}
-static int mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
+static int mp3Read(mp3DecodeData * data, struct decoder *decoder,
+ ReplayGainInfo ** replayGainInfo)
{
int samplesPerFrame;
int samplesLeft;
@@ -926,13 +927,13 @@ static int mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo)
}
if (data->outputPtr >= data->outputBufferEnd) {
- ret = ob_send(data->inStream,
- data->inStream->seekable,
- data->outputBuffer,
- data->outputPtr - data->outputBuffer,
- data->elapsedTime,
- data->bitRate / 1000,
- (replayGainInfo != NULL) ? *replayGainInfo : NULL);
+ ret = decoder_data(decoder, data->inStream,
+ data->inStream->seekable,
+ data->outputBuffer,
+ data->outputPtr - data->outputBuffer,
+ data->elapsedTime,
+ data->bitRate / 1000,
+ (replayGainInfo != NULL) ? *replayGainInfo : NULL);
if (ret == OUTPUT_BUFFER_DC_STOP) {
data->flush = 0;
return DECODE_BREAK;
@@ -1063,16 +1064,16 @@ static int mp3_decode(struct decoder * decoder, InputStream * inStream)
decoder_initialized(decoder);
- while (mp3Read(&data, &replayGainInfo) != DECODE_BREAK) ;
+ while (mp3Read(&data, decoder, &replayGainInfo) != DECODE_BREAK) ;
/* send last little bit if not DECODE_COMMAND_STOP */
if (dc.command != DECODE_COMMAND_STOP &&
data.outputPtr != data.outputBuffer && data.flush) {
- ob_send(NULL,
- data.inStream->seekable,
- data.outputBuffer,
- data.outputPtr - data.outputBuffer,
- data.elapsedTime, data.bitRate / 1000,
- replayGainInfo);
+ decoder_data(decoder, NULL,
+ data.inStream->seekable,
+ data.outputBuffer,
+ data.outputPtr - data.outputBuffer,
+ data.elapsedTime, data.bitRate / 1000,
+ replayGainInfo);
}
if (replayGainInfo)