diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-05-27 15:34:07 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-06-10 12:36:44 +0200 |
commit | 43ed2b86d67ee493a9fd9ef90c13c4cf6ac89257 (patch) | |
tree | aef58e80928806e7f5d97945feb2dc4c07834baa /libavformat | |
parent | c7d8d8d8d91833737ec1b94c9345bcfba5935ee6 (diff) | |
download | ffmpeg-43ed2b86d67ee493a9fd9ef90c13c4cf6ac89257.tar.gz |
URLContext: switch to child_class_iterate()
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avio.c | 3 | ||||
-rw-r--r-- | libavformat/protocols.c | 16 | ||||
-rw-r--r-- | libavformat/url.h | 4 |
3 files changed, 23 insertions, 0 deletions
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. |