From 6707d970c04177bbda9057a1d5609d23739552c5 Mon Sep 17 00:00:00 2001 From: James Almer Date: Mon, 25 Mar 2024 09:32:16 -0300 Subject: [PATCH] avfilter/buffersink: add av_buffersink_get_side_data() This will be used to get global side data that was propagated through the filterchain. Signed-off-by: James Almer --- doc/APIchanges | 3 +++ libavfilter/buffersink.c | 8 ++++++++ libavfilter/buffersink.h | 4 ++++ libavfilter/version.h | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index e4145bbceb..e0e1ff53ae 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2025-01-25 - xxxxxxxxxx - lavfi 10.9.100 - buffersink.h + Add av_buffersink_get_side_data(). + 2025-01-25 - xxxxxxxxxx - lavfi 10.8.100 - buffersrc.h Add AVBufferSrcParameters.side_data and AVBufferSrcParameters.nb_side_data diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 7cdda8bfb0..5cd47ba69f 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -364,6 +364,14 @@ int av_buffersink_get_ch_layout(const AVFilterContext *ctx, AVChannelLayout *out return 0; } +const AVFrameSideData *const *av_buffersink_get_side_data(const AVFilterContext *ctx, + int *nb_side_data) +{ + av_assert0(fffilter(ctx->filter)->activate == activate); + *nb_side_data = ctx->inputs[0]->nb_side_data; + return (const AVFrameSideData *const *)ctx->inputs[0]->side_data; +} + #if FF_API_BUFFERSINK_OPTS #define NB_ITEMS(list) (list ## _size / sizeof(*list)) #endif diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h index 08cb6b3804..a8435eea8f 100644 --- a/libavfilter/buffersink.h +++ b/libavfilter/buffersink.h @@ -48,6 +48,7 @@ * - av_buffersink_get_channels(), * - av_buffersink_get_ch_layout(), * - av_buffersink_get_sample_rate(). + * - av_buffersink_get_side_data(). * * The layout returned by av_buffersink_get_ch_layout() must de uninitialized * by the caller. @@ -122,6 +123,9 @@ int av_buffersink_get_sample_rate (const AVFilterContext *c AVBufferRef * av_buffersink_get_hw_frames_ctx (const AVFilterContext *ctx); +const AVFrameSideData *const *av_buffersink_get_side_data(const AVFilterContext *ctx, + int *nb_side_data); + /** @} */ /** diff --git a/libavfilter/version.h b/libavfilter/version.h index ba8a6fdab2..77f38cb9b4 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -31,7 +31,7 @@ #include "version_major.h" -#define LIBAVFILTER_VERSION_MINOR 8 +#define LIBAVFILTER_VERSION_MINOR 9 #define LIBAVFILTER_VERSION_MICRO 100