[vlc-commits] demux: libmp4: add tsel atom

Francois Cartegnie git at videolan.org
Sat Oct 18 00:42:39 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct 17 21:53:10 2014 +0200| [7a3abe039e62fe7446902e56a9ac672b36e1d158] | committer: Francois Cartegnie

demux: libmp4: add tsel atom

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

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

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 53f4a32..3ace93e 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3276,6 +3276,18 @@ static void MP4_FreeBox_sdtp( MP4_Box_t *p_box )
     FREENULL( p_box->data.p_sdtp->p_sample_table );
 }
 
+static int MP4_ReadBox_tsel( stream_t *p_stream, MP4_Box_t *p_box )
+{
+    MP4_READBOX_ENTER( MP4_Box_data_tsel_t );
+    uint32_t i_version;
+    MP4_GET4BYTES( i_version );
+    if ( i_version != 0 || i_read < 4 )
+        MP4_READBOX_EXIT( 0 );
+    MP4_GET4BYTES( p_box->data.p_tsel->i_switch_group );
+    /* ignore list of attributes as es are present before switch */
+    MP4_READBOX_EXIT( 1 );
+}
+
 static int MP4_ReadBox_mfro( stream_t *p_stream, MP4_Box_t *p_box )
 {
     MP4_READBOX_ENTER( MP4_Box_data_mfro_t );
@@ -3779,6 +3791,9 @@ static const struct
     { ATOM_vndr,    MP4_ReadBox_String,       MP4_FreeBox_String,  ATOM_udta },
     { ATOM_SDLN,    MP4_ReadBox_String,       MP4_FreeBox_String,  ATOM_udta },
 
+    /* udta, non meta */
+    { ATOM_tsel,    MP4_ReadBox_tsel,         MP4_FreeBox_Common,  ATOM_udta },
+
     /* iTunes/Quicktime meta info */
     { ATOM_meta,    MP4_ReadBox_meta,         MP4_FreeBox_Common,  0 },
     { ATOM_data,    MP4_ReadBox_data,         MP4_FreeBox_data,    0 },
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 6abfc29..f1c5d70 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -300,6 +300,7 @@
 #define ATOM_covr VLC_FOURCC( 'c', 'o', 'v', 'r' )
 #define ATOM_flvr VLC_FOURCC( 'f', 'l', 'v', 'r' )
 #define ATOM_rtng VLC_FOURCC( 'r', 't', 'n', 'g' )
+#define ATOM_tsel VLC_FOURCC( 't', 's', 'e', 'l' )
 #define ATOM_xid_ VLC_FOURCC( 'x', 'i', 'd', ' ' )
 
 #define ATOM_chap VLC_FOURCC( 'c', 'h', 'a', 'p' )
@@ -1266,6 +1267,11 @@ typedef struct
 
 typedef struct
 {
+    uint32_t i_switch_group;
+} MP4_Box_data_tsel_t;
+
+typedef struct
+{
     uint8_t  i_version;
     uint32_t i_flags;
 
@@ -1393,6 +1399,7 @@ typedef union MP4_Box_data_s
     MP4_Box_data_trex_t *p_trex;
     MP4_Box_data_mehd_t *p_mehd;
     MP4_Box_data_sdtp_t *p_sdtp;
+    MP4_Box_data_tsel_t *p_tsel;
 
     MP4_Box_data_tfra_t *p_tfra;
     MP4_Box_data_mfro_t *p_mfro;



More information about the vlc-commits mailing list