Skip to content

Commit 623f77e

Browse files
robUx4jbkempf
authored andcommitted
mkv: use a reference for the virtual_segment as we never prepare for a NULL one
it is always done after PreloadLinked() which guarantees it's not NULL assume we start at timestamp 0 on the first call Signed-off-by: Jean-Baptiste Kempf <[email protected]>
1 parent 3c670d5 commit 623f77e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

modules/demux/mkv/demux.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -771,15 +771,15 @@ void demux_sys_t::FreeUnused()
771771
}
772772
}
773773

774-
bool demux_sys_t::PreparePlayback( virtual_segment_c *p_new_vsegment, mtime_t i_mk_date )
774+
bool demux_sys_t::PreparePlayback( virtual_segment_c & new_vsegment, mtime_t i_mk_date )
775775
{
776-
if ( p_new_vsegment != NULL && p_new_vsegment != p_current_vsegment )
776+
if ( p_current_vsegment != &new_vsegment )
777777
{
778778
if ( p_current_vsegment->CurrentSegment() != NULL )
779779
p_current_vsegment->CurrentSegment()->UnSelect();
780780

781-
p_current_vsegment = p_new_vsegment;
782-
i_current_title = p_new_vsegment->i_sys_title;
781+
p_current_vsegment = &new_vsegment;
782+
i_current_title = p_current_vsegment->i_sys_title;
783783
}
784784
if( !p_current_vsegment->CurrentSegment() )
785785
return false;
@@ -804,7 +804,7 @@ void demux_sys_t::JumpTo( virtual_segment_c & vsegment, virtual_chapter_c & vcha
804804
// if the segment is not part of the current segment, select the new one
805805
if ( &vsegment != p_current_vsegment )
806806
{
807-
PreparePlayback( &vsegment, vchapter.i_mk_virtual_start_time );
807+
PreparePlayback( vsegment, vchapter.i_mk_virtual_start_time );
808808
}
809809

810810
if ( !vchapter.p_chapter || !vchapter.p_chapter->Enter( true ) )

modules/demux/mkv/demux.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ struct demux_sys_t
383383
void PreloadFamily( const matroska_segment_c & of_segment );
384384
bool PreloadLinked();
385385
void FreeUnused();
386-
bool PreparePlayback( virtual_segment_c *p_new_vsegment, mtime_t i_mk_date = 0 );
386+
bool PreparePlayback( virtual_segment_c & new_vsegment, mtime_t i_mk_date );
387387
matroska_stream_c *AnalyseAllSegmentsFound( demux_t *p_demux, EbmlStream *p_estream, bool b_initial = false );
388388
void JumpTo( virtual_segment_c & vsegment, virtual_chapter_c & vchapter );
389389

modules/demux/mkv/mkv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static int Open( vlc_object_t * p_this )
249249
msg_Warn( p_demux, "This file references other files, you may want to enable the preload of local directory");
250250

251251
if ( !p_sys->PreloadLinked() ||
252-
!p_sys->PreparePlayback( NULL ) )
252+
!p_sys->PreparePlayback( *p_sys->p_current_vsegment, 0 ) )
253253
{
254254
msg_Err( p_demux, "cannot use the segment" );
255255
goto error;

0 commit comments

Comments
 (0)