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 7EFE142257 for ; Fri, 17 Dec 2021 00:12:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0E0A568AFEB; Fri, 17 Dec 2021 02:12:32 +0200 (EET) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D5B1968A786 for ; Fri, 17 Dec 2021 02:12:22 +0200 (EET) Received: by mail-io1-f52.google.com with SMTP id x10so704181ioj.9 for ; Thu, 16 Dec 2021 16:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rcombs.me; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=r7VF92SVjudlxE7DN4zIictBRpLo4pxVucK4VDOjJ5U=; b=c4rsUJbHwAbu0gpUptAxma6VYPDOZcIbCkALY+l/JjJt/N8nZDChvLVT/+BwtBRGYQ G2l2rDhEeq5Y73yUGziyIUCGq6hYvQol7Fw4p9On30P9hTg2rRuqJrr5Q72JZ9WGXkHz gOxbjk1Akv6ljHc4P5LhCvoqAABSBxfMdVGpH3Ph9ijIotUuv0wB8MDizMsXT/94gOCV E/L4Vae9E1mt/kO6ey8XO1unxZQzPhid5PDPKLaz3knRHLi5T7HI/nq6+1Vvn+0PGwy4 9S/zUEha4jyliVkt4sbfiNZVTCR+wJcgR2ZhCgXQd0pm+mvW9HU5Epv3pXY1qJVxFNq1 481g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r7VF92SVjudlxE7DN4zIictBRpLo4pxVucK4VDOjJ5U=; b=NSSA/n1GiWWs8D9PFl2JnJW0pQyyAyEcbIx1yPUGtdDoV3LDJAfuO1KkFx2rXZ2JcX 4FZmVANgLwIoe8LKNJQENVLN5lrA5h7B0btZlp8RXiflloF07TvivQu4WobgWDKcOC/q ts3slDqK0r3TuSlv0dFi6yYLsuoalhHvXqpNe/+EvS7L8zaD+QdtJkDpKf+A/GlpRtcW /ClxvIZpuub9gScBUJJFiS02QELy5zm+fhvjiRe7hisoabasc+8XYpWUMr+KBscTCJO0 cpczgLr0lJmjRDen291ZQgIRLhyImzqX4zyppaLEgNtzOwRASenZycgacJg5mvkSIYKk qxOw== X-Gm-Message-State: AOAM532yBZbs1mVi7qxlsYqqwvhtBVdHr+efThJCLTwvC3fRAXEBc6dN vQf8ua3q0kijwCs3V6KdCe2Y9cbsF/eem60= X-Google-Smtp-Source: ABdhPJzm02UWLJiu3OAEfZtqDLob/rfVywi0Wz5m/yacjgnYki34mrF18sze27bynceI8/laYxUx4Q== X-Received: by 2002:a05:6638:33a6:: with SMTP id h38mr238795jav.151.1639699941217; Thu, 16 Dec 2021 16:12:21 -0800 (PST) Received: from rcombs-mbp.localdomain ([2601:243:2000:5ac:1163:bda5:7473:fab3]) by smtp.gmail.com with ESMTPSA id z13sm1571257iln.43.2021.12.16.16.12.20 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 16 Dec 2021 16:12:20 -0800 (PST) From: rcombs To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Dec 2021 18:12:08 -0600 Message-Id: <20211217001215.75135-4-rcombs@rcombs.me> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217001215.75135-1-rcombs@rcombs.me> References: <20211217001215.75135-1-rcombs@rcombs.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/10] lavc/videotoolboxenc: detect alpha more generically 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 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: Fixes support for alpha in hardware input frames --- libavcodec/videotoolboxenc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 9857e55fdc..fa8f717a6c 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -406,14 +406,14 @@ static int count_nalus(size_t length_code_size, return 0; } -static CMVideoCodecType get_cm_codec_type(enum AVCodecID id, - enum AVPixelFormat fmt, +static CMVideoCodecType get_cm_codec_type(AVCodecContext *avctx, double alpha_quality) { - switch (id) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt == AV_PIX_FMT_VIDEOTOOLBOX ? avctx->sw_pix_fmt : avctx->pix_fmt); + switch (avctx->codec_id) { case AV_CODEC_ID_H264: return kCMVideoCodecType_H264; case AV_CODEC_ID_HEVC: - if (fmt == AV_PIX_FMT_BGRA && alpha_quality > 0.0) { + if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpha_quality > 0.0) { return kCMVideoCodecType_HEVCWithAlpha; } return kCMVideoCodecType_HEVC; @@ -1376,7 +1376,7 @@ static int vtenc_configure_encoder(AVCodecContext *avctx) CFNumberRef gamma_level = NULL; int status; - codec_type = get_cm_codec_type(avctx->codec_id, avctx->pix_fmt, vtctx->alpha_quality); + codec_type = get_cm_codec_type(avctx, vtctx->alpha_quality); if (!codec_type) { av_log(avctx, AV_LOG_ERROR, "Error: no mapping for AVCodecID %d\n", avctx->codec_id); return AVERROR(EINVAL); -- 2.33.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".