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 916DF49321 for ; Mon, 8 Apr 2024 13:02:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 66C8868D2E5; Mon, 8 Apr 2024 16:00:11 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0E42B68D240 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=1712581193; bh=+lICPwiAl7UATWCSFFOfYHQ3NE/QVT8DDYgWWu6L2gk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VUDPQhn0kqJOxi+/NemZN+pfJfgcWtyKilvVzFRbcVKMX7mtsKB3nZCJKMwtZEAc1 DCMIhvJUhf2SIbTT/adZyak2vJtTYC6zqtzakZfGtxt1Oo6tuwn+do/XfIwtvS/KHn InQnMry+RuS6sQL73iXZq6HZz+O0T3t1n81Hf2rQ= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 8762C4344E; Mon, 8 Apr 2024 14:59:53 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 8 Apr 2024 14:57:09 +0200 Message-ID: <20240408125950.53472-6-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 05/17] avcodec/libx265: 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/libx265.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 3533ac5cc1f..e36a1eb9505 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -892,14 +892,24 @@ static const enum AVPixelFormat x265_csp_twelve[] = { AV_PIX_FMT_NONE }; -static av_cold void libx265_encode_init_csp(FFCodec *codec) +static int libx265_get_supported_config(const AVCodecContext *avctx, + const AVCodec *codec, + enum AVCodecConfig config, + unsigned flags, const void **out) { - if (x265_api_get(12)) - codec->p.pix_fmts = x265_csp_twelve; - else if (x265_api_get(10)) - codec->p.pix_fmts = x265_csp_ten; - else if (x265_api_get(8)) - codec->p.pix_fmts = x265_csp_eight; + if (config == AV_CODEC_CONFIG_PIX_FORMAT) { + if (x265_api_get(12)) + *out = x265_csp_twelve; + else if (x265_api_get(10)) + *out = x265_csp_ten; + else if (x265_api_get(8)) + *out = x265_csp_eight; + else + return AVERROR_EXTERNAL; + return 0; + } + + return ff_default_get_supported_config(avctx, codec, config, flags, out); } #define OFFSET(x) offsetof(libx265Context, x) @@ -952,7 +962,7 @@ FFCodec ff_libx265_encoder = { .p.priv_class = &class, .p.wrapper_name = "libx265", .init = libx265_encode_init, - .init_static_data = libx265_encode_init_csp, + .get_supported_config = libx265_get_supported_config, FF_CODEC_ENCODE_CB(libx265_encode_frame), .close = libx265_encode_close, .priv_data_size = sizeof(libx265Context), -- 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".