[vlc-commits] aout: fix replaygain
Francois Cartegnie
git at videolan.org
Tue May 30 11:39:31 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 26 21:03:25 2017 +0200| [4737b00ecc4cd5be0b3aecc896a8a3a3a5851e0b] | committer: Francois Cartegnie
aout: fix replaygain
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4737b00ecc4cd5be0b3aecc896a8a3a3a5851e0b
---
src/input/decoder.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 01645cf04e..c06e958e96 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -285,6 +285,20 @@ static vout_thread_t *aout_request_vout( void *p_private,
return p_vout;
}
+static bool aout_replaygain_changed( const audio_replay_gain_t *a,
+ const audio_replay_gain_t *b )
+{
+ for( size_t i=0; i<AUDIO_REPLAY_GAIN_MAX; i++ )
+ {
+ if( a->pb_gain[i] != b->pb_gain[i] ||
+ a->pb_peak[i] != b->pb_peak[i] ||
+ a->pb_gain[i] != b->pb_gain[i] ||
+ a->pb_peak[i] != b->pb_peak[i] )
+ return true;
+ }
+ return false;
+}
+
static int aout_update_format( decoder_t *p_dec )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
@@ -304,6 +318,18 @@ static int aout_update_format( decoder_t *p_dec )
input_resource_PutAout( p_owner->p_resource, p_aout );
}
+ /* Check if only replay gain has changed */
+ if( aout_replaygain_changed( &p_dec->fmt_in.audio_replay_gain,
+ &p_owner->fmt.audio_replay_gain ) )
+ {
+ p_dec->fmt_out.audio_replay_gain = p_dec->fmt_in.audio_replay_gain;
+ if( p_owner->p_aout )
+ {
+ p_owner->fmt.audio_replay_gain = p_dec->fmt_in.audio_replay_gain;
+ var_TriggerCallback( p_owner->p_aout, "audio-replay-gain-mode" );
+ }
+ }
+
if( p_owner->p_aout == NULL )
{
p_dec->fmt_out.audio.i_format = p_dec->fmt_out.i_codec;
More information about the vlc-commits
mailing list