[FFmpeg-devel] [PATCH 5/6] nutenc: keep track of max_pts
Michael Niedermayer
michaelni at gmx.at
Sun Aug 19 23:39:11 CEST 2012
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
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 cda0c7f..f991cae 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -860,6 +860,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;
}
--
1.7.9.5
More information about the ffmpeg-devel
mailing list