Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
6d475c40
Commit
6d475c40
authored
Oct 25, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ReplayGainInfo: use CamelCase for struct name
parent
ed7891bf
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
125 additions
and
135 deletions
+125
-135
DecoderAPI.cxx
src/DecoderAPI.cxx
+2
-2
DecoderAPI.hxx
src/DecoderAPI.hxx
+1
-1
DecoderInternal.hxx
src/DecoderInternal.hxx
+1
-1
DecoderThread.cxx
src/DecoderThread.cxx
+2
-2
MusicChunk.hxx
src/MusicChunk.hxx
+1
-1
OutputAll.cxx
src/OutputAll.cxx
+1
-1
OutputAll.hxx
src/OutputAll.hxx
+1
-1
OutputControl.cxx
src/OutputControl.cxx
+2
-1
OutputControl.hxx
src/OutputControl.hxx
+1
-1
ReplayGainConfig.cxx
src/ReplayGainConfig.cxx
+3
-3
ReplayGainConfig.hxx
src/ReplayGainConfig.hxx
+2
-2
ReplayGainInfo.cxx
src/ReplayGainInfo.cxx
+5
-5
ReplayGainInfo.hxx
src/ReplayGainInfo.hxx
+9
-9
FlacCommon.cxx
src/decoder/FlacCommon.cxx
+2
-2
FlacMetadata.cxx
src/decoder/FlacMetadata.cxx
+6
-6
FlacMetadata.hxx
src/decoder/FlacMetadata.hxx
+2
-2
MadDecoderPlugin.cxx
src/decoder/MadDecoderPlugin.cxx
+10
-10
MpcdecDecoderPlugin.cxx
src/decoder/MpcdecDecoderPlugin.cxx
+8
-8
OpusDecoderPlugin.cxx
src/decoder/OpusDecoderPlugin.cxx
+1
-1
OpusTags.cxx
src/decoder/OpusTags.cxx
+2
-2
OpusTags.hxx
src/decoder/OpusTags.hxx
+2
-2
VorbisComments.cxx
src/decoder/VorbisComments.cxx
+6
-6
VorbisComments.hxx
src/decoder/VorbisComments.hxx
+2
-2
VorbisDecoderPlugin.cxx
src/decoder/VorbisDecoderPlugin.cxx
+2
-2
WavpackDecoderPlugin.cxx
src/decoder/WavpackDecoderPlugin.cxx
+14
-22
ReplayGainFilterPlugin.cxx
src/filter/ReplayGainFilterPlugin.cxx
+7
-7
ReplayGainFilterPlugin.hxx
src/filter/ReplayGainFilterPlugin.hxx
+2
-2
ApeReplayGain.cxx
src/tag/ApeReplayGain.cxx
+7
-7
ApeReplayGain.hxx
src/tag/ApeReplayGain.hxx
+2
-2
TagRva2.cxx
src/tag/TagRva2.cxx
+7
-7
TagRva2.hxx
src/tag/TagRva2.hxx
+2
-2
dump_playlist.cxx
test/dump_playlist.cxx
+3
-4
dump_rva2.cxx
test/dump_rva2.cxx
+3
-4
read_tags.cxx
test/read_tags.cxx
+1
-1
run_decoder.cxx
test/run_decoder.cxx
+3
-4
No files found.
src/DecoderAPI.cxx
View file @
6d475c40
...
...
@@ -506,7 +506,7 @@ decoder_tag(Decoder &decoder, InputStream *is,
void
decoder_replay_gain
(
Decoder
&
decoder
,
const
struct
replay_gain_i
nfo
*
replay_gain_info
)
const
ReplayGainI
nfo
*
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_m
ode
rgm
=
replay_gain_mode
;
ReplayGainM
ode
rgm
=
replay_gain_mode
;
if
(
rgm
!=
REPLAY_GAIN_ALBUM
)
rgm
=
REPLAY_GAIN_TRACK
;
...
...
src/DecoderAPI.hxx
View file @
6d475c40
...
...
@@ -174,7 +174,7 @@ decoder_tag(Decoder &decoder, InputStream &is, Tag &&tag)
*/
void
decoder_replay_gain
(
Decoder
&
decoder
,
const
struct
replay_gain_i
nfo
*
replay_gain_info
);
const
ReplayGainI
nfo
*
replay_gain_info
);
/**
* Store MixRamp tags.
...
...
src/DecoderInternal.hxx
View file @
6d475c40
...
...
@@ -75,7 +75,7 @@ struct Decoder {
/** the chunk currently being written to */
struct
music_chunk
*
chunk
;
struct
replay_gain_i
nfo
replay_gain_info
;
ReplayGainI
nfo
replay_gain_info
;
/**
* A positive serial number for checking if replay gain info
...
...
src/DecoderThread.cxx
View file @
6d475c40
...
...
@@ -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_i
nfo
info
;
if
(
replay_gain_ape_read
(
path_fs
,
&
info
))
ReplayGainI
nfo
info
;
if
(
replay_gain_ape_read
(
path_fs
,
info
))
decoder_replay_gain
(
decoder
,
&
info
);
}
...
...
src/MusicChunk.hxx
View file @
6d475c40
...
...
@@ -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_i
nfo
replay_gain_info
;
ReplayGainI
nfo
replay_gain_info
;
/**
* A serial number for checking if replay gain info has
...
...
src/OutputAll.cxx
View file @
6d475c40
...
...
@@ -268,7 +268,7 @@ audio_output_all_update(void)
}
void
audio_output_all_set_replay_gain_mode
(
enum
replay_gain_m
ode
mode
)
audio_output_all_set_replay_gain_mode
(
ReplayGainM
ode
mode
)
{
for
(
unsigned
i
=
0
;
i
<
num_audio_outputs
;
++
i
)
audio_output_set_replay_gain_mode
(
audio_outputs
[
i
],
mode
);
...
...
src/OutputAll.hxx
View file @
6d475c40
...
...
@@ -104,7 +104,7 @@ void
audio_output_all_release
(
void
);
void
audio_output_all_set_replay_gain_mode
(
enum
replay_gain_m
ode
mode
);
audio_output_all_set_replay_gain_mode
(
ReplayGainM
ode
mode
);
/**
* Enqueue a #music_chunk object for playing, i.e. pushes it to a
...
...
src/OutputControl.cxx
View file @
6d475c40
/*
* 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_m
ode
mode
)
ReplayGainM
ode
mode
)
{
if
(
ao
->
replay_gain_filter
!=
nullptr
)
replay_gain_filter_set_mode
(
ao
->
replay_gain_filter
,
mode
);
...
...
src/OutputControl.hxx
View file @
6d475c40
...
...
@@ -32,7 +32,7 @@ struct player_control;
void
audio_output_set_replay_gain_mode
(
struct
audio_output
*
ao
,
enum
replay_gain_m
ode
mode
);
ReplayGainM
ode
mode
);
/**
* Enables the device.
...
...
src/ReplayGainConfig.cxx
View file @
6d475c40
...
...
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <string.h>
enum
replay_gain_m
ode
replay_gain_mode
=
REPLAY_GAIN_OFF
;
ReplayGainM
ode
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_m
ode
ReplayGainM
ode
replay_gain_get_real_mode
(
bool
random_mode
)
{
enum
replay_gain_m
ode
rgm
;
ReplayGainM
ode
rgm
;
rgm
=
replay_gain_mode
;
...
...
src/ReplayGainConfig.hxx
View file @
6d475c40
...
...
@@ -24,7 +24,7 @@
#include "ReplayGainInfo.hxx"
#include "Compiler.h"
extern
enum
replay_gain_m
ode
replay_gain_mode
;
extern
ReplayGainM
ode
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_m
ode
ReplayGainM
ode
replay_gain_get_real_mode
(
bool
random_mode
);
#endif
src/ReplayGainInfo.cxx
View file @
6d475c40
...
...
@@ -21,7 +21,7 @@
#include "ReplayGainInfo.hxx"
float
replay_gain_tuple_scale
(
const
struct
replay_gain_t
uple
*
tuple
,
float
preamp
,
float
missing_preamp
,
bool
peak_limit
)
replay_gain_tuple_scale
(
const
ReplayGainT
uple
*
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
];
}
src/ReplayGainInfo.hxx
View file @
6d475c40
...
...
@@ -24,50 +24,50 @@
#include <cmath>
enum
replay_gain_m
ode
{
enum
ReplayGainM
ode
{
REPLAY_GAIN_AUTO
=
-
2
,
REPLAY_GAIN_OFF
,
REPLAY_GAIN_ALBUM
,
REPLAY_GAIN_TRACK
,
};
struct
replay_gain_t
uple
{
struct
ReplayGainT
uple
{
float
gain
;
float
peak
;
};
struct
replay_gain_i
nfo
{
struct
replay_gain_t
uple
tuples
[
2
];
struct
ReplayGainI
nfo
{
ReplayGainT
uple
tuples
[
2
];
};
static
inline
void
replay_gain_tuple_init
(
struct
replay_gain_t
uple
*
tuple
)
replay_gain_tuple_init
(
ReplayGainT
uple
*
tuple
)
{
tuple
->
gain
=
INFINITY
;
tuple
->
peak
=
0.0
;
}
static
inline
void
replay_gain_info_init
(
struct
replay_gain_i
nfo
*
info
)
replay_gain_info_init
(
struct
ReplayGainI
nfo
*
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_t
uple
*
tuple
)
replay_gain_tuple_defined
(
const
ReplayGainT
uple
*
tuple
)
{
return
!
std
::
isinf
(
tuple
->
gain
);
}
float
replay_gain_tuple_scale
(
const
struct
replay_gain_t
uple
*
tuple
,
float
preamp
,
float
missing_preamp
,
bool
peak_limit
);
replay_gain_tuple_scale
(
const
ReplayGainT
uple
*
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
src/decoder/FlacCommon.cxx
View file @
6d475c40
...
...
@@ -93,7 +93,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
if
(
data
->
unsupported
)
return
;
struct
replay_gain_i
nfo
rgi
;
ReplayGainI
nfo
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
))
...
...
src/decoder/FlacMetadata.cxx
View file @
6d475c40
...
...
@@ -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
;
...
...
src/decoder/FlacMetadata.hxx
View file @
6d475c40
...
...
@@ -110,7 +110,7 @@ public:
struct
tag_handler
;
struct
Tag
;
struct
replay_gain_i
nfo
;
struct
ReplayGainI
nfo
;
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
...
...
src/decoder/MadDecoderPlugin.cxx
View file @
6d475c40
...
...
@@ -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"
))
{
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
atof
(
value
);
r
gi
.
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
atof
(
value
);
found
=
true
;
}
else
if
(
StringEqualsCaseASCII
(
key
,
"replaygain_album_gain"
))
{
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
atof
(
value
);
r
gi
.
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
atof
(
value
);
found
=
true
;
}
else
if
(
StringEqualsCaseASCII
(
key
,
"replaygain_track_peak"
))
{
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_TRACK
].
peak
=
atof
(
value
);
r
gi
.
tuples
[
REPLAY_GAIN_TRACK
].
peak
=
atof
(
value
);
found
=
true
;
}
else
if
(
StringEqualsCaseASCII
(
key
,
"replaygain_album_peak"
))
{
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_ALBUM
].
peak
=
atof
(
value
);
r
gi
.
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
,
r
eplay_gain_info
);
tag_rva2_parse
(
tag
,
r
gi
);
}
#endif
...
...
@@ -392,11 +392,11 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
}
if
(
decoder
!=
nullptr
)
{
struct
replay_gain_i
nfo
rgi
;
ReplayGainI
nfo
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_i
nfo
rgi
;
ReplayGainI
nfo
rgi
;
replay_gain_info_init
(
&
rgi
);
rgi
.
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
lame
.
track_gain
;
rgi
.
tuples
[
REPLAY_GAIN_TRACK
].
peak
=
lame
.
peak
;
...
...
src/decoder/MpcdecDecoderPlugin.cxx
View file @
6d475c40
...
...
@@ -168,14 +168,14 @@ mpcdec_decode(Decoder &mpd_decoder, InputStream &is)
return
;
}
struct
replay_gain_info
replay_gain_info
;
replay_gain_info_init
(
&
r
eplay_gain_info
);
r
eplay_gain_info
.
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
MPC_OLD_GAIN_REF
-
(
info
.
gain_album
/
256.
);
r
eplay_gain_info
.
tuples
[
REPLAY_GAIN_ALBUM
].
peak
=
pow
(
10
,
info
.
peak_album
/
256.
/
20
)
/
32767
;
r
eplay_gain_info
.
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
MPC_OLD_GAIN_REF
-
(
info
.
gain_title
/
256.
);
r
eplay_gain_info
.
tuples
[
REPLAY_GAIN_TRACK
].
peak
=
pow
(
10
,
info
.
peak_title
/
256.
/
20
)
/
32767
;
decoder_replay_gain
(
mpd_decoder
,
&
r
eplay_gain_info
);
ReplayGainInfo
rgi
;
replay_gain_info_init
(
&
r
gi
);
r
gi
.
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
MPC_OLD_GAIN_REF
-
(
info
.
gain_album
/
256.
);
r
gi
.
tuples
[
REPLAY_GAIN_ALBUM
].
peak
=
pow
(
10
,
info
.
peak_album
/
256.
/
20
)
/
32767
;
r
gi
.
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
MPC_OLD_GAIN_REF
-
(
info
.
gain_title
/
256.
);
r
gi
.
tuples
[
REPLAY_GAIN_TRACK
].
peak
=
pow
(
10
,
info
.
peak_title
/
256.
/
20
)
/
32767
;
decoder_replay_gain
(
mpd_decoder
,
&
r
gi
);
decoder_initialized
(
mpd_decoder
,
audio_format
,
is
.
IsSeekable
(),
...
...
src/decoder/OpusDecoderPlugin.cxx
View file @
6d475c40
...
...
@@ -282,7 +282,7 @@ MPDOpusDecoder::HandleBOS(const ogg_packet &packet)
inline
DecoderCommand
MPDOpusDecoder
::
HandleTags
(
const
ogg_packet
&
packet
)
{
replay_gain_i
nfo
rgi
;
ReplayGainI
nfo
rgi
;
replay_gain_info_init
(
&
rgi
);
TagBuilder
tag_builder
;
...
...
src/decoder/OpusTags.cxx
View file @
6d475c40
...
...
@@ -42,7 +42,7 @@ ParseOpusTagName(const char *name)
static
void
ScanOneOpusTag
(
const
char
*
name
,
const
char
*
value
,
replay_gain_i
nfo
*
rgi
,
ReplayGainI
nfo
*
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_i
nfo
*
rgi
,
ReplayGainI
nfo
*
rgi
,
const
struct
tag_handler
*
handler
,
void
*
ctx
)
{
OpusReader
r
(
data
,
size
);
...
...
src/decoder/OpusTags.hxx
View file @
6d475c40
...
...
@@ -24,11 +24,11 @@
#include <stddef.h>
struct
replay_gain_i
nfo
;
struct
ReplayGainI
nfo
;
bool
ScanOpusTags
(
const
void
*
data
,
size_t
size
,
replay_gain_i
nfo
*
rgi
,
ReplayGainI
nfo
*
rgi
,
const
struct
tag_handler
*
handler
,
void
*
ctx
);
#endif
src/decoder/VorbisComments.cxx
View file @
6d475c40
...
...
@@ -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
;
}
...
...
src/decoder/VorbisComments.hxx
View file @
6d475c40
...
...
@@ -22,12 +22,12 @@
#include "check.h"
struct
replay_gain_i
nfo
;
struct
ReplayGainI
nfo
;
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
,
...
...
src/decoder/VorbisDecoderPlugin.cxx
View file @
6d475c40
...
...
@@ -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_i
nfo
rgi
;
if
(
vorbis_comments_to_replay_gain
(
&
rgi
,
comments
))
ReplayGainI
nfo
rgi
;
if
(
vorbis_comments_to_replay_gain
(
rgi
,
comments
))
decoder_replay_gain
(
decoder
,
&
rgi
);
prev_section
=
current_section
;
...
...
src/decoder/WavpackDecoderPlugin.cxx
View file @
6d475c40
...
...
@@ -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
,
&
r
eplay_gain_info
);
ReplayGainInfo
rgi
;
if
(
wavpack_replaygain
(
rgi
,
wpc
))
decoder_replay_gain
(
decoder
,
&
r
gi
);
wavpack_decode
(
decoder
,
wpc
,
true
);
...
...
src/filter/ReplayGainFilterPlugin.cxx
View file @
6d475c40
...
...
@@ -50,9 +50,9 @@ class ReplayGainFilter final : public Filter {
*/
unsigned
base
;
enum
replay_gain_m
ode
mode
;
ReplayGainM
ode
mode
;
struct
replay_gain_i
nfo
info
;
ReplayGainI
nfo
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_i
nfo
*
_info
)
{
void
SetInfo
(
const
ReplayGainI
nfo
*
_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_m
ode
_mode
)
{
void
SetMode
(
ReplayGainM
ode
_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_i
nfo
*
info
)
replay_gain_filter_set_info
(
Filter
*
_filter
,
const
ReplayGainI
nfo
*
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_m
ode
mode
)
replay_gain_filter_set_mode
(
Filter
*
_filter
,
ReplayGainM
ode
mode
)
{
ReplayGainFilter
*
filter
=
(
ReplayGainFilter
*
)
_filter
;
...
...
src/filter/ReplayGainFilterPlugin.hxx
View file @
6d475c40
...
...
@@ -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_i
nfo
*
info
);
replay_gain_filter_set_info
(
Filter
*
filter
,
const
ReplayGainI
nfo
*
info
);
void
replay_gain_filter_set_mode
(
Filter
*
filter
,
enum
replay_gain_m
ode
mode
);
replay_gain_filter_set_mode
(
Filter
*
filter
,
ReplayGainM
ode
mode
);
#endif
src/tag/ApeReplayGain.cxx
View file @
6d475c40
...
...
@@ -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
)
{
...
...
src/tag/ApeReplayGain.hxx
View file @
6d475c40
...
...
@@ -22,9 +22,9 @@
#include "check.h"
struct
replay_gain_i
nfo
;
struct
ReplayGainI
nfo
;
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
src/tag/TagRva2.cxx
View file @
6d475c40
...
...
@@ -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
)
{
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
volume_adjustment
;
r
gi
.
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
volume_adjustment
;
}
else
if
(
strcmp
((
const
char
*
)
id
,
"track"
)
==
0
)
{
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
volume_adjustment
;
r
gi
.
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
volume_adjustment
;
}
else
{
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
volume_adjustment
;
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_TRACK
].
gain
=
volume_adjustment
;
r
gi
.
tuples
[
REPLAY_GAIN_ALBUM
].
gain
=
volume_adjustment
;
r
gi
.
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
;
...
...
src/tag/TagRva2.hxx
View file @
6d475c40
...
...
@@ -23,7 +23,7 @@
#include "check.h"
struct
id3_tag
;
struct
replay_gain_i
nfo
;
struct
ReplayGainI
nfo
;
/**
* 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
test/dump_playlist.cxx
View file @
6d475c40
...
...
@@ -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
=
&
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_TRACK
];
tuple
=
&
r
gi
->
tuples
[
REPLAY_GAIN_TRACK
];
if
(
replay_gain_tuple_defined
(
tuple
))
g_printerr
(
"replay_gain[track]: gain=%f peak=%f
\n
"
,
tuple
->
gain
,
tuple
->
peak
);
...
...
test/dump_rva2.cxx
View file @
6d475c40
...
...
@@ -66,10 +66,10 @@ int main(int argc, char **argv)
return
EXIT_FAILURE
;
}
struct
replay_gain_i
nfo
replay_gain
;
ReplayGainI
nfo
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
);
...
...
test/read_tags.cxx
View file @
6d475c40
...
...
@@ -105,7 +105,7 @@ decoder_tag(gcc_unused Decoder &decoder,
void
decoder_replay_gain
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
const
struct
replay_gain_i
nfo
*
replay_gain_info
)
gcc_unused
const
ReplayGainI
nfo
*
replay_gain_info
)
{
}
...
...
test/run_decoder.cxx
View file @
6d475c40
...
...
@@ -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
=
&
r
eplay_gain_info
->
tuples
[
REPLAY_GAIN_TRACK
];
tuple
=
&
r
gi
->
tuples
[
REPLAY_GAIN_TRACK
];
if
(
replay_gain_tuple_defined
(
tuple
))
g_printerr
(
"replay_gain[track]: gain=%f peak=%f
\n
"
,
tuple
->
gain
,
tuple
->
peak
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment