[FFmpeg-devel] [PATCH 83/87] avutil: remove deprecated AVClass.child_class_next

James Almer jamrial at gmail.com
Mon Apr 19 17:16:21 EEST 2021


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/bitstream_filters.c | 22 --------------------
 libavcodec/bsf.c               |  3 ---
 libavcodec/bsf_internal.h      |  4 ----
 libavcodec/options.c           | 22 --------------------
 libavfilter/af_aresample.c     | 10 ---------
 libavfilter/avfilter.c         | 27 ------------------------
 libavfilter/framesync.h        |  4 ----
 libavfilter/vf_scale.c         | 13 ------------
 libavfilter/vf_spp.c           | 10 ---------
 libavformat/avio.c             |  3 ---
 libavformat/aviobuf.c          | 10 ---------
 libavformat/options.c          | 38 ----------------------------------
 libavformat/protocols.c        | 21 -------------------
 libavformat/url.h              |  4 ----
 libavutil/log.h                | 13 ------------
 libavutil/opt.c                | 19 -----------------
 libavutil/opt.h                | 13 ------------
 libavutil/version.h            |  3 ---
 18 files changed, 239 deletions(-)

diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index 3de2af92d3..e03326515b 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -91,28 +91,6 @@ const AVBitStreamFilter *av_bsf_get_by_name(const char *name)
     return NULL;
 }
 
-#if FF_API_CHILD_CLASS_NEXT
-const AVClass *ff_bsf_child_class_next(const AVClass *prev)
-{
-    const AVBitStreamFilter *f = NULL;
-    void *i = 0;
-
-    /* find the filter that corresponds to prev */
-    while (prev && (f = av_bsf_iterate(&i))) {
-        if (f->priv_class == prev) {
-            break;
-        }
-    }
-
-    /* find next filter with priv options */
-    while ((f = av_bsf_iterate(&i))) {
-        if (f->priv_class)
-            return f->priv_class;
-    }
-    return NULL;
-}
-#endif
-
 const AVClass *ff_bsf_child_class_iterate(void **opaque)
 {
     const AVBitStreamFilter *f;
diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 543fe87b30..9d67ea5395 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -80,9 +80,6 @@ static const AVClass bsf_class = {
     .item_name        = bsf_to_name,
     .version          = LIBAVUTIL_VERSION_INT,
     .child_next       = bsf_child_next,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next = ff_bsf_child_class_next,
-#endif
     .child_class_iterate = ff_bsf_child_class_iterate,
     .category         = AV_CLASS_CATEGORY_BITSTREAM_FILTER,
 };
diff --git a/libavcodec/bsf_internal.h b/libavcodec/bsf_internal.h
index b78c134bdd..06979fdaa3 100644
--- a/libavcodec/bsf_internal.h
+++ b/libavcodec/bsf_internal.h
@@ -42,10 +42,6 @@ int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt);
  */
 int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt);
 
-#if FF_API_CHILD_CLASS_NEXT
-const AVClass *ff_bsf_child_class_next(const AVClass *prev);
-#endif
-
 const AVClass *ff_bsf_child_class_iterate(void **opaque);
 
 #endif /* AVCODEC_BSF_INTERNAL_H */
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 369110b8d0..bba6078b62 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -53,25 +53,6 @@ static void *codec_child_next(void *obj, void *prev)
     return NULL;
 }
 
