From patchwork Thu May 28 20:15:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 19954 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 3125144A30B for ; Thu, 28 May 2020 23:16:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 18E7D68AFCC; Thu, 28 May 2020 23:16:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (unknown [176.97.15.10]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 99D8D68AFBE for ; Thu, 28 May 2020 23:16:30 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id E101A28A6EF for ; Thu, 28 May 2020 22:16:28 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id gNyXbXwT0oDK for ; Thu, 28 May 2020 22:16:27 +0200 (CEST) Received: from quelana.khirnov.net (quelana.khirnov.net [IPv6:2a00:c500:561:200::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 06A0728A6F0 for ; Thu, 28 May 2020 22:16:22 +0200 (CEST) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 743B422E26 for ; Thu, 28 May 2020 22:16:21 +0200 (CEST) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id yX_gJVlHdIwU for ; Thu, 28 May 2020 22:16:20 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 8D80C22E36 for ; Thu, 28 May 2020 22:16:15 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 3A32320E00F5; Thu, 28 May 2020 22:16:11 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 May 2020 22:15:50 +0200 Message-Id: <20200528201559.22618-8-anton@khirnov.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528201559.22618-1-anton@khirnov.net> References: <20200528201559.22618-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/17] AVCodecContext: switch to child_class_iterate() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/options.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libavcodec/options.c b/libavcodec/options.c index 7706a03297..ff16e2cbfd 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -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, };