static seekpoint_t * getChapterEntry( unsigned int i_index, chapters_array_t *p_array )
{
+ if ( i_index > 4096 ) return NULL;
if ( i_index >= p_array->i_size )
{
unsigned int i_newsize = p_array->i_size;
return p_array->pp_chapters[i_index];
}
-void vorbis_ParseComment( vlc_meta_t **pp_meta,
+void vorbis_ParseComment( es_format_t *p_fmt, vlc_meta_t **pp_meta,
const uint8_t *p_data, int i_data,
int *i_attachments, input_attachment_t ***attachments,
int *i_cover_score, int *i_cover_idx,
has##var = true; \
}
+#define IF_EXTRACT_FMT(txt,var,fmt,target) \
+ IF_EXTRACT(txt,var)\
+ if( fmt && !strncasecmp(psz_comment, txt, strlen(txt)) )\
+ {\
+ if ( fmt->target ) free( fmt->target );\
+ fmt->target = strdup(&psz_comment[strlen(txt)]);\
+ }
+
IF_EXTRACT("TITLE=", Title )
else IF_EXTRACT("ARTIST=", Artist )
else IF_EXTRACT("GENRE=", Genre )
else IF_EXTRACT("COMMENTS=", Description )
else IF_EXTRACT("RATING=", Rating )
else IF_EXTRACT("DATE=", Date )
- else IF_EXTRACT("LANGUAGE=", Language )
+ else IF_EXTRACT_FMT("LANGUAGE=", Language, p_fmt, psz_language )
else IF_EXTRACT("ORGANIZATION=", Publisher )
else IF_EXTRACT("ENCODER=", EncodedBy )
else if( !strncasecmp( psz_comment, "METADATA_BLOCK_PICTURE=", strlen("METADATA_BLOCK_PICTURE=")))
char *p = strchr( psz_comment, '=' );
char *psz_val;
if (!p) continue;
- if ( !strncmp(psz_comment, "REPLAYGAIN_TRACK_GAIN=", 22) )
+ if ( !strncasecmp(psz_comment, "REPLAYGAIN_TRACK_GAIN=", 22) )
{
psz_val = malloc( strlen(p+1) + 1 );
if (!psz_val) continue;
free( psz_val );
}
}
- else if ( !strncmp(psz_comment, "REPLAYGAIN_ALBUM_GAIN=", 22) )
+ else if ( !strncasecmp(psz_comment, "REPLAYGAIN_ALBUM_GAIN=", 22) )
{
psz_val = malloc( strlen(p+1) + 1 );
if (!psz_val) continue;
free( psz_val );
}
}
- else if ( !strncmp(psz_comment, "REPLAYGAIN_ALBUM_PEAK=", 22) )
+ else if ( !strncasecmp(psz_comment, "REPLAYGAIN_ALBUM_PEAK=", 22) )
{
(*ppf_replay_peak)[AUDIO_REPLAY_GAIN_ALBUM] = us_atof( ++p );
}
- else if ( !strncmp(psz_comment, "REPLAYGAIN_TRACK_PEAK=", 22) )
+ else if ( !strncasecmp(psz_comment, "REPLAYGAIN_TRACK_PEAK=", 22) )
{
(*ppf_replay_peak)[AUDIO_REPLAY_GAIN_TRACK] = us_atof( ++p );
}
{
unsigned int i_chapt;
seekpoint_t *p_seekpoint = NULL;
- if( strcasestr( psz_comment, "NAME=" ) &&
- ( sscanf( psz_comment, "CHAPTER%uNAME=", &i_chapt ) == 1 ||
- sscanf( psz_comment, "chapter%name=", &i_chapt ) == 1 ) )
+
+ for( int i = 0; psz_comment[i] && psz_comment[i] != '='; i++ )
+ if( psz_comment[i] >= 'a' && psz_comment[i] <= 'z' )
+ psz_comment[i] -= 'a' - 'A';
+
+ if( strstr( psz_comment, "NAME=" ) &&
+ sscanf( psz_comment, "CHAPTER%uNAME=", &i_chapt ) == 1 )
{
char *p = strchr( psz_comment, '=' );
p_seekpoint = getChapterEntry( i_chapt, &chapters_array );
if ( ! p_seekpoint->psz_name )
p_seekpoint->psz_name = strdup( ++p );
}
- else if( sscanf( psz_comment, "CHAPTER%u=", &i_chapt ) == 1 ||
- sscanf( psz_comment, "chapter%u=", &i_chapt ) == 1 )
+ else if( sscanf( psz_comment, "CHAPTER%u=", &i_chapt ) == 1 )
{
unsigned int h, m, s, ms;
char *p = strchr( psz_comment, '=' );