Commit a270a72f authored by François Cartegnie's avatar François Cartegnie 🤞

demux: es: use refactored id3 parser

parent 0b9bd6f6
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "../../packetizer/dts_header.h" #include "../../packetizer/dts_header.h"
#include "../meta_engine/ID3Tag.h" #include "../meta_engine/ID3Tag.h"
#include "../meta_engine/ID3Text.h" #include "../meta_engine/ID3Text.h"
#include "../meta_engine/ID3Meta.h"
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -913,47 +914,38 @@ static int ID3TAG_Parse_Handler( uint32_t i_tag, const uint8_t *p_payload, size_ ...@@ -913,47 +914,38 @@ static int ID3TAG_Parse_Handler( uint32_t i_tag, const uint8_t *p_payload, size_
} }
else if( i_tag == VLC_FOURCC('T', 'X', 'X', 'X') ) else if( i_tag == VLC_FOURCC('T', 'X', 'X', 'X') )
{ {
char *psz_alloc; vlc_meta_t *p_meta = vlc_meta_New();
const char *psz = ID3TextConvert( p_payload, i_payload, &psz_alloc ); if( p_meta )
if( psz )
{ {
const size_t i_len = 21 + 2; bool b_updated;
if( i_len < i_payload ) if( ID3HandleTag( p_payload, i_payload, i_tag, p_meta, &b_updated ) )
{ {
if( !strcasecmp( psz, "REPLAYGAIN_TRACK_GAIN" ) ) char ** ppsz_keys = vlc_meta_CopyExtraNames( p_meta );
if( ppsz_keys )
{ {
free( psz_alloc ); for( size_t i = 0; ppsz_keys[i]; ++i )
psz = ID3TextConv( &p_payload[i_len], i_payload - i_len, {
p_payload[0], &psz_alloc ); float *pf = NULL;
if( psz ) if( !strcasecmp( ppsz_keys[i], "REPLAYGAIN_TRACK_GAIN" ) )
p_sys->rgf_replay_gain[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz ); pf = &p_sys->rgf_replay_gain[AUDIO_REPLAY_GAIN_TRACK];
} else if( !strcasecmp( ppsz_keys[i], "REPLAYGAIN_TRACK_PEAK" ) )
else if( !strcasecmp( psz, "REPLAYGAIN_TRACK_PEAK" ) ) pf = &p_sys->rgf_replay_peak[AUDIO_REPLAY_GAIN_TRACK];
{ else if( !strcasecmp( ppsz_keys[i], "REPLAYGAIN_ALBUM_GAIN" ) )
free( psz_alloc ); pf = &p_sys->rgf_replay_gain[AUDIO_REPLAY_GAIN_ALBUM];
psz = ID3TextConv( &p_payload[i_len], i_payload - i_len, else if( !strcasecmp( ppsz_keys[i], "REPLAYGAIN_ALBUM_PEAK" ) )
p_payload[0], &psz_alloc ); pf = &p_sys->rgf_replay_peak[AUDIO_REPLAY_GAIN_ALBUM];
if( psz ) if( pf )
p_sys->rgf_replay_peak[AUDIO_REPLAY_GAIN_TRACK] = us_atof( psz ); {
} const char *psz_val = vlc_meta_GetExtra( p_meta, ppsz_keys[i] );
else if( !strcasecmp( psz, "REPLAYGAIN_ALBUM_GAIN" ) ) if( psz_val )
{ *pf = us_atof( psz_val );
free( psz_alloc ); }
psz = ID3TextConv( &p_payload[i_len], i_payload - i_len, free( ppsz_keys[i] );
p_payload[0], &psz_alloc ); }
if( psz ) free( ppsz_keys );
p_sys->rgf_replay_gain[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz );
}
else if( !strcasecmp( psz, "REPLAYGAIN_ALBUM_PEAK" ) )
{
free( psz_alloc );
psz = ID3TextConv( &p_payload[i_len], i_payload - i_len,
p_payload[0], &psz_alloc );
if( psz )
p_sys->rgf_replay_peak[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( psz );
} }
} }
free( psz_alloc ); vlc_meta_Delete( p_meta );
} }
} }
......
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