Commit f999c3a0 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: libmp4: read infe boxes

parent f29dbe1e
......@@ -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 }
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment