[FFmpeg-devel] [PATCH] avutil/hwcontext_d3d11va: Support DXGI_FORMAT_B8G8R8A8_UNORM encoding

you74674 at gmail.com you74674 at gmail.com
Mon Mar 8 12:41:52 EET 2021


From: you74674 <you74674 at gmail.com>

Support using DXGI_FORMAT_B8G8R8A8_UNORM format ID3D11Texture2D
texture as AVCodecContext->hw_frames_ctx for encoding.
AV_PIX_FMT_0RGB32 is used here because in libavcodec/nvenc.c, it is
mapped to NV_ENC_BUFFER_FORMAT_ARGB, which is mapped to
DXGI_FORMAT_B8G8R8A8_UNORM in sample code from NvCodec.
---
 libavutil/hwcontext_d3d11va.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index c8ae58f908..14c2fe562e 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -88,6 +88,7 @@ static const struct {
     // Special opaque formats. The pix_fmt is merely a place holder, as the
     // opaque format cannot be accessed directly.
     { DXGI_FORMAT_420_OPAQUE,   AV_PIX_FMT_YUV420P },
+    { DXGI_FORMAT_B8G8R8A8_UNORM, AV_PIX_FMT_0RGB32 }
 };
 
 static void d3d11va_default_lock(void *ctx)
-- 
2.28.0.windows.1



More information about the ffmpeg-devel mailing list