Commit 1a206bf5 authored by Steve Lhomme's avatar Steve Lhomme

mkv.cpp: handle seeking the way it's supposed to work (in the future)

parent 70944c2a
...@@ -1087,9 +1087,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -1087,9 +1087,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_POSITION: case DEMUX_GET_POSITION:
pf = (double*)va_arg( args, double * ); pf = (double*)va_arg( args, double * );
if (p_sys->i_pts < p_sys->i_start_pts) /* if (p_sys->i_pts < p_sys->i_start_pts)
*pf = (double)p_sys->i_start_pts / (1000.0 * p_sys->f_duration); *pf = (double)p_sys->i_start_pts / (1000.0 * p_sys->f_duration);
else else*/
*pf = (double)p_sys->i_pts / (1000.0 * p_sys->f_duration); *pf = (double)p_sys->i_pts / (1000.0 * p_sys->f_duration);
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -1100,9 +1100,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -1100,9 +1100,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * ); pi64 = (int64_t*)va_arg( args, int64_t * );
if (p_sys->i_pts < p_sys->i_start_pts) /* if (p_sys->i_pts < p_sys->i_start_pts)
*pi64 = p_sys->i_start_pts; *pi64 = p_sys->i_start_pts;
else else*/
*pi64 = p_sys->i_pts; *pi64 = p_sys->i_pts;
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -1312,6 +1312,10 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts, ...@@ -1312,6 +1312,10 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
msg_Err( p_demux, "unknown track number=%d", block->TrackNum() ); msg_Err( p_demux, "unknown track number=%d", block->TrackNum() );
return; return;
} }
if( i_pts < p_sys->i_start_pts && tk.fmt.i_cat == AUDIO_ES )
{
return; /* discard audio packets that shouldn't be rendered */
}
es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk.p_es, &b ); es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk.p_es, &b );
if( !b ) if( !b )
...@@ -1351,11 +1355,12 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts, ...@@ -1351,11 +1355,12 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
} }
#endif #endif
/* if (p_sys->i_start_pts > i_pts) if (p_sys->i_start_pts > i_pts)
{ {
p_block->i_dts = p_block->i_pts = -1; p_block->i_dts = 0;
p_block->i_pts = -1;
} }
else*/ else
if( tk.fmt.i_cat != VIDEO_ES ) if( tk.fmt.i_cat != VIDEO_ES )
{ {
p_block->i_dts = p_block->i_pts = i_pts; p_block->i_dts = p_block->i_pts = i_pts;
...@@ -1500,6 +1505,8 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent) ...@@ -1500,6 +1505,8 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent)
p_sys->i_start_pts = i_date; p_sys->i_start_pts = i_date;
es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
while( i_track_skipping > 0 ) while( i_track_skipping > 0 )
{ {
if( BlockGet( p_demux, &block, &i_block_ref1, &i_block_ref2, &i_block_duration ) ) if( BlockGet( p_demux, &block, &i_block_ref1, &i_block_ref2, &i_block_duration ) )
...@@ -1531,7 +1538,6 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent) ...@@ -1531,7 +1538,6 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent)
if( !tk.b_search_keyframe ) if( !tk.b_search_keyframe )
{ {
BlockDecode( p_demux, block, 0, 0 ); BlockDecode( p_demux, block, 0, 0 );
/* es_out_Control( p_demux->out, ES_OUT_SET_PCR, block->GlobalTimecode() / (mtime_t) 1000 );*/
} }
} }
} }
......
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