[FFmpeg-devel] [PATCH 1/2] avformat: add av_stream_get_end_pts()

Michael Niedermayer michaelni at gmx.at
Mon May 19 20:45:46 CEST 2014


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 doc/APIchanges         |    3 +--
 libavformat/avformat.h |    7 +++++++
 libavformat/utils.c    |    5 +++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 4fd30de..8623dbb 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -25,8 +25,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 09870d1..e4f5f0b 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 6454421..119a66d 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;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list