[FFmpeg-cvslog] avformat/utils: Compute the current pts of mpeg1/2 I/ P frames from the next frame when available
Michael Niedermayer
git at videolan.org
Tue Dec 9 04:03:31 CET 2014
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 9 03:34:20 2014 +0100| [dd70470d72758b4e94b17c6808a5ed0c9e8fe097] | committer: Michael Niedermayer
avformat/utils: Compute the current pts of mpeg1/2 I/P frames from the next frame when available
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dd70470d72758b4e94b17c6808a5ed0c9e8fe097
---
libavformat/utils.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f70223b..3246da6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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
More information about the ffmpeg-cvslog
mailing list