[vlc-commits] demux: mp4: set replay gain

Francois Cartegnie git at videolan.org
Mon May 29 17:14:34 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon May 29 16:31:32 2017 +0200| [8f288cf14942a0d48de39c70ab9919ff5e0bd165] | committer: Francois Cartegnie

demux: mp4: set replay gain

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8f288cf14942a0d48de39c70ab9919ff5e0bd165
---

 modules/demux/mp4/mp4.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index d943ee6167..c8b087cf6c 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2837,6 +2837,24 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
     case AUDIO_ES:
         if ( !SetupAudioES( p_demux, p_track, p_sample ) )
             return VLC_EGENERIC;
+        if( p_sys->p_meta )
+        {
+            audio_replay_gain_t *p_arg = &p_track->fmt.audio_replay_gain;
+            const char *psz_meta = vlc_meta_GetExtra( p_sys->p_meta, "replaygain_track_gain" );
+            if( psz_meta )
+            {
+                double f_gain = us_atof( psz_meta );
+                p_arg->pf_gain[AUDIO_REPLAY_GAIN_TRACK] = f_gain;
+                p_arg->pb_gain[AUDIO_REPLAY_GAIN_TRACK] = f_gain != 0;
+            }
+            psz_meta = vlc_meta_GetExtra( p_sys->p_meta, "replaygain_track_peak" );
+            if( psz_meta )
+            {
+                double f_gain = us_atof( psz_meta );
+                p_arg->pf_peak[AUDIO_REPLAY_GAIN_TRACK] = f_gain;
+                p_arg->pb_peak[AUDIO_REPLAY_GAIN_TRACK] = f_gain > 0;
+            }
+        }
         break;
 
     case SPU_ES:



More information about the vlc-commits mailing list