[vlc-commits] demux: libmp4: read heif ispe

Francois Cartegnie git at videolan.org
Tue Mar 13 19:09:35 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Mar  9 12:50:33 2018 +0100| [d0aad165d44000995fe1eaf1acc2c7ee37273f05] | committer: Francois Cartegnie

demux: libmp4: read heif ispe

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

 modules/demux/mp4/libmp4.c | 23 +++++++++++++++++++++++
 modules/demux/mp4/libmp4.h | 14 ++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 9820f022b6..73618c1cfc 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -4495,6 +4495,24 @@ static int MP4_ReadBox_pitm( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_READBOX_EXIT( 1 );
 }
 
+static int MP4_ReadBox_ispe( stream_t *p_stream, MP4_Box_t *p_box )
+{
+    MP4_READBOX_ENTER( MP4_Box_data_ispe_t, NULL );
+    MP4_Box_data_ispe_t *p_data = p_box->data.p_ispe;
+
+    uint8_t i_version;
+    uint32_t i_flags;
+    MP4_GET1BYTE( i_version );
+    MP4_GET3BYTES( i_flags ); VLC_UNUSED(i_flags);
+    if( i_version > 0 )
+        MP4_READBOX_EXIT( 0 );
+
+    MP4_GET4BYTES( p_data->i_width );
+    MP4_GET4BYTES( p_data->i_height );
+
+    MP4_READBOX_EXIT( 1 );
+}
+
 /* For generic */
 static int MP4_ReadBox_default( stream_t *p_stream, MP4_Box_t *p_box )
 {
@@ -4979,6 +4997,11 @@ static const struct
     { ATOM_infe,    MP4_ReadBox_infe,        ATOM_iinf },
     { ATOM_pitm,    MP4_ReadBox_pitm,        ATOM_meta },
 
+    /* HEIF specific meta references */
+    { ATOM_iprp,    MP4_ReadBoxContainer,    ATOM_meta },
+    { ATOM_ipco,    MP4_ReadBoxContainer,    ATOM_iprp },
+    { ATOM_ispe,    MP4_ReadBox_ispe,        ATOM_ipco },
+
     /* Last entry */
     { 0,              MP4_ReadBox_default,   0 }
 };
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 9a37cdb1ec..33993f6c6c 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -401,6 +401,10 @@ typedef int64_t stime_t;
 #define ATOM_iinf VLC_FOURCC('i','i','n','f')
 #define ATOM_infe VLC_FOURCC('i','n','f','e')
 #define ATOM_pitm VLC_FOURCC('p','i','t','m')
+/* HEIF specific meta */
+#define ATOM_iprp VLC_FOURCC('i','p','r','p')
+#define ATOM_ipco VLC_FOURCC('i','p','c','o')
+#define ATOM_ispe VLC_FOURCC('i','s','p','e')
 
 #define HANDLER_mdta VLC_FOURCC('m', 'd', 't', 'a')
 #define HANDLER_mdir VLC_FOURCC('m', 'd', 'i', 'r')
@@ -408,6 +412,9 @@ typedef int64_t stime_t;
 
 #define SAMPLEGROUP_rap  VLC_FOURCC('r', 'a', 'p', ' ')
 
+/* HEIF Specific */
+#define HANDLER_pict VLC_FOURCC('p', 'i', 'c', 't')
+
 /* Do you want some debug information on all read boxes ? */
 #ifndef NDEBUG
 # define MP4_VERBOSE  1
@@ -1672,6 +1679,12 @@ typedef struct
     uint32_t i_item_id;
 } MP4_Box_data_pitm_t;
 
+typedef struct
+{
+    uint32_t i_width;
+    uint32_t i_height;
+} MP4_Box_data_ispe_t;
+
 /*
 typedef struct MP4_Box_data__s
 {
@@ -1790,6 +1803,7 @@ typedef union MP4_Box_data_s
     MP4_Box_data_iinf_t *p_iinf;
     MP4_Box_data_infe_t *p_infe;
     MP4_Box_data_pitm_t *p_pitm;
+    MP4_Box_data_ispe_t *p_ispe; /* heif */
 
     /* for generic handlers */
     MP4_Box_data_binary_t *p_binary;



More information about the vlc-commits mailing list