aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DecoderAPI.cxx4
-rw-r--r--src/DecoderAPI.hxx2
-rw-r--r--src/DecoderInternal.hxx2
-rw-r--r--src/DecoderThread.cxx4
-rw-r--r--src/MusicChunk.hxx2
-rw-r--r--src/OutputAll.cxx2
-rw-r--r--src/OutputAll.hxx2
-rw-r--r--src/OutputControl.cxx3
-rw-r--r--src/OutputControl.hxx2
-rw-r--r--src/ReplayGainConfig.cxx6
-rw-r--r--src/ReplayGainConfig.hxx4
-rw-r--r--src/ReplayGainInfo.cxx10
-rw-r--r--src/ReplayGainInfo.hxx18
-rw-r--r--src/decoder/FlacCommon.cxx4
-rw-r--r--src/decoder/FlacMetadata.cxx12
-rw-r--r--src/decoder/FlacMetadata.hxx4
-rw-r--r--src/decoder/MadDecoderPlugin.cxx20
-rw-r--r--src/decoder/MpcdecDecoderPlugin.cxx16
-rw-r--r--src/decoder/OpusDecoderPlugin.cxx2
-rw-r--r--src/decoder/OpusTags.cxx4
-rw-r--r--src/decoder/OpusTags.hxx4
-rw-r--r--src/decoder/VorbisComments.cxx12
-rw-r--r--src/decoder/VorbisComments.hxx4
-rw-r--r--src/decoder/VorbisDecoderPlugin.cxx4
-rw-r--r--src/decoder/WavpackDecoderPlugin.cxx36
-rw-r--r--src/filter/ReplayGainFilterPlugin.cxx14
-rw-r--r--src/filter/ReplayGainFilterPlugin.hxx4
-rw-r--r--src/tag/ApeReplayGain.cxx14
-rw-r--r--src/tag/ApeReplayGain.hxx4
-rw-r--r--src/tag/TagRva2.cxx14
-rw-r--r--src/tag/TagRva2.hxx4
31 files changed, 115 insertions, 122 deletions
diff --git a/src/DecoderAPI.cxx b/src/DecoderAPI.cxx
index 546aec033..4866c4bb8 100644
--- a/src/DecoderAPI.cxx
+++ b/src/DecoderAPI.cxx
@@ -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;
diff --git a/src/DecoderAPI.hxx b/src/DecoderAPI.hxx
index b2cc7756b..0f9dabb4b 100644
--- a/src/DecoderAPI.hxx
+++ b/src/DecoderAPI.hxx
@@ -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.
diff --git a/src/DecoderInternal.hxx b/src/DecoderInternal.hxx
index 07c682f19..6c93a8b23 100644
--- a/src/DecoderInternal.hxx
+++ b/src/DecoderInternal.hxx
@@ -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
diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx
index 513fdb663..7de6bf0d3 100644
--- a/src/DecoderThread.cxx
+++ b/src/DecoderThread.cxx
@@ -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);
}
diff --git a/src/MusicChunk.hxx b/src/MusicChunk.hxx
index a9b4c3cfd..a829c26f1 100644
--- a/src/MusicChunk.hxx
+++ b/src/MusicChunk.hxx
@@ -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
diff --git a/src/OutputAll.cxx b/src/OutputAll.cxx
index 15662f034..57bc486ce 100644
--- a/src/OutputAll.cxx
+++ b/src/OutputAll.cxx
@@ -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);
diff --git a/src/OutputAll.hxx b/src/OutputAll.hxx
index e1bba68ed..55b7a9617 100644
--- a/src/OutputAll.hxx
+++ b/src/OutputAll.hxx
@@ -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
diff --git a/src/OutputControl.cxx b/src/OutputControl.cxx
index 829bddeae..648705908 100644
--- a/src/OutputControl.cxx
+++ b/src/OutputControl.cxx
@@ -1,3 +1,4 @@
+
/*
* 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);
diff --git a/src/OutputControl.hxx b/src/OutputControl.hxx
index 25fbec1e7..416b07c39 100644
--- a/src/OutputControl.hxx
+++ b/src/OutputControl.hxx
@@ -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.
diff --git a/src/ReplayGainConfig.cxx b/src/ReplayGainConfig.cxx
index ec54dd3e7..36c2ff545 100644
--- a/src/ReplayGainConfig.cxx
+++ b/src/ReplayGainConfig.cxx
@@ -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;
diff --git a/src/ReplayGainConfig.hxx b/src/ReplayGainConfig.hxx
index 79f1b23f0..7777a859b 100644
--- a/src/ReplayGainConfig.hxx
+++ b/src/ReplayGainConfig.hxx
@@ -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
diff --git a/src/ReplayGainInfo.cxx b/src/ReplayGainInfo.cxx
index ac1c13822..6ad9d269e 100644
--- a/src/ReplayGainInfo.cxx
+++ b/src/ReplayGainInfo.cxx
@@ -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];
}
diff --git a/src/ReplayGainInfo.hxx b/src/ReplayGainInfo.hxx
index bfc5f68a7..2b2d3d3db 100644
--- a/src/ReplayGainInfo.hxx
+++ b/src/ReplayGainInfo.hxx
@@ -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
diff --git a/src/decoder/FlacCommon.cxx b/src/decoder/FlacCommon.cxx
index 2aa4ce695..2b2db8066 100644
--- a/src/decoder/FlacCommon.cxx
+++ b/src/decoder/FlacCommon.cxx
@@ -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))
diff --git a/src/decoder/FlacMetadata.cxx b/src/decoder/FlacMetadata.cxx
index 3e01563bb..783394982 100644
--- a/src/decoder/FlacMetadata.cxx
+++ b/src/decoder/FlacMetadata.cxx
@@ -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;
diff --git a/src/decoder/FlacMetadata.hxx b/src/decoder/FlacMetadata.hxx
index 2b4acad06..8b050b2f8 100644
--- a/src/decoder/FlacMetadata.hxx
+++ b/src/decoder/FlacMetadata.hxx
@@ -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
diff --git a/src/decoder/MadDecoderPlugin.cxx b/src/decoder/MadDecoderPlugin.cxx
index b59bde8b4..085497504 100644
--- a/src/decoder/MadDecoderPlugin.cxx
+++ b/src/decoder/MadDecoderPlugin.cxx
@@ -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;
diff --git a/src/decoder/MpcdecDecoderPlugin.cxx b/src/decoder/MpcdecDecoderPlugin.cxx
index feb2caeb4..654feaaf1 100644
--- a/src/decoder/MpcdecDecoderPlugin.cxx
+++ b/src/decoder/MpcdecDecoderPlugin.cxx
@@ -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(),
diff --git a/src/decoder/OpusDecoderPlugin.cxx b/src/decoder/OpusDecoderPlugin.cxx
index a8f0703fb..c50f98a5b 100644
--- a/src/decoder/OpusDecoderPlugin.cxx
+++ b/src/decoder/OpusDecoderPlugin.cxx
@@ -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;
diff --git a/src/decoder/OpusTags.cxx b/src/decoder/OpusTags.cxx
index e0319ad48..f7729e5ad 100644
--- a/src/decoder/OpusTags.cxx
+++ b/src/decoder/OpusTags.cxx
@@ -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);
diff --git a/src/decoder/OpusTags.hxx b/src/decoder/OpusTags.hxx
index cec99effb..eca209a8b 100644
--- a/src/decoder/OpusTags.hxx
+++ b/src/decoder/OpusTags.hxx
@@ -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
diff --git a/src/decoder/VorbisComments.cxx b/src/decoder/VorbisComments.cxx
index 44648884a..9830e733e 100644
--- a/src/decoder/VorbisComments.cxx
+++ b/src/decoder/VorbisComments.cxx
@@ -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;
}
diff --git a/src/decoder/VorbisComments.hxx b/src/decoder/VorbisComments.hxx
index 7a8374785..e5a48ef6b 100644
--- a/src/decoder/VorbisComments.hxx
+++ b/src/decoder/VorbisComments.hxx
@@ -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,
diff --git a/src/decoder/VorbisDecoderPlugin.cxx b/src/decoder/VorbisDecoderPlugin.cxx
index 8705d875f..8e59afe3b 100644
--- a/src/decoder/VorbisDecoderPlugin.cxx
+++ b/src/decoder/VorbisDecoderPlugin.cxx
@@ -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;
diff --git a/src/decoder/WavpackDecoderPlugin.cxx b/src/decoder/WavpackDecoderPlugin.cxx
index 2275e5a91..62934713f 100644
--- a/src/decoder/WavpackDecoderPlugin.cxx
+++ b/src/decoder/WavpackDecoderPlugin.cxx
@@ -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);
diff --git a/src/filter/ReplayGainFilterPlugin.cxx b/src/filter/ReplayGainFilterPlugin.cxx
index 5ac9840b1..5fb59b741 100644
--- a/src/filter/ReplayGainFilterPlugin.cxx
+++ b/src/filter/ReplayGainFilterPlugin.cxx
@@ -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;
diff --git a/src/filter/ReplayGainFilterPlugin.hxx b/src/filter/ReplayGainFilterPlugin.hxx
index 89cbe6c96..74bec22d1 100644
--- a/src/filter/ReplayGainFilterPlugin.hxx
+++ b/src/filter/ReplayGainFilterPlugin.hxx
@@ -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
diff --git a/src/tag/ApeReplayGain.cxx b/src/tag/ApeReplayGain.cxx
index 15526d2d9..12919690e 100644
--- a/src/tag/ApeReplayGain.cxx
+++ b/src/tag/ApeReplayGain.cxx
@@ -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) {
diff --git a/src/tag/ApeReplayGain.hxx b/src/tag/ApeReplayGain.hxx
index 4bc34a9d2..f40523550 100644
--- a/src/tag/ApeReplayGain.hxx
+++ b/src/tag/ApeReplayGain.hxx
@@ -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
diff --git a/src/tag/TagRva2.cxx b/src/tag/TagRva2.cxx
index 071e3a443..204001aa7 100644
--- a/src/tag/TagRva2.cxx
+++ b/src/tag/TagRva2.cxx
@@ -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;
diff --git a/src/tag/TagRva2.hxx b/src/tag/TagRva2.hxx
index 016a3585d..98154041a 100644
--- a/src/tag/TagRva2.hxx
+++ b/src/tag/TagRva2.hxx
@@ -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