diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:05 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:05 +0200 |
commit | 2a83ccdb8f71d224341ea5a6ddbc002693d887fb (patch) | |
tree | 7a6c3f2a480739e2951fe3141c8ca8a1aacc0db7 /src/inputPlugins | |
parent | 8814c0c898162f25ef4851df5cf8c9e68ff83942 (diff) | |
download | mpd-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 'src/inputPlugins')
-rw-r--r-- | src/inputPlugins/_flac_common.h | 11 | ||||
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 6 | ||||
-rw-r--r-- | src/inputPlugins/audiofile_plugin.c | 14 | ||||
-rw-r--r-- | src/inputPlugins/mod_plugin.c | 6 | ||||
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 31 | ||||
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 6 | ||||
-rw-r--r-- | src/inputPlugins/mpc_plugin.c | 16 | ||||
-rw-r--r-- | src/inputPlugins/oggvorbis_plugin.c | 19 | ||||
-rw-r--r-- | src/inputPlugins/wavpack_plugin.c | 8 |
9 files changed, 58 insertions, 59 deletions
diff --git a/src/inputPlugins/_flac_common.h b/src/inputPlugins/_flac_common.h index 2d59f4d9d..9eb916b8c 100644 --- a/src/inputPlugins/_flac_common.h +++ b/src/inputPlugins/_flac_common.h @@ -165,12 +165,11 @@ MpdTag *copyVorbisCommentBlockToMpdTag(const FLAC__StreamMetadata * block, /* keep this inlined, this is just macro but prettier :) */ static inline int flacSendChunk(FlacData * data) { - if (ob_send(data->inStream, - 1, data->chunk, - data->chunk_length, data->time, - data->bitRate, - data->replayGainInfo) == - OUTPUT_BUFFER_DC_STOP) + if (decoder_data(data->decoder, data->inStream, + 1, data->chunk, + data->chunk_length, data->time, + data->bitRate, + data->replayGainInfo) == OUTPUT_BUFFER_DC_STOP) return -1; return 0; diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index d03826c8f..c6bd99850 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -391,9 +391,9 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) sampleBufferLen = sampleCount * 2; - ob_send(NULL, 0, sampleBuffer, - sampleBufferLen, file_time, - bitRate, NULL); + decoder_data(mpd_decoder, NULL, 0, sampleBuffer, + sampleBufferLen, file_time, + bitRate, NULL); if (dc.command == DECODE_COMMAND_SEEK) { dc.seekError = 1; dc_command_finished(); diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index faa58fe64..fc257263e 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -106,13 +106,13 @@ static int audiofile_decode(struct decoder * decoder, char *path) eof = 1; else { current += ret; - ob_send(NULL, - 1, - chunk, ret * fs, - (float)current / - (float)dc.audioFormat. - sampleRate, bitRate, - NULL); + decoder_data(decoder, NULL, + 1, + chunk, ret * fs, + (float)current / + (float)dc.audioFormat. + sampleRate, bitRate, + NULL); if (dc.command == DECODE_COMMAND_STOP) break; } diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index c09803ee4..792cb0c87 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -200,9 +200,9 @@ static int mod_decode(struct decoder * decoder, char *path) ret = VC_WriteBytes(data->audio_buffer, MIKMOD_FRAME_SIZE); total_time += ret * secPerByte; - ob_send(NULL, 0, - (char *)data->audio_buffer, ret, - total_time, 0, NULL); + decoder_data(decoder, NULL, 0, + (char *)data->audio_buffer, ret, + total_time, 0, NULL); } ob_flush(); 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) diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index de658511f..197d00627 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -270,9 +270,9 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) sampleBuffer += offset * channels * 2; - ob_send(inStream, 1, sampleBuffer, - sampleBufferLen, file_time, - bitRate, NULL); + decoder_data(mpd_decoder, inStream, 1, sampleBuffer, + sampleBufferLen, file_time, + bitRate, NULL); if (dc.command == DECODE_COMMAND_STOP) { eof = 1; break; diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index d4ee40f93..abdf44c63 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -215,11 +215,11 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) bitRate = vbrUpdateBits * dc.audioFormat.sampleRate / 1152 / 1000; - ob_send(inStream, - inStream->seekable, - chunk, chunkpos, - total_time, - bitRate, replayGainInfo); + decoder_data(mpd_decoder, inStream, + inStream->seekable, + chunk, chunkpos, + total_time, + bitRate, replayGainInfo); chunkpos = 0; s16 = (mpd_sint16 *) chunk; @@ -237,9 +237,9 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) bitRate = vbrUpdateBits * dc.audioFormat.sampleRate / 1152 / 1000; - ob_send(NULL, inStream->seekable, - chunk, chunkpos, total_time, bitRate, - replayGainInfo); + decoder_data(mpd_decoder, NULL, inStream->seekable, + chunk, chunkpos, total_time, bitRate, + replayGainInfo); } ob_flush(); diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index 0867de69d..1333bc15c 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -309,12 +309,11 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream) if ((test = ov_bitrate_instant(&vf)) > 0) { bitRate = test / 1000; } - ob_send(inStream, - inStream->seekable, - chunk, chunkpos, - ov_pcm_tell(&vf) / - dc.audioFormat.sampleRate, - bitRate, replayGainInfo); + decoder_data(decoder, inStream, + inStream->seekable, + chunk, chunkpos, + ov_pcm_tell(&vf) / dc.audioFormat.sampleRate, + bitRate, replayGainInfo); chunkpos = 0; if (dc.command == DECODE_COMMAND_STOP) break; @@ -322,10 +321,10 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream) } if (dc.command != DECODE_COMMAND_STOP && chunkpos > 0) { - ob_send(NULL, inStream->seekable, - chunk, chunkpos, - ov_time_tell(&vf), bitRate, - replayGainInfo); + decoder_data(decoder, NULL, inStream->seekable, + chunk, chunkpos, + ov_time_tell(&vf), bitRate, + replayGainInfo); } if (replayGainInfo) diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index cd832fdc4..e4134bb31 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -207,10 +207,10 @@ static void wavpack_decode(struct decoder * decoder, format_samples(Bps, chunk, samplesgot * dc.audioFormat.channels); - ob_send(NULL, 0, chunk, - samplesgot * outsamplesize, - file_time, bitrate, - replayGainInfo); + decoder_data(decoder, NULL, 0, chunk, + samplesgot * outsamplesize, + file_time, bitrate, + replayGainInfo); } } while (samplesgot == samplesreq); |