Commit 89c1460e authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

mp4: correct support for name atom

Used for track title by iTunes/QT
parent 245aa586
...@@ -2440,6 +2440,29 @@ static int MP4_ReadBox_drms( stream_t *p_stream, MP4_Box_t *p_box ) ...@@ -2440,6 +2440,29 @@ static int MP4_ReadBox_drms( stream_t *p_stream, MP4_Box_t *p_box )
MP4_READBOX_EXIT( 1 ); MP4_READBOX_EXIT( 1 );
} }
static int MP4_ReadBox_name( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_name_t );
p_box->data.p_name->psz_text = malloc( p_box->i_size + 1 - 8 ); /* +\0, -name, -size */
if( p_box->data.p_name->psz_text == NULL )
MP4_READBOX_EXIT( 0 );
memcpy( p_box->data.p_name->psz_text, p_peek, p_box->i_size - 8 );
p_box->data.p_name->psz_text[p_box->i_size - 8] = '\0';
#ifdef MP4_VERBOSE
msg_Dbg( p_stream, "read box: \"name\" text=`%s'",
p_box->data.p_name->psz_text );
#endif
MP4_READBOX_EXIT( 1 );
}
static void MP4_FreeBox_name( MP4_Box_t *p_box )
{
FREENULL( p_box->data.p_name->psz_text );
}
static int MP4_ReadBox_0xa9xxx( stream_t *p_stream, MP4_Box_t *p_box ) static int MP4_ReadBox_0xa9xxx( stream_t *p_stream, MP4_Box_t *p_box )
{ {
uint16_t i16; uint16_t i16;
...@@ -2895,7 +2918,6 @@ static const struct ...@@ -2895,7 +2918,6 @@ static const struct
{ FOURCC_user, MP4_ReadBox_drms, MP4_FreeBox_Common }, { FOURCC_user, MP4_ReadBox_drms, MP4_FreeBox_Common },
{ FOURCC_key, MP4_ReadBox_drms, MP4_FreeBox_Common }, { FOURCC_key, MP4_ReadBox_drms, MP4_FreeBox_Common },
{ FOURCC_iviv, MP4_ReadBox_drms, MP4_FreeBox_Common }, { FOURCC_iviv, MP4_ReadBox_drms, MP4_FreeBox_Common },
{ FOURCC_name, MP4_ReadBox_drms, MP4_FreeBox_Common },
{ FOURCC_priv, MP4_ReadBox_drms, MP4_FreeBox_Common }, { FOURCC_priv, MP4_ReadBox_drms, MP4_FreeBox_Common },
{ FOURCC_frma, MP4_ReadBox_frma, MP4_FreeBox_Common }, { FOURCC_frma, MP4_ReadBox_frma, MP4_FreeBox_Common },
{ FOURCC_skcr, MP4_ReadBox_skcr, MP4_FreeBox_Common }, { FOURCC_skcr, MP4_ReadBox_skcr, MP4_FreeBox_Common },
...@@ -2939,6 +2961,7 @@ static const struct ...@@ -2939,6 +2961,7 @@ static const struct
/* iTunes/Quicktime meta info */ /* iTunes/Quicktime meta info */
{ FOURCC_meta, MP4_ReadBox_meta, MP4_FreeBox_Common }, { FOURCC_meta, MP4_ReadBox_meta, MP4_FreeBox_Common },
{ FOURCC_name, MP4_ReadBox_name, MP4_FreeBox_name },
/* found in smoothstreaming */ /* found in smoothstreaming */
{ FOURCC_traf, MP4_ReadBoxContainer, MP4_FreeBox_Common }, { FOURCC_traf, MP4_ReadBoxContainer, MP4_FreeBox_Common },
......
...@@ -883,6 +883,12 @@ typedef struct ...@@ -883,6 +883,12 @@ typedef struct
} MP4_Box_data_0xa9xxx_t; } MP4_Box_data_0xa9xxx_t;
typedef struct
{
char *psz_text;
} MP4_Box_data_name_t;
typedef struct typedef struct
{ {
uint32_t i_entry_count; uint32_t i_entry_count;
...@@ -1042,6 +1048,7 @@ typedef union MP4_Box_data_s ...@@ -1042,6 +1048,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_0xa9xxx_t *p_0xa9xxx; MP4_Box_data_0xa9xxx_t *p_0xa9xxx;
MP4_Box_data_chpl_t *p_chpl; MP4_Box_data_chpl_t *p_chpl;
MP4_Box_data_tref_generic_t *p_tref_generic; MP4_Box_data_tref_generic_t *p_tref_generic;
MP4_Box_data_name_t *p_name;
void *p_data; /* for unknow type */ void *p_data; /* for unknow type */
} MP4_Box_data_t; } MP4_Box_data_t;
......
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