[vlc-commits] demux: libmp4: add quicktime pnot movie preview atoms

Francois Cartegnie git at videolan.org
Mon Oct 20 00:26:22 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Oct 19 18:44:11 2014 +0200| [1714b8ead2e6f14f94d25be86c608d845c830a0f] | committer: Francois Cartegnie

demux: libmp4: add quicktime pnot movie preview atoms

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

 modules/demux/mp4/libmp4.c |   19 +++++++++++++++++++
 modules/demux/mp4/libmp4.h |   13 +++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 802a348..0b9b205 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3429,6 +3429,20 @@ static void MP4_FreeBox_tfra( MP4_Box_t *p_box )
     FREENULL( p_box->data.p_tfra->p_sample_number );
 }
 
+static int MP4_ReadBox_pnot( stream_t *p_stream, MP4_Box_t *p_box )
+{
+    if ( p_box->i_size != 20 )
+        return 0;
+    MP4_READBOX_ENTER( MP4_Box_data_pnot_t );
+    MP4_GET4BYTES( p_box->data.p_pnot->i_date );
+    uint16_t i_version;
+    MP4_GET2BYTES( i_version );
+    if ( i_version != 0 )
+        MP4_READBOX_EXIT( 0 );
+    MP4_GETFOURCC( p_box->data.p_pnot->i_type );
+    MP4_GET2BYTES( p_box->data.p_pnot->i_index );
+    MP4_READBOX_EXIT( 1 );
+}
 
 /* For generic */
 static int MP4_ReadBox_default( stream_t *p_stream, MP4_Box_t *p_box )
@@ -3567,6 +3581,11 @@ static const struct
     { ATOM_pasp,    MP4_ReadBox_pasp,         MP4_FreeBox_Common, 0 },
     { ATOM_keys,    MP4_ReadBox_keys,         MP4_FreeBox_keys,   ATOM_meta },
 
+    /* Quicktime preview atoms, all at root */
+    { ATOM_pnot,    MP4_ReadBox_pnot,         MP4_FreeBox_Common, 0 },
+    { ATOM_pict,    MP4_ReadBox_Binary,       MP4_FreeBox_Binary, 0 },
+    { ATOM_PICT,    MP4_ReadBox_Binary,       MP4_FreeBox_Binary, 0 },
+
     /* Nothing to do with this box */
     { ATOM_mdat,    MP4_ReadBoxSkip,          MP4_FreeBox_Common, 0 },
     { ATOM_skip,    MP4_ReadBoxSkip,          MP4_FreeBox_Common, 0 },
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index efd3774..347dbfe 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -54,6 +54,11 @@
 #define ATOM_wide VLC_FOURCC( 'w', 'i', 'd', 'e' )
 #define ATOM_binm VLC_FOURCC( 0x82, 0x82, 0x7f, 0x7d ) /* binary Computer Graphics Metafile */
 
+/* Quicktime preview */
+#define ATOM_pnot VLC_FOURCC( 'p', 'n', 'o', 't' )
+#define ATOM_pict VLC_FOURCC( 'p', 'i', 'c', 't' )
+#define ATOM_PICT VLC_FOURCC( 'P', 'I', 'C', 'T' )
+
 #define ATOM_data VLC_FOURCC( 'd', 'a', 't', 'a' )
 
 #define ATOM_trak VLC_FOURCC( 't', 'r', 'a', 'k' )
@@ -1022,6 +1027,13 @@ typedef struct MP4_Box_data_trun_s
 
 typedef struct
 {
+    uint32_t i_date;
+    uint32_t i_type;
+    uint16_t i_index;
+} MP4_Box_data_pnot_t;
+
+typedef struct
+{
     char *psz_text;
 
 } MP4_Box_data_string_t;
@@ -1429,6 +1441,7 @@ typedef union MP4_Box_data_s
     MP4_Box_data_rmqu_t *p_rmqu;
     MP4_Box_data_rmvc_t *p_rmvc;
 
+    MP4_Box_data_pnot_t *p_pnot;
     MP4_Box_data_chpl_t *p_chpl;
     MP4_Box_data_tref_generic_t *p_tref_generic;
 



More information about the vlc-commits mailing list