uint64_t i_default_duration;
float f_timecodescale;
+ mtime_t i_last_dts;
/* video */
es_format_t fmt;
demux_sys_t( demux_t & demux )
:demuxer(demux)
,i_pts(0)
- ,i_last_dts(0)
,i_start_pts(0)
,i_chapter_time(0)
,meta(NULL)
demux_t & demuxer;
mtime_t i_pts;
- mtime_t i_last_dts;
mtime_t i_start_pts;
mtime_t i_chapter_time;
}
static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
- mtime_t i_duration )
+ mtime_t i_duration, bool f_unreferenced )
{
demux_sys_t *p_sys = p_demux->p_sys;
matroska_segment_c *p_segment = p_sys->p_current_segment->Segment();
{
if( !strcmp( tk->psz_codec, "V_MS/VFW/FOURCC" ) )
{
+ // in VFW we have no idea about B frames
p_block->i_pts = 0;
+ p_block->i_dts = i_pts;
}
else
{
p_block->i_pts = i_pts;
+ if ( f_unreferenced )
+ p_block->i_dts = p_block->i_pts;
+ else
+ p_block->i_dts = min( i_pts, tk->i_last_dts + (tk->i_default_duration >> 10));
+ p_sys->i_pts = p_block->i_dts;
}
- p_block->i_dts = p_sys->i_pts;
}
+ tk->i_last_dts = p_block->i_dts;
#if 0
msg_Dbg( p_demux, "block i_dts: "I64Fd" / i_pts: "I64Fd, p_block->i_dts, p_block->i_pts);
p_block->i_length = i_duration * 1000;
}
+ if( p_sys->i_pts >= p_sys->i_start_pts )
+ {
+ es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_pts );
+ }
+
es_out_Send( p_demux->out, tk->p_es, p_block );
/* use time stamp only for first block */
if ( p_chap->i_user_start_time == p_chap->i_user_start_time )
p_vsegment->SelectNext();
*/
- p_sys->i_last_dts = p_sys->i_pts = p_chap->i_user_end_time;
+ p_sys->i_pts = p_chap->i_user_end_time;
p_sys->i_pts++; // trick to avoid staying on segments with no duration and no content
i_return = 1;
}
}
- mtime_t i_pts, i_dts;
-
- mtime_t i_time = block->GlobalTimecode();
- if ( i_block_ref1 != 0 )
- i_time += min( 0, i_block_ref1 );
- if ( i_block_ref2 != 0 )
- i_time += min( 0, i_block_ref2 );
-
- i_pts = (p_sys->i_chapter_time + block->GlobalTimecode()) / (mtime_t) 1000;
- i_dts = (p_sys->i_chapter_time + i_time) / (mtime_t) 1000;
-
- if ( i_dts != i_pts && p_sys->i_last_dts >= i_dts )
- p_sys->i_last_dts += 200;
- else
- p_sys->i_last_dts = i_dts;
-
- p_sys->i_pts = i_pts;
+ p_sys->i_pts = (p_sys->i_chapter_time + block->GlobalTimecode()) / (mtime_t) 1000;
if( p_sys->i_pts >= p_sys->i_start_pts )
- {
- es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_pts );
- }
-
- if( i_pts >= p_sys->i_start_pts )
if ( p_vsegment->UpdateCurrentToChapter( *p_demux ) )
{
i_return = 1;
continue;
}
- BlockDecode( p_demux, block, i_pts, i_block_duration );
+ BlockDecode( p_demux, block, p_sys->i_pts, i_block_duration, i_block_ref1 >= 0 || i_block_ref2 > 0 );
delete block;
i_block_count++;
}
}
- sys.i_last_dts = sys.i_pts = (sys.i_chapter_time + block->GlobalTimecode()) / (mtime_t) 1000;
+ sys.i_pts = (sys.i_chapter_time + block->GlobalTimecode()) / (mtime_t) 1000;
if( i_track < tracks.size() )
{
}
if( !tracks[i_track]->b_search_keyframe )
{
- BlockDecode( &sys.demuxer, block, sys.i_pts, 0 );
+ BlockDecode( &sys.demuxer, block, sys.i_pts, 0, i_block_ref1 >= 0 || i_block_ref2 > 0 );
}
}
}