There is never an alpha component here, so the actual format is BGR0
rather than BGRA.  This fixes cases which maintain the alpha component
and therefore generate unexpected results.
---
E.g. fixes download and encode with PNG to make an RGB PNG as expected, rather 
than an RGBA PNG with nothing in the alpha channel.  (Previously this was 
relying on the user to realise that the alpha channel contained nothing and 
ignore it.)

 doc/filters.texi           | 2 +-
 libavfilter/vsrc_ddagrab.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index f5032ddf74..550f9a6ecc 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -28183,7 +28183,7 @@ It accepts the following values:
 @item auto
 Passes all supported output formats to DDA and returns what DDA decides to use.
 @item 8bit
-@item bgra
+@item bgrx
 8 Bit formats always work, and DDA will convert to them if neccesary.
 @item 10bit
 @item x2bgr10
diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c
index 9c59faf53e..8ff3c97959 100644
--- a/libavfilter/vsrc_ddagrab.c
+++ b/libavfilter/vsrc_ddagrab.c
@@ -115,14 +115,14 @@ static const AVOption ddagrab_options[] = {
     { "output_fmt", "desired output format",       OFFSET(out_fmt),    AV_OPT_TYPE_INT,  
      { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },    0, INT_MAX, FLAGS, "output_fmt" },
     { "auto",       "let dda pick its preferred format", 0,            
AV_OPT_TYPE_CONST,      { .i64 = 0 },                             0, INT_MAX, FLAGS, "output_fmt" },
     { "8bit",       "only output default 8 Bit format",  0,            
AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },    0, INT_MAX, FLAGS, "output_fmt" },
-    { "bgra",       "only output 8 Bit BGRA",            0,            
AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },    0, INT_MAX, FLAGS, "output_fmt" },
+    { "bgrx",       "only output 8 Bit BGRX",            0,            
AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },    0, INT_MAX, FLAGS, "output_fmt" },
     { "10bit",      "only output default 10 Bit format", 0,            
AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_R10G10B10A2_UNORM }, 0, INT_MAX, FLAGS, "output_fmt" },
     { "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)",
+    { "force_fmt",  "exclude BGRX from format list (experimental, discouraged by 
Microsoft)",
                                                    OFFSET(force_fmt),  
AV_OPT_TYPE_BOOL,       { .i64 = 0    },       0,       1, FLAGS },
     { NULL }
 };
@@ -775,7 +775,7 @@ static av_cold int init_hwframes_ctx(AVFilterContext *avctx)
     switch (dda->raw_format) {
     case DXGI_FORMAT_B8G8R8A8_UNORM:
         av_log(avctx, AV_LOG_VERBOSE, "Probed 8 bit RGB frame format\n");
-        dda->frames_ctx->sw_format = AV_PIX_FMT_BGRA;
+        dda->frames_ctx->sw_format = AV_PIX_FMT_BGR0;
         break;
     case DXGI_FORMAT_R10G10B10A2_UNORM:
         av_log(avctx, AV_LOG_VERBOSE, "Probed 10 bit RGB frame format\n");
--
2.39.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to