[FFmpeg-devel] [PATCH 7/7] lavfi/buffersink: deprecate functions obsoleted by AV_BUFFERSINK_FLAG_PARAMS

Anton Khirnov anton at khirnov.net
Mon Sep 23 18:01:45 EEST 2024


That is all av_buffersink_get_*() except type and frame_rate, for which
AVFrame does not currently have fields.
---
 doc/APIchanges              | 12 +++++++++++-
 libavfilter/buffersink.c    |  4 ++++
 libavfilter/buffersink.h    | 19 ++++++++++++++++++-
 libavfilter/version_major.h |  1 +
 4 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5ddd7189f8..971750bfe7 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -4,7 +4,17 @@ API changes, most recent first:
 
 2024-09-xx - xxxxxxxxxx - lavfi 10.4.100
   Buffersink now sets AVFrame.time_base on the frames it outputs.
-  Add AV_BUFFERSINK_FLAG_PARAMS.
+  Add AV_BUFFERSINK_FLAG_PARAMS; deprecate
+  - av_buffersink_get_time_base()
+  - av_buffersink_get_w()
+  - av_buffersink_get_h()
+  - av_buffersink_get_sample_aspect_ratio()
+  - av_buffersink_get_colorspace()
+  - av_buffersink_get_color_range()
+  - av_buffersink_get_channels()
+  - av_buffersink_get_channel_layout()
+  - av_buffersink_get_sample_rate()
+  - av_buffersink_get_hw_frames_ctx()
 
 2024-09-23 - xxxxxxxxxx - lavc 61.18.100 - avcodec.h
   Add a new flag AV_CODEC_EXPORT_DATA_ENHANCEMENTS for export_side_data.
diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
index d9cd074f17..e0c32d5f10 100644
--- a/libavfilter/buffersink.c
+++ b/libavfilter/buffersink.c
@@ -234,6 +234,7 @@ type av_buffersink_get_##field(const AVFilterContext *ctx) { \
 }
 
 MAKE_AVFILTERLINK_ACCESSOR(enum AVMediaType , type               )
+#if FF_API_BUFFERSINK_GET
 MAKE_AVFILTERLINK_ACCESSOR(AVRational       , time_base          )
 MAKE_AVFILTERLINK_ACCESSOR(int              , format             )
 
@@ -244,6 +245,7 @@ MAKE_AVFILTERLINK_ACCESSOR(enum AVColorSpace, colorspace)
 MAKE_AVFILTERLINK_ACCESSOR(enum AVColorRange, color_range)
 
 MAKE_AVFILTERLINK_ACCESSOR(int              , sample_rate        )
+#endif
 
 AVRational av_buffersink_get_frame_rate(const AVFilterContext *ctx)
 {
@@ -252,6 +254,7 @@ AVRational av_buffersink_get_frame_rate(const AVFilterContext *ctx)
     return l->frame_rate;
 }
 
+#if FF_API_BUFFERSINK_GET
 AVBufferRef* av_buffersink_get_hw_frames_ctx(const AVFilterContext *ctx)
 {
     FilterLink *l = ff_filter_link(ctx->inputs[0]);
@@ -277,6 +280,7 @@ int av_buffersink_get_ch_layout(const AVFilterContext *ctx, AVChannelLayout *out
     *out = ch_layout;
     return 0;
 }
+#endif
 
 #define CHECK_LIST_SIZE(field) \
         if (buf->field ## _size % sizeof(*buf->field)) { \
diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h
index 9c4468af5b..ef5aae8857 100644
--- a/libavfilter/buffersink.h
+++ b/libavfilter/buffersink.h
@@ -124,22 +124,39 @@ void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size);
  */
 
 enum AVMediaType av_buffersink_get_type                (const AVFilterContext *ctx);
+AVRational       av_buffersink_get_frame_rate          (const AVFilterContext *ctx);
+
+#if FF_API_BUFFERSINK_GET
+/**
+ * @deprecated Use av_buffersink_get_frame_flags() with AV_BUFFERSINK_FLAG_PARAMS
+ */
+attribute_deprecated
 AVRational       av_buffersink_get_time_base           (const AVFilterContext *ctx);
+attribute_deprecated
 int              av_buffersink_get_format              (const AVFilterContext *ctx);
 
-AVRational       av_buffersink_get_frame_rate          (const AVFilterContext *ctx);
+attribute_deprecated
 int              av_buffersink_get_w                   (const AVFilterContext *ctx);
+attribute_deprecated
 int              av_buffersink_get_h                   (const AVFilterContext *ctx);
+attribute_deprecated
 AVRational       av_buffersink_get_sample_aspect_ratio (const AVFilterContext *ctx);
+attribute_deprecated
 enum AVColorSpace av_buffersink_get_colorspace         (const AVFilterContext *ctx);
+attribute_deprecated
 enum AVColorRange av_buffersink_get_color_range        (const AVFilterContext *ctx);
 
+attribute_deprecated
 int              av_buffersink_get_channels            (const AVFilterContext *ctx);
+attribute_deprecated
 int              av_buffersink_get_ch_layout           (const AVFilterContext *ctx,
                                                         AVChannelLayout *ch_layout);
+attribute_deprecated
 int              av_buffersink_get_sample_rate         (const AVFilterContext *ctx);
 
+attribute_deprecated
 AVBufferRef *    av_buffersink_get_hw_frames_ctx       (const AVFilterContext *ctx);
+#endif
 
 /** @} */
 
diff --git a/libavfilter/version_major.h b/libavfilter/version_major.h
index c5e660eeda..0ca3b0e358 100644
--- a/libavfilter/version_major.h
+++ b/libavfilter/version_major.h
@@ -36,5 +36,6 @@
  */
 
 #define FF_API_LINK_PUBLIC     (LIBAVFILTER_VERSION_MAJOR < 11)
+#define FF_API_BUFFERSINK_GET  (LIBAVFILTER_VERSION_MAJOR < 11)
 
 #endif /* AVFILTER_VERSION_MAJOR_H */
-- 
2.43.0



More information about the ffmpeg-devel mailing list