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 8C295433C8 for ; Wed, 10 Aug 2022 20:48:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 30F9D68B8EB; Wed, 10 Aug 2022 23:47:36 +0300 (EEST) Received: from btbn.de (btbn.de [136.243.74.85]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B300B68B810 for ; Wed, 10 Aug 2022 23:47:25 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id CC91D2F260A; Wed, 10 Aug 2022 22:47:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1660164444; bh=5JXiadhX66Oeb3v8epLGJztzidQz75zIzINHwUjk9gk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RkmP0qbJgKXEcY5UFZlb/OP9wEGYF4scDvlXkATM7OPJs00J17juPrREswlTpSr3g Cew7mNmTOYwX2ETSzBC4Clo5MMjseSChTR6pm+wS29/9IrhpuFbwgZS2U95fLECGTG oG3s8CvL+YNNAVQ63Xy/+2OisxArKSo54e2mzld4HTOlForAKN6bC9yYbldhSXwc1U K/ylzq/TidUmsR4ve4MtyEQB9WjBsiLad0MOKX4kmKcshfBoFdxh5e1rRUzbkA3hUZ xJ8z7PXvXkzjxrhgDaWP9A21DEOGWnhiLFPWvyePa8w4ezb+XK7QcDmaji8IUGvH6C ouITo02pWnt4Q== From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Wed, 10 Aug 2022 22:47:05 +0200 Message-Id: <20220810204712.3123-4-timo@rothenpieler.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220810204712.3123-1-timo@rothenpieler.org> References: <20220810204712.3123-1-timo@rothenpieler.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 04/11] avfilter/vsrc_ddagrab: add options for more control over output format fallback 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: Timo Rothenpieler 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: --- libavfilter/vsrc_ddagrab.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 252505b96d..00c72187ea 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -98,6 +98,8 @@ typedef struct DdagrabContext { int offset_x; int offset_y; int out_fmt; + int allow_fallback; + int force_fmt; } DdagrabContext; #define OFFSET(x) offsetof(DdagrabContext, x) @@ -117,6 +119,10 @@ static const AVOption ddagrab_options[] = { { "x2bgr10", "only output 10 Bit X2BGR10", 0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R10G10B10A2_UNORM }, 0, INT_MAX, FLAGS, "output_fmt" }, { "16bit", "only output default 16 Bit format", 0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R16G16B16A16_FLOAT },0, INT_MAX, FLAGS, "output_fmt" }, { "rgbaf16", "only output 16 Bit RGBAF16", 0, AV_OPT_TYPE_CONST, { .i64 = DXGI_FORMAT_R16G16B16A16_FLOAT },0, INT_MAX, FLAGS, "output_fmt" }, + { "allow_fallback", "don't error on fallback to default 8 Bit format", + OFFSET(allow_fallback), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, + { "force_fmt", "exclude BGRA from format list (experimental, discouraged by Microsoft)", + OFFSET(force_fmt), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { NULL } }; @@ -226,7 +232,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) } else if (dda->out_fmt) { formats[0] = dda->out_fmt; formats[1] = DXGI_FORMAT_B8G8R8A8_UNORM; - nb_formats = 2; + nb_formats = dda->force_fmt ? 1 : 2; } IDXGIOutput_Release(dxgi_output); @@ -262,7 +268,7 @@ static av_cold int init_dxgi_dda(AVFilterContext *avctx) #else { #endif - if (dda->out_fmt && dda->out_fmt != DXGI_FORMAT_B8G8R8A8_UNORM) { + if (dda->out_fmt && dda->out_fmt != DXGI_FORMAT_B8G8R8A8_UNORM && (!dda->allow_fallback || dda->force_fmt)) { av_log(avctx, AV_LOG_ERROR, "Only 8 bit output supported with legacy API\n"); return AVERROR(ENOTSUP); } @@ -733,7 +739,7 @@ static int ddagrab_config_props(AVFilterLink *outlink) if (ret < 0) return ret; - if (dda->out_fmt && dda->raw_format != dda->out_fmt) { + if (dda->out_fmt && dda->raw_format != dda->out_fmt && (!dda->allow_fallback || dda->force_fmt)) { av_log(avctx, AV_LOG_ERROR, "Requested output format unavailable.\n"); return AVERROR(ENOTSUP); } -- 2.34.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".