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

Francois Cartegnie git at videolan.org
Thu Dec 18 22:39:56 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Dec 15 20:29:42 2014 +0100| [a0398a6d80b61da1d493827a77b455f9c9e7f45c] | committer: Francois Cartegnie

demux: libmp4: add tfdt atom

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

 modules/demux/mp4/libmp4.c |   18 ++++++++++++++++++
 modules/demux/mp4/libmp4.h |   10 ++++++++++
 2 files changed, 28 insertions(+)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 60bcdc4..33bf66e 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -872,6 +872,23 @@ static void MP4_FreeBox_trun( MP4_Box_t *p_box )
     FREENULL( p_box->data.p_trun->p_samples );
 }
 
+static int MP4_ReadBox_tfdt( stream_t *p_stream, MP4_Box_t *p_box )
+{
+    MP4_READBOX_ENTER( MP4_Box_data_tfdt_t );
+    if( i_read < 8 )
+        MP4_READBOX_EXIT( 0 );
+
+    MP4_GETVERSIONFLAGS( p_box->data.p_tfdt );
+
+    if( p_box->data.p_tfdt->i_version == 0 )
+        MP4_GET4BYTES( p_box->data.p_tfdt->i_base_media_decode_time );
+    else if( p_box->data.p_tfdt->i_version == 1 )
+        MP4_GET8BYTES( p_box->data.p_tfdt->i_base_media_decode_time );
+    else
+        MP4_READBOX_EXIT( 0 );
+
+    MP4_READBOX_EXIT( 1 );
+}
 
 static int MP4_ReadBox_tkhd(  stream_t *p_stream, MP4_Box_t *p_box )
 {
@@ -3875,6 +3892,7 @@ static const struct
     { ATOM_sidx,    MP4_ReadBox_sidx,         MP4_FreeBox_sidx,    0 },
     { ATOM_tfhd,    MP4_ReadBox_tfhd,         MP4_FreeBox_Common,  ATOM_traf },
     { ATOM_trun,    MP4_ReadBox_trun,         MP4_FreeBox_trun,    ATOM_traf },
+    { ATOM_tfdt,    MP4_ReadBox_tfdt,         MP4_FreeBox_Common,  ATOM_traf },
     { ATOM_trex,    MP4_ReadBox_trex,         MP4_FreeBox_Common,  ATOM_mvex },
     { ATOM_mehd,    MP4_ReadBox_mehd,         MP4_FreeBox_Common,  ATOM_mvex },
     { ATOM_sdtp,    MP4_ReadBox_sdtp,         MP4_FreeBox_sdtp,    0 },
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index b184469..a1b8c4c 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -102,6 +102,7 @@
 #define ATOM_traf VLC_FOURCC( 't', 'r', 'a', 'f' )
 #define ATOM_sidx VLC_FOURCC( 's', 'i', 'd', 'x' )
 #define ATOM_tfhd VLC_FOURCC( 't', 'f', 'h', 'd' )
+#define ATOM_tfdt VLC_FOURCC( 't', 'f', 'd', 't' )
 #define ATOM_trun VLC_FOURCC( 't', 'r', 'u', 'n' )
 #define ATOM_cprt VLC_FOURCC( 'c', 'p', 'r', 't' )
 #define ATOM_iods VLC_FOURCC( 'i', 'o', 'd', 's' )
@@ -1025,6 +1026,14 @@ typedef struct MP4_Box_data_trun_s
 
 } MP4_Box_data_trun_t;
 
+typedef struct MP4_Box_data_tfdt_s
+{
+    uint8_t  i_version;
+    uint32_t i_flags;
+    int64_t  i_base_media_decode_time;
+
+} MP4_Box_data_tfdt_t;
+
 typedef struct
 {
     uint32_t i_date;
@@ -1380,6 +1389,7 @@ typedef union MP4_Box_data_s
     MP4_Box_data_sidx_t *p_sidx;
     MP4_Box_data_tfhd_t *p_tfhd;
     MP4_Box_data_trun_t *p_trun;
+    MP4_Box_data_tfdt_t *p_tfdt;
     MP4_Box_data_tkhd_t *p_tkhd;
     MP4_Box_data_mdhd_t *p_mdhd;
     MP4_Box_data_hdlr_t *p_hdlr;



More information about the vlc-commits mailing list