[FFmpeg-devel] [PATCH] Fix failure to initialize ddagrab if adapter ID is specified

Jøger Hansegård joger.hansegard at qt.io
Tue Aug 8 20:52:06 EEST 2023


Fix failure to initialize ddagrab if adapter ID is specified.

If an adapter ID is specified when initializing hw device for d3d11va,
ddagrab does not work on Windows 11. This prevents capturing screens
connected to a secondary adapter.

Failing command:
    ffmpeg -init_hw_device d3d11va:0 -filter_complex ddagrab=0,hwdownload,format=bgra -c:v h264_mf output.mkv

The reason is that d3d11va_device_create uses CreateDXGIFactory to
create a DXGIFactory 1.0. This causes init_dxgi_dda's call to
IDXGIOutput5_DuplicateOutput1 to fail because it is only supported on
DXGI 1.1 and higher.

The fix is to always crate DXGI factory using CreateDXGIFactory1 as
proposed in this patch.

Fixes: #10385
---
 libavutil/hwcontext_d3d11va.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index aa50538d64..fa8d5410f2 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -62,7 +62,7 @@ static av_cold void load_functions(void)
         return;

     mD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE) GetProcAddress(d3dlib, "D3D11CreateDevice");
-    mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory");
+    mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, "CreateDXGIFactory1");
 #else
     // In UWP (which lacks LoadLibrary), CreateDXGIFactory isn't available,
     // only CreateDXGIFactory1
--
2.40.1.windows.1



Jøger Hansegård
PhD
Senior R&D Manager
The Qt Company
Sandakerveien 116
0484 Oslo
Norway
joger.hansegard at qt.io<mailto:joger.hansegard at qt.io>
+4792642127
www.qt.io<https://www.qt.io>

[cid:image001.png at 01D9CA31.9D2C6180]<https://www.qt.io/>
[cid:image002.png at 01D9CA31.9D2C6180]<https://www.facebook.com/qt/>
[cid:image003.png at 01D9CA31.9D2C6180]<https://twitter.com/qtproject>
[cid:image004.png at 01D9CA31.9D2C6180]<https://www.linkedin.com/company/qtgroup/>
[cid:image005.png at 01D9CA31.9D2C6180]<https://www.youtube.com/QtStudios>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 3186 bytes
Desc: image001.png
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230808/6f317fec/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 460 bytes
Desc: image002.png
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230808/6f317fec/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 890 bytes
Desc: image003.png
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230808/6f317fec/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 626 bytes
Desc: image004.png
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230808/6f317fec/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 656 bytes
Desc: image005.png
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230808/6f317fec/attachment-0004.png>


More information about the ffmpeg-devel mailing list