Commit 531f8a29 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Jean-Baptiste Kempf

dshow: fix timestamp conversion (fixes #11725)

Zero is a legal REFERENCE_TIME value.

(cherry picked from commit dddf319b0bd8b7d04881497f18aab57b04ae437c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 54142142
...@@ -1885,9 +1885,7 @@ static int Demux( demux_t *p_demux ) ...@@ -1885,9 +1885,7 @@ static int Demux( demux_t *p_demux )
REFERENCE_TIME i_pts, i_end_date; REFERENCE_TIME i_pts, i_end_date;
HRESULT hr = sample.p_sample->GetTime( &i_pts, &i_end_date ); HRESULT hr = sample.p_sample->GetTime( &i_pts, &i_end_date );
if( hr != VFW_S_NO_STOP_TIME && hr != S_OK ) i_pts = 0; if( hr == S_OK || hr == VFW_S_NO_STOP_TIME )
if( !i_pts )
{ {
if( p_stream->mt.majortype == MEDIATYPE_Video || !p_stream->b_pts ) if( p_stream->mt.majortype == MEDIATYPE_Video || !p_stream->b_pts )
{ {
...@@ -1895,10 +1893,12 @@ static int Demux( demux_t *p_demux ) ...@@ -1895,10 +1893,12 @@ static int Demux( demux_t *p_demux )
i_pts = sample.i_timestamp; i_pts = sample.i_timestamp;
p_stream->b_pts = true; p_stream->b_pts = true;
} }
i_pts += (i_pts >= 0) ? +5 : -5;
i_pts /= 10; /* 100-ns to µs conversion */
i_pts += VLC_TS_0;
} }
else
i_pts /= 10; /* Dshow works with 100 nano-seconds resolution */ i_pts = VLC_TS_INVALID;
#if 0 #if 0
msg_Dbg( p_demux, "Read() stream: %i, size: %i, PTS: %"PRId64, msg_Dbg( p_demux, "Read() stream: %i, size: %i, PTS: %"PRId64,
i_stream, i_data_size, i_pts ); i_stream, i_data_size, i_pts );
...@@ -1909,7 +1909,8 @@ static int Demux( demux_t *p_demux ) ...@@ -1909,7 +1909,8 @@ static int Demux( demux_t *p_demux )
p_block->i_pts = p_block->i_dts = i_pts; p_block->i_pts = p_block->i_dts = i_pts;
sample.p_sample->Release(); sample.p_sample->Release();
es_out_Control( p_demux->out, ES_OUT_SET_PCR, i_pts > 0 ? i_pts : 0 ); if( i_pts > VLC_TS_INVALID )
es_out_Control( p_demux->out, ES_OUT_SET_PCR, i_pts );
es_out_Send( p_demux->out, p_stream->p_es, p_block ); es_out_Send( p_demux->out, p_stream->p_es, p_block );
i_samples--; i_samples--;
......
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