X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Fhwcontext_d3d11va.c;h=b68d26280442cea63bedf324fd55d4052566248a;hb=37644f047703aab4562429d9e4441ba6b4eab8ca;hp=960883c9d8a811c44dc35f34276432c4cc3104e9;hpb=0018f17f233d5a702513b7f83eadff8d15f08883;p=ffmpeg diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 960883c9d8a..b68d2628044 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -20,14 +20,6 @@ #include -// Include thread.h before redefining _WIN32_WINNT, to get -// the right implementation for AVOnce -#include "thread.h" - -#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif #define COBJMACROS #include @@ -46,6 +38,7 @@ #include "imgutils.h" #include "pixdesc.h" #include "pixfmt.h" +#include "thread.h" typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory); @@ -556,8 +549,6 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, } } - hr = mD3D11CreateDevice(pAdapter, pAdapter ? D3D_DRIVER_TYPE_UNKNOWN : D3D_DRIVER_TYPE_HARDWARE, NULL, creationFlags, NULL, 0, - D3D11_SDK_VERSION, &device_hwctx->device, NULL, NULL); if (pAdapter) { DXGI_ADAPTER_DESC2 desc; hr = IDXGIAdapter2_GetDesc(pAdapter, &desc); @@ -565,8 +556,12 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, av_log(ctx, AV_LOG_INFO, "Using device %04x:%04x (%ls).\n", desc.VendorId, desc.DeviceId, desc.Description); } - IDXGIAdapter_Release(pAdapter); } + + hr = mD3D11CreateDevice(pAdapter, pAdapter ? D3D_DRIVER_TYPE_UNKNOWN : D3D_DRIVER_TYPE_HARDWARE, NULL, creationFlags, NULL, 0, + D3D11_SDK_VERSION, &device_hwctx->device, NULL, NULL); + if (pAdapter) + IDXGIAdapter_Release(pAdapter); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Failed to create Direct3D device (%lx)\n", (long)hr); return AVERROR_UNKNOWN;