Browse Source

avformat/utils: Compute the current pts of mpeg1/2 I/P frames from the next frame when available

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.6
Michael Niedermayer 11 years ago
parent
commit
dd70470d72
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      libavformat/utils.c

+ 8
- 0
libavformat/utils.c View File

@@ -1102,6 +1102,14 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
st->last_IP_duration = pkt->duration;
if (pkt->dts != AV_NOPTS_VALUE)
st->cur_dts = pkt->dts + st->last_IP_duration;
if (pkt->dts != AV_NOPTS_VALUE &&
pkt->pts == AV_NOPTS_VALUE &&
st->last_IP_duration > 0 &&
(st->cur_dts - next_dts) <= 1 &&
next_dts != next_pts &&
next_pts != AV_NOPTS_VALUE)
pkt->pts = next_dts;

st->last_IP_duration = pkt->duration;
st->last_IP_pts = pkt->pts;
/* Cannot compute PTS if not present (we can compute it only


Loading…
Cancel
Save