summaryrefslogtreecommitdiff
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-11 15:55:34 +0100
committerMax Kellermann <max@duempel.org>2008-11-11 15:55:34 +0100
commit114b3c1e78433ff3760a28641d6da3925ef8d3ce (patch)
treef92bc79eda01492741cf37a824d922c10758c1a2 /src/decoder
parent54ad08ab378f9e988cc8289c0923e50047805b1f (diff)
replay_gain: no CamelCase
Renamed functions and variables.
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/_flac_common.c14
-rw-r--r--src/decoder/_flac_common.h2
-rw-r--r--src/decoder/flac_plugin.c2
-rw-r--r--src/decoder/mp3_plugin.c47
-rw-r--r--src/decoder/mpc_plugin.c14
-rw-r--r--src/decoder/oggflac_plugin.c2
-rw-r--r--src/decoder/oggvorbis_plugin.c22
-rw-r--r--src/decoder/wavpack_plugin.c22
8 files changed, 65 insertions, 60 deletions
diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c
index a8a856755..3df7d24e5 100644
--- a/src/decoder/_flac_common.c
+++ b/src/decoder/_flac_common.c
@@ -70,21 +70,21 @@ static void flacParseReplayGain(const FLAC__StreamMetadata * block,
int found = 0;
if (data->replayGainInfo)
- freeReplayGainInfo(data->replayGainInfo);
+ replay_gain_info_free(data->replayGainInfo);
- data->replayGainInfo = newReplayGainInfo();
+ data->replayGainInfo = replay_gain_info_new();
found |= flacFindVorbisCommentFloat(block, "replaygain_album_gain",
- &data->replayGainInfo->albumGain);
+ &data->replayGainInfo->album_gain);
found |= flacFindVorbisCommentFloat(block, "replaygain_album_peak",
- &data->replayGainInfo->albumPeak);
+ &data->replayGainInfo->album_peak);
found |= flacFindVorbisCommentFloat(block, "replaygain_track_gain",
- &data->replayGainInfo->trackGain);
+ &data->replayGainInfo->track_gain);
found |= flacFindVorbisCommentFloat(block, "replaygain_track_peak",
- &data->replayGainInfo->trackPeak);
+ &data->replayGainInfo->track_peak);
if (!found) {
- freeReplayGainInfo(data->replayGainInfo);
+ replay_gain_info_free(data->replayGainInfo);
data->replayGainInfo = NULL;
}
}
diff --git a/src/decoder/_flac_common.h b/src/decoder/_flac_common.h
index c1c648a62..37465a216 100644
--- a/src/decoder/_flac_common.h
+++ b/src/decoder/_flac_common.h
@@ -145,7 +145,7 @@ typedef struct {
FLAC__uint64 position;
struct decoder *decoder;
struct input_stream *inStream;
- ReplayGainInfo *replayGainInfo;
+ struct replay_gain_info *replayGainInfo;
struct tag *tag;
} FlacData;
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index ad64b7355..c6421031b 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -368,7 +368,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
fail:
if (data.replayGainInfo)
- freeReplayGainInfo(data.replayGainInfo);
+ replay_gain_info_free(data.replayGainInfo);
if (flacDec)
flac_delete(flacDec);
diff --git a/src/decoder/mp3_plugin.c b/src/decoder/mp3_plugin.c
index cf46ac166..602c9e2f9 100644
--- a/src/decoder/mp3_plugin.c
+++ b/src/decoder/mp3_plugin.c
@@ -204,16 +204,17 @@ mp3_fill_buffer(struct mp3_data *data)
}
#ifdef HAVE_ID3TAG
-static ReplayGainInfo *parse_id3_replay_gain_info(struct id3_tag *tag)
+static struct replay_gain_info *
+parse_id3_replay_gain_info(struct id3_tag *tag)
{
int i;
char *key;
char *value;
struct id3_frame *frame;
bool found = false;
- ReplayGainInfo *replay_gain_info;
+ struct replay_gain_info *replay_gain_info;
- replay_gain_info = newReplayGainInfo();
+ replay_gain_info = replay_gain_info_new();
for (i = 0; (frame = id3_tag_findframe(tag, "TXXX", i)); i++) {
if (frame->nfields < 3)
@@ -227,16 +228,16 @@ static ReplayGainInfo *parse_id3_replay_gain_info(struct id3_tag *tag)
(&frame->fields[2]));
if (strcasecmp(key, "replaygain_track_gain") == 0) {
- replay_gain_info->trackGain = atof(value);
+ replay_gain_info->track_gain = atof(value);
found = true;
} else if (strcasecmp(key, "replaygain_album_gain") == 0) {
- replay_gain_info->albumGain = atof(value);
+ replay_gain_info->album_gain = atof(value);
found = true;
} else if (strcasecmp(key, "replaygain_track_peak") == 0) {
- replay_gain_info->trackPeak = atof(value);
+ replay_gain_info->track_peak = atof(value);
found = true;
} else if (strcasecmp(key, "replaygain_album_peak") == 0) {
- replay_gain_info->albumPeak = atof(value);
+ replay_gain_info->album_peak = atof(value);
found = true;
}
@@ -246,7 +247,7 @@ static ReplayGainInfo *parse_id3_replay_gain_info(struct id3_tag *tag)
if (found)
return replay_gain_info;
- freeReplayGainInfo(replay_gain_info);
+ replay_gain_info_free(replay_gain_info);
return NULL;
}
#endif
@@ -254,7 +255,7 @@ static ReplayGainInfo *parse_id3_replay_gain_info(struct id3_tag *tag)
#ifdef HAVE_ID3TAG
static void mp3_parse_id3(struct mp3_data *data, size_t tagsize,
struct tag **mpd_tag,
- ReplayGainInfo **replay_gain_info_r)
+ struct replay_gain_info **replay_gain_info_r)
{
struct id3_tag *id3_tag = NULL;
id3_length_t count;
@@ -307,10 +308,11 @@ static void mp3_parse_id3(struct mp3_data *data, size_t tagsize,
}
if (replay_gain_info_r) {
- ReplayGainInfo *tmp_rgi = parse_id3_replay_gain_info(id3_tag);
+ struct replay_gain_info *tmp_rgi =
+ parse_id3_replay_gain_info(id3_tag);
if (tmp_rgi != NULL) {
if (*replay_gain_info_r)
- freeReplayGainInfo(*replay_gain_info_r);
+ replay_gain_info_free(*replay_gain_info_r);
*replay_gain_info_r = tmp_rgi;
}
}
@@ -323,7 +325,7 @@ static void mp3_parse_id3(struct mp3_data *data, size_t tagsize,
static enum mp3_action
decode_next_frame_header(struct mp3_data *data, struct tag **tag,
- ReplayGainInfo **replay_gain_info_r)
+ struct replay_gain_info **replay_gain_info_r)
{
enum mad_layer layer;
@@ -698,7 +700,7 @@ mp3_filesize_to_song_length(struct mp3_data *data)
static bool
mp3_decode_first_frame(struct mp3_data *data, struct tag **tag,
- ReplayGainInfo **replay_gain_info_r)
+ struct replay_gain_info **replay_gain_info_r)
{
struct decoder *decoder = data->decoder;
struct xing xing;
@@ -758,9 +760,9 @@ mp3_decode_first_frame(struct mp3_data *data, struct tag **tag,
* parse_lame() for details. -- jat */
if (replay_gain_info_r && !*replay_gain_info_r &&
lame.track_gain) {
- *replay_gain_info_r = newReplayGainInfo();
- (*replay_gain_info_r)->trackGain = lame.track_gain;
- (*replay_gain_info_r)->trackPeak = lame.peak;
+ *replay_gain_info_r = replay_gain_info_new();
+ (*replay_gain_info_r)->track_gain = lame.track_gain;
+ (*replay_gain_info_r)->track_peak = lame.peak;
}
}
}
@@ -813,7 +815,7 @@ static int mp3_total_file_time(const char *file)
static bool
mp3_open(struct input_stream *is, struct mp3_data *data,
struct decoder *decoder, struct tag **tag,
- ReplayGainInfo **replay_gain_info_r)
+ struct replay_gain_info **replay_gain_info_r)
{
mp3_data_init(data, decoder, is);
*tag = NULL;
@@ -877,7 +879,7 @@ mp3_update_timer_next_frame(struct mp3_data *data)
*/
static enum decoder_command
mp3_send_pcm(struct mp3_data *data, unsigned i, unsigned pcm_length,
- ReplayGainInfo *replay_gain_info)
+ struct replay_gain_info *replay_gain_info)
{
unsigned max_samples;
@@ -916,7 +918,8 @@ mp3_send_pcm(struct mp3_data *data, unsigned i, unsigned pcm_length,
* Synthesize the current frame and send it via decoder_data().
*/
static enum decoder_command
-mp3_synth_and_send(struct mp3_data *data, ReplayGainInfo *replay_gain_info)
+mp3_synth_and_send(struct mp3_data *data,
+ struct replay_gain_info *replay_gain_info)
{
unsigned i, pcm_length;
enum decoder_command cmd;
@@ -971,7 +974,7 @@ mp3_synth_and_send(struct mp3_data *data, ReplayGainInfo *replay_gain_info)
}
static bool
-mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
+mp3_read(struct mp3_data *data, struct replay_gain_info **replay_gain_info_r)
{
struct decoder *decoder = data->decoder;
int ret;
@@ -1052,7 +1055,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
{
struct mp3_data data;
struct tag *tag = NULL;
- ReplayGainInfo *replay_gain_info = NULL;
+ struct replay_gain_info *replay_gain_info = NULL;
struct audio_format audio_format;
if (!mp3_open(input_stream, &data, decoder, &tag, &replay_gain_info)) {
@@ -1077,7 +1080,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
while (mp3_read(&data, &replay_gain_info)) ;
if (replay_gain_info)
- freeReplayGainInfo(replay_gain_info);
+ replay_gain_info_free(replay_gain_info);
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK &&
data.mute_frame == MUTEFRAME_SEEK)
diff --git a/src/decoder/mpc_plugin.c b/src/decoder/mpc_plugin.c
index a9917d9f9..6bb1d4f59 100644
--- a/src/decoder/mpc_plugin.c
+++ b/src/decoder/mpc_plugin.c
@@ -120,7 +120,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
mpc_uint32_t vbrUpdateBits;
float total_time;
int i;
- ReplayGainInfo *replayGainInfo = NULL;
+ struct replay_gain_info *replayGainInfo = NULL;
data.inStream = inStream;
data.decoder = mpd_decoder;
@@ -156,11 +156,11 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
audio_format.channels = info.channels;
audio_format.sample_rate = info.sample_freq;
- replayGainInfo = newReplayGainInfo();
- replayGainInfo->albumGain = info.gain_album * 0.01;
- replayGainInfo->albumPeak = info.peak_album / 32767.0;
- replayGainInfo->trackGain = info.gain_title * 0.01;
- replayGainInfo->trackPeak = info.peak_title / 32767.0;
+ replayGainInfo = replay_gain_info_new();
+ replayGainInfo->album_gain = info.gain_album * 0.01;
+ replayGainInfo->album_peak = info.peak_album / 32767.0;
+ replayGainInfo->track_gain = info.gain_title * 0.01;
+ replayGainInfo->track_peak = info.peak_title / 32767.0;
decoder_initialized(mpd_decoder, &audio_format,
inStream->seekable,
@@ -231,7 +231,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
replayGainInfo);
}
- freeReplayGainInfo(replayGainInfo);
+ replay_gain_info_free(replayGainInfo);
return true;
}
diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c
index c117cf3d2..17770a2a7 100644
--- a/src/decoder/oggflac_plugin.c
+++ b/src/decoder/oggflac_plugin.c
@@ -31,7 +31,7 @@ static void oggflac_cleanup(FlacData * data,
OggFLAC__SeekableStreamDecoder * decoder)
{
if (data->replayGainInfo)
- freeReplayGainInfo(data->replayGainInfo);
+ replay_gain_info_free(data->replayGainInfo);
if (decoder)
OggFLAC__seekable_stream_decoder_delete(decoder);
}
diff --git a/src/decoder/oggvorbis_plugin.c b/src/decoder/oggvorbis_plugin.c
index cc6f8f119..d73a5f7f5 100644
--- a/src/decoder/oggvorbis_plugin.c
+++ b/src/decoder/oggvorbis_plugin.c
@@ -93,31 +93,33 @@ static const char *ogg_parseComment(const char *comment, const char *needle)
return NULL;
}
-static void ogg_getReplayGainInfo(char **comments, ReplayGainInfo ** infoPtr)
+static void
+ogg_getReplayGainInfo(char **comments,
+ struct replay_gain_info **infoPtr)
{
const char *temp;
bool found = false;
if (*infoPtr)
- freeReplayGainInfo(*infoPtr);
- *infoPtr = newReplayGainInfo();
+ replay_gain_info_free(*infoPtr);
+ *infoPtr = replay_gain_info_new();
while (*comments) {
if ((temp =
ogg_parseComment(*comments, "replaygain_track_gain"))) {
- (*infoPtr)->trackGain = atof(temp);
+ (*infoPtr)->track_gain = atof(temp);
found = true;
} else if ((temp = ogg_parseComment(*comments,
"replaygain_album_gain"))) {
- (*infoPtr)->albumGain = atof(temp);
+ (*infoPtr)->album_gain = atof(temp);
found = true;
} else if ((temp = ogg_parseComment(*comments,
"replaygain_track_peak"))) {
- (*infoPtr)->trackPeak = atof(temp);
+ (*infoPtr)->track_peak = atof(temp);
found = true;
} else if ((temp = ogg_parseComment(*comments,
"replaygain_album_peak"))) {
- (*infoPtr)->albumPeak = atof(temp);
+ (*infoPtr)->album_peak = atof(temp);
found = true;
}
@@ -125,7 +127,7 @@ static void ogg_getReplayGainInfo(char **comments, ReplayGainInfo ** infoPtr)
}
if (!found) {
- freeReplayGainInfo(*infoPtr);
+ replay_gain_info_free(*infoPtr);
*infoPtr = NULL;
}
}
@@ -209,7 +211,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
int chunkpos = 0;
long bitRate = 0;
long test;
- ReplayGainInfo *replayGainInfo = NULL;
+ struct replay_gain_info *replayGainInfo = NULL;
char **comments;
const char *errorStr;
bool initialized = false;
@@ -324,7 +326,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
}
if (replayGainInfo)
- freeReplayGainInfo(replayGainInfo);
+ replay_gain_info_free(replayGainInfo);
ov_clear(&vf);
return true;
diff --git a/src/decoder/wavpack_plugin.c b/src/decoder/wavpack_plugin.c
index 1dc496648..d76f46974 100644
--- a/src/decoder/wavpack_plugin.c
+++ b/src/decoder/wavpack_plugin.c
@@ -121,7 +121,7 @@ format_samples_float(mpd_unused int bytes_per_sample, void *buffer,
*/
static void
wavpack_decode(struct decoder * decoder, WavpackContext *wpc, bool canseek,
- ReplayGainInfo *replayGainInfo)
+ struct replay_gain_info *replayGainInfo)
{
struct audio_format audio_format;
void (*format_samples)(int bytes_per_sample,
@@ -229,43 +229,43 @@ wavpack_tag(WavpackContext *wpc, char *key)
return value;
}
-static ReplayGainInfo *
+static struct replay_gain_info *
wavpack_replaygain(WavpackContext *wpc)
{
static char replaygain_track_gain[] = "replaygain_track_gain";
static char replaygain_album_gain[] = "replaygain_album_gain";
static char replaygain_track_peak[] = "replaygain_track_peak";
static char replaygain_album_peak[] = "replaygain_album_peak";
- ReplayGainInfo *replay_gain_info;
+ struct replay_gain_info *replay_gain_info;
bool found = false;
char *value;
- replay_gain_info = newReplayGainInfo();
+ replay_gain_info = replay_gain_info_new();
value = wavpack_tag(wpc, replaygain_track_gain);
if (value) {
- replay_gain_info->trackGain = atof(value);
+ replay_gain_info->track_gain = atof(value);
free(value);
found = true;
}
value = wavpack_tag(wpc, replaygain_album_gain);
if (value) {
- replay_gain_info->albumGain = atof(value);
+ replay_gain_info->album_gain = atof(value);
free(value);
found = true;
}
value = wavpack_tag(wpc, replaygain_track_peak);
if (value) {
- replay_gain_info->trackPeak = atof(value);
+ replay_gain_info->track_peak = atof(value);
free(value);
found = true;
}
value = wavpack_tag(wpc, replaygain_album_peak);
if (value) {
- replay_gain_info->albumPeak = atof(value);
+ replay_gain_info->album_peak = atof(value);
free(value);
found = true;
}
@@ -275,7 +275,7 @@ wavpack_replaygain(WavpackContext *wpc)
return replay_gain_info;
}
- freeReplayGainInfo(replay_gain_info);
+ replay_gain_info_free(replay_gain_info);
return NULL;
}
@@ -537,7 +537,7 @@ wavpack_filedecode(struct decoder *decoder, const char *fname)
{
char error[ERRORLEN];
WavpackContext *wpc;
- ReplayGainInfo *replay_gain_info;
+ struct replay_gain_info *replay_gain_info;
wpc = WavpackOpenFileInput(fname, error,
OPEN_TAGS | OPEN_WVC |
@@ -553,7 +553,7 @@ wavpack_filedecode(struct decoder *decoder, const char *fname)
wavpack_decode(decoder, wpc, true, replay_gain_info);
if (replay_gain_info) {
- freeReplayGainInfo(replay_gain_info);
+ replay_gain_info_free(replay_gain_info);
}
WavpackCloseFile(wpc);