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 1866B49331 for ; Mon, 8 Apr 2024 13:02:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5BFE268D2FB; Mon, 8 Apr 2024 16:00:13 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3E4AA68D247 for ; Mon, 8 Apr 2024 15:59:58 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1712581194; bh=HkDvjrtRNqX01zYOO2Hqr5OPSKntVuFM7y/NaZ0ryEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CijgfTAl7j57sSirtWh6npu++i6tZCb4tVS9bZ8Ku9M96wiY+Oet4oqp5E8P93TpA kjVDjEWpp/wnEVklQABWASOuzbUJOVaO8J9rbt4p+mSeF/qNbhs18PClJ1JAEZ85p5 vKdzWKBOY7rS3tqz2s4roiIBuIt2TYcQqN9z92V0= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id EFC62444D6; Mon, 8 Apr 2024 14:59:53 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 8 Apr 2024 14:57:11 +0200 Message-ID: <20240408125950.53472-8-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240408125950.53472-1-ffmpeg@haasn.xyz> References: <20240408125950.53472-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 07/17] 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 5023d2fda42..0488e5c3c9a 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) @@ -1529,5 +1537,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".