URLContext: switch to child_class_iterate()

pull/340/head
Anton Khirnov 5 years ago
parent c7d8d8d8d9
commit 43ed2b86d6
  1. 3
      libavformat/avio.c
  2. 16
      libavformat/protocols.c
  3. 4
      libavformat/url.h

@ -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,
};
/*@}*/

@ -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)
{

@ -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.

Loading…
Cancel
Save