From: Steinar Gunderson Date: Sat, 25 Sep 2010 17:41:43 +0000 (+0200) Subject: On DEMUX_GET_TIME, return the last pts as opposed to mdate(). X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4985b5ca7ae3384efc65a15f520f3b8a76792ebe;p=vlc On DEMUX_GET_TIME, return the last pts as opposed to mdate(). --- diff --git a/modules/access/sdi.cpp b/modules/access/sdi.cpp index 61bb92ac85..b9329e84fc 100644 --- a/modules/access/sdi.cpp +++ b/modules/access/sdi.cpp @@ -110,6 +110,7 @@ struct demux_sys_t es_out_id_t *p_video_es; es_out_id_t *p_audio_es; bool b_first_frame; + int i_last_pts; int i_width, i_height, i_fps_num, i_fps_den; uint32_t i_dominance_flags; @@ -617,6 +618,7 @@ static void Close( vlc_object_t *p_this ) static int Control( demux_t *p_demux, int i_query, va_list args ) { + demux_sys_t *p_sys = p_demux->p_sys; bool *pb; int64_t *pi64; @@ -637,7 +639,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) case DEMUX_GET_TIME: pi64 = (int64_t*)va_arg( args, int64_t * ); - *pi64 = mdate(); /* FIXME */ + *pi64 = p_sys->i_last_pts; return VLC_SUCCESS; /* TODO implement others */ @@ -669,12 +671,16 @@ static int Demux( demux_t *p_demux ) if( p_video_block ) { + if( p_video_block->i_pts > p_sys->i_last_pts ) + p_sys->i_last_pts = p_video_block->i_pts; es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_video_block->i_pts ); es_out_Send( p_demux->out, p_sys->p_video_es, p_video_block ); } if( p_audio_block ) { + if( p_audio_block->i_pts > p_sys->i_last_pts ) + p_sys->i_last_pts = p_audio_block->i_pts; es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_audio_block->i_pts ); es_out_Send( p_demux->out, p_sys->p_audio_es, p_audio_block ); }