ep = new EbmlParser( &es, segment, &sys.demuxer,
var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
cluster = NULL;
- sys.i_start_pts = 0;
- sys.i_pts = 0;
- sys.i_pcr = 0;
+ sys.i_start_pts = VLC_TS_0;
+ sys.i_pts = VLC_TS_INVALID;
+ sys.i_pcr = VLC_TS_0;
return;
}
var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
cluster = NULL;
- sys.i_start_pts = i_date;
+ sys.i_start_pts = i_date + VLC_TS_0;
/* now parse until key frame */
const int es_types[3] = { VIDEO_ES, AUDIO_ES, SPU_ES };
/*Neither video nor audio track... no seek further*/
if( unlikely( !p_first ) )
{
- es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, i_date );
+ es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, i_date + VLC_TS_0 );
es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_date );
return;
}
if( p_last->i_date < p_min->i_date )
p_min = p_last;
- sys.i_pcr = sys.i_pts = p_min->i_date;
- es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, VLC_TS_0 + sys.i_pcr );
+ sys.i_pcr = sys.i_pts = p_min->i_date + VLC_TS_0;
+ es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, sys.i_pcr );
es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_date );
cluster = (KaxCluster *) ep->UnGet( p_min->i_seek_pos, p_min->i_cluster_pos );
}
es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_start_time );
- sys.i_start_pts = i_start_time;
+ sys.i_start_pts = i_start_time + VLC_TS_0;
// reset the stream reading to the first cluster of the segment used
es.I_O().setFilePointer( i_start_pos );
{
/* TODO handle successive chapters with the same user_start_time/user_end_time
*/
- p_sys->i_pts = p_chap->i_virtual_stop_time;
+ p_sys->i_pts = p_chap->i_virtual_stop_time + VLC_TS_0;
p_sys->i_pts++; // trick to avoid staying on segments with no duration and no content
i_return = 1;
}
if( simpleblock != NULL )
- p_sys->i_pts = p_sys->i_chapter_time + ( (mtime_t)simpleblock->GlobalTimecode() / INT64_C(1000) );
+ p_sys->i_pts = (mtime_t)simpleblock->GlobalTimecode() / INT64_C(1000);
else
- p_sys->i_pts = p_sys->i_chapter_time + ( (mtime_t)block->GlobalTimecode() / INT64_C(1000) );
+ p_sys->i_pts = (mtime_t)block->GlobalTimecode() / INT64_C(1000);
+ p_sys->i_pts += p_sys->i_chapter_time + VLC_TS_0;
mtime_t i_pcr = VLC_TS_INVALID;
for( size_t i = 0; i < p_segment->tracks.size(); i++)
bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux )
{
demux_sys_t & sys = *demux.p_sys;
- virtual_chapter_c *p_cur_chapter;
+ virtual_chapter_c *p_cur_chapter = NULL;
virtual_edition_c * p_cur_edition = editions[ i_current_edition ];
bool b_has_seeked = false;
- p_cur_chapter = p_cur_edition->getChapterbyTimecode( sys.i_pts );
+ if ( sys.i_pts != VLC_TS_INVALID )
+ p_cur_chapter = p_cur_edition->getChapterbyTimecode( sys.i_pts - VLC_TS_0 );
/* we have moved to a new chapter */
if ( p_cur_chapter != NULL && p_current_chapter != p_cur_chapter )
return true;
}
}
- sys.i_start_pts = p_cur_chapter->i_virtual_start_time;;
+ sys.i_start_pts = p_cur_chapter->i_virtual_start_time + VLC_TS_0;
}
p_current_chapter = p_cur_chapter;