[FFmpeg-cvslog] nutenc: keep track of max_pts

Michael Niedermayer git at videolan.org
Sun Aug 26 22:22:20 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Aug 19 23:34:38 2012 +0200| [b2a8ce4e6771244fe7a3a1e4c6bda4ec28775575] | committer: Michael Niedermayer

nutenc: keep track of max_pts

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2a8ce4e6771244fe7a3a1e4c6bda4ec28775575
---

 libavformat/nut.h    |    2 ++
 libavformat/nutenc.c |    5 +++++
 2 files changed, 7 insertions(+)

diff --git a/libavformat/nut.h b/libavformat/nut.h
index 2d16f3e..39743db 100644
--- a/libavformat/nut.h
+++ b/libavformat/nut.h
@@ -103,6 +103,8 @@ typedef struct {
     AVRational *time_base;
     struct AVTreeNode *syncpoints;
     int sp_count;
+    int64_t max_pts;
+    AVRational *max_pts_tb;
 } NUTContext;
 
 extern const AVCodecTag ff_nut_subtitle_tags[];
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 00f4653..97bed1e 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -863,6 +863,11 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt){
             nus->keyframe_pts[nut->sp_count] = pkt->pts;
     }
 
+    if(!nut->max_pts_tb || av_compare_ts(nut->max_pts, *nut->max_pts_tb, pkt->pts, *nus->time_base) < 0) {
+        nut->max_pts = pkt->pts;
+        nut->max_pts_tb = nus->time_base;
+    }
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list