[vlc-commits] demux: libmp4: read infe boxes
Francois Cartegnie
git at videolan.org
Tue Mar 13 19:09:33 CET 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Mar 13 13:31:26 2018 +0100| [f999c3a0aceb0c469e8627ff196c1c2272d02d1b] | committer: Francois Cartegnie
demux: libmp4: read infe boxes
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f999c3a0aceb0c469e8627ff196c1c2272d02d1b
---
modules/demux/mp4/libmp4.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++
modules/demux/mp4/libmp4.h | 14 +++++++++++
2 files changed, 76 insertions(+)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index b42f0993fa..c8c27111b6 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -4416,6 +4416,67 @@ static int MP4_ReadBox_iinf( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 );
}
+static void MP4_FreeBox_infe( MP4_Box_t *p_box )
+{
+ MP4_Box_data_infe_t *p_data = p_box->data.p_infe;
+ free( p_data->psz_content_encoding );
+ free( p_data->psz_content_type );
+ free( p_data->psz_item_name );
+ free( p_data->psz_item_uri_type );
+}
+
+static int MP4_ReadBox_infe( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ MP4_READBOX_ENTER( MP4_Box_data_infe_t, MP4_FreeBox_infe );
+ MP4_Box_data_infe_t *p_data = p_box->data.p_infe;
+
+ uint8_t i_version;
+ MP4_GET1BYTE( i_version );
+ MP4_GET3BYTES( p_data->i_flags );
+ if( i_version > 3 )
+ MP4_READBOX_EXIT( 0 );
+
+ if( i_version < 2 )
+ {
+ MP4_GET2BYTES( p_data->i_item_id );
+ MP4_GET2BYTES( p_data->i_item_protection_index );
+ p_data->psz_item_name = mp4_getstringz( &p_peek, &i_read );
+ if( i_read > 0 )
+ {
+ p_data->psz_content_type = mp4_getstringz( &p_peek, &i_read );
+ if( i_read > 0 )
+ p_data->psz_content_encoding = mp4_getstringz( &p_peek, &i_read );
+ }
+
+ //if( i_version == 1 )
+ {
+ /* extensions, we do not care */
+ }
+ }
+ else
+ {
+ if( i_version == 2 )
+ MP4_GET2BYTES( p_data->i_item_id );
+ else
+ MP4_GET4BYTES( p_data->i_item_id );
+ MP4_GET2BYTES( p_data->i_item_protection_index );
+ MP4_GETFOURCC( p_data->item_type );
+ p_data->psz_item_name = mp4_getstringz( &p_peek, &i_read );
+ if( p_data->item_type == VLC_FOURCC('m','i','m','e') )
+ {
+ p_data->psz_content_type = mp4_getstringz( &p_peek, &i_read );
+ if( i_read > 0 )
+ p_data->psz_content_encoding = mp4_getstringz( &p_peek, &i_read );
+ }
+ else if( p_data->item_type == VLC_FOURCC('u','r','i',' ') )
+ {
+ p_data->psz_item_uri_type = mp4_getstringz( &p_peek, &i_read );
+ }
+ }
+
+ MP4_READBOX_EXIT( 1 );
+}
+
/* For generic */
static int MP4_ReadBox_default( stream_t *p_stream, MP4_Box_t *p_box )
{
@@ -4897,6 +4958,7 @@ static const struct
/* iso4 brand meta references */
{ ATOM_iloc, MP4_ReadBox_iloc, ATOM_meta },
{ ATOM_iinf, MP4_ReadBox_iinf, ATOM_meta },
+ { ATOM_infe, MP4_ReadBox_infe, ATOM_iinf },
/* Last entry */
{ 0, MP4_ReadBox_default, 0 }
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index b234138150..e088c1cdf2 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -399,6 +399,7 @@ typedef int64_t stime_t;
/* iso4 meta references */
#define ATOM_iloc VLC_FOURCC('i','l','o','c')
#define ATOM_iinf VLC_FOURCC('i','i','n','f')
+#define ATOM_infe VLC_FOURCC('i','n','f','e')
#define HANDLER_mdta VLC_FOURCC('m', 'd', 't', 'a')
#define HANDLER_mdir VLC_FOURCC('m', 'd', 'i', 'r')
@@ -1653,6 +1654,18 @@ typedef struct
uint32_t i_entry_count;
} MP4_Box_data_iinf_t;
+typedef struct
+{
+ uint32_t i_flags;
+ uint32_t i_item_id;
+ uint16_t i_item_protection_index;
+ vlc_fourcc_t item_type;
+ char *psz_item_name;
+ char *psz_content_type;
+ char *psz_content_encoding;
+ char *psz_item_uri_type;
+} MP4_Box_data_infe_t;
+
/*
typedef struct MP4_Box_data__s
{
@@ -1769,6 +1782,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_iloc_t *p_iloc;
MP4_Box_data_iinf_t *p_iinf;
+ MP4_Box_data_infe_t *p_infe;
/* for generic handlers */
MP4_Box_data_binary_t *p_binary;
More information about the vlc-commits
mailing list