[FFmpeg-devel] [PATCH] interpolate last pts when genpts is activated
baptiste.coudurier at gmail.com
baptiste.coudurier
Tue Jun 30 10:07:23 CEST 2009
From: bcoudurier <baptiste.coudurier at gmail.com>
---
libavformat/utils.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index fd28d1d..ced035c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -952,6 +952,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
pktl = s->packet_buffer;
if (pktl) {
AVPacket *next_pkt= &pktl->pkt;
+ int64_t max_pts = AV_NOPTS_VALUE;
if(genpts && next_pkt->dts != AV_NOPTS_VALUE){
while(pktl && next_pkt->pts == AV_NOPTS_VALUE){
@@ -961,6 +962,7 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
/*&& pktl->pkt.dts != AV_NOPTS_VALUE*/){
next_pkt->pts= pktl->pkt.dts;
}
+ max_pts = FFMAX(max_pts, pktl->pkt.pts);
pktl= pktl->next;
}
pktl = s->packet_buffer;
@@ -971,6 +973,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
|| !genpts || eof){
/* read packet from packet buffer, if there is data */
*pkt = *next_pkt;
+ if (eof && max_pts != AV_NOPTS_VALUE && pkt->duration)
+ pkt->pts = max_pts + pkt->duration;
s->packet_buffer = pktl->next;
av_free(pktl);
return 0;
--
1.6.3.3
More information about the ffmpeg-devel
mailing list