[FFmpeg-cvslog] URLContext: switch to child_class_iterate()
Anton Khirnov
git at videolan.org
Wed Jun 10 13:53:19 EEST 2020
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed May 27 15:34:07 2020 +0200| [43ed2b86d67ee493a9fd9ef90c13c4cf6ac89257] | committer: Anton Khirnov
URLContext: switch to child_class_iterate()
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43ed2b86d67ee493a9fd9ef90c13c4cf6ac89257
---
libavformat/avio.c | 3 +++
libavformat/protocols.c | 16 ++++++++++++++++
libavformat/url.h | 4 ++++
3 files changed, 23 insertions(+)
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 237966c303..3886ed7a90 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -67,7 +67,10 @@ 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/protocols.c b/libavformat/protocols.c
index f1b8eab0fd..7df18fbb3b 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -73,6 +73,7 @@ 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;
@@ -91,7 +92,22 @@ const AVClass *ff_urlcontext_child_class_next(const AVClass *prev)
return url_protocols[i]->priv_data_class;
return NULL;
}
+#endif
+const AVClass *ff_urlcontext_child_class_iterate(void **iter)
+{
+ const AVClass *ret = NULL;
+ uintptr_t i;
+
+ for (i = (uintptr_t)*iter; url_protocols[i]; i++) {
+ ret = url_protocols[i]->priv_data_class;
+ if (ret)
+ break;
+ }
+
+ *iter = (void*)(uintptr_t)(url_protocols[i] ? i + 1 : i);
+ return ret;
+}
const char *avio_enum_protocols(void **opaque, int output)
{
diff --git a/libavformat/url.h b/libavformat/url.h
index 4750bfff82..de0d30aca0 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -322,7 +322,11 @@ void 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);
/**
* Construct a list of protocols matching a given whitelist and/or blacklist.
More information about the ffmpeg-cvslog
mailing list