[vlc-commits] demux: libmp4: handle btrt atom

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


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct 28 18:52:29 2015 +0100| [7a36207825e77b01936668265fd543b43823c830] | committer: Francois Cartegnie

demux: libmp4: handle btrt atom

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

 modules/demux/mp4/libmp4.c |   15 +++++++++++++++
 modules/demux/mp4/libmp4.h |    9 +++++++++
 2 files changed, 24 insertions(+)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 9286a89..e902ac8 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3325,6 +3325,20 @@ static int MP4_ReadBox_iods( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_READBOX_EXIT( 1 );
 }
 
+static int MP4_ReadBox_btrt( stream_t *p_stream, MP4_Box_t *p_box )
+{
+    MP4_READBOX_ENTER( MP4_Box_data_btrt_t, NULL );
+
+    if(i_read != 12)
+        MP4_READBOX_EXIT( 0 );
+
+    MP4_GET4BYTES( p_box->data.p_btrt->i_buffer_size );
+    MP4_GET4BYTES( p_box->data.p_btrt->i_max_bitrate );
+    MP4_GET4BYTES( p_box->data.p_btrt->i_avg_bitrate );
+
+    MP4_READBOX_EXIT( 1 );
+}
+
 static int MP4_ReadBox_pasp( stream_t *p_stream, MP4_Box_t *p_box )
 {
     MP4_READBOX_ENTER( MP4_Box_data_pasp_t, NULL );
@@ -3731,6 +3745,7 @@ static const struct
     { ATOM_enda,    MP4_ReadBox_enda,         0 },
     { ATOM_iods,    MP4_ReadBox_iods,         0 },
     { ATOM_pasp,    MP4_ReadBox_pasp,         0 },
+    { ATOM_btrt,    MP4_ReadBox_btrt,         0 }, /* codecs bitrate stsd/????/btrt */
     { ATOM_keys,    MP4_ReadBox_keys,         ATOM_meta },
 
     /* Quicktime preview atoms, all at root */
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index b8fbb71..62a6b30 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -132,6 +132,7 @@ typedef int64_t stime_t;
 #define ATOM_mpod VLC_FOURCC( 'm', 'p', 'o', 'd' )
 #define ATOM_hnti VLC_FOURCC( 'h', 'n', 't', 'i' )
 #define ATOM_rtp  VLC_FOURCC( 'r', 't', 'p', ' ' )
+#define ATOM_btrt VLC_FOURCC( 'b', 't', 'r', 't' )
 
 #define ATOM_esds VLC_FOURCC( 'e', 's', 'd', 's' )
 
@@ -1285,6 +1286,13 @@ typedef struct
 
 typedef struct
 {
+    uint32_t i_buffer_size;
+    uint32_t i_max_bitrate;
+    uint32_t i_avg_bitrate;
+} MP4_Box_data_btrt_t;
+
+typedef struct
+{
     uint32_t i_horizontal_spacing;
     uint32_t i_vertical_spacing;
 } MP4_Box_data_pasp_t;
@@ -1443,6 +1451,7 @@ typedef union MP4_Box_data_s
     MP4_Box_data_enda_t *p_enda;
     MP4_Box_data_keys_t *p_keys;
     MP4_Box_data_iods_t *p_iods;
+    MP4_Box_data_btrt_t *p_btrt;
     MP4_Box_data_pasp_t *p_pasp;
     MP4_Box_data_trex_t *p_trex;
     MP4_Box_data_mehd_t *p_mehd;



More information about the vlc-commits mailing list