This will be used to propagate global side data through the filterchain.
Signed-off-by: James Almer <[email protected]>
---
libavfilter/buffersink.c | 21 +++++++++++++++++++++
libavfilter/buffersink.h | 5 +++++
2 files changed, 26 insertions(+)
diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index 565d084ddf..2ac7950b9b 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -364,6 +364,27 @@ int av_buffersink_get_ch_layout(const AVFilterContext
*ctx, AVChannelLayout *out
return 0;
}
+int av_buffersink_get_side_data(const AVFilterContext *ctx,
+ AVFrameSideData ***side_data,
+ int *nb_side_data)
+{
+ AVFrameSideData **sd = NULL;
+ int nb_sd = 0;
+ av_assert0(ctx->filter->activate == activate);
+
+ for (int i = 0; i < ctx->inputs[0]->nb_side_data; i++) {
+ int ret = av_frame_side_data_clone(&sd, &nb_sd,
+ ctx->inputs[0]->side_data[i], 0);
+ if (ret < 0) {
+ av_frame_side_data_free(&sd, &nb_sd);
+ return ret;
+ }
+ }
+ *side_data = sd;
+ *nb_side_data = nb_sd;
+ return 0;
+}
+
#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..79e994e112 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,10 @@ int av_buffersink_get_sample_rate
(const AVFilterContext *c
AVBufferRef * av_buffersink_get_hw_frames_ctx (const AVFilterContext
*ctx);
+int av_buffersink_get_side_data (const AVFilterContext
*ctx,
+ AVFrameSideData
***side_data,
+ int *nb_side_data);
+
/** @} */
/**
--
2.47.1
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".