[vlc-commits] mp4: correct support for name atom
Jean-Baptiste Kempf
git at videolan.org
Thu Aug 25 02:15:39 CEST 2011
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Aug 25 02:15:00 2011 +0200| [89c1460e3c620a2338d483731dcfc331c066cd20] | committer: Jean-Baptiste Kempf
mp4: correct support for name atom
Used for track title by iTunes/QT
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89c1460e3c620a2338d483731dcfc331c066cd20
---
modules/demux/mp4/libmp4.c | 25 ++++++++++++++++++++++++-
modules/demux/mp4/libmp4.h | 7 +++++++
2 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 831406e..573f06e 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2440,6 +2440,29 @@ static int MP4_ReadBox_drms( stream_t *p_stream, MP4_Box_t *p_box )
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 )
{
uint16_t i16;
@@ -2895,7 +2918,6 @@ static const struct
{ FOURCC_user, MP4_ReadBox_drms, MP4_FreeBox_Common },
{ FOURCC_key, 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_frma, MP4_ReadBox_frma, MP4_FreeBox_Common },
{ FOURCC_skcr, MP4_ReadBox_skcr, MP4_FreeBox_Common },
@@ -2939,6 +2961,7 @@ static const struct
/* iTunes/Quicktime meta info */
{ FOURCC_meta, MP4_ReadBox_meta, MP4_FreeBox_Common },
+ { FOURCC_name, MP4_ReadBox_name, MP4_FreeBox_name },
/* found in smoothstreaming */
{ FOURCC_traf, MP4_ReadBoxContainer, MP4_FreeBox_Common },
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 902e6a4..0997b91 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -885,6 +885,12 @@ typedef struct
typedef struct
{
+ char *psz_text;
+
+} MP4_Box_data_name_t;
+
+typedef struct
+{
uint32_t i_entry_count;
uint32_t *i_track_ID;
@@ -1042,6 +1048,7 @@ typedef union MP4_Box_data_s
MP4_Box_data_0xa9xxx_t *p_0xa9xxx;
MP4_Box_data_chpl_t *p_chpl;
MP4_Box_data_tref_generic_t *p_tref_generic;
+ MP4_Box_data_name_t *p_name;
void *p_data; /* for unknow type */
} MP4_Box_data_t;
More information about the vlc-commits
mailing list