Commit 4bdcec38 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Vorbis: cosmetics

parent 065f6bb1
...@@ -119,7 +119,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d ...@@ -119,7 +119,7 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
for( ; i_comment > 0; i_comment-- ) for( ; i_comment > 0; i_comment-- )
{ {
char *psz; char *psz_comment;
if( i_data < 4 ) if( i_data < 4 )
break; break;
n = GetDWLE(p_data); RM(4); n = GetDWLE(p_data); RM(4);
...@@ -128,25 +128,25 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d ...@@ -128,25 +128,25 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
if( n <= 0 ) if( n <= 0 )
continue; continue;
psz = strndup( (const char*)p_data, n ); psz_comment = strndup( (const char*)p_data, n );
RM(n); RM(n);
EnsureUTF8( psz ); EnsureUTF8( psz_comment );
#define IF_EXTRACT(txt,var) \ #define IF_EXTRACT(txt,var) \
if( !strncasecmp(psz, txt, strlen(txt)) ) \ if( !strncasecmp(psz_comment, txt, strlen(txt)) ) \
{ \ { \
const char *oldval = vlc_meta_Get( p_meta, vlc_meta_ ## var ); \ const char *oldval = vlc_meta_Get( p_meta, vlc_meta_ ## var ); \
if( oldval && has##var) \ if( oldval && has##var) \
{ \ { \
char * newval; \ char * newval; \
if( asprintf( &newval, "%s,%s", oldval, &psz[strlen(txt)] ) == -1 ) \ if( asprintf( &newval, "%s,%s", oldval, &psz_comment[strlen(txt)] ) == -1 ) \
newval = NULL; \ newval = NULL; \
vlc_meta_Set( p_meta, vlc_meta_ ## var, newval ); \ vlc_meta_Set( p_meta, vlc_meta_ ## var, newval ); \
free( newval ); \ free( newval ); \
} \ } \
else \ else \
vlc_meta_Set( p_meta, vlc_meta_ ## var, &psz[strlen(txt)] ); \ vlc_meta_Set( p_meta, vlc_meta_ ## var, &psz_comment[strlen(txt)] ); \
has##var = true; \ has##var = true; \
} }
IF_EXTRACT("TITLE=", Title ) IF_EXTRACT("TITLE=", Title )
...@@ -164,14 +164,14 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d ...@@ -164,14 +164,14 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
} }
else IF_EXTRACT("GENRE=", Genre ) else IF_EXTRACT("GENRE=", Genre )
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_comment, "METADATA_BLOCK_PICTURE=", strlen("METADATA_BLOCK_PICTURE=")))
{ {
if( attachments == NULL ) if( attachments == NULL )
continue; 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_comment[strlen("METADATA_BLOCK_PICTURE=")]);
input_attachment_t *p_attachment = ParseFlacPicture( p_picture, i_size, i_attach, &i ); input_attachment_t *p_attachment = ParseFlacPicture( p_picture, i_size, i_attach, &i );
if( p_attachment ) if( p_attachment )
{ {
...@@ -183,16 +183,16 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d ...@@ -183,16 +183,16 @@ static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_d
*i_attachments, *attachments, p_attachment ); *i_attachments, *attachments, p_attachment );
} }
} }
else if( strchr( psz, '=' ) ) else if( strchr( psz_comment, '=' ) )
{ {
/* generic (PERFORMER/LICENSE/ORGANIZATION/LOCATION/CONTACT/ISRC, /* generic (PERFORMER/LICENSE/ORGANIZATION/LOCATION/CONTACT/ISRC,
* undocumented tags and replay gain ) */ * undocumented tags and replay gain ) */
char *p = strchr( psz, '=' ); char *p = strchr( psz_comment, '=' );
*p++ = '\0'; *p++ = '\0';
vlc_meta_AddExtra( p_meta, psz, p ); vlc_meta_AddExtra( p_meta, psz_comment, p );
} }
#undef IF_EXTRACT #undef IF_EXTRACT
free( psz ); free( psz_comment );
} }
#undef RM #undef RM
} }
......
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