aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder')
-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
12 files changed, 57 insertions, 65 deletions
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);