[FFmpeg-devel] [PATCH v2 3/9] avfilter/buffersink: add a side_data field

James Almer jamrial at gmail.com
Wed Jan 15 17:51:59 EET 2025


This will be used to propagate global side data through the filterchain.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavfilter/buffersink.c | 8 ++++++++
 libavfilter/buffersink.h | 4 ++++
 2 files changed, 12 insertions(+)

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);
+
 /** @} */
 
 /**
-- 
2.48.0



More information about the ffmpeg-devel mailing list