diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-04-13 01:16:27 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-04-13 01:16:27 +0000 |
commit | 412ce8bdc48f05963b7ef7eca27d760aff3a8500 (patch) | |
tree | 1d6fffc5adb99c46405fb700650a8d68baa60b6a /src/inputPlugins | |
parent | c1963ed483c66e85ac19ce8c3a6dbc6b19ca30c3 (diff) | |
download | mpd-412ce8bdc48f05963b7ef7eca27d760aff3a8500.tar.gz mpd-412ce8bdc48f05963b7ef7eca27d760aff3a8500.tar.xz mpd-412ce8bdc48f05963b7ef7eca27d760aff3a8500.zip |
Make the OutputBuffer API more consistent
We had functions names varied between
outputBufferFoo, fooOutputBuffer, and output_buffer_foo
That was too confusing for my little brain to handle.
And the global variable was somehow named 'cb' instead of
the more obvious 'ob'...
git-svn-id: https://svn.musicpd.org/mpd/trunk@7355 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputPlugins')
-rw-r--r-- | src/inputPlugins/_flac_common.c | 2 | ||||
-rw-r--r-- | src/inputPlugins/_flac_common.h | 2 | ||||
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 6 | ||||
-rw-r--r-- | src/inputPlugins/audiofile_plugin.c | 8 | ||||
-rw-r--r-- | src/inputPlugins/flac_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/mod_plugin.c | 6 | ||||
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 14 | ||||
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 10 | ||||
-rw-r--r-- | src/inputPlugins/mpc_plugin.c | 10 | ||||
-rw-r--r-- | src/inputPlugins/oggflac_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/oggvorbis_plugin.c | 10 | ||||
-rw-r--r-- | src/inputPlugins/wavpack_plugin.c | 8 |
12 files changed, 42 insertions, 42 deletions
diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c index 80b1210d1..cf23a5e8c 100644 --- a/src/inputPlugins/_flac_common.c +++ b/src/inputPlugins/_flac_common.c @@ -170,7 +170,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block, dc.audioFormat.sampleRate = si->sample_rate; dc.audioFormat.channels = (mpd_sint8)si->channels; dc.totalTime = ((float)si->total_samples) / (si->sample_rate); - getOutputAudioFormat(&(dc.audioFormat), &(cb.audioFormat)); + getOutputAudioFormat(&(dc.audioFormat), &(ob.audioFormat)); break; case FLAC__METADATA_TYPE_VORBIS_COMMENT: flacParseReplayGain(block, data); diff --git a/src/inputPlugins/_flac_common.h b/src/inputPlugins/_flac_common.h index 18e51d587..10c2f3d38 100644 --- a/src/inputPlugins/_flac_common.h +++ b/src/inputPlugins/_flac_common.h @@ -167,7 +167,7 @@ MpdTag *copyVorbisCommentBlockToMpdTag(const FLAC__StreamMetadata * block, /* keep this inlined, this is just macro but prettier :) */ static inline int flacSendChunk(FlacData * data) { - if (sendDataToOutputBuffer(data->inStream, + if (ob_send(data->inStream, 1, data->chunk, data->chunk_length, data->time, data->bitRate, diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index ebf402be1..6e53c6420 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -376,7 +376,7 @@ static int aac_decode(char *path) dc.audioFormat.channels = frameInfo.channels; dc.audioFormat.sampleRate = sampleRate; getOutputAudioFormat(&(dc.audioFormat), - &(cb.audioFormat)); + &(ob.audioFormat)); dc.state = DECODE_STATE_DECODE; } @@ -395,7 +395,7 @@ static int aac_decode(char *path) sampleBufferLen = sampleCount * 2; - sendDataToOutputBuffer(NULL, 0, sampleBuffer, + ob_send(NULL, 0, sampleBuffer, sampleBufferLen, file_time, bitRate, NULL); if (dc.seek) { @@ -408,7 +408,7 @@ static int aac_decode(char *path) } } - flushOutputBuffer(); + ob_flush(); faacDecClose(decoder); if (b.buffer) diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index d661278b1..558731dd3 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -72,7 +72,7 @@ static int audiofile_decode(char *path) (unsigned int)afGetRate(af_fp, AF_DEFAULT_TRACK); dc.audioFormat.channels = (mpd_uint8)afGetVirtualChannels(af_fp, AF_DEFAULT_TRACK); - getOutputAudioFormat(&(dc.audioFormat), &(cb.audioFormat)); + getOutputAudioFormat(&(dc.audioFormat), &(ob.audioFormat)); frame_count = afGetFrameCount(af_fp, AF_DEFAULT_TRACK); @@ -97,7 +97,7 @@ static int audiofile_decode(char *path) while (!eof) { if (dc.seek) { - clearOutputBuffer(); + ob_clear(); current = dc.seekWhere * dc.audioFormat.sampleRate; afSeekFrame(af_fp, AF_DEFAULT_TRACK, current); @@ -112,7 +112,7 @@ static int audiofile_decode(char *path) eof = 1; else { current += ret; - sendDataToOutputBuffer(NULL, + ob_send(NULL, 1, chunk, ret * fs, @@ -125,7 +125,7 @@ static int audiofile_decode(char *path) } } - flushOutputBuffer(); + ob_flush(); } afCloseFile(af_fp); diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index 70b5c7a80..38131bac9 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -430,7 +430,7 @@ static int flac_decode_internal(InputStream * inStream, int is_ogg) FLAC__uint64 sampleToSeek = dc.seekWhere * dc.audioFormat.sampleRate + 0.5; if (flac_seek_absolute(flacDec, sampleToSeek)) { - clearOutputBuffer(); + ob_clear(); data.time = ((float)sampleToSeek) / dc.audioFormat.sampleRate; data.position = 0; @@ -447,7 +447,7 @@ static int flac_decode_internal(InputStream * inStream, int is_ogg) /* send last little bit */ if (data.chunk_length > 0 && !dc.stop) { flacSendChunk(&data); - flushOutputBuffer(); + ob_flush(); } fail: diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index 31ffa9a3d..4b79a3672 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -183,7 +183,7 @@ static int mod_decode(char *path) dc.audioFormat.bits = 16; dc.audioFormat.sampleRate = 44100; dc.audioFormat.channels = 2; - getOutputAudioFormat(&(dc.audioFormat), &(cb.audioFormat)); + getOutputAudioFormat(&(dc.audioFormat), &(ob.audioFormat)); secPerByte = 1.0 / ((dc.audioFormat.bits * dc.audioFormat.channels / 8.0) * @@ -205,12 +205,12 @@ static int mod_decode(char *path) ret = VC_WriteBytes(data->audio_buffer, MIKMOD_FRAME_SIZE); total_time += ret * secPerByte; - sendDataToOutputBuffer(NULL, 0, + ob_send(NULL, 0, (char *)data->audio_buffer, ret, total_time, 0, NULL); } - flushOutputBuffer(); + ob_flush(); mod_close(data); diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index ee26385d9..dcfc25cdc 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -853,7 +853,7 @@ static int mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo) case MUTEFRAME_SEEK: if (dc.seekWhere <= data->elapsedTime) { data->outputPtr = data->outputBuffer; - clearOutputBuffer(); + ob_clear(); data->muteFrame = 0; dc.seek = 0; decoder_wakeup_player(); @@ -928,7 +928,7 @@ static int mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo) } if (data->outputPtr >= data->outputBufferEnd) { - ret = sendDataToOutputBuffer(data->inStream, + ret = ob_send(data->inStream, data->inStream->seekable, data->outputBuffer, data->outputPtr - data->outputBuffer, @@ -963,7 +963,7 @@ static int mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo) data->frameOffset[j]) == 0) { data->outputPtr = data->outputBuffer; - clearOutputBuffer(); + ob_clear(); data->currentFrame = j; } else dc.seekError = 1; @@ -1029,7 +1029,7 @@ static int mp3_decode(InputStream * inStream) } initAudioFormatFromMp3DecodeData(&data, &(dc.audioFormat)); - getOutputAudioFormat(&(dc.audioFormat), &(cb.audioFormat)); + getOutputAudioFormat(&(dc.audioFormat), &(ob.audioFormat)); dc.totalTime = data.totalTime; @@ -1063,7 +1063,7 @@ static int mp3_decode(InputStream * inStream) while (mp3Read(&data, &replayGainInfo) != DECODE_BREAK) ; /* send last little bit if not dc.stop */ if (!dc.stop && data.outputPtr != data.outputBuffer && data.flush) { - sendDataToOutputBuffer(NULL, + ob_send(NULL, data.inStream->seekable, data.outputBuffer, data.outputPtr - data.outputBuffer, @@ -1075,12 +1075,12 @@ static int mp3_decode(InputStream * inStream) freeReplayGainInfo(replayGainInfo); if (dc.seek && data.muteFrame == MUTEFRAME_SEEK) { - clearOutputBuffer(); + ob_clear(); dc.seek = 0; decoder_wakeup_player(); } - flushOutputBuffer(); + ob_flush(); mp3DecodeDataFinalize(&data); return 0; diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 1dd418b2d..7f13ca344 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -217,7 +217,7 @@ static int mp4_decode(InputStream * inStream) if (seeking && seekPositionFound) { seekPositionFound = 0; - clearOutputBuffer(); + ob_clear(); seeking = 0; dc.seek = 0; decoder_wakeup_player(); @@ -255,7 +255,7 @@ static int mp4_decode(InputStream * inStream) dc.audioFormat.sampleRate = scale; dc.audioFormat.channels = frameInfo.channels; getOutputAudioFormat(&(dc.audioFormat), - &(cb.audioFormat)); + &(ob.audioFormat)); dc.state = DECODE_STATE_DECODE; } @@ -277,7 +277,7 @@ static int mp4_decode(InputStream * inStream) sampleBuffer += offset * channels * 2; - sendDataToOutputBuffer(inStream, 1, sampleBuffer, + ob_send(inStream, 1, sampleBuffer, sampleBufferLen, file_time, bitRate, NULL); if (dc.stop) { @@ -295,11 +295,11 @@ static int mp4_decode(InputStream * inStream) return -1; if (dc.seek && seeking) { - clearOutputBuffer(); + ob_clear(); dc.seek = 0; decoder_wakeup_player(); } - flushOutputBuffer(); + ob_flush(); return 0; } diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index 77ca07b30..1003f15d5 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -170,7 +170,7 @@ static int mpc_decode(InputStream * inStream) dc.audioFormat.channels = info.channels; dc.audioFormat.sampleRate = info.sample_freq; - getOutputAudioFormat(&(dc.audioFormat), &(cb.audioFormat)); + getOutputAudioFormat(&(dc.audioFormat), &(ob.audioFormat)); replayGainInfo = newReplayGainInfo(); replayGainInfo->albumGain = info.gain_album * 0.01; @@ -184,7 +184,7 @@ static int mpc_decode(InputStream * inStream) if (dc.seek) { samplePos = dc.seekWhere * dc.audioFormat.sampleRate; if (mpc_decoder_seek_sample(&decoder, samplePos)) { - clearOutputBuffer(); + ob_clear(); s16 = (mpd_sint16 *) chunk; chunkpos = 0; } else @@ -221,7 +221,7 @@ static int mpc_decode(InputStream * inStream) bitRate = vbrUpdateBits * dc.audioFormat.sampleRate / 1152 / 1000; - sendDataToOutputBuffer(inStream, + ob_send(inStream, inStream->seekable, chunk, chunkpos, total_time, @@ -243,12 +243,12 @@ static int mpc_decode(InputStream * inStream) bitRate = vbrUpdateBits * dc.audioFormat.sampleRate / 1152 / 1000; - sendDataToOutputBuffer(NULL, inStream->seekable, + ob_send(NULL, inStream->seekable, chunk, chunkpos, total_time, bitRate, replayGainInfo); } - flushOutputBuffer(); + ob_flush(); freeReplayGainInfo(replayGainInfo); diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 003b057d9..67259b626 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -362,7 +362,7 @@ static int oggflac_decode(InputStream * inStream) dc.audioFormat.sampleRate + 0.5; if (OggFLAC__seekable_stream_decoder_seek_absolute (decoder, sampleToSeek)) { - clearOutputBuffer(); + ob_clear(); data.time = ((float)sampleToSeek) / dc.audioFormat.sampleRate; data.position = 0; @@ -381,7 +381,7 @@ static int oggflac_decode(InputStream * inStream) /* send last little bit */ if (data.chunk_length > 0 && !dc.stop) { flacSendChunk(&data); - flushOutputBuffer(); + ob_flush(); } fail: diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index eb44b5c6e..16040b388 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -275,7 +275,7 @@ static int oggvorbis_decode(InputStream * inStream) while (1) { if (dc.seek) { if (0 == ov_time_seek_page(&vf, dc.seekWhere)) { - clearOutputBuffer(); + ob_clear(); chunkpos = 0; } else dc.seekError = 1; @@ -292,7 +292,7 @@ static int oggvorbis_decode(InputStream * inStream) dc.audioFormat.sampleRate = vi->rate; if (dc.state == DECODE_STATE_START) { getOutputAudioFormat(&(dc.audioFormat), - &(cb.audioFormat)); + &(ob.audioFormat)); dc.state = DECODE_STATE_DECODE; } comments = ov_comment(&vf, -1)->user_comments; @@ -316,7 +316,7 @@ static int oggvorbis_decode(InputStream * inStream) if ((test = ov_bitrate_instant(&vf)) > 0) { bitRate = test / 1000; } - sendDataToOutputBuffer(inStream, + ob_send(inStream, inStream->seekable, chunk, chunkpos, ov_pcm_tell(&vf) / @@ -329,7 +329,7 @@ static int oggvorbis_decode(InputStream * inStream) } if (!dc.stop && chunkpos > 0) { - sendDataToOutputBuffer(NULL, inStream->seekable, + ob_send(NULL, inStream->seekable, chunk, chunkpos, ov_time_tell(&vf), bitRate, replayGainInfo); @@ -340,7 +340,7 @@ static int oggvorbis_decode(InputStream * inStream) ov_clear(&vf); - flushOutputBuffer(); + ob_flush(); return 0; } diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index 13f10a1e9..6ab3d4d7a 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -166,7 +166,7 @@ static void wavpack_decode(WavpackContext *wpc, int canseek, samplesreq = sizeof(chunk) / (4 * dc.audioFormat.channels); - getOutputAudioFormat(&(dc.audioFormat), &(cb.audioFormat)); + getOutputAudioFormat(&(dc.audioFormat), &(ob.audioFormat)); dc.totalTime = (float)allsamples / dc.audioFormat.sampleRate; dc.state = DECODE_STATE_DECODE; @@ -179,7 +179,7 @@ static void wavpack_decode(WavpackContext *wpc, int canseek, if (canseek) { int where; - clearOutputBuffer(); + ob_clear(); where = dc.seekWhere * dc.audioFormat.sampleRate; @@ -210,14 +210,14 @@ static void wavpack_decode(WavpackContext *wpc, int canseek, format_samples(Bps, chunk, samplesgot * dc.audioFormat.channels); - sendDataToOutputBuffer(NULL, 0, chunk, + ob_send(NULL, 0, chunk, samplesgot * outsamplesize, file_time, bitrate, replayGainInfo); } } while (samplesgot == samplesreq); - flushOutputBuffer(); + ob_flush(); } static char *wavpack_tag(WavpackContext *wpc, char *key) |