diff options
author | Max Kellermann <max@duempel.org> | 2008-10-10 14:40:54 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-10 14:40:54 +0200 |
commit | de2cb3f37568e7680549057f8d7b6d748c388480 (patch) | |
tree | 46f9f43a1f83b49945c8a4fc77f933fad9230e01 /src/inputPlugins | |
parent | 6101dc6c768b09dbcdc1840a84b619a5a6a20129 (diff) |
audio_format: renamed sampleRate to sample_rate
The last bit of CamelCase in audio_format.h. Additionally, rename a
bunch of local variables.
Diffstat (limited to 'src/inputPlugins')
-rw-r--r-- | src/inputPlugins/_flac_common.c | 2 | ||||
-rw-r--r-- | src/inputPlugins/aac_plugin.c | 46 | ||||
-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 | 4 | ||||
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 2 | ||||
-rw-r--r-- | src/inputPlugins/mp4_plugin.c | 8 | ||||
-rw-r--r-- | src/inputPlugins/mpc_plugin.c | 12 | ||||
-rw-r--r-- | src/inputPlugins/oggflac_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/oggvorbis_plugin.c | 4 | ||||
-rw-r--r-- | src/inputPlugins/wavpack_plugin.c | 9 |
11 files changed, 51 insertions, 52 deletions
diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c index 22d8774a3..f24e20531 100644 --- a/src/inputPlugins/_flac_common.c +++ b/src/inputPlugins/_flac_common.c @@ -162,7 +162,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block, switch (block->type) { case FLAC__METADATA_TYPE_STREAMINFO: data->audio_format.bits = (int8_t)si->bits_per_sample; - data->audio_format.sampleRate = si->sample_rate; + data->audio_format.sample_rate = si->sample_rate; data->audio_format.channels = (int8_t)si->channels; data->total_time = ((float)si->total_samples) / (si->sample_rate); break; diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index a96623e1b..e9b2d7476 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -148,7 +148,7 @@ static size_t adts_find_frame(AacBuffer * b) static void adtsParse(AacBuffer * b, float *length) { unsigned int frames, frameLength; - int sampleRate = 0; + int sample_rate = 0; float framesPerSec; /* Read all frames to ensure correct time and bitrate */ @@ -158,9 +158,9 @@ static void adtsParse(AacBuffer * b, float *length) frameLength = adts_find_frame(b); if (frameLength > 0) { if (frames == 0) { - sampleRate = adtsSampleRates[(b-> - buffer[2] & 0x3c) - >> 2]; + sample_rate = adtsSampleRates[(b-> + buffer[2] & 0x3c) + >> 2]; } if (frameLength > b->bytesIntoBuffer) @@ -171,7 +171,7 @@ static void adtsParse(AacBuffer * b, float *length) break; } - framesPerSec = (float)sampleRate / 1024.0; + framesPerSec = (float)sample_rate / 1024.0; if (framesPerSec != 0) *length = (float)frames / framesPerSec; } @@ -253,7 +253,7 @@ static float getAacFloatTotalTime(char *file) float length; faacDecHandle decoder; faacDecConfigurationPtr config; - uint32_t sampleRate; + uint32_t sample_rate; unsigned char channels; InputStream inStream; long bread; @@ -274,11 +274,11 @@ static float getAacFloatTotalTime(char *file) fillAacBuffer(&b); #ifdef HAVE_FAAD_BUFLEN_FUNCS bread = faacDecInit(decoder, b.buffer, b.bytesIntoBuffer, - &sampleRate, &channels); + &sample_rate, &channels); #else - bread = faacDecInit(decoder, b.buffer, &sampleRate, &channels); + bread = faacDecInit(decoder, b.buffer, &sample_rate, &channels); #endif - if (bread >= 0 && sampleRate > 0 && channels > 0) + if (bread >= 0 && sample_rate > 0 && channels > 0) length = 0; faacDecClose(decoder); @@ -312,7 +312,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder, faacDecConfigurationPtr config; long bread; struct audio_format audio_format; - uint32_t sampleRate; + uint32_t sample_rate; unsigned char channels; unsigned int sampleCount; char *sampleBuffer; @@ -346,9 +346,9 @@ static int aac_stream_decode(struct decoder * mpd_decoder, #ifdef HAVE_FAAD_BUFLEN_FUNCS bread = faacDecInit(decoder, b.buffer, b.bytesIntoBuffer, - &sampleRate, &channels); + &sample_rate, &channels); #else - bread = faacDecInit(decoder, b.buffer, &sampleRate, &channels); + bread = faacDecInit(decoder, b.buffer, &sample_rate, &channels); #endif if (bread < 0) { ERROR("Error not a AAC stream.\n"); @@ -386,12 +386,12 @@ static int aac_stream_decode(struct decoder * mpd_decoder, break; } #ifdef HAVE_FAACDECFRAMEINFO_SAMPLERATE - sampleRate = frameInfo.samplerate; + sample_rate = frameInfo.samplerate; #endif if (!initialized) { audio_format.channels = frameInfo.channels; - audio_format.sampleRate = sampleRate; + audio_format.sample_rate = sample_rate; decoder_initialized(mpd_decoder, &audio_format, totalTime); initialized = 1; } @@ -402,11 +402,11 @@ static int aac_stream_decode(struct decoder * mpd_decoder, if (sampleCount > 0) { bitRate = frameInfo.bytesconsumed * 8.0 * - frameInfo.channels * sampleRate / + frameInfo.channels * sample_rate / frameInfo.samples / 1000 + 0.5; file_time += (float)(frameInfo.samples) / frameInfo.channels / - sampleRate; + sample_rate; } sampleBufferLen = sampleCount * 2; @@ -446,7 +446,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) faacDecConfigurationPtr config; long bread; struct audio_format audio_format; - uint32_t sampleRate; + uint32_t sample_rate; unsigned char channels; unsigned int sampleCount; char *sampleBuffer; @@ -484,9 +484,9 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) #ifdef HAVE_FAAD_BUFLEN_FUNCS bread = faacDecInit(decoder, b.buffer, b.bytesIntoBuffer, - &sampleRate, &channels); + &sample_rate, &channels); #else - bread = faacDecInit(decoder, b.buffer, &sampleRate, &channels); + bread = faacDecInit(decoder, b.buffer, &sample_rate, &channels); #endif if (bread < 0) { ERROR("Error not a AAC stream.\n"); @@ -522,12 +522,12 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) break; } #ifdef HAVE_FAACDECFRAMEINFO_SAMPLERATE - sampleRate = frameInfo.samplerate; + sample_rate = frameInfo.samplerate; #endif if (!initialized) { audio_format.channels = frameInfo.channels; - audio_format.sampleRate = sampleRate; + audio_format.sample_rate = sample_rate; decoder_initialized(mpd_decoder, &audio_format, totalTime); initialized = 1; @@ -539,11 +539,11 @@ static int aac_decode(struct decoder * mpd_decoder, char *path) if (sampleCount > 0) { bitRate = frameInfo.bytesconsumed * 8.0 * - frameInfo.channels * sampleRate / + frameInfo.channels * sample_rate / frameInfo.samples / 1000 + 0.5; file_time += (float)(frameInfo.samples) / frameInfo.channels / - sampleRate; + sample_rate; } sampleBufferLen = sampleCount * 2; diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index 421cdf354..4c08074c4 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -71,14 +71,14 @@ static int audiofile_decode(struct decoder * decoder, char *path) AF_SAMPFMT_TWOSCOMP, 16); afGetVirtualSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits); audio_format.bits = (uint8_t)bits; - audio_format.sampleRate = + audio_format.sample_rate = (unsigned int)afGetRate(af_fp, AF_DEFAULT_TRACK); audio_format.channels = (uint8_t)afGetVirtualChannels(af_fp, AF_DEFAULT_TRACK); frame_count = afGetFrameCount(af_fp, AF_DEFAULT_TRACK); - total_time = ((float)frame_count / (float)audio_format.sampleRate); + total_time = ((float)frame_count / (float)audio_format.sample_rate); bitRate = (uint16_t)(st.st_size * 8.0 / total_time / 1000.0 + 0.5); @@ -97,7 +97,7 @@ static int audiofile_decode(struct decoder * decoder, char *path) if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { decoder_clear(decoder); current = decoder_seek_where(decoder) * - audio_format.sampleRate; + audio_format.sample_rate; afSeekFrame(af_fp, AF_DEFAULT_TRACK, current); decoder_command_finished(decoder); } @@ -110,7 +110,7 @@ static int audiofile_decode(struct decoder * decoder, char *path) current += ret; decoder_data(decoder, NULL, 1, chunk, ret * fs, - (float)current / (float)audio_format.sampleRate, + (float)current / (float)audio_format.sample_rate, bitRate, NULL); } while (decoder_get_command(decoder) != DECODE_COMMAND_STOP); diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index cd8a8efd3..2f3ec88d9 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -350,11 +350,11 @@ static int flac_decode_internal(struct decoder * decoder, break; if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) { FLAC__uint64 sampleToSeek = decoder_seek_where(decoder) * - data.audio_format.sampleRate + 0.5; + data.audio_format.sample_rate + 0.5; if (flac_seek_absolute(flacDec, sampleToSeek)) { decoder_clear(decoder); data.time = ((float)sampleToSeek) / - data.audio_format.sampleRate; + data.audio_format.sample_rate; data.position = 0; decoder_command_finished(decoder); } else diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index 9ae9cef16..98bd67f0f 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -186,12 +186,12 @@ static int mod_decode(struct decoder * decoder, char *path) } audio_format.bits = 16; - audio_format.sampleRate = 44100; + audio_format.sample_rate = 44100; audio_format.channels = 2; secPerByte = 1.0 / ((audio_format.bits * audio_format.channels / 8.0) * - (float)audio_format.sampleRate); + (float)audio_format.sample_rate); decoder_initialized(decoder, &audio_format, 0); diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 60e09a1bb..2990de1ac 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -1030,7 +1030,7 @@ static void initAudioFormatFromMp3DecodeData(mp3DecodeData * data, struct audio_format * af) { af->bits = 16; - af->sampleRate = (data->frame).header.samplerate; + af->sample_rate = (data->frame).header.samplerate; af->channels = MAD_NCHANNELS(&(data->frame).header); } diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 6a2d167b2..d284313d4 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -92,7 +92,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) struct audio_format audio_format; unsigned char *mp4Buffer; unsigned int mp4BufferSize; - uint32_t sampleRate; + uint32_t sample_rate; unsigned char channels; long sampleId; long numSamples; @@ -149,7 +149,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) mp4ff_get_decoder_config(mp4fh, track, &mp4Buffer, &mp4BufferSize); if (faacDecInit2 - (decoder, mp4Buffer, mp4BufferSize, &sampleRate, &channels) < 0) { + (decoder, mp4Buffer, mp4BufferSize, &sample_rate, &channels) < 0) { ERROR("Error not a AAC stream.\n"); faacDecClose(decoder); mp4ff_close(mp4fh); @@ -157,7 +157,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) return -1; } - audio_format.sampleRate = sampleRate; + audio_format.sample_rate = sample_rate; audio_format.channels = channels; file_time = mp4ff_get_track_duration_use_offsets(mp4fh, track); scale = mp4ff_time_scale(mp4fh, track); @@ -255,7 +255,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream) #ifdef HAVE_FAACDECFRAMEINFO_SAMPLERATE scale = frameInfo.samplerate; #endif - audio_format.sampleRate = scale; + audio_format.sample_rate = scale; audio_format.channels = frameInfo.channels; decoder_initialized(mpd_decoder, &audio_format, total_time); diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index ca37333d3..f74dc8ddc 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -154,7 +154,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) audio_format.bits = 16; audio_format.channels = info.channels; - audio_format.sampleRate = info.sample_freq; + audio_format.sample_rate = info.sample_freq; replayGainInfo = newReplayGainInfo(); replayGainInfo->albumGain = info.gain_album * 0.01; @@ -168,7 +168,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) while (!eof) { if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) { samplePos = decoder_seek_where(mpd_decoder) * - audio_format.sampleRate; + audio_format.sample_rate; if (mpc_decoder_seek_sample(&decoder, samplePos)) { decoder_clear(mpd_decoder); s16 = (int16_t *) chunk; @@ -201,10 +201,10 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) if (chunkpos >= MPC_CHUNK_SIZE) { total_time = ((float)samplePos) / - audio_format.sampleRate; + audio_format.sample_rate; bitRate = vbrUpdateBits * - audio_format.sampleRate / 1152 / 1000; + audio_format.sample_rate / 1152 / 1000; decoder_data(mpd_decoder, inStream, inStream->seekable, @@ -224,10 +224,10 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream) if (decoder_get_command(mpd_decoder) != DECODE_COMMAND_STOP && chunkpos > 0) { - total_time = ((float)samplePos) / audio_format.sampleRate; + total_time = ((float)samplePos) / audio_format.sample_rate; bitRate = - vbrUpdateBits * audio_format.sampleRate / 1152 / 1000; + vbrUpdateBits * audio_format.sample_rate / 1152 / 1000; decoder_data(mpd_decoder, NULL, inStream->seekable, chunk, chunkpos, total_time, bitRate, diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 3a2db5c03..53f233e0c 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -316,12 +316,12 @@ static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream) } if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) { FLAC__uint64 sampleToSeek = decoder_seek_where(mpd_decoder) * - data.audio_format.sampleRate + 0.5; + data.audio_format.sample_rate + 0.5; if (OggFLAC__seekable_stream_decoder_seek_absolute (decoder, sampleToSeek)) { decoder_clear(mpd_decoder); data.time = ((float)sampleToSeek) / - data.audio_format.sampleRate; + data.audio_format.sample_rate; data.position = 0; decoder_command_finished(mpd_decoder); } else diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index 0e1d523b9..bf2448605 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -278,7 +278,7 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream) /*printf("new song!\n"); */ vorbis_info *vi = ov_info(&vf, -1); audio_format.channels = vi->channels; - audio_format.sampleRate = vi->rate; + audio_format.sample_rate = vi->rate; if (!initialized) { float total_time = ov_time_total(&vf, -1); if (total_time < 0) @@ -311,7 +311,7 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream) decoder_data(decoder, inStream, inStream->seekable, chunk, chunkpos, - ov_pcm_tell(&vf) / audio_format.sampleRate, + ov_pcm_tell(&vf) / audio_format.sample_rate, bitRate, replayGainInfo); chunkpos = 0; if (decoder_get_command(decoder) == DECODE_COMMAND_STOP) diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index af7c3a2f3..3e99980bd 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -140,7 +140,7 @@ static void wavpack_decode(struct decoder * decoder, int position, outsamplesize; int Bps; - audio_format.sampleRate = WavpackGetSampleRate(wpc); + audio_format.sample_rate = WavpackGetSampleRate(wpc); audio_format.channels = WavpackGetReducedChannels(wpc); audio_format.bits = WavpackGetBitsPerSample(wpc); @@ -168,7 +168,7 @@ static void wavpack_decode(struct decoder * decoder, samplesreq = sizeof(chunk) / (4 * audio_format.channels); decoder_initialized(decoder, &audio_format, - (float)allsamples / audio_format.sampleRate); + (float)allsamples / audio_format.sample_rate); position = 0; @@ -180,7 +180,7 @@ static void wavpack_decode(struct decoder * decoder, decoder_clear(decoder); where = decoder_seek_where(decoder) * - audio_format.sampleRate; + audio_format.sample_rate; if (WavpackSeekSample(wpc, where)) { position = where; decoder_command_finished(decoder); @@ -200,8 +200,7 @@ static void wavpack_decode(struct decoder * decoder, int bitrate = (int)(WavpackGetInstantBitrate(wpc) / 1000 + 0.5); position += samplesgot; - file_time = (float)position / - audio_format.sampleRate; + file_time = (float)position / audio_format.sample_rate; format_samples(Bps, chunk, samplesgot * audio_format.channels); |