-#if FF_API_CHILD_CLASS_NEXT
-static const AVClass *codec_child_class_next(const AVClass *prev)
-{
-    void *iter = NULL;
-    const AVCodec *c = NULL;
-
-    /* find the codec that corresponds to prev */
-    while (prev && (c = av_codec_iterate(&iter)))
-        if (c->priv_class == prev)
-            break;
-
-    /* find next codec with priv options */
-    while (c = av_codec_iterate(&iter))
-        if (c->priv_class)
-            return c->priv_class;
-    return NULL;
-}
-#endif
-
 static const AVClass *codec_child_class_iterate(void **iter)
 {
     const AVCodec *c;
@@ -96,9 +77,6 @@ static const AVClass av_codec_context_class = {
     .version                 = LIBAVUTIL_VERSION_INT,
     .log_level_offset_offset = offsetof(AVCodecContext, log_level_offset),
     .child_next              = codec_child_next,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next        = codec_child_class_next,
-#endif
     .child_class_iterate     = codec_child_class_iterate,
     .category                = AV_CLASS_CATEGORY_ENCODER,
     .get_category            = get_category,
diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index e54bd3eb41..f8e03061a5 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -293,13 +293,6 @@ static int request_frame(AVFilterLink *outlink)
     return ret;
 }
 
-#if FF_API_CHILD_CLASS_NEXT
-static const AVClass *resample_child_class_next(const AVClass *prev)
-{
-    return prev ? NULL : swr_get_class();
-}
-#endif
-
 static const AVClass *resample_child_class_iterate(void **iter)
 {
     const AVClass *c = *iter ? NULL : swr_get_class();
@@ -326,9 +319,6 @@ static const AVClass aresample_class = {
     .item_name        = av_default_item_name,
     .option           = options,
     .version          = LIBAVUTIL_VERSION_INT,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next = resample_child_class_next,
-#endif
     .child_class_iterate = resample_child_class_iterate,
     .child_next       = resample_child_next,
 };
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 6e12c8fa05..c04afc6639 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -571,30 +571,6 @@ static void *filter_child_next(void *obj, void *prev)
     return NULL;
 }
 
-#if FF_API_CHILD_CLASS_NEXT
-static const AVClass *filter_child_class_next(const AVClass *prev)
-{
-    void *opaque = NULL;
-    const AVFilter *f = NULL;
-
-    /* find the filter that corresponds to prev */
-    while (prev && (f = av_filter_iterate(&opaque)))
-        if (f->priv_class == prev)
-            break;
-
-    /* could not find filter corresponding to prev */
-    if (prev && !f)
-        return NULL;
-
-    /* find next filter with specific options */
-    while ((f = av_filter_iterate(&opaque)))
-        if (f->priv_class)
-            return f->priv_class;
-
-    return NULL;
-}
-#endif
-
 static const AVClass *filter_child_class_iterate(void **iter)
 {
     const AVFilter *f;
@@ -627,9 +603,6 @@ static const AVClass avfilter_class = {
     .version    = LIBAVUTIL_VERSION_INT,
     .category   = AV_CLASS_CATEGORY_FILTER,
     .child_next = filter_child_next,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next = filter_child_class_next,
-#endif
     .child_class_iterate = filter_child_class_iterate,
     .option           = avfilter_options,
 };
diff --git a/libavfilter/framesync.h b/libavfilter/framesync.h
index 51bab16285..fb85e8aec7 100644
--- a/libavfilter/framesync.h
+++ b/libavfilter/framesync.h
@@ -305,9 +305,6 @@ static int name##_framesync_preinit(AVFilterContext *ctx) { \
     ff_framesync_preinit(&s->field); \
     return 0; \
 } \
-static const AVClass *name##_child_class_next(const AVClass *prev) { \
-    return prev ? NULL : ff_framesync_get_class(); \
-} \
 static void *name##_child_next(void *obj, void *prev) { \
     context *s = obj; \
     s->fs.class = ff_framesync_get_class(); /* FIXME */ \
@@ -319,7 +316,6 @@ static const AVClass name##_class = { \
     .option           = name##_options, \
     .version          = LIBAVUTIL_VERSION_INT, \
     .category         = AV_CLASS_CATEGORY_FILTER, \
-    .child_class_next = name##_child_class_next, \
     .child_class_iterate = ff_framesync_child_class_iterate, \
     .child_next       = name##_child_next, \
 }
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 3add31bace..7f68a51913 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -879,13 +879,6 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
     return ret;
 }
 
