summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-10 14:40:54 +0200
committerMax Kellermann <max@duempel.org>2008-10-10 14:40:54 +0200
commitde2cb3f37568e7680549057f8d7b6d748c388480 (patch)
tree46f9f43a1f83b49945c8a4fc77f933fad9230e01 /src
parent6101dc6c768b09dbcdc1840a84b619a5a6a20129 (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')
-rw-r--r--src/audio.c10
-rw-r--r--src/audioOutputs/audioOutput_alsa.c16
-rw-r--r--src/audioOutputs/audioOutput_ao.c2
-rw-r--r--src/audioOutputs/audioOutput_jack.c8
-rw-r--r--src/audioOutputs/audioOutput_mvp.c8
-rw-r--r--src/audioOutputs/audioOutput_oss.c4
-rw-r--r--src/audioOutputs/audioOutput_osx.c4
-rw-r--r--src/audioOutputs/audioOutput_pulse.c4
-rw-r--r--src/audioOutputs/audioOutput_shout.c2
-rw-r--r--src/audioOutputs/audioOutput_shout_mp3.c2
-rw-r--r--src/audioOutputs/audioOutput_shout_ogg.c4
-rw-r--r--src/audio_format.h10
-rw-r--r--src/crossfade.c2
-rw-r--r--src/inputPlugins/_flac_common.c2
-rw-r--r--src/inputPlugins/aac_plugin.c46
-rw-r--r--src/inputPlugins/audiofile_plugin.c8
-rw-r--r--src/inputPlugins/flac_plugin.c4
-rw-r--r--src/inputPlugins/mod_plugin.c4
-rw-r--r--src/inputPlugins/mp3_plugin.c2
-rw-r--r--src/inputPlugins/mp4_plugin.c8
-rw-r--r--src/inputPlugins/mpc_plugin.c12
-rw-r--r--src/inputPlugins/oggflac_plugin.c4
-rw-r--r--src/inputPlugins/oggvorbis_plugin.c4
-rw-r--r--src/inputPlugins/wavpack_plugin.c9
-rw-r--r--src/pcm_utils.c10
-rw-r--r--src/player_thread.c2
-rw-r--r--src/timer.c2
27 files changed, 96 insertions, 97 deletions
diff --git a/src/audio.c b/src/audio.c
index bda0107ff..a4d4e3ea4 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -137,16 +137,16 @@ int parseAudioConfig(struct audio_format *audioFormat, char *conf)
memset(audioFormat, 0, sizeof(*audioFormat));
- audioFormat->sampleRate = strtol(conf, &test, 10);
+ audioFormat->sample_rate = strtol(conf, &test, 10);
if (*test != ':') {
ERROR("error parsing audio output format: %s\n", conf);
return -1;
}
- if (audioFormat->sampleRate <= 0) {
- ERROR("sample rate %i is not >= 0\n",
- (int)audioFormat->sampleRate);
+ if (audioFormat->sample_rate <= 0) {
+ ERROR("sample rate %u is not >= 0\n",
+ audioFormat->sample_rate);
return -1;
}
@@ -315,7 +315,7 @@ static int flushAudioBuffer(void)
static size_t audio_buffer_size(const struct audio_format *af)
{
- return (af->bits >> 3) * af->channels * (af->sampleRate >> 5);
+ return (af->bits >> 3) * af->channels * (af->sample_rate >> 5);
}
static void audio_buffer_resize(size_t size)
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c
index 83bd9c256..30ad449f3 100644
--- a/src/audioOutputs/audioOutput_alsa.c
+++ b/src/audioOutputs/audioOutput_alsa.c
@@ -142,7 +142,7 @@ static int alsa_openDevice(void *data, struct audio_format *audioFormat)
snd_pcm_format_t bitformat;
snd_pcm_hw_params_t *hwparams;
snd_pcm_sw_params_t *swparams;
- unsigned int sampleRate = audioFormat->sampleRate;
+ unsigned int sample_rate = audioFormat->sample_rate;
unsigned int channels = audioFormat->channels;
snd_pcm_uframes_t alsa_buffer_size;
snd_pcm_uframes_t alsa_period_size;
@@ -217,13 +217,13 @@ configure_hw:
audioFormat->channels = (int8_t)channels;
err = snd_pcm_hw_params_set_rate_near(ad->pcmHandle, hwparams,
- &sampleRate, NULL);
- if (err < 0 || sampleRate == 0) {
- ERROR("ALSA device \"%s\" does not support %i Hz audio\n",
- ad->device, (int)audioFormat->sampleRate);
+ &sample_rate, NULL);
+ if (err < 0 || sample_rate == 0) {
+ ERROR("ALSA device \"%s\" does not support %u Hz audio\n",
+ ad->device, audioFormat->sample_rate);
goto fail;
}
- audioFormat->sampleRate = sampleRate;
+ audioFormat->sample_rate = sample_rate;
buffer_time = ad->buffer_time;
cmd = "snd_pcm_hw_params_set_buffer_time_near";
@@ -291,8 +291,8 @@ configure_hw:
ad->sampleSize = audio_format_sample_size(audioFormat) * audioFormat->channels;
DEBUG("ALSA device \"%s\" will be playing %i bit, %u channel audio at "
- "%i Hz\n", ad->device, audioFormat->bits,
- channels, sampleRate);
+ "%u Hz\n", ad->device, audioFormat->bits,
+ channels, sample_rate);
return 0;
diff --git a/src/audioOutputs/audioOutput_ao.c b/src/audioOutputs/audioOutput_ao.c
index b91895bde..e731f972a 100644
--- a/src/audioOutputs/audioOutput_ao.c
+++ b/src/audioOutputs/audioOutput_ao.c
@@ -182,7 +182,7 @@ static int audioOutputAo_openDevice(void *data,
}
format.bits = audio_format->bits;
- format.rate = audio_format->sampleRate;
+ format.rate = audio_format->sample_rate;
format.byte_format = AO_FMT_NATIVE;
format.channels = audio_format->channels;
diff --git a/src/audioOutputs/audioOutput_jack.c b/src/audioOutputs/audioOutput_jack.c
index f26dfcf7a..8a2cb6cdc 100644
--- a/src/audioOutputs/audioOutput_jack.c
+++ b/src/audioOutputs/audioOutput_jack.c
@@ -126,7 +126,7 @@ static int srate(mpd_unused jack_nframes_t rate, void *data)
JackData *jd = (JackData *)data;
struct audio_format *audioFormat = jd->audio_format;
- audioFormat->sampleRate = (int)jack_get_sample_rate(jd->client);
+ audioFormat->sample_rate = (int)jack_get_sample_rate(jd->client);
return 0;
}
@@ -188,13 +188,13 @@ static void shutdown_callback(void *arg)
static void set_audioformat(JackData *jd, struct audio_format *audioFormat)
{
- audioFormat->sampleRate = (int) jack_get_sample_rate(jd->client);
- DEBUG("samplerate = %d\n", audioFormat->sampleRate);
+ audioFormat->sample_rate = jack_get_sample_rate(jd->client);
+ DEBUG("samplerate = %u\n", audioFormat->sample_rate);
audioFormat->channels = 2;
audioFormat->bits = 16;
jd->bps = audioFormat->channels
* sizeof(jack_default_audio_sample_t)
- * audioFormat->sampleRate;
+ * audioFormat->sample_rate;
}
static void error_callback(const char *msg)
diff --git a/src/audioOutputs/audioOutput_mvp.c b/src/audioOutputs/audioOutput_mvp.c
index 59f43a4fd..00b069c3d 100644
--- a/src/audioOutputs/audioOutput_mvp.c
+++ b/src/audioOutputs/audioOutput_mvp.c
@@ -202,11 +202,11 @@ static int mvp_openDevice(struct audio_output *audioOutput,
return -1;
}
#ifdef WORDS_BIGENDIAN
- mvp_setPcmParams(md, audioFormat->sampleRate, audioFormat->channels, 0,
- audioFormat->bits);
+ mvp_setPcmParams(md, audioFormat->sample_rate, audioFormat->channels,
+ 0, audioFormat->bits);
#else
- mvp_setPcmParams(md, audioFormat->sampleRate, audioFormat->channels, 1,
- audioFormat->bits);
+ mvp_setPcmParams(md, audioFormat->sample_rate, audioFormat->channels,
+ 1, audioFormat->bits);
#endif
return 0;
}
diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c
index 487e9a75d..8dddf3be7 100644
--- a/src/audioOutputs/audioOutput_oss.c
+++ b/src/audioOutputs/audioOutput_oss.c
@@ -487,14 +487,14 @@ static int oss_openDevice(void *data,
OssData *od = data;
od->channels = (int8_t)audioFormat->channels;
- od->sampleRate = audioFormat->sampleRate;
+ od->sampleRate = audioFormat->sample_rate;
od->bits = (int8_t)audioFormat->bits;
if ((ret = oss_open(od)) < 0)
return ret;
audioFormat->channels = od->channels;
- audioFormat->sampleRate = od->sampleRate;
+ audioFormat->sample_rate = od->sampleRate;
audioFormat->bits = od->bits;
DEBUG("oss device \"%s\" will be playing %i bit %i channel audio at "
diff --git a/src/audioOutputs/audioOutput_osx.c b/src/audioOutputs/audioOutput_osx.c
index 9071ed6c9..1fc0a5d9e 100644
--- a/src/audioOutputs/audioOutput_osx.c
+++ b/src/audioOutputs/audioOutput_osx.c
@@ -259,7 +259,7 @@ static int osx_openDevice(struct audio_output *audioOutput,
return -1;
}
- streamDesc.mSampleRate = audioFormat->sampleRate;
+ streamDesc.mSampleRate = audioFormat->sample_rate;
streamDesc.mFormatID = kAudioFormatLinearPCM;
streamDesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger;
#ifdef WORDS_BIGENDIAN
@@ -283,7 +283,7 @@ static int osx_openDevice(struct audio_output *audioOutput,
}
/* create a buffer of 1s */
- od->bufferSize = (audioFormat->sampleRate) *
+ od->bufferSize = (audioFormat->sample_rate) *
(audioFormat->bits >> 3) * (audioFormat->channels);
od->buffer = xrealloc(od->buffer, od->bufferSize);
diff --git a/src/audioOutputs/audioOutput_pulse.c b/src/audioOutputs/audioOutput_pulse.c
index 38014c8f0..93a1d8b37 100644
--- a/src/audioOutputs/audioOutput_pulse.c
+++ b/src/audioOutputs/audioOutput_pulse.c
@@ -138,7 +138,7 @@ static int pulse_openDevice(void *data,
}
ss.format = PA_SAMPLE_S16NE;
- ss.rate = audioFormat->sampleRate;
+ ss.rate = audioFormat->sample_rate;
ss.channels = audioFormat->channels;
pd->s = pa_simple_new(pd->server, MPD_PULSE_NAME, PA_STREAM_PLAYBACK,
@@ -159,7 +159,7 @@ static int pulse_openDevice(void *data,
"channel audio at %i Hz\n",
audio_output_get_name(pd->ao),
audioFormat->bits,
- audioFormat->channels, audioFormat->sampleRate);
+ audioFormat->channels, audioFormat->sample_rate);
return 0;
}
diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c
index 34327573c..00c4eb059 100644
--- a/src/audioOutputs/audioOutput_shout.c
+++ b/src/audioOutputs/audioOutput_shout.c
@@ -255,7 +255,7 @@ static void *my_shout_init_driver(struct audio_output *audio_output,
snprintf(temp, sizeof(temp), "%u", sd->audio_format.channels);
shout_set_audio_info(sd->shout_conn, SHOUT_AI_CHANNELS, temp);
- snprintf(temp, sizeof(temp), "%d", sd->audio_format.sampleRate);
+ snprintf(temp, sizeof(temp), "%u", sd->audio_format.sample_rate);
shout_set_audio_info(sd->shout_conn, SHOUT_AI_SAMPLERATE, temp);
diff --git a/src/audioOutputs/audioOutput_shout_mp3.c b/src/audioOutputs/audioOutput_shout_mp3.c
index c54632b15..722079b29 100644
--- a/src/audioOutputs/audioOutput_shout_mp3.c
+++ b/src/audioOutputs/audioOutput_shout_mp3.c
@@ -93,7 +93,7 @@ static int shout_mp3_encoder_init_encoder(struct shout_data *sd)
}
if (0 != lame_set_in_samplerate(ld->gfp,
- sd->audio_format.sampleRate)) {
+ sd->audio_format.sample_rate)) {
ERROR("error setting lame sample rate\n");
return -1;
}
diff --git a/src/audioOutputs/audioOutput_shout_ogg.c b/src/audioOutputs/audioOutput_shout_ogg.c
index 14747c324..5983b4d89 100644
--- a/src/audioOutputs/audioOutput_shout_ogg.c
+++ b/src/audioOutputs/audioOutput_shout_ogg.c
@@ -187,7 +187,7 @@ static int reinit_encoder(struct shout_data *sd)
if (sd->quality >= -1.0) {
if (0 != vorbis_encode_init_vbr(&od->vi,
sd->audio_format.channels,
- sd->audio_format.sampleRate,
+ sd->audio_format.sample_rate,
sd->quality * 0.1)) {
ERROR("error initializing vorbis vbr\n");
vorbis_info_clear(&od->vi);
@@ -196,7 +196,7 @@ static int reinit_encoder(struct shout_data *sd)
} else {
if (0 != vorbis_encode_init(&od->vi,
sd->audio_format.channels,
- sd->audio_format.sampleRate, -1.0,
+ sd->audio_format.sample_rate, -1.0,
sd->bitrate * 1000, -1.0)) {
ERROR("error initializing vorbis encoder\n");
vorbis_info_clear(&od->vi);
diff --git a/src/audio_format.h b/src/audio_format.h
index dd9b3cae8..2475aa77e 100644
--- a/src/audio_format.h
+++ b/src/audio_format.h
@@ -23,27 +23,27 @@
#include <stdbool.h>
struct audio_format {
- uint32_t sampleRate;
+ uint32_t sample_rate;
uint8_t bits;
uint8_t channels;
};
static inline void audio_format_clear(struct audio_format *af)
{
- af->sampleRate = 0;
+ af->sample_rate = 0;
af->bits = 0;
af->channels = 0;
}
static inline bool audio_format_defined(const struct audio_format *af)
{
- return af->sampleRate != 0;
+ return af->sample_rate != 0;
}
static inline bool audio_format_equals(const struct audio_format *a,
const struct audio_format *b)
{
- return a->sampleRate == b->sampleRate &&
+ return a->sample_rate == b->sample_rate &&
a->bits == b->bits &&
a->channels == b->channels;
}
@@ -63,7 +63,7 @@ static inline unsigned audio_format_sample_size(const struct audio_format *af)
static inline double audio_format_time_to_size(const struct audio_format *af)
{
- return af->sampleRate * af->channels * audio_format_sample_size(af);
+ return af->sample_rate * af->channels * audio_format_sample_size(af);
}
static inline double audioFormatSizeToTime(const struct audio_format *af)
diff --git a/src/crossfade.c b/src/crossfade.c
index cb780db3b..b4d4695c4 100644
--- a/src/crossfade.c
+++ b/src/crossfade.c
@@ -37,7 +37,7 @@ unsigned cross_fade_calc(float duration, float total_time,
assert(duration > 0);
assert(af->bits > 0);
assert(af->channels > 0);
- assert(af->sampleRate > 0);
+ assert(af->sample_rate > 0);
chunks = audio_format_time_to_size(af) / CHUNK_SIZE;
chunks = (chunks * duration + 0.5);
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);
diff --git a/src/pcm_utils.c b/src/pcm_utils.c
index 9274c2eb6..eb3d4b124 100644
--- a/src/pcm_utils.c
+++ b/src/pcm_utils.c
@@ -503,13 +503,13 @@ size_t pcm_convertAudioFormat(const struct audio_format *inFormat,
exit(EXIT_FAILURE);
}
- if (inFormat->sampleRate == outFormat->sampleRate) {
+ if (inFormat->sample_rate == outFormat->sample_rate) {
assert(outSize >= len);
memcpy(outBuffer, buf, len);
} else {
len = pcm_convertSampleRate(outFormat->channels,
- inFormat->sampleRate, buf, len,
- outFormat->sampleRate, outBuffer,
+ inFormat->sample_rate, buf, len,
+ outFormat->sample_rate, outBuffer,
outSize, convState);
if (len == 0)
exit(EXIT_FAILURE);
@@ -521,8 +521,8 @@ size_t pcm_convertAudioFormat(const struct audio_format *inFormat,
size_t pcm_sizeOfConvBuffer(const struct audio_format *inFormat, size_t inSize,
const struct audio_format *outFormat)
{
- const double ratio = (double)outFormat->sampleRate /
- (double)inFormat->sampleRate;
+ const double ratio = (double)outFormat->sample_rate /
+ (double)inFormat->sample_rate;
const int shift = 2 * outFormat->channels;
size_t outSize = inSize;
diff --git a/src/player_thread.c b/src/player_thread.c
index 6a08bf46e..efb7d7ab5 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -253,7 +253,7 @@ static void do_play(void)
closeAudioDevice();
}
pc.totalTime = dc.totalTime;
- pc.sampleRate = dc.audioFormat.sampleRate;
+ pc.sampleRate = dc.audioFormat.sample_rate;
pc.bits = dc.audioFormat.bits;
pc.channels = dc.audioFormat.channels;
sizeToTime = audioFormatSizeToTime(&ob.audioFormat);
diff --git a/src/timer.c b/src/timer.c
index f8bbacdc4..84c03fbe6 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -40,7 +40,7 @@ Timer *timer_new(const struct audio_format *af)
timer = xmalloc(sizeof(Timer));
timer->time = 0;
timer->started = 0;
- timer->rate = af->sampleRate * (af->bits / CHAR_BIT) * af->channels;
+ timer->rate = af->sample_rate * (af->bits / CHAR_BIT) * af->channels;
return timer;
}