[FFmpeg-cvslog] bsf: switch to child_class_iterate()

Anton Khirnov git at videolan.org
Wed Jun 10 13:53:00 EEST 2020


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed May 27 15:34:07 2020 +0200| [c0d6eaca50ad65fb8f45b02863d31b3421899959] | committer: Anton Khirnov

bsf: switch to child_class_iterate()

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c0d6eaca50ad65fb8f45b02863d31b3421899959
---

 libavcodec/bitstream_filters.c | 14 ++++++++++++++
 libavcodec/bsf.c               |  3 +++
 libavcodec/bsf_internal.h      |  4 ++++
 3 files changed, 21 insertions(+)

diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index a7aa5dca65..b26d6a910e 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -96,6 +96,7 @@ 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;
@@ -115,3 +116,16 @@ const AVClass *ff_bsf_child_class_next(const AVClass *prev)
     }
     return NULL;
 }
+#endif
+
+const AVClass *ff_bsf_child_class_iterate(void **opaque)
+{
+    const AVBitStreamFilter *f;
+
+    /* find next filter with priv options */
+    while ((f = av_bsf_iterate(opaque))) {
+        if (f->priv_class)
+            return f->priv_class;
+    }
+    return NULL;
+}
diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 5e1c794a76..d71bc32584 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -79,7 +79,10 @@ 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 fefd5b8905..b78c134bdd 100644
--- a/libavcodec/bsf_internal.h
+++ b/libavcodec/bsf_internal.h
@@ -42,6 +42,10 @@ 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 */



More information about the ffmpeg-cvslog mailing list