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 B3BA446B77 for ; Mon, 4 Sep 2023 03:54:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BE33068C79E; Mon, 4 Sep 2023 06:53:53 +0300 (EEST) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 382C768BD6B for ; Mon, 4 Sep 2023 06:53:48 +0300 (EEST) Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-31f4a286ae1so169906f8f.3 for ; Sun, 03 Sep 2023 20:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693799627; x=1694404427; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YUIuW5uAT4pKqWSajsxc/TAjVprg3onwAb2ghhXXHFc=; b=UnlFqYA/7K6w7wzA3D++Wq8v9xVjqIBLPFnjLBI/tI28bAME4mrF9P9+Scld9KylZK g6yfFaRyPjy5GbB60Au6MvO5eEa/XO/u/GeDJrnM/58VvCnCIap4vF4Tq3bOZaNWoeFo /onKaOXsKNJ2JaoKQ0uTRvggbcsCQPdFezKrNm73QQnuHHGp5D3PW0WSndKZVsPId23F Fo+mqWbBj0bM03C0KWOoSCeFxUp5UAaTjWxcnmeALDflvceXS3BdAUVolSkWz47ZRumh QTa8EavJqxlx5IRZbhe2V9DWdgS1h15NcA026Ur2TDZ72Tey8HjHe9K0DsJ5SpqpuO/F U13w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693799627; x=1694404427; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YUIuW5uAT4pKqWSajsxc/TAjVprg3onwAb2ghhXXHFc=; b=IdZiSpE3jqnS/xxmf3As8ODdAaqN3GT65yPjwaXf1Qr2dv2gjKLPMhRrVBSXtnHeO/ 0ADW1AonmJPqKkMVtyt09OF5cA37RWxZw8f4AGQ4eZBvDl2fVxNWX/iUOTsEzhRgDCdi xVGQxtcQLnGXJ3qzvbybh2YhVdV5WagtZ8OvC35gkbG/+xfQBSebQVpXoqw5+SkETaPn Dd8e2M5dI3NJOcNUXuIOZakRpOmCQ60fecVXrPrg0X40SwZTzees1sWhPeVC7/e/NQjT GwaXBuC1Ec4kKrrhXivZPh59draRQ1O0luWurcGIAcDPwe/AeyPu0nKKh2S7Kp3EpdiO LFgg== X-Gm-Message-State: AOJu0YyljdlwnDm9bHlY8ViQNN4Q0xG6Wc+TakW5MZ1Z94MG0wwkPWlo kwLHuxMgdKJeofsWsi2uicbLoWsiW5bAWgXu X-Google-Smtp-Source: AGHT+IFb2rVclDzNN4M+wA/yGKZ8eO6DYSYuEQwOoqSBFUZD27uWQeX5le4jwypfqUT990jmW26ygA== X-Received: by 2002:a5d:61cd:0:b0:31c:488e:ff33 with SMTP id q13-20020a5d61cd000000b0031c488eff33mr6501875wrv.58.1693799627073; Sun, 03 Sep 2023 20:53:47 -0700 (PDT) Received: from localhost.localdomain ([49.51.162.193]) by smtp.gmail.com with ESMTPSA id l21-20020a7bc455000000b003fe195cecb3sm15966716wmi.38.2023.09.03.20.53.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 20:53:46 -0700 (PDT) From: Jun Zhao To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Sep 2023 11:53:40 +0800 Message-Id: <20230904035340.1819580-2-mypopydev@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230904035340.1819580-1-mypopydev@gmail.com> References: <20230904035340.1819580-1-mypopydev@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavc/videotoolboxenc: Get the encoder supported properties 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: Jun Zhao , Jun Zhao 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: Get the encoder supported properties list, it will be used for feature support checks. Signed-off-by: Jun Zhao --- libavcodec/videotoolboxenc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 5633640a30..8e70915225 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -232,6 +232,7 @@ typedef struct VTEncContext { AVClass *class; enum AVCodecID codec_id; VTCompressionSessionRef session; + CFDictionaryRef supported_props; CFStringRef ycbcr_matrix; CFStringRef color_primaries; CFStringRef transfer_function; @@ -1110,6 +1111,18 @@ static int vtenc_create_encoder(AVCodecContext *avctx, return AVERROR_EXTERNAL; } + status = VTCopySupportedPropertyDictionaryForEncoder(avctx->width, + avctx->height, + codec_type, + enc_info, + NULL, + &vtctx->supported_props); + + if (status != noErr) { + av_log(avctx, AV_LOG_ERROR,"Error retrieving the supported property dictionary err=%"PRId64"", (int64_t)status); + return AVERROR_EXTERNAL; + } + // Dump the init encoder { CFStringRef encoderID = NULL; @@ -1656,6 +1669,7 @@ static av_cold int vtenc_init(AVCodecContext *avctx) if (vtctx->profile == FF_PROFILE_UNKNOWN) vtctx->profile = avctx->profile; vtctx->session = NULL; + vtctx->supported_props = NULL; status = vtenc_configure_encoder(avctx); if (status) return status; @@ -2426,6 +2440,11 @@ static int create_cv_pixel_buffer(AVCodecContext *avctx, if (vtstatus == kVTInvalidSessionErr) { CFRelease(vtctx->session); vtctx->session = NULL; + if (vtctx->supported_props) { + CFRelease(vtctx->supported_props); + vtctx->supported_props = NULL; + } + status = vtenc_configure_encoder(avctx); if (status == 0) pix_buf_pool = VTCompressionSessionGetPixelBufferPool(vtctx->session); @@ -2685,6 +2704,10 @@ pe_cleanup: CFRelease(vtctx->session); vtctx->session = NULL; + if (vtctx->supported_props) { + CFRelease(vtctx->supported_props); + vtctx->supported_props = NULL; + } vtctx->frame_ct_out = 0; av_assert0(status != 0 || (avctx->extradata && avctx->extradata_size > 0)); @@ -2709,6 +2732,10 @@ static av_cold int vtenc_close(AVCodecContext *avctx) pthread_mutex_destroy(&vtctx->lock); CFRelease(vtctx->session); vtctx->session = NULL; + if (vtctx->supported_props) { + CFRelease(vtctx->supported_props); + vtctx->supported_props = NULL; + } if (vtctx->color_primaries) { CFRelease(vtctx->color_primaries); -- 2.25.1 _______________________________________________ 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".