Commit 6d475c40 authored by Max Kellermann's avatar Max Kellermann

ReplayGainInfo: use CamelCase for struct name

parent ed7891bf
......@@ -506,7 +506,7 @@ decoder_tag(Decoder &decoder, InputStream *is,
void
decoder_replay_gain(Decoder &decoder,
const struct replay_gain_info *replay_gain_info)
const ReplayGainInfo *replay_gain_info)
{
if (replay_gain_info != nullptr) {
static unsigned serial;
......@@ -514,7 +514,7 @@ decoder_replay_gain(Decoder &decoder,
serial = 1;
if (REPLAY_GAIN_OFF != replay_gain_mode) {
enum replay_gain_mode rgm = replay_gain_mode;
ReplayGainMode rgm = replay_gain_mode;
if (rgm != REPLAY_GAIN_ALBUM)
rgm = REPLAY_GAIN_TRACK;
......
......@@ -174,7 +174,7 @@ decoder_tag(Decoder &decoder, InputStream &is, Tag &&tag)
*/
void
decoder_replay_gain(Decoder &decoder,
const struct replay_gain_info *replay_gain_info);
const ReplayGainInfo *replay_gain_info);
/**
* Store MixRamp tags.
......
......@@ -75,7 +75,7 @@ struct Decoder {
/** the chunk currently being written to */
struct music_chunk *chunk;
struct replay_gain_info replay_gain_info;
ReplayGainInfo replay_gain_info;
/**
* A positive serial number for checking if replay gain info
......
......@@ -274,8 +274,8 @@ decoder_run_stream(Decoder &decoder, const char *uri)
static void
decoder_load_replay_gain(Decoder &decoder, const char *path_fs)
{
struct replay_gain_info info;
if (replay_gain_ape_read(path_fs, &info))
ReplayGainInfo info;
if (replay_gain_ape_read(path_fs, info))
decoder_replay_gain(decoder, &info);
}
......
......@@ -75,7 +75,7 @@ struct music_chunk {
* Replay gain information associated with this chunk.
* Only valid if the serial is not 0.
*/
struct replay_gain_info replay_gain_info;
ReplayGainInfo replay_gain_info;
/**
* A serial number for checking if replay gain info has
......
......@@ -268,7 +268,7 @@ audio_output_all_update(void)
}
void
audio_output_all_set_replay_gain_mode(enum replay_gain_mode mode)
audio_output_all_set_replay_gain_mode(ReplayGainMode mode)
{
for (unsigned i = 0; i < num_audio_outputs; ++i)
audio_output_set_replay_gain_mode(audio_outputs[i], mode);
......
......@@ -104,7 +104,7 @@ void
audio_output_all_release(void);
void
audio_output_all_set_replay_gain_mode(enum replay_gain_mode mode);
audio_output_all_set_replay_gain_mode(ReplayGainMode mode);
/**
* Enqueue a #music_chunk object for playing, i.e. pushes it to a
......
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
......@@ -96,7 +97,7 @@ ao_lock_command(struct audio_output *ao, enum audio_output_command cmd)
void
audio_output_set_replay_gain_mode(struct audio_output *ao,
enum replay_gain_mode mode)
ReplayGainMode mode)
{
if (ao->replay_gain_filter != nullptr)
replay_gain_filter_set_mode(ao->replay_gain_filter, mode);
......
......@@ -32,7 +32,7 @@ struct player_control;
void
audio_output_set_replay_gain_mode(struct audio_output *ao,
enum replay_gain_mode mode);
ReplayGainMode mode);
/**
* Enables the device.
......
......@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
enum replay_gain_mode replay_gain_mode = REPLAY_GAIN_OFF;
ReplayGainMode replay_gain_mode = REPLAY_GAIN_OFF;
static constexpr bool DEFAULT_REPLAYGAIN_LIMIT = true;
......@@ -134,10 +134,10 @@ void replay_gain_global_init(void)
replay_gain_limit = config_get_bool(CONF_REPLAYGAIN_LIMIT, DEFAULT_REPLAYGAIN_LIMIT);
}
enum replay_gain_mode
ReplayGainMode
replay_gain_get_real_mode(bool random_mode)
{
enum replay_gain_mode rgm;
ReplayGainMode rgm;
rgm = replay_gain_mode;
......
......@@ -24,7 +24,7 @@
#include "ReplayGainInfo.hxx"
#include "Compiler.h"
extern enum replay_gain_mode replay_gain_mode;
extern ReplayGainMode replay_gain_mode;
extern float replay_gain_preamp;
extern float replay_gain_missing_preamp;
extern bool replay_gain_limit;
......@@ -50,7 +50,7 @@ replay_gain_set_mode_string(const char *p);
* Returns the "real" mode according to the "auto" setting"
*/
gcc_pure
enum replay_gain_mode
ReplayGainMode
replay_gain_get_real_mode(bool random_mode);
#endif
......@@ -21,7 +21,7 @@
#include "ReplayGainInfo.hxx"
float
replay_gain_tuple_scale(const struct replay_gain_tuple *tuple, float preamp, float missing_preamp, bool peak_limit)
replay_gain_tuple_scale(const ReplayGainTuple *tuple, float preamp, float missing_preamp, bool peak_limit)
{
float scale;
......@@ -40,9 +40,9 @@ replay_gain_tuple_scale(const struct replay_gain_tuple *tuple, float preamp, flo
}
void
replay_gain_info_complete(struct replay_gain_info *info)
replay_gain_info_complete(ReplayGainInfo &info)
{
if (!replay_gain_tuple_defined(&info->tuples[REPLAY_GAIN_ALBUM]))
info->tuples[REPLAY_GAIN_ALBUM] =
info->tuples[REPLAY_GAIN_TRACK];
if (!replay_gain_tuple_defined(&info.tuples[REPLAY_GAIN_ALBUM]))
info.tuples[REPLAY_GAIN_ALBUM] =
info.tuples[REPLAY_GAIN_TRACK];
}
......@@ -24,50 +24,50 @@
#include <cmath>
enum replay_gain_mode {
enum ReplayGainMode {
REPLAY_GAIN_AUTO = -2,
REPLAY_GAIN_OFF,
REPLAY_GAIN_ALBUM,
REPLAY_GAIN_TRACK,
};
struct replay_gain_tuple {
struct ReplayGainTuple {
float gain;
float peak;
};
struct replay_gain_info {
struct replay_gain_tuple tuples[2];
struct ReplayGainInfo {
ReplayGainTuple tuples[2];
};
static inline void
replay_gain_tuple_init(struct replay_gain_tuple *tuple)
replay_gain_tuple_init(ReplayGainTuple *tuple)
{
tuple->gain = INFINITY;
tuple->peak = 0.0;
}
static inline void
replay_gain_info_init(struct replay_gain_info *info)
replay_gain_info_init(struct ReplayGainInfo *info)
{
replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_ALBUM]);
replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_TRACK]);
}
static inline bool
replay_gain_tuple_defined(const struct replay_gain_tuple *tuple)
replay_gain_tuple_defined(const ReplayGainTuple *tuple)
{
return !std::isinf(tuple->gain);
}
float
replay_gain_tuple_scale(const struct replay_gain_tuple *tuple, float preamp, float missing_preamp, bool peak_limit);
replay_gain_tuple_scale(const ReplayGainTuple *tuple, float preamp, float missing_preamp, bool peak_limit);
/**
* Attempt to auto-complete missing data. In particular, if album
* information is missing, track gain is used.
*/
void
replay_gain_info_complete(struct replay_gain_info *info);
replay_gain_info_complete(ReplayGainInfo &info);
#endif
......@@ -93,7 +93,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
if (data->unsupported)
return;
struct replay_gain_info rgi;
ReplayGainInfo rgi;
char *mixramp_start;
char *mixramp_end;
......@@ -103,7 +103,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
break;
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
if (flac_parse_replay_gain(&rgi, block))
if (flac_parse_replay_gain(rgi, block))
decoder_replay_gain(data->decoder, &rgi);
if (flac_parse_mixramp(&mixramp_start, &mixramp_end, block))
......
......@@ -61,24 +61,24 @@ flac_find_float_comment(const FLAC__StreamMetadata *block,
}
bool
flac_parse_replay_gain(struct replay_gain_info *rgi,
flac_parse_replay_gain(ReplayGainInfo &rgi,
const FLAC__StreamMetadata *block)
{
bool found = false;
replay_gain_info_init(rgi);
replay_gain_info_init(&rgi);
if (flac_find_float_comment(block, "replaygain_album_gain",
&rgi->tuples[REPLAY_GAIN_ALBUM].gain))
&rgi.tuples[REPLAY_GAIN_ALBUM].gain))
found = true;
if (flac_find_float_comment(block, "replaygain_album_peak",
&rgi->tuples[REPLAY_GAIN_ALBUM].peak))
&rgi.tuples[REPLAY_GAIN_ALBUM].peak))
found = true;
if (flac_find_float_comment(block, "replaygain_track_gain",
&rgi->tuples[REPLAY_GAIN_TRACK].gain))
&rgi.tuples[REPLAY_GAIN_TRACK].gain))
found = true;
if (flac_find_float_comment(block, "replaygain_track_peak",
&rgi->tuples[REPLAY_GAIN_TRACK].peak))
&rgi.tuples[REPLAY_GAIN_TRACK].peak))
found = true;
return found;
......
......@@ -110,7 +110,7 @@ public:
struct tag_handler;
struct Tag;
struct replay_gain_info;
struct ReplayGainInfo;
static inline unsigned
flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info)
......@@ -122,7 +122,7 @@ flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info)
}
bool
flac_parse_replay_gain(struct replay_gain_info *rgi,
flac_parse_replay_gain(ReplayGainInfo &rgi,
const FLAC__StreamMetadata *block);
bool
......
......@@ -251,7 +251,7 @@ MadDecoder::FillBuffer()
#ifdef HAVE_ID3TAG
static bool
parse_id3_replay_gain_info(struct replay_gain_info *replay_gain_info,
parse_id3_replay_gain_info(ReplayGainInfo &rgi,
struct id3_tag *tag)
{
int i;
......@@ -260,7 +260,7 @@ parse_id3_replay_gain_info(struct replay_gain_info *replay_gain_info,
struct id3_frame *frame;
bool found = false;
replay_gain_info_init(replay_gain_info);
replay_gain_info_init(&rgi);
for (i = 0; (frame = id3_tag_findframe(tag, "TXXX", i)); i++) {
if (frame->nfields < 3)
......@@ -274,16 +274,16 @@ parse_id3_replay_gain_info(struct replay_gain_info *replay_gain_info,
(&frame->fields[2]));
if (StringEqualsCaseASCII(key, "replaygain_track_gain")) {
replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = atof(value);
rgi.tuples[REPLAY_GAIN_TRACK].gain = atof(value);
found = true;
} else if (StringEqualsCaseASCII(key, "replaygain_album_gain")) {
replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = atof(value);
rgi.tuples[REPLAY_GAIN_ALBUM].gain = atof(value);
found = true;
} else if (StringEqualsCaseASCII(key, "replaygain_track_peak")) {
replay_gain_info->tuples[REPLAY_GAIN_TRACK].peak = atof(value);
rgi.tuples[REPLAY_GAIN_TRACK].peak = atof(value);
found = true;
} else if (StringEqualsCaseASCII(key, "replaygain_album_peak")) {
replay_gain_info->tuples[REPLAY_GAIN_ALBUM].peak = atof(value);
rgi.tuples[REPLAY_GAIN_ALBUM].peak = atof(value);
found = true;
}
......@@ -293,7 +293,7 @@ parse_id3_replay_gain_info(struct replay_gain_info *replay_gain_info,
return found ||
/* fall back on RVA2 if no replaygain tags found */
tag_rva2_parse(tag, replay_gain_info);
tag_rva2_parse(tag, rgi);
}
#endif
......@@ -392,11 +392,11 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
}
if (decoder != nullptr) {
struct replay_gain_info rgi;
ReplayGainInfo rgi;
char *mixramp_start;
char *mixramp_end;
if (parse_id3_replay_gain_info(&rgi, id3_tag)) {
if (parse_id3_replay_gain_info(rgi, id3_tag)) {
decoder_replay_gain(*decoder, &rgi);
found_replay_gain = true;
}
......@@ -871,7 +871,7 @@ MadDecoder::DecodeFirstFrame(Tag **tag)
* parse_lame() for details. -- jat */
if (decoder != nullptr && !found_replay_gain &&
lame.track_gain) {
struct replay_gain_info rgi;
ReplayGainInfo rgi;
replay_gain_info_init(&rgi);
rgi.tuples[REPLAY_GAIN_TRACK].gain = lame.track_gain;
rgi.tuples[REPLAY_GAIN_TRACK].peak = lame.peak;
......
......@@ -168,14 +168,14 @@ mpcdec_decode(Decoder &mpd_decoder, InputStream &is)
return;
}
struct replay_gain_info replay_gain_info;
replay_gain_info_init(&replay_gain_info);
replay_gain_info.tuples[REPLAY_GAIN_ALBUM].gain = MPC_OLD_GAIN_REF - (info.gain_album / 256.);
replay_gain_info.tuples[REPLAY_GAIN_ALBUM].peak = pow(10, info.peak_album / 256. / 20) / 32767;
replay_gain_info.tuples[REPLAY_GAIN_TRACK].gain = MPC_OLD_GAIN_REF - (info.gain_title / 256.);
replay_gain_info.tuples[REPLAY_GAIN_TRACK].peak = pow(10, info.peak_title / 256. / 20) / 32767;
decoder_replay_gain(mpd_decoder, &replay_gain_info);
ReplayGainInfo rgi;
replay_gain_info_init(&rgi);
rgi.tuples[REPLAY_GAIN_ALBUM].gain = MPC_OLD_GAIN_REF - (info.gain_album / 256.);
rgi.tuples[REPLAY_GAIN_ALBUM].peak = pow(10, info.peak_album / 256. / 20) / 32767;
rgi.tuples[REPLAY_GAIN_TRACK].gain = MPC_OLD_GAIN_REF - (info.gain_title / 256.);
rgi.tuples[REPLAY_GAIN_TRACK].peak = pow(10, info.peak_title / 256. / 20) / 32767;
decoder_replay_gain(mpd_decoder, &rgi);
decoder_initialized(mpd_decoder, audio_format,
is.IsSeekable(),
......
......@@ -282,7 +282,7 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet)
inline DecoderCommand
MPDOpusDecoder::HandleTags(const ogg_packet &packet)
{
replay_gain_info rgi;
ReplayGainInfo rgi;
replay_gain_info_init(&rgi);
TagBuilder tag_builder;
......
......@@ -42,7 +42,7 @@ ParseOpusTagName(const char *name)
static void
ScanOneOpusTag(const char *name, const char *value,
replay_gain_info *rgi,
ReplayGainInfo *rgi,
const struct tag_handler *handler, void *ctx)
{
if (rgi != nullptr && strcmp(name, "R128_TRACK_GAIN") == 0) {
......@@ -66,7 +66,7 @@ ScanOneOpusTag(const char *name, const char *value,
bool
ScanOpusTags(const void *data, size_t size,
replay_gain_info *rgi,
ReplayGainInfo *rgi,
const struct tag_handler *handler, void *ctx)
{
OpusReader r(data, size);
......
......@@ -24,11 +24,11 @@
#include <stddef.h>
struct replay_gain_info;
struct ReplayGainInfo;
bool
ScanOpusTags(const void *data, size_t size,
replay_gain_info *rgi,
ReplayGainInfo *rgi,
const struct tag_handler *handler, void *ctx);
#endif
......@@ -47,29 +47,29 @@ vorbis_comment_value(const char *comment, const char *needle)
}
bool
vorbis_comments_to_replay_gain(struct replay_gain_info *rgi, char **comments)
vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments)
{
const char *temp;
bool found = false;
replay_gain_info_init(rgi);
replay_gain_info_init(&rgi);
while (*comments) {
if ((temp =
vorbis_comment_value(*comments, "replaygain_track_gain"))) {
rgi->tuples[REPLAY_GAIN_TRACK].gain = atof(temp);
rgi.tuples[REPLAY_GAIN_TRACK].gain = atof(temp);
found = true;
} else if ((temp = vorbis_comment_value(*comments,
"replaygain_album_gain"))) {
rgi->tuples[REPLAY_GAIN_ALBUM].gain = atof(temp);
rgi.tuples[REPLAY_GAIN_ALBUM].gain = atof(temp);
found = true;
} else if ((temp = vorbis_comment_value(*comments,
"replaygain_track_peak"))) {
rgi->tuples[REPLAY_GAIN_TRACK].peak = atof(temp);
rgi.tuples[REPLAY_GAIN_TRACK].peak = atof(temp);
found = true;
} else if ((temp = vorbis_comment_value(*comments,
"replaygain_album_peak"))) {
rgi->tuples[REPLAY_GAIN_ALBUM].peak = atof(temp);
rgi.tuples[REPLAY_GAIN_ALBUM].peak = atof(temp);
found = true;
}
......
......@@ -22,12 +22,12 @@
#include "check.h"
struct replay_gain_info;
struct ReplayGainInfo;
struct tag_handler;
struct Tag;
bool
vorbis_comments_to_replay_gain(struct replay_gain_info *rgi, char **comments);
vorbis_comments_to_replay_gain(ReplayGainInfo &rgi, char **comments);
void
vorbis_comments_scan(char **comments,
......
......@@ -283,8 +283,8 @@ vorbis_stream_decode(Decoder &decoder,
char **comments = ov_comment(&vf, -1)->user_comments;
vorbis_send_comments(decoder, input_stream, comments);
struct replay_gain_info rgi;
if (vorbis_comments_to_replay_gain(&rgi, comments))
ReplayGainInfo rgi;
if (vorbis_comments_to_replay_gain(rgi, comments))
decoder_replay_gain(decoder, &rgi);
prev_section = current_section;
......
......@@ -221,29 +221,21 @@ wavpack_tag_float(WavpackContext *wpc, const char *key, float *value_r)
}
static bool
wavpack_replaygain(struct replay_gain_info *replay_gain_info,
wavpack_replaygain(ReplayGainInfo &rgi,
WavpackContext *wpc)
{
bool found = false;
replay_gain_info_init(replay_gain_info);
found |= wavpack_tag_float(
wpc, "replaygain_track_gain",
&replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain
);
found |= wavpack_tag_float(
wpc, "replaygain_track_peak",
&replay_gain_info->tuples[REPLAY_GAIN_TRACK].peak
);
found |= wavpack_tag_float(
wpc, "replaygain_album_gain",
&replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain
);
found |= wavpack_tag_float(
wpc, "replaygain_album_peak",
&replay_gain_info->tuples[REPLAY_GAIN_ALBUM].peak
);
replay_gain_info_init(&rgi);
found |= wavpack_tag_float(wpc, "replaygain_track_gain",
&rgi.tuples[REPLAY_GAIN_TRACK].gain);
found |= wavpack_tag_float(wpc, "replaygain_track_peak",
&rgi.tuples[REPLAY_GAIN_TRACK].peak);
found |= wavpack_tag_float(wpc, "replaygain_album_gain",
&rgi.tuples[REPLAY_GAIN_ALBUM].gain);
found |= wavpack_tag_float(wpc, "replaygain_album_peak",
&rgi.tuples[REPLAY_GAIN_ALBUM].peak);
return found;
}
......@@ -547,9 +539,9 @@ wavpack_filedecode(Decoder &decoder, const char *fname)
return;
}
struct replay_gain_info replay_gain_info;
if (wavpack_replaygain(&replay_gain_info, wpc))
decoder_replay_gain(decoder, &replay_gain_info);
ReplayGainInfo rgi;
if (wavpack_replaygain(rgi, wpc))
decoder_replay_gain(decoder, &rgi);
wavpack_decode(decoder, wpc, true);
......
......@@ -50,9 +50,9 @@ class ReplayGainFilter final : public Filter {
*/
unsigned base;
enum replay_gain_mode mode;
ReplayGainMode mode;
struct replay_gain_info info;
ReplayGainInfo info;
/**
* The current volume, between 0 and a value that may or may not exceed
......@@ -88,17 +88,17 @@ public:
Update();
}
void SetInfo(const struct replay_gain_info *_info) {
void SetInfo(const ReplayGainInfo *_info) {
if (_info != NULL) {
info = *_info;
replay_gain_info_complete(&info);
replay_gain_info_complete(info);
} else
replay_gain_info_init(&info);
Update();
}
void SetMode(enum replay_gain_mode _mode) {
void SetMode(ReplayGainMode _mode) {
if (_mode == mode)
/* no change */
return;
......@@ -217,7 +217,7 @@ replay_gain_filter_set_mixer(Filter *_filter, Mixer *mixer,
}
void
replay_gain_filter_set_info(Filter *_filter, const replay_gain_info *info)
replay_gain_filter_set_info(Filter *_filter, const ReplayGainInfo *info)
{
ReplayGainFilter *filter = (ReplayGainFilter *)_filter;
......@@ -225,7 +225,7 @@ replay_gain_filter_set_info(Filter *_filter, const replay_gain_info *info)
}
void
replay_gain_filter_set_mode(Filter *_filter, enum replay_gain_mode mode)
replay_gain_filter_set_mode(Filter *_filter, ReplayGainMode mode)
{
ReplayGainFilter *filter = (ReplayGainFilter *)_filter;
......
......@@ -44,9 +44,9 @@ replay_gain_filter_set_mixer(Filter *_filter, Mixer *mixer,
* gain data is available for the current song
*/
void
replay_gain_filter_set_info(Filter *filter, const replay_gain_info *info);
replay_gain_filter_set_info(Filter *filter, const ReplayGainInfo *info);
void
replay_gain_filter_set_mode(Filter *filter, enum replay_gain_mode mode);
replay_gain_filter_set_mode(Filter *filter, ReplayGainMode mode);
#endif
......@@ -29,7 +29,7 @@
static bool
replay_gain_ape_callback(unsigned long flags, const char *key,
const char *_value, size_t value_length,
struct replay_gain_info *info)
ReplayGainInfo &info)
{
/* we only care about utf-8 text tags */
if ((flags & (0x3 << 1)) != 0)
......@@ -43,27 +43,27 @@ replay_gain_ape_callback(unsigned long flags, const char *key,
value[value_length] = 0;
if (StringEqualsCaseASCII(key, "replaygain_track_gain")) {
info->tuples[REPLAY_GAIN_TRACK].gain = atof(value);
info.tuples[REPLAY_GAIN_TRACK].gain = atof(value);
return true;
} else if (StringEqualsCaseASCII(key, "replaygain_album_gain")) {
info->tuples[REPLAY_GAIN_ALBUM].gain = atof(value);
info.tuples[REPLAY_GAIN_ALBUM].gain = atof(value);
return true;
} else if (StringEqualsCaseASCII(key, "replaygain_track_peak")) {
info->tuples[REPLAY_GAIN_TRACK].peak = atof(value);
info.tuples[REPLAY_GAIN_TRACK].peak = atof(value);
return true;
} else if (StringEqualsCaseASCII(key, "replaygain_album_peak")) {
info->tuples[REPLAY_GAIN_ALBUM].peak = atof(value);
info.tuples[REPLAY_GAIN_ALBUM].peak = atof(value);
return true;
} else
return false;
}
bool
replay_gain_ape_read(const char *path_fs, struct replay_gain_info *info)
replay_gain_ape_read(const char *path_fs, ReplayGainInfo &info)
{
bool found = false;
auto callback = [info, &found]
auto callback = [&info, &found]
(unsigned long flags, const char *key,
const char *value,
size_t value_length) {
......
......@@ -22,9 +22,9 @@
#include "check.h"
struct replay_gain_info;
struct ReplayGainInfo;
bool
replay_gain_ape_read(const char *path_fs, struct replay_gain_info *info);
replay_gain_ape_read(const char *path_fs, ReplayGainInfo &info);
#endif
......@@ -73,7 +73,7 @@ rva2_float_volume_adjustment(const struct rva2_data *data)
}
static inline bool
rva2_apply_data(struct replay_gain_info *replay_gain_info,
rva2_apply_data(ReplayGainInfo &rgi,
const struct rva2_data *data, const id3_latin1_t *id)
{
if (data->type != CHANNEL_MASTER_VOLUME)
......@@ -82,19 +82,19 @@ rva2_apply_data(struct replay_gain_info *replay_gain_info,
float volume_adjustment = rva2_float_volume_adjustment(data);
if (strcmp((const char *)id, "album") == 0) {
replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = volume_adjustment;
rgi.tuples[REPLAY_GAIN_ALBUM].gain = volume_adjustment;
} else if (strcmp((const char *)id, "track") == 0) {
replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = volume_adjustment;
rgi.tuples[REPLAY_GAIN_TRACK].gain = volume_adjustment;
} else {
replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = volume_adjustment;
replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = volume_adjustment;
rgi.tuples[REPLAY_GAIN_ALBUM].gain = volume_adjustment;
rgi.tuples[REPLAY_GAIN_TRACK].gain = volume_adjustment;
}
return true;
}
static bool
rva2_apply_frame(struct replay_gain_info *replay_gain_info,
rva2_apply_frame(ReplayGainInfo &replay_gain_info,
const struct id3_frame *frame)
{
const id3_latin1_t *id = id3_field_getlatin1(id3_frame_field(frame, 0));
......@@ -133,7 +133,7 @@ rva2_apply_frame(struct replay_gain_info *replay_gain_info,
}
bool
tag_rva2_parse(struct id3_tag *tag, struct replay_gain_info *replay_gain_info)
tag_rva2_parse(struct id3_tag *tag, ReplayGainInfo &replay_gain_info)
{
bool found = false;
......
......@@ -23,7 +23,7 @@
#include "check.h"
struct id3_tag;
struct replay_gain_info;
struct ReplayGainInfo;
/**
* Parse the RVA2 tag, and fill the #replay_gain_info struct. This is
......@@ -32,6 +32,6 @@ struct replay_gain_info;
* @return true on success
*/
bool
tag_rva2_parse(struct id3_tag *tag, struct replay_gain_info *replay_gain_info);
tag_rva2_parse(struct id3_tag *tag, ReplayGainInfo &replay_gain_info);
#endif
......@@ -117,15 +117,14 @@ decoder_tag(gcc_unused Decoder &decoder,
void
decoder_replay_gain(gcc_unused Decoder &decoder,
const struct replay_gain_info *replay_gain_info)
const ReplayGainInfo *rgi)
{
const struct replay_gain_tuple *tuple =
&replay_gain_info->tuples[REPLAY_GAIN_ALBUM];
const ReplayGainTuple *tuple = &rgi->tuples[REPLAY_GAIN_ALBUM];
if (replay_gain_tuple_defined(tuple))
g_printerr("replay_gain[album]: gain=%f peak=%f\n",
tuple->gain, tuple->peak);
tuple = &replay_gain_info->tuples[REPLAY_GAIN_TRACK];
tuple = &rgi->tuples[REPLAY_GAIN_TRACK];
if (replay_gain_tuple_defined(tuple))
g_printerr("replay_gain[track]: gain=%f peak=%f\n",
tuple->gain, tuple->peak);
......
......@@ -66,10 +66,10 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
struct replay_gain_info replay_gain;
ReplayGainInfo replay_gain;
replay_gain_info_init(&replay_gain);
bool success = tag_rva2_parse(tag, &replay_gain);
bool success = tag_rva2_parse(tag, replay_gain);
id3_tag_delete(tag);
if (!success) {
......@@ -77,8 +77,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
const struct replay_gain_tuple *tuple =
&replay_gain.tuples[REPLAY_GAIN_ALBUM];
const ReplayGainTuple *tuple = &replay_gain.tuples[REPLAY_GAIN_ALBUM];
if (replay_gain_tuple_defined(tuple))
g_printerr("replay_gain[album]: gain=%f peak=%f\n",
tuple->gain, tuple->peak);
......
......@@ -105,7 +105,7 @@ decoder_tag(gcc_unused Decoder &decoder,
void
decoder_replay_gain(gcc_unused Decoder &decoder,
gcc_unused const struct replay_gain_info *replay_gain_info)
gcc_unused const ReplayGainInfo *replay_gain_info)
{
}
......
......@@ -127,15 +127,14 @@ decoder_tag(gcc_unused Decoder &decoder,
void
decoder_replay_gain(gcc_unused Decoder &decoder,
const struct replay_gain_info *replay_gain_info)
const ReplayGainInfo *rgi)
{
const struct replay_gain_tuple *tuple =
&replay_gain_info->tuples[REPLAY_GAIN_ALBUM];
const ReplayGainTuple *tuple = &rgi->tuples[REPLAY_GAIN_ALBUM];
if (replay_gain_tuple_defined(tuple))
g_printerr("replay_gain[album]: gain=%f peak=%f\n",
tuple->gain, tuple->peak);
tuple = &replay_gain_info->tuples[REPLAY_GAIN_TRACK];
tuple = &rgi->tuples[REPLAY_GAIN_TRACK];
if (replay_gain_tuple_defined(tuple))
g_printerr("replay_gain[track]: gain=%f peak=%f\n",
tuple->gain, tuple->peak);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment