From 7f7080dc73df87c9aa5b96faf99567277fc6c6eb Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 19 May 2014 20:16:01 +0200 Subject: [PATCH] avformat: add av_stream_get_end_pts() Signed-off-by: Michael Niedermayer --- doc/APIchanges | 3 +-- libavformat/avformat.h | 7 +++++++ libavformat/utils.c | 5 +++++ libavformat/version.h | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 323f773c96..6bc4ac51e4 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -32,8 +32,7 @@ API changes, most recent first: 2014-05-xx - xxxxxxx - lavf 55.17.1 - avformat.h Deprecate AVStream.pts and the AVFrac struct, which was its only use case. - Those fields were poorly defined and not meant to be public, so there is - no replacement for them. + See use av_stream_get_end_pts() 2014-05-18 - fd05602 - lavc 55.52.0 - avcodec.h Add avcodec_free_context(). From now on it should be used for freeing diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 2677c27e4d..5c07541b36 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1067,6 +1067,13 @@ typedef struct AVStream { AVRational av_stream_get_r_frame_rate(const AVStream *s); void av_stream_set_r_frame_rate(AVStream *s, AVRational r); +/** + * Returns the pts of the last muxed packet + its duration + * + * the retuned value is undefined when used with a demuxer. + */ +int64_t av_stream_get_end_pts(const AVStream *st); + #define AV_PROGRAM_RUNNING 1 /** diff --git a/libavformat/utils.c b/libavformat/utils.c index f840bc045e..8e791776fb 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -110,6 +110,11 @@ MAKE_ACCESSORS(AVFormatContext, format, int, metadata_header_padding) MAKE_ACCESSORS(AVFormatContext, format, void *, opaque) MAKE_ACCESSORS(AVFormatContext, format, av_format_control_message, control_message_cb) +int64_t av_stream_get_end_pts(const AVStream *st) +{ + return st->pts.val; +} + void av_format_inject_global_side_data(AVFormatContext *s) { int i; diff --git a/libavformat/version.h b/libavformat/version.h index 2d2ca9a0b7..37240c49cc 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFORMAT_VERSION_MAJOR 55 -#define LIBAVFORMAT_VERSION_MINOR 39 +#define LIBAVFORMAT_VERSION_MINOR 40 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \