Commit 01119bb3 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: mp4: fix meta root node lookup

parent 111e4939
...@@ -1476,23 +1476,33 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -1476,23 +1476,33 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_META: case DEMUX_GET_META:
{ {
vlc_meta_t *p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t*); vlc_meta_t *p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t*);
MP4_Box_t *p_string;
MP4_Box_t *p_covr = MP4_BoxGet( p_sys->p_root, "/moov/udta/meta/ilst/covr/data[0]" ); const char *psz_roots[] = { "/moov/udta/meta/ilst",
if ( p_covr ) "/moov/meta/ilst",
vlc_meta_SetArtURL( p_meta, "attachment://picture0" ); "/moov/udta/meta",
"/moov/udta",
"/meta/ilst",
"/udta",
NULL };
MP4_Box_t *p_udta = MP4_BoxGet( p_sys->p_root, "/moov/udta/meta/ilst" ); const MP4_Box_t *p_covr = NULL;
if( p_udta == NULL ) const MP4_Box_t *p_udta = NULL;
for( int i_index = 0; psz_roots[i_index] && !p_udta; i_index++ )
{ {
p_udta = MP4_BoxGet( p_sys->p_root, "/moov/udta" ); p_udta = MP4_BoxGet( p_sys->p_root, psz_roots[i_index] );
if( p_udta == NULL && p_covr == NULL ) if ( p_udta )
return VLC_EGENERIC; {
else p_covr = MP4_BoxGet( p_sys->p_root, "covr/data[0]" );
return VLC_SUCCESS; if ( p_covr )
vlc_meta_SetArtURL( p_meta, "attachment://picture0" );
}
} }
for( p_string = p_udta->p_first; p_string != NULL; if( p_udta == NULL && p_covr == NULL )
return VLC_EGENERIC;
for( const MP4_Box_t * p_string = p_udta->p_first; p_string != NULL;
p_string = p_string->p_next ) p_string = p_string->p_next )
{ {
...@@ -1622,6 +1632,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -1622,6 +1632,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{ {
if( p_string->i_type == xa9typetoextrameta[i].xa9_type ) if( p_string->i_type == xa9typetoextrameta[i].xa9_type )
{ {
assert( BOXDATA(p_string) );
char *psz_utf = strdup( BOXDATA(p_string)->psz_text ? BOXDATA(p_string)->psz_text : "" ); char *psz_utf = strdup( BOXDATA(p_string)->psz_text ? BOXDATA(p_string)->psz_text : "" );
if( psz_utf ) if( psz_utf )
{ {
......
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