diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/cuda-gst.h b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/cuda-gst.h index 37bb4f9ca0..381264a3bb 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/cuda-gst.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/cuda-gst.h @@ -4,6 +4,16 @@ #include #include +#ifdef G_OS_WIN32 +#ifndef INITGUID +#include +#endif /* INITGUID */ + +#include +#include +#include +#endif /* G_OS_WIN32 */ + G_BEGIN_DECLS /* cuda.h */ @@ -182,23 +192,23 @@ CUresult CUDAAPI CuGLGetDevices (unsigned int * pCudaDeviceCount, CUGLDeviceList deviceList); -#ifdef GST_CUDA_HAS_D3D +#ifdef G_OS_WIN32 /* cudaD3D11.h */ GST_CUDA_API CUresult CUDAAPI CuGraphicsD3D11RegisterResource(CUgraphicsResource * pCudaResource, - gpointer pD3DResource, + ID3D11Resource * pD3DResource, unsigned int Flags); GST_CUDA_API CUresult CUDAAPI CuD3D11GetDevice(CUdevice * device, - gpointer pAdapter); + IDXGIAdapter * pAdapter); GST_CUDA_API CUresult CUDAAPI CuD3D11GetDevices(unsigned int * pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, - gpointer pD3D11Device, - CUD3D11DeviceList deviceList); + ID3D11Device * pD3D11Device, + CUd3d11DeviceList deviceList); #endif G_END_DECLS diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudacontext.c b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudacontext.c index bd611dc295..aed158aa36 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudacontext.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudacontext.c @@ -182,7 +182,7 @@ gst_cuda_context_find_dxgi_adapter_luid (CUdevice cuda_device) continue; } - cuda_ret = CuD3D11GetDevice (&other_dev, adapter); + cuda_ret = CuD3D11GetDevice (&other_dev, (IDXGIAdapter *) adapter); IDXGIAdapter1_Release (adapter); if (cuda_ret == CUDA_SUCCESS && other_dev == cuda_device) { diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudaloader.c b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudaloader.c index 064987fb01..fffcbefd2b 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudaloader.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudaloader.c @@ -123,13 +123,15 @@ typedef struct _GstNvCodecCudaVTable CUdevice * pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList); +#ifdef G_OS_WIN32 CUresult (CUDAAPI * CuGraphicsD3D11RegisterResource) (CUgraphicsResource * - pCudaResource, gpointer pD3DResource, unsigned int Flags); + pCudaResource, ID3D11Resource * pD3DResource, unsigned int Flags); CUresult (CUDAAPI * CuD3D11GetDevice) (CUdevice * device, - gpointer pAdapter); + IDXGIAdapter * pAdapter); CUresult (CUDAAPI * CuD3D11GetDevices) (unsigned int *pCudaDeviceCount, CUdevice * pCudaDevices, unsigned int cudaDeviceCount, - gpointer pD3D11Device, CUD3D11DeviceList deviceList); + ID3D11Device * pD3D11Device, CUd3d11DeviceList deviceList); +#endif } GstNvCodecCudaVTable; /* *INDENT-ON* */ @@ -223,7 +225,7 @@ gst_cuda_load_library (void) LOAD_SYMBOL (cuGraphicsGLRegisterBuffer, CuGraphicsGLRegisterBuffer); LOAD_SYMBOL (cuGLGetDevices, CuGLGetDevices); -#ifdef GST_CUDA_HAS_D3D +#ifdef G_OS_WIN32 /* cudaD3D11.h */ LOAD_SYMBOL (cuGraphicsD3D11RegisterResource, CuGraphicsD3D11RegisterResource); @@ -590,10 +592,10 @@ CuGLGetDevices (unsigned int *pCudaDeviceCount, CUdevice * pCudaDevices, } /* cudaD3D11.h */ -#ifdef GST_CUDA_HAS_D3D +#ifdef G_OS_WIN32 CUresult CUDAAPI CuGraphicsD3D11RegisterResource (CUgraphicsResource * pCudaResource, - gpointer pD3DResource, unsigned int Flags) + ID3D11Resource * pD3DResource, unsigned int Flags) { g_assert (gst_cuda_vtable.CuGraphicsD3D11RegisterResource != NULL); @@ -602,7 +604,7 @@ CuGraphicsD3D11RegisterResource (CUgraphicsResource * pCudaResource, } CUresult CUDAAPI -CuD3D11GetDevice (CUdevice * device, gpointer pAdapter) +CuD3D11GetDevice (CUdevice * device, IDXGIAdapter * pAdapter) { g_assert (gst_cuda_vtable.CuD3D11GetDevice != NULL); @@ -611,9 +613,8 @@ CuD3D11GetDevice (CUdevice * device, gpointer pAdapter) CUresult CUDAAPI CuD3D11GetDevices (unsigned int *pCudaDeviceCount, - CUdevice * pCudaDevices, - unsigned int cudaDeviceCount, - gpointer pD3D11Device, CUD3D11DeviceList deviceList) + CUdevice * pCudaDevices, unsigned int cudaDeviceCount, + ID3D11Device * pD3D11Device, CUd3d11DeviceList deviceList) { g_assert (gst_cuda_vtable.CuD3D11GetDevices != NULL); diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c index 43e5974520..9dfb0f7d4a 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c @@ -495,7 +495,7 @@ gst_cuda_graphics_resource_register_gl_buffer (GstCudaGraphicsResource * return TRUE; } -#ifdef GST_CUDA_HAS_D3D +#ifdef G_OS_WIN32 /** * gst_cuda_graphics_resource_register_d3d11_resource: (skip) * @resource a #GstCudaGraphicsResource @@ -512,7 +512,7 @@ gst_cuda_graphics_resource_register_gl_buffer (GstCudaGraphicsResource * */ gboolean gst_cuda_graphics_resource_register_d3d11_resource (GstCudaGraphicsResource * - resource, gpointer d3d11_resource, CUgraphicsRegisterFlags flags) + resource, ID3D11Resource * d3d11_resource, CUgraphicsRegisterFlags flags) { CUresult cuda_ret; diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h index 8ade84d1b9..8bccb8f6cf 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h @@ -162,10 +162,10 @@ gboolean gst_cuda_graphics_resource_register_gl_buffer (GstCudaGraphicsRe guint buffer, CUgraphicsRegisterFlags flags); -#ifdef GST_CUDA_HAS_D3D +#ifdef G_OS_WIN32 GST_CUDA_API gboolean gst_cuda_graphics_resource_register_d3d11_resource (GstCudaGraphicsResource * resource, - gpointer d3d11_resource, + ID3D11Resource * d3d11_resource, CUgraphicsRegisterFlags flags); #endif diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/meson.build b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/meson.build index 5c39b354b2..00ebdbc6d8 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/meson.build +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/meson.build @@ -23,6 +23,20 @@ if host_system not in ['windows', 'linux'] subdir_done() endif +cuda_win32_headers = [ + 'initguid.h', + 'd3d11.h', + 'dxgi.h', +] + +if host_system == 'windows' + foreach h : cuda_win32_headers + if not cc.has_header(h) + subdir_done() + endif + endforeach +endif + cuda_stubinc = include_directories('./stub') extra_c_args = ['-DGST_USE_UNSTABLE_API'] diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/stub/cuda.h b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/stub/cuda.h index 8455a686cc..1d37813b8a 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/stub/cuda.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/stub/cuda.h @@ -132,13 +132,6 @@ typedef struct gsize Height; } CUDA_MEMCPY2D; -typedef enum -{ - CU_D3D11_DEVICE_LIST_ALL = 0x01, - CU_D3D11_DEVICE_LIST_CURRENT_FRAME = 0x02, - CU_D3D11_DEVICE_LIST_NEXT_FRAME = 0x03, -} CUD3D11DeviceList; - typedef struct { CUaddress_mode addressMode[3]; diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/stub/cudaD3D11.h b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/stub/cudaD3D11.h new file mode 100644 index 0000000000..26c38f7712 --- /dev/null +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/stub/cudaD3D11.h @@ -0,0 +1,14 @@ +#pragma once + +#include + +G_BEGIN_DECLS + +typedef enum +{ + CU_D3D11_DEVICE_LIST_ALL = 0x01, + CU_D3D11_DEVICE_LIST_CURRENT_FRAME = 0x02, + CU_D3D11_DEVICE_LIST_NEXT_FRAME = 0x03, +} CUd3d11DeviceList; + +G_END_DECLS