diff mbox series

[FFmpeg-devel,1/3] lavfi/buffersink: add av_buffersink_get_pts().

Message ID 20200625183518.1217406-1-george@nsup.org
State New
Headers show
Series [FFmpeg-devel,1/3] lavfi/buffersink: add av_buffersink_get_pts().
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Nicolas George June 25, 2020, 6:35 p.m. UTC
TODO APIChange & bump

Signed-off-by: Nicolas George <george@nsup.org>
---
 libavfilter/buffersink.c | 5 +++++
 libavfilter/buffersink.h | 5 +++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 76a46f6678..c65a5051a4 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -125,6 +125,11 @@  int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx,
     return get_frame_internal(ctx, frame, 0, nb_samples);
 }
 
+int64_t av_buffersink_get_pts(AVFilterContext *ctx)
+{
+    return ctx->inputs[0]->current_pts;
+}
+
 #if FF_API_NEXT
 AVBufferSinkParams *av_buffersink_params_alloc(void)
 {
diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index 2ec821c685..b3e3cc0f29 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -59,6 +59,11 @@  int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flag
  */
 #define AV_BUFFERSINK_FLAG_NO_REQUEST 2
 
+/**
+ * Get the current PTS, i.e. the PTS of the last frame or the end of stream.
+ */
+int64_t av_buffersink_get_pts(AVFilterContext *ctx);
+
 #if FF_API_NEXT
 /**
  * Struct to use for initializing a buffersink context.