AVCodecContext: switch to child_class_iterate()

This commit is contained in:
Anton Khirnov 2020-05-27 15:34:07 +02:00
parent c0d6eaca50
commit 851e0dfe29

View File

@ -53,6 +53,7 @@ static void *codec_child_next(void *obj, void *prev)
return NULL;
}
#if FF_API_CHILD_CLASS_NEXT
static const AVClass *codec_child_class_next(const AVClass *prev)
{
void *iter = NULL;
@ -69,6 +70,17 @@ static const AVClass *codec_child_class_next(const AVClass *prev)
return c->priv_class;
return NULL;
}
#endif
static const AVClass *codec_child_class_iterate(void **iter)
{
const AVCodec *c;
/* find next codec with priv options */
while (c = av_codec_iterate(iter))
if (c->priv_class)
return c->priv_class;
return NULL;
}
static AVClassCategory get_category(void *ptr)
{
@ -84,7 +96,10 @@ static const AVClass av_codec_context_class = {
.version = LIBAVUTIL_VERSION_INT,
.log_level_offset_offset = offsetof(AVCodecContext, log_level_offset),
.child_next = codec_child_next,
#if FF_API_CHILD_CLASS_NEXT
.child_class_next = codec_child_class_next,
#endif
.child_class_iterate = codec_child_class_iterate,
.category = AV_CLASS_CATEGORY_ENCODER,
.get_category = get_category,
};