From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id A3E424A753 for ; Fri, 5 Apr 2024 18:58:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 839BB68D1FA; Fri, 5 Apr 2024 21:57:38 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 63B3B68D198 for ; Fri, 5 Apr 2024 21:57:31 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1712343447; bh=NWy4vbMmSNZU+7cl0RLALU/3x7t6zQSDXODn/bT2kOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z+zo5gwpSlb9KzCOchIXik2qyZvp6cR321+3fR8pNdV6HgPs/CgA9oUz2qGYstavj LWV3TitRRyEo6gnHfEoOf1XqkP/YPVm9Wqx3Mko2kcB5+nRzwBykT3SqS/rjd2+Qhj +ZhZMJF96YqyS0ftzfrvh675cwjdXzYR6Vi0AIRA= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id F046D42B62; Fri, 5 Apr 2024 20:57:26 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 Apr 2024 20:57:16 +0200 Message-ID: <20240405185721.111072-6-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405185721.111072-1-ffmpeg@haasn.xyz> References: <20240405185721.111072-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/11] avcodec/libaomenc: switch to get_supported_config() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas --- libavcodec/libaomenc.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 4a71bba9c9c..899aa2b261f 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -1398,16 +1398,24 @@ static const enum AVPixelFormat av1_pix_fmts_highbd_with_gray[] = { AV_PIX_FMT_NONE }; -static av_cold void av1_init_static(FFCodec *codec) +static int av1_get_supported_config(const AVCodecContext *avctx, + const AVCodec *codec, + enum AVCodecConfig config, + unsigned flags, const void **out) { - int supports_monochrome = aom_codec_version() >= 20001; - aom_codec_caps_t codec_caps = aom_codec_get_caps(aom_codec_av1_cx()); - if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) - codec->p.pix_fmts = supports_monochrome ? av1_pix_fmts_highbd_with_gray : - av1_pix_fmts_highbd; - else - codec->p.pix_fmts = supports_monochrome ? av1_pix_fmts_with_gray : - av1_pix_fmts; + if (config == AV_CODEC_CONFIG_PIX_FORMAT) { + int supports_monochrome = aom_codec_version() >= 20001; + aom_codec_caps_t codec_caps = aom_codec_get_caps(aom_codec_av1_cx()); + if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) + *out = supports_monochrome ? av1_pix_fmts_highbd_with_gray : + av1_pix_fmts_highbd; + else + *out = supports_monochrome ? av1_pix_fmts_with_gray : + av1_pix_fmts; + return 0; + } + + return ff_default_get_supported_config(avctx, codec, config, flags, out); } static av_cold int av1_init(AVCodecContext *avctx) @@ -1528,5 +1536,5 @@ FFCodec ff_libaom_av1_encoder = { FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS, .defaults = defaults, - .init_static_data = av1_init_static, + .get_supported_config = av1_get_supported_config, }; -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".