From 30d2459dc5f746b331f99487bb186256dc0552c7 Mon Sep 17 00:00:00 2001 From: David Flynn Date: Sat, 23 Aug 2008 22:12:38 +0100 Subject: [PATCH] [demux/avi] Enable dirac support (Set PTS on first output block) It is possible for a decoder to interpolate all the PTS values at its output (They are in order and it knows the frame rate). However, an initial offset is required. Demuxers which only provide DTS (such as AVI) do not provide the initial offset. Enable setting PTS=DTS on the first block output from the demux. NB, this isn't actually correct, it assumes the first PTS=DTS, which is often not the case. For most MPEG2 style gops this should be ok, however a sequence that starts with a reordered picture will cause problems. It isn't trivial to determine the initial offset between PTS and DTS. UNTESTED WITH OTHER CODECS --- modules/demux/avi/avi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index eb7cbfbb86..cbbb211438 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -113,6 +113,7 @@ typedef struct typedef struct { bool b_activated; + bool b_donefirst_pts; unsigned int i_cat; /* AUDIO_ES, VIDEO_ES */ vlc_fourcc_t i_codec; @@ -1147,7 +1148,10 @@ static int Demux_Seekable( demux_t *p_demux ) else { p_frame->i_dts = p_frame->i_pts; - p_frame->i_pts = 0; + if (tk->b_donefirst_pts) + p_frame->i_pts = 0; + else + tk->b_donefirst_pts = 1; } //p_pes->i_rate = p_demux->stream.control.i_rate; @@ -1265,7 +1269,10 @@ static int Demux_UnSeekable( demux_t *p_demux ) else { p_frame->i_dts = p_frame->i_pts; - p_frame->i_pts = 0; + if (p_stream_master->b_donefirst_pts) + p_frame->i_pts = 0; + else + p_stream_master->b_donefirst_pts = 1; } //p_pes->i_rate = p_demux->stream.control.i_rate; -- 2.11.4.GIT