Commit 0b9bd6f6 authored by François Cartegnie's avatar François Cartegnie 🤞

meta: ID3: load replaygain into meta

parent df437c07
......@@ -100,7 +100,37 @@ static bool ID3HandleTag( const uint8_t *p_buf, size_t i_buf,
uint32_t i_tag,
vlc_meta_t *p_meta, bool *pb_updated )
{
if( ((const char *) &i_tag)[0] == 'T' )
if( i_tag == VLC_FOURCC('W', 'X', 'X', 'X') )
{
return ID3LinkFrameTagHandler( p_buf, i_buf, p_meta, pb_updated );
}
else if( i_tag == VLC_FOURCC('T', 'X', 'X', 'X') )
{
char *psz_key_alloc;
const char *psz_key = ID3TextConvert( p_buf, i_buf, &psz_key_alloc );
if( psz_key )
{
const size_t i_len = strlen( psz_key ) + 2;
if( i_len < i_buf )
{
/* Only set those which are known as non binary */
if( !strncasecmp( psz_key, "REPLAYGAIN_", 11 ) )
{
char *psz_val_alloc;
const char *psz_val = ID3TextConv( &p_buf[i_len], i_buf - i_len,
p_buf[0], &psz_val_alloc );
if( psz_val )
{
vlc_meta_AddExtra( p_meta, psz_key, psz_val );
free( psz_val_alloc );
}
}
}
free( psz_key_alloc );
return (vlc_meta_GetExtraCount( p_meta ) > 0);
}
}
else if ( ((const char *) &i_tag)[0] == 'T' )
{
for( size_t i=0; i<ARRAY_SIZE(ID3_tag_to_metatype); i++ )
{
......@@ -111,10 +141,6 @@ static bool ID3HandleTag( const uint8_t *p_buf, size_t i_buf,
p_meta, pb_updated );
}
}
else if( i_tag == VLC_FOURCC('W', 'X', 'X', 'X') )
{
return ID3LinkFrameTagHandler( p_buf, i_buf, p_meta, pb_updated );
}
return false;
}
......
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