[vlc-commits] meta: ID3: load replaygain into meta
Francois Cartegnie
git at videolan.org
Mon May 29 20:33:43 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon May 29 19:48:19 2017 +0200| [0b9bd6f694b497d07a6007e198e61ecdd29091c2] | committer: Francois Cartegnie
meta: ID3: load replaygain into meta
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0b9bd6f694b497d07a6007e198e61ecdd29091c2
---
modules/meta_engine/ID3Meta.h | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/modules/meta_engine/ID3Meta.h b/modules/meta_engine/ID3Meta.h
index d35e370919..90aa24f7b9 100644
--- a/modules/meta_engine/ID3Meta.h
+++ b/modules/meta_engine/ID3Meta.h
@@ -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;
}
More information about the vlc-commits
mailing list