Commit cb31dc35 authored by Steve Lhomme's avatar Steve Lhomme

mkv.cpp: clean & fix seeking inside virtual_segment_t

parent 164b14f0
...@@ -1569,11 +1569,12 @@ bool matroska_segment_t::Select( mtime_t i_start_time ) ...@@ -1569,11 +1569,12 @@ bool matroska_segment_t::Select( mtime_t i_start_time )
} }
sys.i_start_pts = i_start_time; sys.i_start_pts = i_start_time;
ep->Reset( &sys.demuxer );
// reset the stream reading to the first cluster of the segment used // reset the stream reading to the first cluster of the segment used
es.I_O().setFilePointer( i_start_pos ); es.I_O().setFilePointer( i_start_pos );
delete ep;
ep = new EbmlParser( &es, segment, &sys.demuxer );
return true; return true;
} }
...@@ -1591,6 +1592,8 @@ void matroska_segment_t::UnSelect( ) ...@@ -1591,6 +1592,8 @@ void matroska_segment_t::UnSelect( )
} }
#undef tk #undef tk
} }
delete ep;
ep = NULL;
} }
bool virtual_segment_t::Select( input_title_t & title ) bool virtual_segment_t::Select( input_title_t & title )
...@@ -3678,12 +3681,12 @@ void matroska_segment_t::Seek( mtime_t i_date, mtime_t i_time_offset ) ...@@ -3678,12 +3681,12 @@ void matroska_segment_t::Seek( mtime_t i_date, mtime_t i_time_offset )
msg_Dbg( &sys.demuxer, "seek got "I64Fd" (%d%%)", msg_Dbg( &sys.demuxer, "seek got "I64Fd" (%d%%)",
i_seek_time, (int)( 100 * i_seek_position / stream_Size( sys.demuxer.s ) ) ); i_seek_time, (int)( 100 * i_seek_position / stream_Size( sys.demuxer.s ) ) );
es.I_O().setFilePointer( i_seek_position, seek_beginning );
delete ep; delete ep;
ep = new EbmlParser( &es, segment, &sys.demuxer ); ep = new EbmlParser( &es, segment, &sys.demuxer );
cluster = NULL; cluster = NULL;
es.I_O().setFilePointer( i_seek_position, seek_beginning );
sys.i_start_pts = i_date; sys.i_start_pts = i_date;
es_out_Control( sys.demuxer.out, ES_OUT_RESET_PCR ); es_out_Control( sys.demuxer.out, ES_OUT_RESET_PCR );
......
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