* after called one of theses functions, file position is unknown
* you need to call MP4_GotoBox to go where you want
*****************************************************************************/
-int MP4_ReadBoxContainerChildren( stream_t *p_stream,
- MP4_Box_t *p_container, uint32_t i_last_child )
+static int MP4_ReadBoxContainerChildrenIndexed( stream_t *p_stream,
+ MP4_Box_t *p_container, uint32_t i_last_child, bool b_indexed )
{
MP4_Box_t *p_box;
/* Size of root container is set to 0 when unknown, for exemple
* with a DASH stream. In that case, we skip the following check */
if( p_container->i_size
- && ( stream_Tell( p_stream ) + 8 >
+ && ( stream_Tell( p_stream ) + ((b_indexed)?16:8) >
(off_t)(p_container->i_pos + p_container->i_size) )
)
{
do
{
+ uint32_t i_index = 0;
+ if ( b_indexed )
+ {
+ uint8_t read[8];
+ if ( stream_Read( p_stream, read, 8 ) < 8 )
+ return 0;
+ i_index = GetDWBE(&read[4]);
+ }
if( ( p_box = MP4_ReadBox( p_stream, p_container ) ) == NULL ) break;
+ p_box->i_index = i_index;
/* chain this box with the father and the other at same level */
if( !p_container->p_first ) p_container->p_first = p_box;
return 1;
}
+int MP4_ReadBoxContainerChildren( stream_t *p_stream, MP4_Box_t *p_container,
+ uint32_t i_last_child )
+{
+ return MP4_ReadBoxContainerChildrenIndexed( p_stream, p_container,
+ i_last_child, false );
+}
+
static int MP4_ReadBoxContainerRaw( stream_t *p_stream, MP4_Box_t *p_container )
{
return MP4_ReadBoxContainerChildren( p_stream, p_container, 0 );
return 1;
}
+static int MP4_ReadBox_ilst( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ if( p_box->i_size < 8 || stream_Read( p_stream, NULL, 8 ) < 8 )
+ return 0;
+
+ /* Find our handler */
+ if ( !p_box->i_handler && p_box->p_father )
+ {
+ const MP4_Box_t *p_sibling = p_box->p_father->p_first;
+ while( p_sibling )
+ {
+ if ( p_sibling->i_type == ATOM_hdlr && p_sibling->data.p_hdlr )
+ {
+ p_box->i_handler = p_sibling->data.p_hdlr->i_handler_type;
+ break;
+ }
+ p_sibling = p_sibling->p_next;
+ }
+ }
+
+ switch( p_box->i_handler )
+ {
+ case 0:
+ msg_Warn( p_stream, "no handler for ilst atom" );
+ return 0;
+ case HANDLER_mdta:
+ return MP4_ReadBoxContainerChildrenIndexed( p_stream, p_box, 0, true );
+ case HANDLER_mdir:
+ return MP4_ReadBoxContainerChildren( p_stream, p_box, 0 );
+ default:
+ msg_Warn( p_stream, "Unknown ilst handler type '%4.4s'", (char*)&p_box->i_handler );
+ return 0;
+ }
+}
+
static int MP4_ReadBox_ftyp( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_ftyp_t );
MP4_GET2BYTESLE( p_WMA2->Format.nBlockAlign );
MP4_GET2BYTESLE( p_WMA2->Format.wBitsPerSample );
- if ( i_read < 0 )
+ uint16_t i_cbSize;
+ MP4_GET2BYTESLE( i_cbSize );
+
+ if ( i_read < 0 || i_cbSize > i_read )
goto error;
- p_WMA2->i_extra = i_read;
+ p_WMA2->i_extra = i_cbSize;
if ( p_WMA2->i_extra )
{
- p_WMA2->p_extra = malloc( i_read );
+ p_WMA2->p_extra = malloc( p_WMA2->i_extra );
if ( ! p_WMA2->p_extra )
goto error;
- memcpy( p_WMA2->p_extra, p_peek, i_read );
+ memcpy( p_WMA2->p_extra, p_peek, p_WMA2->i_extra );
}
MP4_READBOX_EXIT( 1 );
FREENULL( p_box->data.p_strf->p_extra );
}
+static int MP4_ReadBox_ASF( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ MP4_READBOX_ENTER( MP4_Box_data_ASF_t );
+
+ MP4_Box_data_ASF_t *p_asf = p_box->data.p_asf;
+
+ if (i_read != 8)
+ MP4_READBOX_EXIT( 0 );
+
+ MP4_GET1BYTE( p_asf->i_stream_number );
+ /* remaining is unknown */
+
+ MP4_READBOX_EXIT( 1 );
+}
+
static int MP4_ReadBox_stsdext_chan( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_chan_t );
MP4_GET4BYTES( p_chan->layout.i_channels_layout_tag );
MP4_GET4BYTES( p_chan->layout.i_channels_bitmap );
MP4_GET4BYTES( p_chan->layout.i_channels_description_count );
- if ( i_read < p_chan->layout.i_channels_description_count * 24 )
+
+ size_t i_descsize = 8 + 3 * sizeof(float);
+ if ( (size_t)i_read < p_chan->layout.i_channels_description_count * i_descsize )
MP4_READBOX_EXIT( 0 );
p_chan->layout.p_descriptions =
- malloc( p_chan->layout.i_channels_description_count * 24 );
+ malloc( p_chan->layout.i_channels_description_count * i_descsize );
if ( !p_chan->layout.p_descriptions )
MP4_READBOX_EXIT( 0 );
- for( uint32_t i=0; i<p_chan->layout.i_channels_description_count; i++ )
+ uint32_t i;
+ for( i=0; i<p_chan->layout.i_channels_description_count; i++ )
{
+ if ( i_read < 20 )
+ break;
MP4_GET4BYTES( p_chan->layout.p_descriptions[i].i_channel_label );
MP4_GET4BYTES( p_chan->layout.p_descriptions[i].i_channel_flags );
MP4_GET4BYTES( p_chan->layout.p_descriptions[i].f_coordinates[0] );
MP4_GET4BYTES( p_chan->layout.p_descriptions[i].f_coordinates[1] );
MP4_GET4BYTES( p_chan->layout.p_descriptions[i].f_coordinates[2] );
}
+ if ( i<p_chan->layout.i_channels_description_count )
+ p_chan->layout.i_channels_description_count = i;
#ifdef MP4_VERBOSE
msg_Dbg( p_stream,
MP4_READBOX_EXIT( 1 );
}
-static int MP4_ReadBox_gnre( stream_t *p_stream, MP4_Box_t *p_box )
-{
- MP4_Box_data_gnre_t *p_gnre;
- MP4_READBOX_ENTER( MP4_Box_data_gnre_t );
-
- p_gnre = p_box->data.p_gnre;
-
- uint32_t i_data_len;
- uint32_t i_data_tag;
-
- MP4_GET4BYTES( i_data_len );
- MP4_GETFOURCC( i_data_tag );
- if( i_data_len < 10 || i_data_tag != ATOM_data )
- MP4_READBOX_EXIT( 0 );
-
- uint32_t i_version;
- VLC_UNUSED(i_version);
- uint32_t i_reserved;
- VLC_UNUSED(i_reserved);
- MP4_GET4BYTES( i_version );
- MP4_GET4BYTES( i_reserved );
- MP4_GET2BYTES( p_gnre->i_genre );
- if( p_gnre->i_genre == 0 )
- MP4_READBOX_EXIT( 0 );
-#ifdef MP4_VERBOSE
- msg_Dbg( p_stream, "read box: \"gnre\" genre=%i", p_gnre->i_genre );
-#endif
-
- MP4_READBOX_EXIT( 1 );
-}
-
-static int MP4_ReadBox_trkn( stream_t *p_stream, MP4_Box_t *p_box )
-{
- MP4_Box_data_trkn_t *p_trkn;
- MP4_READBOX_ENTER( MP4_Box_data_trkn_t );
-
- p_trkn = p_box->data.p_trkn;
-
- uint32_t i_data_len;
- uint32_t i_data_tag;
-
- MP4_GET4BYTES( i_data_len );
- MP4_GETFOURCC( i_data_tag );
- if( i_data_len < 12 || i_data_tag != ATOM_data )
- MP4_READBOX_EXIT( 0 );
-
- uint32_t i_version;
- VLC_UNUSED(i_version);
- uint32_t i_reserved;
- VLC_UNUSED(i_reserved);
- MP4_GET4BYTES( i_version );
- MP4_GET4BYTES( i_reserved );
- MP4_GET2BYTES( i_reserved );
- MP4_GET2BYTES( p_trkn->i_track_number );
-#ifdef MP4_VERBOSE
- msg_Dbg( p_stream, "read box: \"trkn\" number=%i", p_trkn->i_track_number );
-#endif
- if( i_data_len > 15 )
- {
- MP4_GET2BYTES( p_trkn->i_track_total );
-#ifdef MP4_VERBOSE
- msg_Dbg( p_stream, "read box: \"trkn\" total=%i", p_trkn->i_track_total );
-#endif
- }
-
- MP4_READBOX_EXIT( 1 );
-}
-
static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
{
p_box->i_handler = ATOM_soun;
return 1;
}
-static int MP4_ReadBox_name( stream_t *p_stream, MP4_Box_t *p_box )
+static int MP4_ReadBox_String( stream_t *p_stream, MP4_Box_t *p_box )
{
- MP4_READBOX_ENTER( MP4_Box_data_name_t );
+ MP4_READBOX_ENTER( MP4_Box_data_string_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 )
+ p_box->data.p_string->psz_text = malloc( p_box->i_size + 1 - 8 ); /* +\0, -name, -size */
+ if( p_box->data.p_string->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';
+ memcpy( p_box->data.p_string->psz_text, p_peek, p_box->i_size - 8 );
+ p_box->data.p_string->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 );
+ msg_Dbg( p_stream, "read box: \"%4.4s\" text=`%s'", (char *) & p_box->i_type,
+ p_box->data.p_string->psz_text );
#endif
MP4_READBOX_EXIT( 1 );
}
-static void MP4_FreeBox_name( MP4_Box_t *p_box )
+static void MP4_FreeBox_String( MP4_Box_t *p_box )
{
- FREENULL( p_box->data.p_name->psz_text );
+ FREENULL( p_box->data.p_string->psz_text );
}
static int MP4_ReadBox_data( stream_t *p_stream, MP4_Box_t *p_box )
{
MP4_READBOX_ENTER( MP4_Box_data_data_t );
+ MP4_Box_data_data_t *p_data = p_box->data.p_data;
+
+ if ( i_read < 8 || i_read - 8 > UINT32_MAX )
+ MP4_READBOX_EXIT( 0 );
- /* What's that header ?? */
- if ( i_read <= 8 )
+ uint8_t i_type;
+ MP4_GET1BYTE( i_type );
+ if ( i_type != 0 )
+ {
+#ifdef MP4_VERBOSE
+ msg_Dbg( p_stream, "skipping unknown 'data' atom with type %"PRIu8, i_type );
+#endif
MP4_READBOX_EXIT( 0 );
+ }
- p_box->data.p_data->p_blob = malloc( i_read - 8 );
+ MP4_GET3BYTES( p_data->e_wellknowntype );
+ MP4_GET2BYTES( p_data->locale.i_country );
+ MP4_GET2BYTES( p_data->locale.i_language );
+#ifdef MP4_VERBOSE
+ msg_Dbg( p_stream, "read 'data' atom: knowntype=%"PRIu32", country=%"PRIu16" lang=%"PRIu16
+ ", size %"PRId64" bytes", p_data->e_wellknowntype,
+ p_data->locale.i_country, p_data->locale.i_language, i_read );
+#endif
+ p_box->data.p_data->p_blob = malloc( i_read );
if ( !p_box->data.p_data->p_blob )
MP4_READBOX_EXIT( 0 );
- p_box->data.p_data->i_blob = i_read - 8;
- memcpy( p_box->data.p_data->p_blob, p_peek + 8, i_read - 8 );
+ p_box->data.p_data->i_blob = i_read;
+ memcpy( p_box->data.p_data->p_blob, p_peek, i_read);
MP4_READBOX_EXIT( 1 );
}
free( p_box->data.p_data->p_blob );
}
+static int MP4_ReadBox_Metadata( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ const uint8_t *p_peek;
+ if ( stream_Peek( p_stream, &p_peek, 16 ) < 16 )
+ return 0;
+ if ( stream_Read( p_stream, NULL, 8 ) < 8 )
+ return 0;
+ return MP4_ReadBoxContainerChildren( p_stream, p_box, ATOM_data );
+}
+
static int MP4_ReadBox_0xa9xxx( stream_t *p_stream, MP4_Box_t *p_box )
{
- uint16_t i16;
+ return MP4_ReadBox_Metadata( p_stream, p_box );
- MP4_READBOX_ENTER( MP4_Box_data_0xa9xxx_t );
+/* FIXME: find out what was that 2 bytes sized atom and its own handler */
+// if ( GetWBE( &p_peek[8] ) > 0 )
+// uint16_t i16;
- p_box->data.p_0xa9xxx->psz_text = NULL;
+// MP4_READBOX_ENTER( MP4_Box_data_string_t );
- MP4_GET2BYTES( i16 );
+// p_box->data.p_string->psz_text = NULL;
- if( i16 > 0 )
- {
- int i_length = i16;
+// MP4_GET2BYTES( i16 );
- MP4_GET2BYTES( i16 );
- if( i_length >= i_read ) i_length = i_read + 1;
+// if( i16 > 0 )
+// {
+// int i_length = i16;
- p_box->data.p_0xa9xxx->psz_text = malloc( i_length );
- if( p_box->data.p_0xa9xxx->psz_text == NULL )
- MP4_READBOX_EXIT( 0 );
+// MP4_GET2BYTES( i16 );
+// if( i_length >= i_read ) i_length = i_read + 1;
- i_length--;
- memcpy( p_box->data.p_0xa9xxx->psz_text,
- p_peek, i_length );
- p_box->data.p_0xa9xxx->psz_text[i_length] = '\0';
+// p_box->data.p_string->psz_text = malloc( i_length );
+// if( p_box->data.p_string->psz_text == NULL )
+// MP4_READBOX_EXIT( 0 );
-#ifdef MP4_VERBOSE
- msg_Dbg( p_stream,
- "read box: \"c%3.3s\" text=`%s'",
- ((char*)&p_box->i_type + 1),
- p_box->data.p_0xa9xxx->psz_text );
-#endif
- }
- else
- {
- /* try iTune/Quicktime format, rewind to start */
- p_peek -= 2; i_read += 2;
- // we are expecting a 'data' box
- uint32_t i_data_len;
- uint32_t i_data_tag;
+// i_length--;
+// memcpy( p_box->data.p_string->psz_text,
+// p_peek, i_length );
+// p_box->data.p_string->psz_text[i_length] = '\0';
- MP4_GET4BYTES( i_data_len );
- if( i_data_len > i_read ) i_data_len = i_read;
- MP4_GETFOURCC( i_data_tag );
- if( (i_data_len > 0) && (i_data_tag == ATOM_data) )
- {
- /* data box contains a version/flags field */
- uint32_t i_version;
- uint32_t i_reserved;
- VLC_UNUSED(i_reserved);
- MP4_GET4BYTES( i_version );
- MP4_GET4BYTES( i_reserved );
- // version should be 0, flags should be 1 for text, 0 for data
- if( ( i_version == 0x00000001 ) && (i_data_len >= 12 ) )
- {
- // the rest is the text
- i_data_len -= 12;
- p_box->data.p_0xa9xxx->psz_text = malloc( i_data_len + 1 );
- if( p_box->data.p_0xa9xxx->psz_text == NULL )
- MP4_READBOX_EXIT( 0 );
-
- memcpy( p_box->data.p_0xa9xxx->psz_text,
- p_peek, i_data_len );
- p_box->data.p_0xa9xxx->psz_text[i_data_len] = '\0';
-#ifdef MP4_VERBOSE
- msg_Dbg( p_stream,
- "read box: \"c%3.3s\" text=`%s'",
- ((char*)&p_box->i_type+1),
- p_box->data.p_0xa9xxx->psz_text );
-#endif
- }
- else
- {
- // TODO: handle data values for ID3 tag values, track num or cover art,etc...
- }
- }
- }
+//#ifdef MP4_VERBOSE
+// msg_Dbg( p_stream,
+// "read box: \"c%3.3s\" text=`%s'",
+// ((char*)&p_box->i_type + 1),
+// p_box->data.p_string->psz_text );
+//#endif
+// }
+// else
- MP4_READBOX_EXIT( 1 );
+// MP4_READBOX_EXIT( 1 );
}
static void MP4_FreeBox_0xa9xxx( MP4_Box_t *p_box )
{
- FREENULL( p_box->data.p_0xa9xxx->psz_text );
+ /* If Meta, that box should be empty /common */
+ if( p_box->data.p_string )
+ FREENULL( p_box->data.p_string->psz_text );
}
/* Chapter support */
uint64_t i_start;
uint8_t i_len;
int i_copy;
+ if ( i_read < 9 )
+ break;
MP4_GET8BYTES( i_start );
MP4_GET1BYTE( i_len );
p_peek += i_copy;
i_read -= i_copy;
}
+
+ if ( i != p_chpl->i_chapter )
+ p_chpl->i_chapter = i;
+
/* Bubble sort by increasing start date */
do
{
FREENULL( p_box->data.p_tref_generic->i_track_ID );
}
+static int MP4_ReadBox_keys( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ MP4_READBOX_ENTER( MP4_Box_data_keys_t );
+
+ if ( i_read < 8 )
+ MP4_READBOX_EXIT( 0 );
+
+ uint32_t i_count;
+ MP4_GET4BYTES( i_count ); /* reserved + flags */
+ if ( i_count != 0 )
+ MP4_READBOX_EXIT( 0 );
+
+ MP4_GET4BYTES( i_count );
+ p_box->data.p_keys->p_entries = calloc( i_count, sizeof(*p_box->data.p_keys->p_entries) );
+ if ( !p_box->data.p_keys->p_entries )
+ MP4_READBOX_EXIT( 0 );
+ p_box->data.p_keys->i_entry_count = i_count;
+
+ uint32_t i=0;
+ for( ; i < i_count; i++ )
+ {
+ if ( i_read < 8 )
+ break;
+ uint32_t i_keysize;
+ MP4_GET4BYTES( i_keysize );
+ if ( (i_keysize < 8) || (i_keysize - 4 > i_read) )
+ break;
+ MP4_GETFOURCC( p_box->data.p_keys->p_entries[i].i_namespace );
+ i_keysize -= 8;
+ p_box->data.p_keys->p_entries[i].psz_value = malloc( i_keysize + 1 );
+ if ( !p_box->data.p_keys->p_entries[i].psz_value )
+ break;
+ memcpy( p_box->data.p_keys->p_entries[i].psz_value, p_peek, i_keysize );
+ p_box->data.p_keys->p_entries[i].psz_value[i_keysize] = 0;
+ p_peek += i_keysize;
+ i_read -= i_keysize;
+#ifdef MP4_ULTRA_VERBOSE
+ msg_Dbg( p_stream, "read box: \"keys\": %u '%s'", i + 1,
+ p_box->data.p_keys->p_entries[i].p_value );
+#endif
+ }
+ if ( i < i_count )
+ p_box->data.p_keys->i_entry_count = i;
+
+ MP4_READBOX_EXIT( 1 );
+}
+
+static void MP4_FreeBox_keys( MP4_Box_t *p_box )
+{
+ for( uint32_t i=0; i<p_box->data.p_keys->i_entry_count; i++ )
+ free( p_box->data.p_keys->p_entries[i].psz_value );
+ free( p_box->data.p_keys->p_entries );
+}
+
static int MP4_ReadBox_meta( stream_t *p_stream, MP4_Box_t *p_box )
{
uint8_t meta_data[8];
if( i_actually_read < 8 )
return 0;
- if ( !p_box->p_father )
- return 0;
-
- switch( p_box->p_father->i_type )
+ if ( p_box->p_father && p_box->p_father->i_type == ATOM_udta ) /* itunes udta/meta */
{
- case ATOM_udta: /* itunes udta/meta */
/* meta content starts with a 4 byte version/flags value (should be 0) */
i_actually_read = stream_Read( p_stream, meta_data, 4 );
- if( i_actually_read < 4 )
+ if( i_actually_read < 4 || memcmp( meta_data, "\0\0\0", 4 ) )
return 0;
+ }
- /* then it behaves like a container */
- return MP4_ReadBoxContainerRaw( p_stream, p_box );
-
- default: /* regular meta atom */
-
- i_actually_read = stream_Read( p_stream, meta_data, 8 );
- if( i_actually_read < 8 )
- return 0;
+ if ( !MP4_ReadBoxContainerChildren( p_stream, p_box, ATOM_hdlr ) )
+ return 0;
- /* Mandatory */
- if ( VLC_FOURCC( meta_data[4], meta_data[5], meta_data[6], meta_data[7] ) != ATOM_hdlr )
- return 0;
+ /* Mandatory */
+ const MP4_Box_t *p_hdlr = MP4_BoxGet( p_box, "hdlr" );
+ if ( !p_hdlr || !BOXDATA(p_hdlr) ||
+ ( BOXDATA(p_hdlr)->i_handler_type != HANDLER_mdta &&
+ BOXDATA(p_hdlr)->i_handler_type != HANDLER_mdir ) ||
+ BOXDATA(p_hdlr)->i_version != 0 )
+ return 0;
- //ft
- }
- return 1;
+ /* then it behaves like a container */
+ return MP4_ReadBoxContainerRaw( p_stream, p_box );
}
static int MP4_ReadBox_iods( stream_t *p_stream, MP4_Box_t *p_box )
#ifdef MP4_VERBOSE
msg_Dbg( p_stream, "i_sample_count is %"PRIu32"", i_sample_count );
- msg_Dbg( p_stream,
+ if ( i_sample_count > 3 )
+ msg_Dbg( p_stream,
"read box: \"sdtp\" head: %"PRIx8" %"PRIx8" %"PRIx8" %"PRIx8"",
p_sdtp->p_sample_table[0],
p_sdtp->p_sample_table[1],
{ ATOM_tref, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_trak },
{ ATOM_gmhd, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_minf },
{ ATOM_wave, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_stsd },
+ { ATOM_wave, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_mp4a }, /* some quicktime mp4a/wave/mp4a.. */
{ ATOM_wave, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_WMA2 }, /* flip4mac */
- { ATOM_ilst, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_meta },
+ { ATOM_ilst, MP4_ReadBox_ilst, MP4_FreeBox_Common, ATOM_meta },
{ ATOM_mvex, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_moov },
{ ATOM_mvex, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_ftyp },
{ ATOM_esds, MP4_ReadBox_esds, MP4_FreeBox_esds, ATOM_wave }, /* mp4a in wave chunk */
{ ATOM_esds, MP4_ReadBox_esds, MP4_FreeBox_esds, ATOM_mp4a },
{ ATOM_esds, MP4_ReadBox_esds, MP4_FreeBox_esds, ATOM_mp4v },
+ { ATOM_esds, MP4_ReadBox_esds, MP4_FreeBox_esds, ATOM_mp4s },
{ ATOM_dcom, MP4_ReadBox_dcom, MP4_FreeBox_Common, 0 },
{ ATOM_cmvd, MP4_ReadBox_cmvd, MP4_FreeBox_cmvd, 0 },
{ ATOM_avcC, MP4_ReadBox_avcC, MP4_FreeBox_avcC, ATOM_avc1 },
{ ATOM_enda, MP4_ReadBox_enda, MP4_FreeBox_Common, 0 },
{ ATOM_iods, MP4_ReadBox_iods, MP4_FreeBox_Common, 0 },
{ ATOM_pasp, MP4_ReadBox_pasp, MP4_FreeBox_Common, 0 },
+ { ATOM_keys, MP4_ReadBox_keys, MP4_FreeBox_keys, ATOM_meta },
/* Nothing to do with this box */
{ ATOM_mdat, MP4_ReadBoxSkip, MP4_FreeBox_Common, 0 },
{ ATOM_yuv2, MP4_ReadBox_sample_vide, MP4_FreeBox_sample_vide, 0 },
{ ATOM_strf, MP4_ReadBox_strf, MP4_FreeBox_strf, ATOM_WMV3 }, /* flip4mac */
+ { ATOM_ASF , MP4_ReadBox_ASF, MP4_FreeBox_Common, ATOM_WMV3 }, /* flip4mac */
+ { ATOM_ASF , MP4_ReadBox_ASF, MP4_FreeBox_Common, ATOM_wave }, /* flip4mac */
- { ATOM_mp4s, MP4_ReadBox_sample_mp4s, MP4_FreeBox_Common, 0 },
+ { ATOM_mp4s, MP4_ReadBox_sample_mp4s, MP4_FreeBox_Common, ATOM_stsd },
/* XXX there is 2 box where we could find this entry stbl and tref*/
{ ATOM_hint, MP4_ReadBox_default, MP4_FreeBox_Common, 0 },
{ ATOM_frma, MP4_ReadBox_frma, MP4_FreeBox_Common, ATOM_wave }, /* flip4mac */
{ ATOM_skcr, MP4_ReadBox_skcr, MP4_FreeBox_Common, 0 },
- /* found in udta */
- { ATOM_0xa9nam, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9aut, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9cpy, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9swr, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9inf, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
+ /* ilst meta tags */
{ ATOM_0xa9ART, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9dir, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
+ { ATOM_0xa9alb, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_0xa9cmt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9req, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
+ { ATOM_0xa9com, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_0xa9day, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_0xa9des, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9fmt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9prd, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9prf, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9src, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9alb, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9dis, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_0xa9enc, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_0xa9gen, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9trk, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9dsa, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9hst, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9url, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9ope, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9com, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9wrt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9too, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9wrn, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9mak, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9mod, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9PRD, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_0xa9grp, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
{ ATOM_0xa9lyr, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9gen, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9st3, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9ard, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9arg, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9cak, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9con, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9des, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9lnt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9phg, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9pub, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9sne, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9sol, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9thx, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_0xa9xpd, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
- { ATOM_chpl, MP4_ReadBox_chpl, MP4_FreeBox_chpl, ATOM_udta },
-
- { ATOM_gnre, MP4_ReadBox_gnre, MP4_FreeBox_Common, ATOM_ilst },
- { ATOM_trkn, MP4_ReadBox_trkn, MP4_FreeBox_Common, ATOM_ilst },
+ { ATOM_0xa9nam, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
+ { ATOM_0xa9too, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
+ { ATOM_0xa9trk, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
+ { ATOM_0xa9wrt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_ilst },
+ { ATOM_chpl, MP4_ReadBox_chpl, MP4_FreeBox_chpl, ATOM_ilst },
+ { ATOM_covr, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_ilst },
+ { ATOM_gnre, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst },
+ { ATOM_trkn, MP4_ReadBox_Metadata, MP4_FreeBox_Common, ATOM_ilst },
+
+ /* udta */
+ { ATOM_0xa9ART, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9alb, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9ard, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9arg, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9aut, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9cak, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9cmt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9con, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9com, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9cpy, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9day, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9des, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9dir, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9dis, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9dsa, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9fmt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9gen, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9grp, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9hst, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9inf, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9isr, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9lab, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9lal, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9lnt, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9lyr, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9mak, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9mal, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9mod, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9ope, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9phg, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9PRD, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9prd, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9prf, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9pub, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9req, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9sne, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9snm, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9sol, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9src, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9st3, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9swr, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9thx, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9too, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9trk, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9url, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9wrn, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9xpd, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_0xa9xyz, MP4_ReadBox_0xa9xxx, MP4_FreeBox_0xa9xxx, ATOM_udta },
+ { ATOM_name, MP4_ReadBox_String, MP4_FreeBox_String, ATOM_udta },
+ { ATOM_vndr, MP4_ReadBox_String, MP4_FreeBox_String, ATOM_udta },
+ { ATOM_SDLN, MP4_ReadBox_String, MP4_FreeBox_String, ATOM_udta },
/* iTunes/Quicktime meta info */
{ ATOM_meta, MP4_ReadBox_meta, MP4_FreeBox_Common, 0 },
- { ATOM_name, MP4_ReadBox_name, MP4_FreeBox_name, 0 },
- { ATOM_covr, MP4_ReadBoxContainer, MP4_FreeBox_Common, ATOM_ilst },
{ ATOM_data, MP4_ReadBox_data, MP4_FreeBox_data, 0 },
/* found in smoothstreaming */
MP4_Box_t *p_box, unsigned int i_level )
{
MP4_Box_t *p_child;
+ uint32_t i_displayedtype = p_box->i_type;
+ if( ! MP4_BOX_TYPE_ASCII() ) ((char*)&i_displayedtype)[0] = 'c';
if( !i_level )
{
- if MP4_BOX_TYPE_ASCII()
- msg_Dbg( s, "dumping root Box \"%4.4s\"",
- (char*)&p_box->i_type );
- else
- msg_Dbg( s, "dumping root Box \"c%3.3s\"",
- (char*)&p_box->i_type+1 );
+ msg_Dbg( s, "dumping root Box \"%4.4s\"",
+ (char*)&i_displayedtype );
}
else
{
{
str[i*4] = '|';
}
- if( MP4_BOX_TYPE_ASCII() )
- snprintf( &str[i_level * 4], sizeof(str) - 4*i_level,
- "+ %4.4s size %"PRIu64" offset %ld%s",
- (char*)&p_box->i_type, p_box->i_size, p_box->i_pos,
- p_box->e_flags & BOX_FLAG_INCOMPLETE ? " (\?\?\?\?)" : "" );
- else
- snprintf( &str[i_level * 4], sizeof(str) - 4*i_level,
- "+ c%3.3s size %"PRIu64" offset %ld%s",
- (char*)&p_box->i_type+1, p_box->i_size, p_box->i_pos,
- p_box->e_flags & BOX_FLAG_INCOMPLETE ? " (\?\?\?\?)" : "" );
+
+ snprintf( &str[i_level * 4], sizeof(str) - 4*i_level,
+ "+ %4.4s size %"PRIu64" offset %ju%s",
+ (char*)&i_displayedtype, p_box->i_size,
+ (uintmax_t)p_box->i_pos,
+ p_box->e_flags & BOX_FLAG_INCOMPLETE ? " (\?\?\?\?)" : "" );
msg_Dbg( s, "%s", str );
}
p_child = p_box->p_first;