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 2E0774A75A for ; Fri, 5 Apr 2024 18:58:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 65D5C68D19E; Fri, 5 Apr 2024 21:57:36 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C11BE68D095 for ; Fri, 5 Apr 2024 21:57:26 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1712343446; bh=Ge9oXuzwsrP/gCsGtWY89yY71e2NxYUVYlhhj9u+QjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JGOUjexLnfupWdU5YjVitiA+ALvhWgQxrNUZ0o7l2eVRc0YRDE07v3O4KyyCZp3x4 KakF/tjP3H1zzf8p/b5zpvS7cN70tMYb5OpenjIYgwZd3ujOCUDk0mimQPLtM6A/Kb EpYgJIDCiAwmJ45OqVPTBQtFvoMzbzvmJjsGdFKo= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 8481E428D7; Fri, 5 Apr 2024 20:57:26 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 Apr 2024 20:57:14 +0200 Message-ID: <20240405185721.111072-4-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 04/11] 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 0645cd20457..ff1e8463aa1 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) @@ -951,7 +961,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".