summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-19 23:34:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-26 22:15:20 +0200
commitb2a8ce4e6771244fe7a3a1e4c6bda4ec28775575 (patch)
tree6acadef6690d1081508d5c5e555155b3f9f21013
parentc2a134c66c857300ec5ebdcec8ba85d498ad1e63 (diff)
nutenc: keep track of max_pts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/nut.h2
-rw-r--r--libavformat/nutenc.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/nut.h b/libavformat/nut.h
index 2d16f3e469..39743db1b3 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 00f4653f09..97bed1ef1d 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;
}