From patchwork Mon Jan 9 12:50:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 39940 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp3065648pzb; Mon, 9 Jan 2023 04:50:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXsAFcuceiM2jEMwgLdBRRlRVGm3w9oaBoDDRoW3KtKzV+ki2Ra1FTYnM3xSpC8IcGPRephQ X-Received: by 2002:a05:6402:5408:b0:482:f518:792d with SMTP id ev8-20020a056402540800b00482f518792dmr49524194edb.28.1673268627245; Mon, 09 Jan 2023 04:50:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268627; cv=none; d=google.com; s=arc-20160816; b=n3NvDFYUTngtk6XBn9EUOVyI5fQ/kU9yU2qtEAjMmZIP0VMPG3lf1tylFu50vdodUZ 11nBxduie+fhXTNklAQBMDyGe0lihMQp688A4vCppDEfvARVHObyTgBhEWzZHcmh5coB mPUY1cxkTgTMKOIurK8VMIFQQWqtxf4KQ9SCp9ElsAJANPfDTLNVOLKNeVGzhF2a+pDR /uZkwF9JacDpWeKvCsUHDv44zVqQVF/gMTkBMpBzemDRAwH5aN+7DT8GzvWLeFN3ed64 Rv2Qpdx5y1jprnIICDBkOqP0HuIr7qfMJ5j4SFLkJlpLyLplL9gP0zfgseOsx4vttglV 10rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to:date :to:from:message-id:dkim-signature:delivered-to; bh=G+C98ELEAkGGHjZouaPaS9ZSnVGqJ1zibRlsUZZ9J9Y=; b=NXYPbzCiwGqhlL3nijfMeb93HmVTAaoNCb+a5jPOtRmLdTdr2lXYUQugemZRtvYbrX /K1Zu/pjNWySx+U1hr7BP4Yo+4rH5EJDGxgU3gD4W4n5fn+RbqNFYvM3GZEkvB4Ow7uO opVvi86n+XoZtGqLELoYWxEIlxlSPyLdwjiYkkGTedgiqGARIE8L3WCHmNuYQwhaZBxA kZJwmboRAQvnowTCROsvatWbO3UtoSTNOAnYyrzBHIyKYD6hdAoI5xaqduQFBFzyD32l QvheBxztQnSLZZpFXDzt8Fdgz3img0Pp2XT3UzSopivP64tvAHkfrTVPIBIDAiyGru/z Qqqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=vb2C73PE; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id mj24-20020a170906af9800b00782539a0286si7243636ejb.142.2023.01.09.04.50.26; Mon, 09 Jan 2023 04:50:27 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=vb2C73PE; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E8D3568BCCD; Mon, 9 Jan 2023 14:50:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-233.mail.qq.com (out203-205-221-233.mail.qq.com [203.205.221.233]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6C43E68BB61 for ; Mon, 9 Jan 2023 14:50:14 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1673268611; bh=sfjAaokmBToC7WkirP22eDd2uHBQX9p4VeoZYTflO/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vb2C73PE+60r+iNcQ8C2eXzz2hTvSaI1w2eREj7AazIRtsWh5Hi14VRGCIGQwPv9x a+DPT+mK/wa54R/oZYHheDLtXxGCxcz3cZSzYhcrlLB83P3dDav06ToiXTqDZxs9K2 KKcBsQJ5TzljkNXF0Qo6OkZ9Xfh20NG5xZ7LasPg= Received: from ZHILIZHAO-MB2.tencent.com ([119.147.10.192]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id C898A4CD; Mon, 09 Jan 2023 20:50:09 +0800 X-QQ-mid: xmsmtpt1673268610tku4awe4p Message-ID: X-QQ-XMAILINFO: MiE+axgVDEQLrEmCtnHalgnQxIBrn1LLJ0kKtyVg8TKrPC4IL3I3fUghUyUSM9 Tr8McjMbORBpcNnff5j/O6XjYv6ThbnXWhDFYMOQTDF+DGBw0oeN4ShfgNOc2jz0qi9ONwEeQLAr JwcPj+zUEE/4kKd6OlrA6NlPuUI7/4WX2ABFHefQA7mGG0IVwI3+iodOUkb1WE0rEpck7xsrUBGS d6ajpd+cRaBSRtRhkVT90VZ+UMIWs01VoYsDyNDUXImXseNeKeCW6sCQTDvaZKHLcY6+OlAcx2Bq Az+NiszTFQPNxAy8/ldgkUXHJrDmcLtsFbZHDPP1oVJTs7unX+X5pja6zHDoKMLGc2pL50KmLk1n jH2PSVnsW72lrGGdRXZyJhWmYmLceB+vBHgCr622FvxWsWKgXxRDvn9KIOVbCOcI4MTTkKDRIi6C +br/UyMsnJ1gUkVwjxFl2mR4AqfbNF2NBOi4cyqG269ERpPs2NtsRPqFKKFb/ed2ltyuo7+GIoYS HG5tFuA0VXY7Ln3fSitFtc4b/bMz/C3jLdkuj279whCERiGmlgDwhBTKzexsvRoIPakTm5dbCrJD vTFePKp+ZbO/VVIe9zS8OjysRVejHlUHmwVa8oE1G2iVQ8njtHnB3Y35Gi9BkSo3BTmBM3gED9Eb LGwJgeNM7WWQKKRnioYSU03dYthD5AqU0QewS8GYP8FvYUVHxPqda6GJWO6ct9a1c7ZJCtv1Y29x fjJ9dR6M+LuDpiBh/RJ+My38KXbKr6EC6afB2L3yXL18FR2U7HP9Nv53x6lYg5FQNJ64XMNSpDJB nWZAxBsnkemv4Dyx7jk35PbUIGGYfgKQBYIdcOOCaiPQ8FLMZ+6/8+fAoCOlN1ZhFogJLdXrY+Kx VXEKZAZ+UnYgKiJfgKbwOf7h9cLoNJjr5hqwTCOjBaJ3IUGMEeWXoVroFPUnhRriuUy5mtaLxfLX RDXswO53pTVZ0jnVM71659Xdk3bVx0CaybYR0ousF30wGOc0MkBbA76bUjP7aQEGaMuxQoiXA= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 9 Jan 2023 20:50:04 +0800 X-OQ-MSGID: <20230109125008.13336-2-quinkblack@foxmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230109125008.13336-1-quinkblack@foxmail.com> References: <20230109125008.13336-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/videotoolbox: prefer hw_frames_ctx/hw_device_ctx over hwaccel_context 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: M2175eIq5kft From: Zhao Zhili --- libavcodec/videotoolbox.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index a18b49007d..acf0c79822 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -1181,7 +1181,8 @@ int ff_videotoolbox_common_init(AVCodecContext *avctx) vtctx->logctx = avctx; - if (avctx->hwaccel_context) + if (!avctx->hw_frames_ctx && !avctx->hw_device_ctx && + avctx->hwaccel_context) return videotoolbox_start(avctx); if (!avctx->hw_frames_ctx && !avctx->hw_device_ctx) { From patchwork Mon Jan 9 12:50:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 39941 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp3065747pzb; Mon, 9 Jan 2023 04:50:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXsqR/LTGqfU2ya7N2ZlRnyhMyZzRF43VSOLfltWpdWAkPWbVwXcIQVv23lh1e8oLy0vhICm X-Received: by 2002:a17:907:9b06:b0:83f:8e58:6427 with SMTP id kn6-20020a1709079b0600b0083f8e586427mr54208611ejc.63.1673268636542; Mon, 09 Jan 2023 04:50:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268636; cv=none; d=google.com; s=arc-20160816; b=GRTBDzmQ1DyWTIFDraBn+qRCodtp16rrbFEIoyMC+D52mrGiLobYChCpxCgVqwhs+L Y/2UZ4Sudy+oTGKgtwzU3H+DPqaS1tiM06imgXexCaWEqVvYp52SJQDmEhDRH5I/conS KzEgeL1Q6MYIl3G/CnBx8+C/SxoaKBJIZxIebJTV9nheV3dN2FVfp2RZ4KJRJXHRot8U esafK42OIIuMHHFp3Fy2LBishqanq02lvzT6JLKkQRWLOSVsQzPWShgxiQJP5MEUqdRP yRSMjXPW1cQIMTI3/Vm1pP0fPNOik/ayVuCpV7mICFYq4awEu2VNaUutZwWP7NqK4Ryo zMDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to:date :to:from:message-id:dkim-signature:delivered-to; bh=BD3xBA1vQMAvwkNGj+QMX1AxdmgKSuHNUNflxFMJyLo=; b=GoGHXlhct8qbN4SrDe+lgJgsJSCM6MGa9tTgRtaIDSTapUseIEqWgT9hPtBbtgLDJg XE8Hn6g17F6nBnFUsnEvf7ChFZVidasZb7Mzd8SlQ+PBjmOu4JDatq7hU+ZPVovGuyjm GWot+nMZn5EQZYjY0YAao4WvENu3tT7pkW1pjdcLVXOdkvZ9DtkraFzCOik0/Od5CW+b ljyA29ge4z6qWHwqWj1/2L/2N1TEMrBg5m8mFXzsmtJt5CTIpA5RKoFJ4jbIY29YBHZK 8qQwc0KcGFAj7y7pEm1MSV1lYTBph8m8BNJgoQ+Tp/CUDvL9123cQ9hzhF6bzer3tvay DriA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=zJxo9voD; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a21-20020a1709066d5500b007add8160fd9si6933393ejt.765.2023.01.09.04.50.36; Mon, 09 Jan 2023 04:50:36 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=zJxo9voD; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DAD1C68BD03; Mon, 9 Jan 2023 14:50:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6784968BCCD for ; Mon, 9 Jan 2023 14:50:16 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1673268612; bh=WmzlHax//eSYjDOOErYRm+t+D+BZdVx9rc7Gwk78zew=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=zJxo9voDv1cjei+z9XKE7Ne9iPoBa/idYZJ2muP7yb0aA8w0EdTMGVhhxIH50nSvN 2hOlqtNLTPaOpHjauwAOeRKt+Rb/Ub6GxFo0cIvNrWEB0rh/lSnhgldIUVysgR2ryP bsIpd689qCMCWmUfdpQDIb8zzhaJcmQc9GY4VJLM= Received: from ZHILIZHAO-MB2.tencent.com ([119.147.10.192]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id C898A4CD; Mon, 09 Jan 2023 20:50:09 +0800 X-QQ-mid: xmsmtpt1673268612tgn8u8g6l Message-ID: X-QQ-XMAILINFO: NkHKfw09D6j8cg1OayiKssWwlBa1+bV3bi25a1TJ9FI1e5Doz0GWHV9wKfJzuM huGwFVyP4WA76f1dLwy6L5qBnXPGbhoNQUwfKC1yV7NOQnLCP8xk1QFFOGfpIZ1QxE7fv8IEoxJH XKM8Wk/AAGvYNG/F7y7MwG6gdaqesDYMlFxhB5UBRqr4GlTTZF4C5KloDf2cPSGa2trMyhEiOBeb aI6MV/Awm0F2Rpm/Vvz52EM/Y/zClTBWqJe0X1wQojPjfmJ0z9+/SS48GcWljkAeB1UvPBo+jvhl dihPoXJtJZLqPSlnmCMjVaRSH46INvgJiBi5+Ms1yR6i6y5mOdgphQSvLe3wAx0rmqnL1pT1tVXP 6/MxV0M+IAlwNf4/zmbwbHR67P1DHJZDBU+DYHv5dC1d4FuNvLjtty7BBy5rN/7IMHjqFDlU0c/v JyK+xbQDSh3DV5sN1tP8Fk9+kMMl1st6wFG/ThG5e/b2rPZFhcP3QbJv/jxM0kmpS3VF8rboiXwA 3ltYvqxrGMQ4mHG9QR/cdz9L6RXRt/a+jb3W3VjLEs6V8c5YO6zqY7BGaZKdZ3YWrUxTJm4X08x0 +hJG3oO2s9waaOujHH/NKOCp+flfcwibUh2hlC2nTbOJX9qB/CvpH+4MkiWQw7qE1pu9COLNhRdh bazgEOnJPOQU6vH6IwOIFbv6o5ZxTKugmKLDuhmbaduxt/lEBzDPPcbDsjpmsIuftAVF6uTpua0s D6zWb1SjYLbc/qGNUz5IdOJDkJ0y0IceOyiMeKyQJvICvsuVlq4aCx0jvQy7oDgF3XRMS7WAv6xS JVbABQCibRigfBmYdECinaBPDHCzrUuBWHWya+QmfTDAKSE4gN9HCEfEM/AQ7g2MU2mLnBQjC11u 863eQL2uH1JTj+yJIEuHiZB5+IfyFGafdUSoaxUyNYhI/Y6X/XxxcjXg+HTLZOkZFXa+mmZugvgB ElDhqgoO1EDmhQ/4E7diUfo0m1XLfYWvjEzRvS5HwO5R+v9iW5voTzpFtPheBvSDWg3ZJYDcEr0Y YU+WrpuSTmnDHiWhE4 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 9 Jan 2023 20:50:06 +0800 X-OQ-MSGID: <20230109125008.13336-4-quinkblack@foxmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230109125008.13336-1-quinkblack@foxmail.com> References: <20230109125008.13336-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/videotoolbox: deprecate creating AVVideotoolboxContext by user 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: GYgWRsDf2EPW From: Zhao Zhili --- libavcodec/version_major.h | 1 + libavcodec/videotoolbox.c | 35 ++++++++++++++++++++--------------- libavcodec/videotoolbox.h | 12 ++++++++++++ 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h index 12f863deb7..2c0443c4c8 100644 --- a/libavcodec/version_major.h +++ b/libavcodec/version_major.h @@ -52,6 +52,7 @@ #define FF_API_SVTAV1_OPTS (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_AYUV_CODECID (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_VT_HWACCEL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 60) #endif /* AVCODEC_VERSION_MAJOR_H */ diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index acf0c79822..a3d19c4c63 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -1173,6 +1173,22 @@ static enum AVPixelFormat videotoolbox_best_pixel_format(AVCodecContext *avctx) return AV_PIX_FMT_NV12; } +static AVVideotoolboxContext *av_videotoolbox_alloc_context_with_pix_fmt(enum AVPixelFormat pix_fmt, + bool full_range) +{ + AVVideotoolboxContext *ret = av_mallocz(sizeof(*ret)); + + if (ret) { + OSType cv_pix_fmt_type = av_map_videotoolbox_format_from_pixfmt2(pix_fmt, full_range); + if (cv_pix_fmt_type == 0) { + cv_pix_fmt_type = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; + } + ret->cv_pix_fmt_type = cv_pix_fmt_type; + } + + return ret; +} + int ff_videotoolbox_common_init(AVCodecContext *avctx) { VTContext *vtctx = avctx->internal->hwaccel_priv_data; @@ -1191,7 +1207,7 @@ int ff_videotoolbox_common_init(AVCodecContext *avctx) return AVERROR(EINVAL); } - vtctx->vt_ctx = av_videotoolbox_alloc_context(); + vtctx->vt_ctx = av_videotoolbox_alloc_context_with_pix_fmt(AV_PIX_FMT_NONE, false); if (!vtctx->vt_ctx) { err = AVERROR(ENOMEM); goto fail; @@ -1371,22 +1387,9 @@ const AVHWAccel ff_prores_videotoolbox_hwaccel = { .priv_data_size = sizeof(VTContext), }; -static AVVideotoolboxContext *av_videotoolbox_alloc_context_with_pix_fmt(enum AVPixelFormat pix_fmt, - bool full_range) -{ - AVVideotoolboxContext *ret = av_mallocz(sizeof(*ret)); - if (ret) { - OSType cv_pix_fmt_type = av_map_videotoolbox_format_from_pixfmt2(pix_fmt, full_range); - if (cv_pix_fmt_type == 0) { - cv_pix_fmt_type = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; - } - ret->cv_pix_fmt_type = cv_pix_fmt_type; - } - - return ret; -} +#if FF_API_VT_HWACCEL_CONTEXT AVVideotoolboxContext *av_videotoolbox_alloc_context(void) { return av_videotoolbox_alloc_context_with_pix_fmt(AV_PIX_FMT_NONE, false); @@ -1413,4 +1416,6 @@ void av_videotoolbox_default_free(AVCodecContext *avctx) videotoolbox_stop(avctx); av_freep(&avctx->hwaccel_context); } +#endif /* FF_API_VT_HWACCEL_CONTEXT */ + #endif /* CONFIG_VIDEOTOOLBOX */ diff --git a/libavcodec/videotoolbox.h b/libavcodec/videotoolbox.h index 25a747a49f..3cd1d254ff 100644 --- a/libavcodec/videotoolbox.h +++ b/libavcodec/videotoolbox.h @@ -90,6 +90,8 @@ typedef struct AVVideotoolboxContext { int cm_codec_type; } AVVideotoolboxContext; +#if FF_API_VT_HWACCEL_CONTEXT + /** * Allocate and initialize a Videotoolbox context. * @@ -102,7 +104,9 @@ typedef struct AVVideotoolboxContext { * object and free the Videotoolbox context using av_free(). * * @return the newly allocated context or NULL on failure + * @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead. */ +attribute_deprecated AVVideotoolboxContext *av_videotoolbox_alloc_context(void); /** @@ -112,7 +116,9 @@ AVVideotoolboxContext *av_videotoolbox_alloc_context(void); * @param avctx the corresponding codec context * * @return >= 0 on success, a negative AVERROR code on failure + * @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead. */ +attribute_deprecated int av_videotoolbox_default_init(AVCodecContext *avctx); /** @@ -123,7 +129,9 @@ int av_videotoolbox_default_init(AVCodecContext *avctx); * @param vtctx the Videotoolbox context to use * * @return >= 0 on success, a negative AVERROR code on failure + * @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead. */ +attribute_deprecated int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext *vtctx); /** @@ -131,9 +139,13 @@ int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext * * av_videotoolbox_default_init(). * * @param avctx the corresponding codec context + * @deprecated Use AVCodecContext.hw_frames_ctx or hw_device_ctx instead. */ +attribute_deprecated void av_videotoolbox_default_free(AVCodecContext *avctx); +#endif /* FF_API_VT_HWACCEL_CONTEXT */ + /** * @} */ From patchwork Mon Jan 9 12:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 39942 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp3065847pzb; Mon, 9 Jan 2023 04:50:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXuF0c1iQhE2Q4/KvQMm6chlKI8VQPm4Es1jN2cvlz4uMQ7MdIQRTILLYi0oL0PXO5bdOCzk X-Received: by 2002:a05:6402:ea0:b0:46f:68d0:76 with SMTP id h32-20020a0564020ea000b0046f68d00076mr45436192eda.34.1673268645099; Mon, 09 Jan 2023 04:50:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268645; cv=none; d=google.com; s=arc-20160816; b=VLP8hY5NzKhxhUHICImFdwvcajWen2B3cY86RqkXwIbVSl1h52K+IrFKjfZRgdc7AP bDQEFz4njo8fyxSNrw8Ht5F9YgCKbVo5bLsiSuleQXo3nerCTzCMwxa+6zaxE6FkTNIS LLagQbu1mBvYBzw0ECpR8zhSt/xJfcAN42htCplQwxKxzKYVG0buQK7zq0IjL1dILo7M 88joJyFLV0mOF9jEcj8mjWAj/bzftw4x3HUNUtVQG8eO7FE83/fnH8nSO1ndzHB54prm i9TA4dCvzva/Vj7a0X+sdb4/ymynQ7FKPAuHrlKprXlllMMe49GEAX+V1abYoehjDAmr ZCKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to:date :to:from:message-id:dkim-signature:delivered-to; bh=o7xLkSE0qvJeAfTzkQwrqqJ35foDuZ0A4M0lJS6QLOk=; b=dIQPEkTn3sOwwG5cVMVA3Ih/GeCc5c0vKwx1Hbs2H2GAXjJlfNYGA4bTKXjjOoj7bI agIRubXOtF68ILrmmclDCoRoKQO8qaQL0qCi+oj5e+rbZ1m9ui8KNWQeXXuXO1VXn0Vo Ne+XjFKrlhPOMbTCeSe2BbNJDDjCFqLsvQvV75k2VPn2he6yOwJ1aSefY2FEeLFKaeOQ xQSrPhBMWnvcXxHYilUnV/KqqmzYHyCmy00i0Myr9y1nGH+9/JtxpMxWDhLmT+z4EZec 4rUF8ruwFiOqRoXX2VTKvNj6ywrwAU/9pEils3j8pDUN4IoEI4GcgnbHkNnAEEaGKtXQ D4pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=NwCRimyf; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g25-20020a170906595900b0084c46478993si7315128ejr.775.2023.01.09.04.50.44; Mon, 09 Jan 2023 04:50:45 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=NwCRimyf; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C6A6D68BCDD; Mon, 9 Jan 2023 14:50:24 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-58-216.mail.qq.com (out162-62-58-216.mail.qq.com [162.62.58.216]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BCF4368BB61 for ; Mon, 9 Jan 2023 14:50:16 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1673268613; bh=puD6RryxX4kRfnOscEu5puTgicxIGVvBIqLyGu5qVus=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NwCRimyfQ+OAmUiXYB/axDUh7U9nxBKkpi3UDFVxod60O3pZ8g16p9jbsDIUZ4+KY kJrrsXZmpdKVav+XpX8YQimFTVu9/koqniLBe3le26IvMEjtf0qb3wZgFvmdDEAyvz oa5dj/Tfs/pqiXYPYYq3nDOvVDBF4hlHVbAjikV4= Received: from ZHILIZHAO-MB2.tencent.com ([119.147.10.192]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id C898A4CD; Mon, 09 Jan 2023 20:50:09 +0800 X-QQ-mid: xmsmtpt1673268612tss3f5hmd Message-ID: X-QQ-XMAILINFO: MyIXMys/8kCt8xZmD2vRtvKXsVrWcEdpj2Ubc3yPNj/cosOuYHNFCvUISEEJXR SObnfy2vsxrdLD6CNTITUoYPO8mSCZ3HW1LcgLXiX3to1sLaeep+uI8bUwZOPsdfx4nmWqnn/Tb4 PTY72IOsY6FKq1VCxGMbCALwNGHJGiZo3SOacIDtoDrDfF6Zp1vZfBHOHNfV2fr5z6rWrX82fFEP M4O0uwNkj+YOutzi3IeZH2REGxEshHu14p4pcWwo7og7euxgmwIpvunE4LI+OFNKz7Sf6ORB72eq qD28Udu7EByAmzgHCTTrNWEzvBN1DTDXYu1DuEg07my+OTvDXrtFpfcAF5OnKpFd/6RqR256+G5i KfFXjWz169dWFjWxwUPVn2u+qL2vAoOvlk1/mnL8Ij+36eSALhZy7SNUAHNLdaXbAQDkwJczpbzI 6AGEgtr0j01p8gDRbvX/lCIGgxJOlnfuhFW9oyhrlKBbxfHZCq/Z5moycCvLCDKbkgIZ7TMx4YGQ gFWkvegFTD9x6Hd72Blhz61qYg6Qfq7FB9D6vyUxRtSZ/ukV6f97M5LOWYuIGhvbblxY+NqtOVS4 4DYjBKxvsa0T75+3mqtcDsh+Pm8SwY0BlWCk0FtBszV5wr0/CVOZc3aA3jEZho7k4n/nj3WC/NxU lKIwto1L5V/QK5F+eAFZW18ZvQvJo7hfhJh8L4c0iMkiyLWb7fQdbx7LZ/TUQxCAJ34s786UzZxe CapyoEHV95FtDToCjurgIh95IQfHMm6T4iSy4CwxKNvyL7Lg72NraX4kS0KMfqSM7FC3+xLSkvdN csCkT6P/fZ5qShzSghbr5p5WRc9Q7BmlQPJ7iHvNOm15ezN+Zr+JF+dUQ6ygBETDX7XoAKyGlssf XW0rOpdj/HX8+6c4UvHogQY4ydAl50K/zeRhQjnB22IuF7CSTnYOgjvk1eLlHE8+gxB5QfPGHj4C HejceZxiC/SAdGTOSzPebr0WsjLwhUHMnP1CFFvIOzVeQo4OkDMWkT8TPXMuqf1VtXPWZySYI= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 9 Jan 2023 20:50:07 +0800 X-OQ-MSGID: <20230109125008.13336-5-quinkblack@foxmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230109125008.13336-1-quinkblack@foxmail.com> References: <20230109125008.13336-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/videotoolbox: fix documents of AVVideotoolboxContext 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: nVBk6sEjrZZZ From: Zhao Zhili Since those fields will be overridden by videotoolbox_start(), they should never be set by user, it can trigger memory leaks otherwise. --- libavcodec/videotoolbox.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/videotoolbox.h b/libavcodec/videotoolbox.h index 3cd1d254ff..ba5eddbf46 100644 --- a/libavcodec/videotoolbox.h +++ b/libavcodec/videotoolbox.h @@ -57,7 +57,6 @@ typedef struct AVVideotoolboxContext { /** * Videotoolbox decompression session object. - * Created and freed the caller. */ VTDecompressionSessionRef session; @@ -79,13 +78,11 @@ typedef struct AVVideotoolboxContext { /** * CoreMedia Format Description that Videotoolbox will use to create the decompression session. - * Set by the caller. */ CMVideoFormatDescriptionRef cm_fmt_desc; /** * CoreMedia codec type that Videotoolbox will use to create the decompression session. - * Set by the caller. */ int cm_codec_type; } AVVideotoolboxContext; From patchwork Mon Jan 9 12:50:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 39945 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp3066116pzb; Mon, 9 Jan 2023 04:51:10 -0800 (PST) X-Google-Smtp-Source: AMrXdXu3mlFtExM2slKxlE51kIpFlm0DKbgDcup3Fgzt+Lj5a9dFORvkPqGYX3OcPfJlrJF9ErOr X-Received: by 2002:a05:6402:2b93:b0:47e:5b70:de79 with SMTP id fj19-20020a0564022b9300b0047e5b70de79mr57903177edb.17.1673268670625; Mon, 09 Jan 2023 04:51:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268670; cv=none; d=google.com; s=arc-20160816; b=hdhc82axvuJKkvwMrx7Mxzeywwxwp4s2KYB8U22E6m30KFehKrAuQqMfw6s45yBKr/ Yvv5byE5L9ykVC5sjNbWjTjcozexgnKK/D83BYnGeUBDkRxMyROcYYBDtzanGpiPOY52 HOaznnziOVLJwRqUE0RIKzC4rXbqwOTUSaL6g3nv+K/2IuhBdns1OZwM5DASWQwq9gIX KYvplbWgP3UzryMtJz/78E+BjrzrDaRbLhjW1A64jHxq2+wSm3O4/zN021RpgcRYD8RW tNh8FOAO9pXRFy0fgtToLjC8siUS90OfeZi9p0uQRsrPFV1abUdO6Bln3DJDHu+1vaoD i5Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to:date :to:from:message-id:dkim-signature:delivered-to; bh=8INAnen8aTZqf0L7UcPYQq0hGxY6yJYoJKdJ3jI2Gpw=; b=bqzoqPYeBCUsgOgiFHokOwKTM+Ztgm2Wm+z8c42EOOWXFxvJ5SY3TF9qoP1Nc9f8rH GGp0lvkqcV/jzls6r8lkk+70tBLEVyLg/7m/1qFrN7HSDkNwKKbgIEbF9fUZZPGNtBJO oRC0YX+KWq4FT7/+NJ2gelG+C7e9Z/ZcI4iCzRwYcvApF/zfC7Re8icnMWkmsh2YrDkw DydgZg5Mu14v/vklQ6sY2nzH4DiEEWSXwWiraROUtbLwOg8FhJr03vZXH3rxNYZvvykj hHKzO+mBKqSQXY6G37Qv8kPxMv9WrAzHlZKK70N3kgIGXGvPznug4oCx8/T9EJaH87CY efcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=hTTv1HcH; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l13-20020aa7c30d000000b0046b32882b04si8246722edq.440.2023.01.09.04.51.10; Mon, 09 Jan 2023 04:51:10 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=hTTv1HcH; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7DB3F68BD25; Mon, 9 Jan 2023 14:50:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-64.mail.qq.com (out162-62-57-64.mail.qq.com [162.62.57.64]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E19268BCEC for ; Mon, 9 Jan 2023 14:50:18 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1673268614; bh=fIFjuZPCoSEcuFdilCZSXsCEgU9nFwHxfU6PGAasVj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hTTv1HcHysQUfll40lGW7qlC2NzWmEPyoB2G9FSm/jTnfPUrTZ/vfEiPuZ6JH7+YK j+ZTA3dWA9xEkm3+RotFMIfYU43vZDLJ7MdcHRiQg/QUumM2tzyUcuEhx2iQy3ZK1L xzw/Bu0lWvkbXNUB9x5t/7kbZHui4hdiIe2QPFu4= Received: from ZHILIZHAO-MB2.tencent.com ([119.147.10.192]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id C898A4CD; Mon, 09 Jan 2023 20:50:09 +0800 X-QQ-mid: xmsmtpt1673268613tmp6jw73x Message-ID: X-QQ-XMAILINFO: OaubouGXmhNzl1xC0tZNLeAu3Mn+sTg3FVFvhApvRScyvgBw1rk0lDQCrG1/Jp Dn4xaIalEJoh/riPp1VsNAT63TeoiEAHimcNdxoQvypiv5LddEgnEUObU2LAEDhy9C7rzn2WBNB7 VdFFQUnVVPXlO3WxRLWWMDVIlR6s2EaEYtdDDg4ZcPzwxLri2r2wQGDpGKDDlPcALQzrsUnzWFvx dVVT4JPaViW6atYWBfAedWE+RQAS+rHfPu8uFWm+Xpc6a5Eh/nKQuEgic/DC/K9XnY3ofME57VT4 NnP0SgMqRBNAq/j9rjMKtIT2/YNg8RiGgu9N6SFgfNk3L0ZLi+GrY0Xp90TE6VeN0V4auvwc4Lnk rDBAMJtexYyugen37e/aA3vuA3FcCrovsvOF1o4E439ECvMghUrpulbDwLLetB4nZXLoLOBnWE8Q 2QY/11OfaE5OZb8JC9QPNfhm3HLM6kBWvyDhlxA3WK9UoyQP8GZBjCDx74iuCPYvrB3rOktHP/2B 9QzB98IFzK+fD4nK72J4B5ELQzG5SY14JPDshHiWEfTLWJnejg/CDKtrVPjPTc7KzzjwHiXvWxuw E3N2F8TU/8YWhl71QnBgmT1i28qERPKfG2v9tBKwfHGMgZtdk+HkL1kZ4A+usBkHNI5U+BMaeSaD xu1/PEs0X8Rhw1ZwkBtKd839axPt9lZ9DSfe3hcN2r5bJm3K1i7TIaWSp7ugQwJHGqn1V2t8+k8G 1Ujqy21L4p3zZ8a9hZ81wIyT2l36vbpbiky4vSictFVIVjy0M5UOVa6yQnKZFy9Fjw7VoZxSKV7C B2v/tGFnmjj0hrtegAIPOGUp+olsUDWimltvSIVHXPUXQhgp1ntn22Yrh4hbdqhWkkFj/gWMzhjA Sroh6YbrKGhY1dkSNp/dWPEFUiAL+BRhBiywKYTiWS+ZvRBus5+laoKA6s9/FoE5VJCT434syEYM iwroBE8rcMjGThpIOTov7wwIxPIEbfax0uGLOhW4bFSKf61Wr80g7B+Pz1vfN0 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 9 Jan 2023 20:50:08 +0800 X-OQ-MSGID: <20230109125008.13336-6-quinkblack@foxmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230109125008.13336-1-quinkblack@foxmail.com> References: <20230109125008.13336-1-quinkblack@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/5] avcodec/videotoolbox: don't use av_ prefix for local function 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 7bbDty/5IpIO From: Zhao Zhili --- libavcodec/videotoolbox.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index a3d19c4c63..e42fea6f32 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -1173,8 +1173,8 @@ static enum AVPixelFormat videotoolbox_best_pixel_format(AVCodecContext *avctx) return AV_PIX_FMT_NV12; } -static AVVideotoolboxContext *av_videotoolbox_alloc_context_with_pix_fmt(enum AVPixelFormat pix_fmt, - bool full_range) +static AVVideotoolboxContext *videotoolbox_alloc_context_with_pix_fmt(enum AVPixelFormat pix_fmt, + bool full_range) { AVVideotoolboxContext *ret = av_mallocz(sizeof(*ret)); @@ -1207,7 +1207,7 @@ int ff_videotoolbox_common_init(AVCodecContext *avctx) return AVERROR(EINVAL); } - vtctx->vt_ctx = av_videotoolbox_alloc_context_with_pix_fmt(AV_PIX_FMT_NONE, false); + vtctx->vt_ctx = videotoolbox_alloc_context_with_pix_fmt(AV_PIX_FMT_NONE, false); if (!vtctx->vt_ctx) { err = AVERROR(ENOMEM); goto fail; @@ -1392,7 +1392,7 @@ const AVHWAccel ff_prores_videotoolbox_hwaccel = { #if FF_API_VT_HWACCEL_CONTEXT AVVideotoolboxContext *av_videotoolbox_alloc_context(void) { - return av_videotoolbox_alloc_context_with_pix_fmt(AV_PIX_FMT_NONE, false); + return videotoolbox_alloc_context_with_pix_fmt(AV_PIX_FMT_NONE, false); } int av_videotoolbox_default_init(AVCodecContext *avctx) @@ -1404,7 +1404,7 @@ int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext * { enum AVPixelFormat pix_fmt = videotoolbox_best_pixel_format(avctx); bool full_range = avctx->color_range == AVCOL_RANGE_JPEG; - avctx->hwaccel_context = vtctx ?: av_videotoolbox_alloc_context_with_pix_fmt(pix_fmt, full_range); + avctx->hwaccel_context = vtctx ?: videotoolbox_alloc_context_with_pix_fmt(pix_fmt, full_range); if (!avctx->hwaccel_context) return AVERROR(ENOMEM); return 0;