File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ ver 0.25 (not yet released)
77 - vgmstream: new plugin
88* output
99 - pipewire: add option "reconnect_stream"
10+ * player
11+ - support replay gain parameter in stream URI
1012* switch to C++23
1113* require Meson 1.2
1214
Original file line number Diff line number Diff line change @@ -678,6 +678,14 @@ prevents `Bit-perfect playback`_). To use a hardware mixer, set
678678``replay_gain_handler `` to ``mixer `` in the ``audio_output `` section
679679(see :ref: `config_audio_output ` for details).
680680
681+ The ``gain `` URL fragment can be used to apply ReplayGain tags to
682+ Internet radios, which helps to normalize volume across different
683+ radios, e.g.::
684+
685+ mpc add 'http://radio.example.com/stream#gain=-3.5'
686+
687+ This will set "track" and "album" ReplayGain tags for the stream to -3.5 dB.
688+
681689Simple Volume Normalization
682690^^^^^^^^^^^^^^^^^^^^^^^^^^^
683691
Original file line number Diff line number Diff line change 2121#include " util/Domain.hxx"
2222#include " util/ScopeExit.hxx"
2323#include " util/StringCompare.hxx"
24+ #include " util/UriQueryParser.hxx"
2425#include " thread/Name.hxx"
2526#include " tag/ApeReplayGain.hxx"
27+ #include " tag/ReplayGainParser.hxx"
2628#include " Log.hxx"
2729
2830#include < stdexcept>
@@ -277,6 +279,19 @@ LoadReplayGain(DecoderClient &client, InputStream &is)
277279 ReplayGainInfo info;
278280 if (replay_gain_ape_read (is, info))
279281 client.SubmitReplayGain (&info);
282+
283+ const char *fragment = uri_get_fragment (is.GetURI ());
284+ if (fragment != nullptr ) {
285+ const auto gain = UriFindRawQueryParameter (fragment, " gain" );
286+ if (gain.data () != nullptr ) {
287+ if (ParseReplayGainTag (info, " replaygain_track_gain" ,
288+ std::string (gain).c_str ())) {
289+ info.album .gain = info.track .gain ;
290+ info.album .peak = info.track .peak = 0.0 ;
291+ client.SubmitReplayGain (&info);
292+ }
293+ }
294+ }
280295}
281296
282297/* *
You can’t perform that action at this time.
0 commit comments