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
This commit is contained in:
Eric Wong
2008-04-13 01:16:27 +00:00
parent c1963ed483
commit 412ce8bdc4
17 changed files with 146 additions and 146 deletions

View File

@@ -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);

View File

@@ -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,

View File

@@ -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)

View File

@@ -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);

View File

@@ -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:

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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:

View File

@@ -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;
}

View File

@@ -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)