Commit 779e24dc authored by Denis Charmet's avatar Denis Charmet Committed by Jean-Baptiste Kempf

Fix seek in mka

Fix #6078
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
(cherry picked from commit 7098f402)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3543efbf
......@@ -690,6 +690,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
mtime_t i_pts = 0;
spoint *p_first = NULL;
spoint *p_last = NULL;
int i_cat;
if( i_global_position >= 0 )
{
......@@ -772,9 +773,12 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_date );
/* now parse until key frame */
const int es[3] = { VIDEO_ES, AUDIO_ES, SPU_ES };
for( int i = 0, i_cat = es[0]; i < 2; i_cat = es[++i] )
{
for( i_track = 0; i_track < tracks.size(); i_track++ )
{
if( tracks[i_track]->fmt.i_cat == VIDEO_ES )
if( tracks[i_track]->fmt.i_cat == i_cat )
{
spoint * seekpoint = new spoint(i_track, i_seek_time, i_seek_position, i_seek_position);
if( unlikely( !seekpoint ) )
......@@ -799,6 +803,12 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
}
}
}
if( likely( p_first ) )
break;
}
/*Neither video nor audio track... no seek further*/
if( unlikely( !p_first ) )
return;
while( i_pts < i_date )
{
......@@ -825,7 +835,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
i_pts = sys.i_chapter_time + block->GlobalTimecode() / (mtime_t) 1000;
if( i_track < tracks.size() )
{
if( tracks[i_track]->fmt.i_cat == VIDEO_ES && b_key_picture )
if( tracks[i_track]->fmt.i_cat == i_cat && b_key_picture )
{
/* get the seekpoint */
spoint * sp;
......
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