[vlc-commits] demux: mp4: set bitrate

Francois Cartegnie git at videolan.org
Wed Oct 28 18:54:34 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct 28 18:51:57 2015 +0100| [157f892928afa63c006965d7f7414f92bb5f885a] | committer: Francois Cartegnie

demux: mp4: set bitrate

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

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

diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index 8db8b9a..0ae48a8 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -30,6 +30,18 @@
 #include <vlc_aout.h>
 #include <assert.h>
 
+static void SetupGlobalExtensions( mp4_track_t *p_track, MP4_Box_t *p_sample )
+{
+    if( !p_track->fmt.i_bitrate )
+    {
+        const MP4_Box_t *p_btrt = MP4_BoxGet( p_sample, "btrt" );
+        if( p_btrt && BOXDATA(p_btrt) )
+        {
+            p_track->fmt.i_bitrate = BOXDATA(p_btrt)->i_avg_bitrate;
+        }
+    }
+}
+
 static void SetupESDS( demux_t *p_demux, mp4_track_t *p_track, const MP4_descriptor_decoder_config_t *p_decconfig )
 {
     /* First update information based on i_objectTypeIndication */
@@ -229,6 +241,8 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
         p_track->i_block_flags = BOXDATA(p_fiel)->i_flags;
     }
 
+    SetupGlobalExtensions( p_track, p_sample );
+
     /* now see if esds is present and if so create a data packet
         with decoder_specific_info  */
     MP4_Box_t *p_esds = MP4_BoxGet( p_sample, "esds" );
@@ -689,6 +703,8 @@ int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
 
     }
 
+    SetupGlobalExtensions( p_track, p_sample );
+
     /* now see if esds is present and if so create a data packet
         with decoder_specific_info  */
     MP4_Box_t *p_esds = MP4_BoxGet( p_sample, "esds" );
@@ -837,6 +853,8 @@ int SetupSpuES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
             break;
     }
 
+    SetupGlobalExtensions( p_track, p_sample );
+
     /* now see if esds is present and if so create a data packet
         with decoder_specific_info  */
     MP4_Box_t *p_esds = MP4_BoxGet( p_sample, "esds" );



More information about the vlc-commits mailing list