diff mbox series

[FFmpeg-devel,11/17] avflter: switch to child_class_iterate()

Message ID 20200528201559.22618-11-anton@khirnov.net
State Accepted
Commit aba98de6b89fd5a50d6308e9cd81bf17ec6bbe3d
Headers show
Series [FFmpeg-devel,01/17] Remove unnecessary use of avcodec_close(). | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Anton Khirnov May 28, 2020, 8:15 p.m. UTC
---
 libavfilter/avfilter.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Moritz Barsnick June 4, 2020, 11:39 a.m. UTC | #1
On Thu, May 28, 2020 at 22:15:53 +0200, Anton Khirnov wrote:

> Subject: [PATCH 11/17] avflter: switch to child_class_iterate()

Nit: avfilter

Moritz
diff mbox series

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 394811916d..dd8074e462 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -583,6 +583,7 @@  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;
@@ -604,6 +605,18 @@  static const AVClass *filter_child_class_next(const AVClass *prev)
 
     return NULL;
 }
+#endif
+
+static const AVClass *filter_child_class_iterate(void **iter)
+{
+    const AVFilter *f;
+
+    while ((f = av_filter_iterate(iter)))
+        if (f->priv_class)
+            return f->priv_class;
+
+    return NULL;
+}
 
 #define OFFSET(x) offsetof(AVFilterContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM
@@ -625,7 +638,10 @@  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,
 };