-#if FF_API_CHILD_CLASS_NEXT
-static const AVClass *child_class_next(const AVClass *prev)
-{
-    return prev ? NULL : sws_get_class();
-}
-#endif
-
 static const AVClass *child_class_iterate(void **iter)
 {
     const AVClass *c = *iter ? NULL : sws_get_class();
@@ -950,9 +943,6 @@ static const AVClass scale_class = {
     .option           = scale_options,
     .version          = LIBAVUTIL_VERSION_INT,
     .category         = AV_CLASS_CATEGORY_FILTER,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next = child_class_next,
-#endif
     .child_class_iterate = child_class_iterate,
 };
 
@@ -993,9 +983,6 @@ static const AVClass scale2ref_class = {
     .option           = scale_options,
     .version          = LIBAVUTIL_VERSION_INT,
     .category         = AV_CLASS_CATEGORY_FILTER,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next = child_class_next,
-#endif
     .child_class_iterate = child_class_iterate,
 };
 
diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c
index 6ea7e7458f..c548d86d72 100644
--- a/libavfilter/vf_spp.c
+++ b/libavfilter/vf_spp.c
@@ -46,13 +46,6 @@ enum mode {
     NB_MODES
 };
 
-#if FF_API_CHILD_CLASS_NEXT
-static const AVClass *child_class_next(const AVClass *prev)
-{
-    return prev ? NULL : avcodec_dct_get_class();
-}
-#endif
-
 static const AVClass *child_class_iterate(void **iter)
 {
     const AVClass *c = *iter ? NULL : avcodec_dct_get_class();
@@ -85,9 +78,6 @@ static const AVClass spp_class = {
     .option           = spp_options,
     .version          = LIBAVUTIL_VERSION_INT,
     .category         = AV_CLASS_CATEGORY_FILTER,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next = child_class_next,
-#endif
     .child_class_iterate = child_class_iterate,
     .child_next       = child_next,
 };
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 8011482e76..2974f4b2b4 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -67,9 +67,6 @@ const AVClass ffurl_context_class = {
     .option           = options,
     .version          = LIBAVUTIL_VERSION_INT,
     .child_next       = urlcontext_child_next,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next = ff_urlcontext_child_class_next,
-#endif
     .child_class_iterate = ff_urlcontext_child_class_iterate,
 };
 /*@}*/
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 1ecc7fb095..ddfa4ecbf1 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -48,13 +48,6 @@ static void *ff_avio_child_next(void *obj, void *prev)
     return prev ? NULL : s->opaque;
 }
 
-#if FF_API_CHILD_CLASS_NEXT
-static const AVClass *ff_avio_child_class_next(const AVClass *prev)
-{
-    return prev ? NULL : &ffurl_context_class;
-}
-#endif
-
 static const AVClass *child_class_iterate(void **iter)
 {
     const AVClass *c = *iter ? NULL : &ffurl_context_class;
@@ -76,9 +69,6 @@ const AVClass ff_avio_class = {
     .version    = LIBAVUTIL_VERSION_INT,
     .option     = ff_avio_options,
     .child_next = ff_avio_child_next,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next = ff_avio_child_class_next,
-#endif
     .child_class_iterate = child_class_iterate,
 };
 
diff --git a/libavformat/options.c b/libavformat/options.c
index 632d450c90..dccb6faa73 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -54,41 +54,6 @@ static void *format_child_next(void *obj, void *prev)
     return NULL;
 }
 
-#if FF_API_CHILD_CLASS_NEXT
-static const AVClass *format_child_class_next(const AVClass *prev)
-{
-    const AVInputFormat *ifmt = NULL;
-    const AVOutputFormat *ofmt = NULL;
-    void *ifmt_iter = NULL, *ofmt_iter = NULL;
-
-    if (!prev)
-        return &ff_avio_class;
-
-    while ((ifmt = av_demuxer_iterate(&ifmt_iter)))
-        if (ifmt->priv_class == prev)
-            break;
-
-    if (!ifmt) {
-        ifmt_iter = NULL;
-        while ((ofmt = av_muxer_iterate(&ofmt_iter)))
-            if (ofmt->priv_class == prev)
-                break;
-    }
-    if (!ofmt) {
-        ofmt_iter = NULL;
-        while ((ifmt = av_demuxer_iterate(&ifmt_iter)))
-            if (ifmt->priv_class)
-                return ifmt->priv_class;
-    }
-
-    while ((ofmt = av_muxer_iterate(&ofmt_iter)))
-        if (ofmt->priv_class)
-            return ofmt->priv_class;
-
-    return NULL;
-}
-#endif
-
 enum {
     CHILD_CLASS_ITER_AVIO = 0,
     CHILD_CLASS_ITER_MUX,
@@ -158,9 +123,6 @@ static const AVClass av_format_context_class = {
     .option         = avformat_options,
     .version        = LIBAVUTIL_VERSION_INT,
     .child_next     = format_child_next,
-#if FF_API_CHILD_CLASS_NEXT
-    .child_class_next = format_child_class_next,
-#endif
     .child_class_iterate = format_child_class_iterate,
     .category       = AV_CLASS_CATEGORY_MUXER,
     .get_category   = get_category,
diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index fb6fabdce5..4b6b1c8e98 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -75,27 +75,6 @@ extern const URLProtocol ff_libzmq_protocol;
 
 #include "libavformat/protocol_list.c"
 
-#if FF_API_CHILD_CLASS_NEXT
-const AVClass *ff_urlcontext_child_class_next(const AVClass *prev)
-{
-    int i;
-
-    /* find the protocol that corresponds to prev */
-    for (i = 0; prev && url_protocols[i]; i++) {
-        if (url_protocols[i]->priv_data_class == prev) {
-            i++;
-            break;
-        }
-    }
-
-    /* find next protocol with priv options */
-    for (; url_protocols[i]; i++)
-        if (url_protocols[i]->priv_data_class)
-            return url_protocols[i]->priv_data_class;
-    return NULL;
-}
-#endif
-
 const AVClass *ff_urlcontext_child_class_iterate(void **iter)
 {
     const AVClass *ret = NULL;
diff --git a/libavformat/url.h b/libavformat/url.h
index 3bb1cf89f7..40e6c1d17c 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -329,10 +329,6 @@ int ff_make_absolute_url(char *buf, int size, const char *base,
  */
 AVIODirEntry *ff_alloc_dir_entry(void);
 
-#if FF_API_CHILD_CLASS_NEXT
-const AVClass *ff_urlcontext_child_class_next(const AVClass *prev);
-#endif
-
 const AVClass *ff_urlcontext_child_class_iterate(void **iter);
 
 /**
diff --git a/libavutil/log.h b/libavutil/log.h
index 8edd6bbf2b..c2f1232a16 100644
--- a/libavutil/log.h
+++ b/libavutil/log.h
@@ -112,19 +112,6 @@ typedef struct AVClass {
      */
     void* (*child_next)(void *obj, void *prev);
 
-#if FF_API_CHILD_CLASS_NEXT
-    /**
-     * Return an AVClass corresponding to the next potential
-     * AVOptions-enabled child.
-     *
-     * The difference between child_next and this is that
-     * child_next iterates over _already existing_ objects, while
-     * child_class_next iterates over _all possible_ children.
-     */
-    attribute_deprecated
-    const struct AVClass* (*child_class_next)(const struct AVClass *prev);
-#endif
-
     /**
      * Category used for visualization (like color)
      * This is only set if the category is equal for all objects using this class.
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 590146b5fb..4124efd9b6 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1717,29 +1717,10 @@ void *av_opt_child_next(void *obj, void *prev)
     return NULL;
 }
 
-#if FF_API_CHILD_CLASS_NEXT
-FF_DISABLE_DEPRECATION_WARNINGS
-const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev)
-{
-    if (parent->child_class_next)
-        return parent->child_class_next(prev);
-    return NULL;
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
 const AVClass *av_opt_child_class_iterate(const AVClass *parent, void **iter)
 {
     if (parent->child_class_iterate)
         return parent->child_class_iterate(iter);
-#if FF_API_CHILD_CLASS_NEXT
-FF_DISABLE_DEPRECATION_WARNINGS
-    if (parent->child_class_next) {
-        *iter = parent->child_class_next(*iter);
-        return *iter;
-    }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
     return NULL;
 }
 
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 8dc020a820..c2329e5589 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -648,19 +648,6 @@ const AVOption *av_opt_next(const void *obj, const AVOption *prev);
  */
 void *av_opt_child_next(void *obj, void *prev);
 
-#if FF_API_CHILD_CLASS_NEXT
-/**
- * Iterate over potential AVOptions-enabled children of parent.
- *
- * @param prev result of a previous call to this function or NULL
- * @return AVClass corresponding to next potential child or NULL
- *
- * @deprecated use av_opt_child_class_iterate
- */
-attribute_deprecated
-const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev);
-#endif
-
 /**
  * Iterate over potential AVOptions-enabled children of parent.
  *
diff --git a/libavutil/version.h b/libavutil/version.h
index b61467ed9d..eb380bc0d7 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,9 +105,6 @@
  * @{
  */
 
-#ifndef FF_API_CHILD_CLASS_NEXT
-#define FF_API_CHILD_CLASS_NEXT         (LIBAVUTIL_VERSION_MAJOR < 57)
-#endif
 #ifndef FF_API_D2STR
 #define FF_API_D2STR                    (LIBAVUTIL_VERSION_MAJOR < 58)
 #endif
-- 
2.31.1



More information about the ffmpeg-devel mailing list