Commit 106127b6 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Vorbis: permit to return attachments too

parent fd94f73f
...@@ -578,7 +578,7 @@ static void ParseComment( demux_t *p_demux, const uint8_t *p_data, int i_data ) ...@@ -578,7 +578,7 @@ static void ParseComment( demux_t *p_demux, const uint8_t *p_data, int i_data )
if( i_data < 4 ) if( i_data < 4 )
return; return;
vorbis_ParseComment( &p_sys->p_meta, &p_data[4], i_data - 4 ); vorbis_ParseComment( &p_sys->p_meta, &p_data[4], i_data - 4, NULL, NULL );
} }
......
...@@ -1525,7 +1525,8 @@ static void Ogg_ExtractXiphMeta( demux_t *p_demux, const void *p_headers, unsign ...@@ -1525,7 +1525,8 @@ static void Ogg_ExtractXiphMeta( demux_t *p_demux, const void *p_headers, unsign
/* TODO how to handle multiple comments properly ? */ /* TODO how to handle multiple comments properly ? */
if( i_count >= 2 && pi_size[1] > i_skip ) if( i_count >= 2 && pi_size[1] > i_skip )
vorbis_ParseComment( &p_ogg->p_meta, (uint8_t*)pp_data[1] + i_skip, pi_size[1] - i_skip ); vorbis_ParseComment( &p_ogg->p_meta, (uint8_t*)pp_data[1] + i_skip, pi_size[1] - i_skip,
&p_ogg->i_attachments, &p_ogg->attachments );
for( unsigned i = 0; i < i_count; i++ ) for( unsigned i = 0; i < i_count; i++ )
free( pp_data[i] ); free( pp_data[i] );
......
...@@ -70,7 +70,8 @@ error: ...@@ -70,7 +70,8 @@ error:
return p_attachment; return p_attachment;
} }
static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_data, int i_data ) static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_data, int i_data,
int *i_attachments, input_attachment_t ***attachments)
{ {
int n; int n;
int i_comment; int i_comment;
...@@ -158,6 +159,9 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d ...@@ -158,6 +159,9 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
else IF_EXTRACT("DATE=", Date ) else IF_EXTRACT("DATE=", Date )
else if( !strncasecmp( psz, "METADATA_BLOCK_PICTURE=", strlen("METADATA_BLOCK_PICTURE="))) else if( !strncasecmp( psz, "METADATA_BLOCK_PICTURE=", strlen("METADATA_BLOCK_PICTURE=")))
{ {
if( attachments == NULL )
continue;
int i; int i;
uint8_t *p_picture; uint8_t *p_picture;
size_t i_size = vlc_b64_decode_binary( &p_picture, &psz[strlen("METADATA_BLOCK_PICTURE=")]); size_t i_size = vlc_b64_decode_binary( &p_picture, &psz[strlen("METADATA_BLOCK_PICTURE=")]);
...@@ -168,6 +172,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d ...@@ -168,6 +172,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
snprintf( psz_url, sizeof(psz_url), "attachment://%s", p_attachment->psz_name ); snprintf( psz_url, sizeof(psz_url), "attachment://%s", p_attachment->psz_name );
vlc_meta_Set( p_meta, vlc_meta_ArtworkURL, psz_url ); vlc_meta_Set( p_meta, vlc_meta_ArtworkURL, psz_url );
i_attach++; i_attach++;
TAB_APPEND( *i_attachments, *attachments, p_attachment );
} }
} }
else if( strchr( psz, '=' ) ) else if( strchr( psz, '=' ) )
......
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