Commit a76a1d04 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Vobsub: language is not necessarily on 2 characters

This fixes quite a few .idx samples that didn't work before.
parent b44e5fa2
...@@ -519,25 +519,25 @@ static int ParseVobSubIDX( demux_t *p_demux ) ...@@ -519,25 +519,25 @@ static int ParseVobSubIDX( demux_t *p_demux )
} }
else if( !strncmp( "id:", line, 3 ) ) else if( !strncmp( "id:", line, 3 ) )
{ {
char language[3]; char language[33]; /* Usually 2 or 3 letters, sometimes more.
Spec (or lack of) doesn't define any limit */
int i_track_id; int i_track_id;
es_format_t fmt; es_format_t fmt;
/* Lets start a new track */ /* Lets start a new track */
if( sscanf( line, "id: %2s, index: %d", if( sscanf( line, "id: %32[^ ,], index: %d",
language, &i_track_id ) == 2 ) language, &i_track_id ) == 2 )
{ {
p_sys->i_tracks++; p_sys->i_tracks++;
p_sys->track = xrealloc( p_sys->track, p_sys->track = xrealloc( p_sys->track,
sizeof( vobsub_track_t ) * (p_sys->i_tracks + 1 ) ); sizeof( vobsub_track_t ) * (p_sys->i_tracks + 1 ) );
language[2] = '\0';
/* Init the track */ /* Init the track */
current_tk = &p_sys->track[p_sys->i_tracks - 1]; current_tk = &p_sys->track[p_sys->i_tracks - 1];
memset( current_tk, 0, sizeof( vobsub_track_t ) ); memset( current_tk, 0, sizeof( vobsub_track_t ) );
current_tk->i_current_subtitle = 0; current_tk->i_current_subtitle = 0;
current_tk->i_subtitles = 0; current_tk->i_subtitles = 0;
current_tk->p_subtitles = xmalloc( sizeof( subtitle_t ) );; current_tk->p_subtitles = xmalloc( sizeof( subtitle_t ) );
current_tk->i_track_id = i_track_id; current_tk->i_track_id = i_track_id;
current_tk->i_delay = (int64_t)0; current_tk->i_delay = (int64_t)0;
......
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