mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
nvcodec: Fix crash on 32-bit Windows
We weren't using the correct calling convention when calling CUDA and CUVID APIs. `CUDAAPI` is `__stdcall` on Windows. This was working fine on x64 because `__stdcall` is ignored and there's no special calling convention. However, on x86, we need to use `__stdcall`.
This commit is contained in:
parent
7e93ae0638
commit
1a7ea45ffd
5 changed files with 182 additions and 166 deletions
|
@ -44,48 +44,53 @@ typedef struct _GstNvCodecCudaVTable
|
|||
{
|
||||
gboolean loaded;
|
||||
|
||||
CUresult (*CuInit) (unsigned int Flags);
|
||||
CUresult (*CuGetErrorName) (CUresult error, const char **pStr);
|
||||
CUresult (*CuGetErrorString) (CUresult error, const char **pStr);
|
||||
CUresult (CUDAAPI * CuInit) (unsigned int Flags);
|
||||
CUresult (CUDAAPI * CuGetErrorName) (CUresult error, const char **pStr);
|
||||
CUresult (CUDAAPI * CuGetErrorString) (CUresult error, const char **pStr);
|
||||
|
||||
CUresult (*CuCtxCreate) (CUcontext * pctx, unsigned int flags,
|
||||
CUresult (CUDAAPI * CuCtxCreate) (CUcontext * pctx, unsigned int flags,
|
||||
CUdevice dev);
|
||||
CUresult (*CuCtxDestroy) (CUcontext ctx);
|
||||
CUresult (*CuCtxPopCurrent) (CUcontext * pctx);
|
||||
CUresult (*CuCtxPushCurrent) (CUcontext ctx);
|
||||
CUresult (CUDAAPI * CuCtxDestroy) (CUcontext ctx);
|
||||
CUresult (CUDAAPI * CuCtxPopCurrent) (CUcontext * pctx);
|
||||
CUresult (CUDAAPI * CuCtxPushCurrent) (CUcontext ctx);
|
||||
|
||||
CUresult (*CuGraphicsMapResources) (unsigned int count,
|
||||
CUresult (CUDAAPI * CuGraphicsMapResources) (unsigned int count,
|
||||
CUgraphicsResource * resources, CUstream hStream);
|
||||
CUresult (*CuGraphicsUnmapResources) (unsigned int count,
|
||||
CUresult (CUDAAPI * CuGraphicsUnmapResources) (unsigned int count,
|
||||
CUgraphicsResource * resources, CUstream hStream);
|
||||
CUresult (*CuGraphicsSubResourceGetMappedArray) (CUarray * pArray,
|
||||
CUresult (CUDAAPI * CuGraphicsSubResourceGetMappedArray) (CUarray * pArray,
|
||||
CUgraphicsResource resource, unsigned int arrayIndex,
|
||||
unsigned int mipLevel);
|
||||
CUresult (*CuGraphicsResourceGetMappedPointer) (CUdeviceptr * pDevPtr,
|
||||
size_t * pSize, CUgraphicsResource resource);
|
||||
CUresult (*CuGraphicsUnregisterResource) (CUgraphicsResource resource);
|
||||
CUresult (CUDAAPI * CuGraphicsResourceGetMappedPointer) (CUdeviceptr *
|
||||
pDevPtr, size_t * pSize, CUgraphicsResource resource);
|
||||
CUresult (CUDAAPI *
|
||||
CuGraphicsUnregisterResource) (CUgraphicsResource resource);
|
||||
|
||||
CUresult (*CuMemAlloc) (CUdeviceptr * dptr, unsigned int bytesize);
|
||||
CUresult (*CuMemAllocPitch) (CUdeviceptr * dptr, size_t * pPitch,
|
||||
CUresult (CUDAAPI * CuMemAlloc) (CUdeviceptr * dptr, unsigned int bytesize);
|
||||
CUresult (CUDAAPI * CuMemAllocPitch) (CUdeviceptr * dptr, size_t * pPitch,
|
||||
size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes);
|
||||
CUresult (*CuMemcpy2D) (const CUDA_MEMCPY2D * pCopy);
|
||||
CUresult (*CuMemcpy2DAsync) (const CUDA_MEMCPY2D * pCopy, CUstream hStream);
|
||||
CUresult (*CuMemFree) (CUdeviceptr dptr);
|
||||
CUresult (*CuStreamCreate) (CUstream * phStream, unsigned int Flags);
|
||||
CUresult (*CuStreamDestroy) (CUstream hStream);
|
||||
CUresult (*CuStreamSynchronize) (CUstream hStream);
|
||||
CUresult (CUDAAPI * CuMemcpy2D) (const CUDA_MEMCPY2D * pCopy);
|
||||
CUresult (CUDAAPI * CuMemcpy2DAsync) (const CUDA_MEMCPY2D * pCopy,
|
||||
CUstream hStream);
|
||||
CUresult (CUDAAPI * CuMemFree) (CUdeviceptr dptr);
|
||||
CUresult (CUDAAPI * CuStreamCreate) (CUstream * phStream,
|
||||
unsigned int Flags);
|
||||
CUresult (CUDAAPI * CuStreamDestroy) (CUstream hStream);
|
||||
CUresult (CUDAAPI * CuStreamSynchronize) (CUstream hStream);
|
||||
|
||||
CUresult (*CuDeviceGet) (CUdevice * device, int ordinal);
|
||||
CUresult (*CuDeviceGetCount) (int *count);
|
||||
CUresult (*CuDeviceGetName) (char *name, int len, CUdevice dev);
|
||||
CUresult (*CuDeviceGetAttribute) (int *pi, CUdevice_attribute attrib,
|
||||
CUdevice dev);
|
||||
CUresult (CUDAAPI * CuDeviceGet) (CUdevice * device, int ordinal);
|
||||
CUresult (CUDAAPI * CuDeviceGetCount) (int *count);
|
||||
CUresult (CUDAAPI * CuDeviceGetName) (char *name, int len, CUdevice dev);
|
||||
CUresult (CUDAAPI * CuDeviceGetAttribute) (int *pi,
|
||||
CUdevice_attribute attrib, CUdevice dev);
|
||||
|
||||
CUresult (*CuGraphicsGLRegisterImage) (CUgraphicsResource * pCudaResource,
|
||||
unsigned int image, unsigned int target, unsigned int Flags);
|
||||
CUresult (*CuGraphicsGLRegisterBuffer) (CUgraphicsResource * pCudaResource,
|
||||
unsigned int buffer, unsigned int Flags);
|
||||
CUresult (*CuGraphicsResourceSetMapFlags) (CUgraphicsResource resource,
|
||||
CUresult (CUDAAPI * CuGraphicsGLRegisterImage) (CUgraphicsResource *
|
||||
pCudaResource, unsigned int image, unsigned int target,
|
||||
unsigned int Flags);
|
||||
CUresult (CUDAAPI * CuGraphicsGLRegisterBuffer) (CUgraphicsResource *
|
||||
pCudaResource, unsigned int buffer, unsigned int Flags);
|
||||
CUresult (CUDAAPI *
|
||||
CuGraphicsResourceSetMapFlags) (CUgraphicsResource resource,
|
||||
unsigned int flags);
|
||||
} GstNvCodecCudaVTable;
|
||||
|
||||
|
@ -156,7 +161,7 @@ error:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuInit (unsigned int Flags)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuInit != NULL);
|
||||
|
@ -164,7 +169,7 @@ CuInit (unsigned int Flags)
|
|||
return gst_cuda_vtable.CuInit (Flags);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGetErrorName (CUresult error, const char **pStr)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuGetErrorName != NULL);
|
||||
|
@ -172,7 +177,7 @@ CuGetErrorName (CUresult error, const char **pStr)
|
|||
return gst_cuda_vtable.CuGetErrorName (error, pStr);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGetErrorString (CUresult error, const char **pStr)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuGetErrorString != NULL);
|
||||
|
@ -180,7 +185,7 @@ CuGetErrorString (CUresult error, const char **pStr)
|
|||
return gst_cuda_vtable.CuGetErrorString (error, pStr);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuCtxCreate (CUcontext * pctx, unsigned int flags, CUdevice dev)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuCtxCreate != NULL);
|
||||
|
@ -188,7 +193,7 @@ CuCtxCreate (CUcontext * pctx, unsigned int flags, CUdevice dev)
|
|||
return gst_cuda_vtable.CuCtxCreate (pctx, flags, dev);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuCtxDestroy (CUcontext ctx)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuCtxDestroy != NULL);
|
||||
|
@ -196,7 +201,7 @@ CuCtxDestroy (CUcontext ctx)
|
|||
return gst_cuda_vtable.CuCtxDestroy (ctx);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuCtxPopCurrent (CUcontext * pctx)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuCtxPopCurrent != NULL);
|
||||
|
@ -204,7 +209,7 @@ CuCtxPopCurrent (CUcontext * pctx)
|
|||
return gst_cuda_vtable.CuCtxPopCurrent (pctx);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuCtxPushCurrent (CUcontext ctx)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuCtxPushCurrent != NULL);
|
||||
|
@ -212,7 +217,7 @@ CuCtxPushCurrent (CUcontext ctx)
|
|||
return gst_cuda_vtable.CuCtxPushCurrent (ctx);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGraphicsMapResources (unsigned int count, CUgraphicsResource * resources,
|
||||
CUstream hStream)
|
||||
{
|
||||
|
@ -221,7 +226,7 @@ CuGraphicsMapResources (unsigned int count, CUgraphicsResource * resources,
|
|||
return gst_cuda_vtable.CuGraphicsMapResources (count, resources, hStream);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGraphicsUnmapResources (unsigned int count, CUgraphicsResource * resources,
|
||||
CUstream hStream)
|
||||
{
|
||||
|
@ -230,7 +235,7 @@ CuGraphicsUnmapResources (unsigned int count, CUgraphicsResource * resources,
|
|||
return gst_cuda_vtable.CuGraphicsUnmapResources (count, resources, hStream);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGraphicsSubResourceGetMappedArray (CUarray * pArray,
|
||||
CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel)
|
||||
{
|
||||
|
@ -240,7 +245,7 @@ CuGraphicsSubResourceGetMappedArray (CUarray * pArray,
|
|||
arrayIndex, mipLevel);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGraphicsResourceGetMappedPointer (CUdeviceptr * pDevPtr, size_t * pSize,
|
||||
CUgraphicsResource resource)
|
||||
{
|
||||
|
@ -250,7 +255,7 @@ CuGraphicsResourceGetMappedPointer (CUdeviceptr * pDevPtr, size_t * pSize,
|
|||
resource);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGraphicsUnregisterResource (CUgraphicsResource resource)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuGraphicsUnregisterResource != NULL);
|
||||
|
@ -258,7 +263,7 @@ CuGraphicsUnregisterResource (CUgraphicsResource resource)
|
|||
return gst_cuda_vtable.CuGraphicsUnregisterResource (resource);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuMemAlloc (CUdeviceptr * dptr, unsigned int bytesize)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuMemAlloc != NULL);
|
||||
|
@ -266,7 +271,7 @@ CuMemAlloc (CUdeviceptr * dptr, unsigned int bytesize)
|
|||
return gst_cuda_vtable.CuMemAlloc (dptr, bytesize);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuMemAllocPitch (CUdeviceptr * dptr, size_t * pPitch, size_t WidthInBytes,
|
||||
size_t Height, unsigned int ElementSizeBytes)
|
||||
{
|
||||
|
@ -276,7 +281,7 @@ CuMemAllocPitch (CUdeviceptr * dptr, size_t * pPitch, size_t WidthInBytes,
|
|||
ElementSizeBytes);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuMemcpy2D (const CUDA_MEMCPY2D * pCopy)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuMemcpy2D != NULL);
|
||||
|
@ -284,7 +289,7 @@ CuMemcpy2D (const CUDA_MEMCPY2D * pCopy)
|
|||
return gst_cuda_vtable.CuMemcpy2D (pCopy);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuMemcpy2DAsync (const CUDA_MEMCPY2D * pCopy, CUstream hStream)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuMemcpy2DAsync != NULL);
|
||||
|
@ -292,7 +297,7 @@ CuMemcpy2DAsync (const CUDA_MEMCPY2D * pCopy, CUstream hStream)
|
|||
return gst_cuda_vtable.CuMemcpy2DAsync (pCopy, hStream);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuMemFree (CUdeviceptr dptr)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuMemFree != NULL);
|
||||
|
@ -300,7 +305,7 @@ CuMemFree (CUdeviceptr dptr)
|
|||
return gst_cuda_vtable.CuMemFree (dptr);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuStreamCreate (CUstream * phStream, unsigned int Flags)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuStreamCreate != NULL);
|
||||
|
@ -308,7 +313,7 @@ CuStreamCreate (CUstream * phStream, unsigned int Flags)
|
|||
return gst_cuda_vtable.CuStreamCreate (phStream, Flags);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuStreamDestroy (CUstream hStream)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuStreamDestroy != NULL);
|
||||
|
@ -316,7 +321,7 @@ CuStreamDestroy (CUstream hStream)
|
|||
return gst_cuda_vtable.CuStreamDestroy (hStream);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuStreamSynchronize (CUstream hStream)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuStreamSynchronize != NULL);
|
||||
|
@ -324,7 +329,7 @@ CuStreamSynchronize (CUstream hStream)
|
|||
return gst_cuda_vtable.CuStreamSynchronize (hStream);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuDeviceGet (CUdevice * device, int ordinal)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuDeviceGet != NULL);
|
||||
|
@ -332,7 +337,7 @@ CuDeviceGet (CUdevice * device, int ordinal)
|
|||
return gst_cuda_vtable.CuDeviceGet (device, ordinal);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuDeviceGetCount (int *count)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuDeviceGetCount != NULL);
|
||||
|
@ -340,7 +345,7 @@ CuDeviceGetCount (int *count)
|
|||
return gst_cuda_vtable.CuDeviceGetCount (count);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuDeviceGetName (char *name, int len, CUdevice dev)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuDeviceGetName != NULL);
|
||||
|
@ -348,7 +353,7 @@ CuDeviceGetName (char *name, int len, CUdevice dev)
|
|||
return gst_cuda_vtable.CuDeviceGetName (name, len, dev);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuDeviceGetAttribute (int *pi, CUdevice_attribute attrib, CUdevice dev)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuDeviceGetAttribute != NULL);
|
||||
|
@ -357,7 +362,7 @@ CuDeviceGetAttribute (int *pi, CUdevice_attribute attrib, CUdevice dev)
|
|||
}
|
||||
|
||||
/* cudaGL.h */
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGraphicsGLRegisterImage (CUgraphicsResource * pCudaResource,
|
||||
unsigned int image, unsigned int target, unsigned int Flags)
|
||||
{
|
||||
|
@ -367,7 +372,7 @@ CuGraphicsGLRegisterImage (CUgraphicsResource * pCudaResource,
|
|||
target, Flags);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGraphicsGLRegisterBuffer (CUgraphicsResource * pCudaResource,
|
||||
unsigned int buffer, unsigned int Flags)
|
||||
{
|
||||
|
@ -377,7 +382,7 @@ CuGraphicsGLRegisterBuffer (CUgraphicsResource * pCudaResource,
|
|||
Flags);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuGraphicsResourceSetMapFlags (CUgraphicsResource resource, unsigned int flags)
|
||||
{
|
||||
g_assert (gst_cuda_vtable.CuGraphicsResourceSetMapFlags != NULL);
|
||||
|
|
|
@ -31,116 +31,116 @@ gboolean gst_cuda_load_library (void);
|
|||
|
||||
/* cuda.h */
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuInit (unsigned int Flags);
|
||||
CUresult CUDAAPI CuInit (unsigned int Flags);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGetErrorName (CUresult error,
|
||||
const char **pStr);
|
||||
CUresult CUDAAPI CuGetErrorName (CUresult error,
|
||||
const char **pStr);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGetErrorString (CUresult error,
|
||||
const char **pStr);
|
||||
CUresult CUDAAPI CuGetErrorString (CUresult error,
|
||||
const char **pStr);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuCtxCreate (CUcontext * pctx,
|
||||
unsigned int flags,
|
||||
CUdevice dev);
|
||||
CUresult CUDAAPI CuCtxCreate (CUcontext * pctx,
|
||||
unsigned int flags,
|
||||
CUdevice dev);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuCtxDestroy (CUcontext ctx);
|
||||
CUresult CUDAAPI CuCtxDestroy (CUcontext ctx);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuCtxPopCurrent (CUcontext * pctx);
|
||||
CUresult CUDAAPI CuCtxPopCurrent (CUcontext * pctx);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuCtxPushCurrent (CUcontext ctx);
|
||||
CUresult CUDAAPI CuCtxPushCurrent (CUcontext ctx);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGraphicsMapResources (unsigned int count,
|
||||
CUgraphicsResource * resources,
|
||||
CUstream hStream);
|
||||
CUresult CUDAAPI CuGraphicsMapResources (unsigned int count,
|
||||
CUgraphicsResource * resources,
|
||||
CUstream hStream);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGraphicsUnmapResources (unsigned int count,
|
||||
CUgraphicsResource * resources,
|
||||
CUstream hStream);
|
||||
CUresult CUDAAPI CuGraphicsUnmapResources (unsigned int count,
|
||||
CUgraphicsResource * resources,
|
||||
CUstream hStream);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGraphicsSubResourceGetMappedArray (CUarray * pArray,
|
||||
CUgraphicsResource resource,
|
||||
unsigned int arrayIndex,
|
||||
unsigned int mipLevel);
|
||||
CUresult CUDAAPI CuGraphicsSubResourceGetMappedArray (CUarray * pArray,
|
||||
CUgraphicsResource resource,
|
||||
unsigned int arrayIndex,
|
||||
unsigned int mipLevel);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGraphicsResourceGetMappedPointer (CUdeviceptr * pDevPtr,
|
||||
size_t * pSize,
|
||||
CUgraphicsResource resource);
|
||||
CUresult CUDAAPI CuGraphicsResourceGetMappedPointer (CUdeviceptr * pDevPtr,
|
||||
size_t * pSize,
|
||||
CUgraphicsResource resource);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGraphicsUnregisterResource (CUgraphicsResource resource);
|
||||
CUresult CUDAAPI CuGraphicsUnregisterResource (CUgraphicsResource resource);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuMemAlloc (CUdeviceptr * dptr,
|
||||
unsigned int bytesize);
|
||||
CUresult CUDAAPI CuMemAlloc (CUdeviceptr * dptr,
|
||||
unsigned int bytesize);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuMemAllocPitch (CUdeviceptr * dptr,
|
||||
size_t * pPitch,
|
||||
size_t WidthInBytes,
|
||||
size_t Height,
|
||||
unsigned int ElementSizeBytes);
|
||||
CUresult CUDAAPI CuMemAllocPitch (CUdeviceptr * dptr,
|
||||
size_t * pPitch,
|
||||
size_t WidthInBytes,
|
||||
size_t Height,
|
||||
unsigned int ElementSizeBytes);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuMemcpy2D (const CUDA_MEMCPY2D * pCopy);
|
||||
CUresult CUDAAPI CuMemcpy2D (const CUDA_MEMCPY2D * pCopy);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuMemcpy2DAsync (const CUDA_MEMCPY2D *pCopy, CUstream hStream);
|
||||
CUresult CUDAAPI CuMemcpy2DAsync (const CUDA_MEMCPY2D *pCopy, CUstream hStream);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuMemFree (CUdeviceptr dptr);
|
||||
CUresult CUDAAPI CuMemFree (CUdeviceptr dptr);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuStreamCreate (CUstream *phStream,
|
||||
unsigned int Flags);
|
||||
CUresult CUDAAPI CuStreamCreate (CUstream *phStream,
|
||||
unsigned int Flags);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuStreamDestroy (CUstream hStream);
|
||||
CUresult CUDAAPI CuStreamDestroy (CUstream hStream);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuStreamSynchronize (CUstream hStream);
|
||||
CUresult CUDAAPI CuStreamSynchronize (CUstream hStream);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuDeviceGet (CUdevice * device,
|
||||
int ordinal);
|
||||
CUresult CUDAAPI CuDeviceGet (CUdevice * device,
|
||||
int ordinal);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuDeviceGetCount (int *count);
|
||||
CUresult CUDAAPI CuDeviceGetCount (int *count);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuDeviceGetName (char *name,
|
||||
int len,
|
||||
CUdevice dev);
|
||||
CUresult CUDAAPI CuDeviceGetName (char *name,
|
||||
int len,
|
||||
CUdevice dev);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuDeviceGetAttribute (int *pi,
|
||||
CUdevice_attribute attrib,
|
||||
CUdevice dev);
|
||||
CUresult CUDAAPI CuDeviceGetAttribute (int *pi,
|
||||
CUdevice_attribute attrib,
|
||||
CUdevice dev);
|
||||
|
||||
/* cudaGL.h */
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGraphicsGLRegisterImage (CUgraphicsResource * pCudaResource,
|
||||
unsigned int image,
|
||||
unsigned int target,
|
||||
unsigned int Flags);
|
||||
CUresult CUDAAPI CuGraphicsGLRegisterImage (CUgraphicsResource * pCudaResource,
|
||||
unsigned int image,
|
||||
unsigned int target,
|
||||
unsigned int Flags);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGraphicsGLRegisterBuffer (CUgraphicsResource * pCudaResource,
|
||||
unsigned int buffer,
|
||||
unsigned int Flags);
|
||||
CUresult CUDAAPI CuGraphicsGLRegisterBuffer (CUgraphicsResource * pCudaResource,
|
||||
unsigned int buffer,
|
||||
unsigned int Flags);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuGraphicsResourceSetMapFlags (CUgraphicsResource resource,
|
||||
unsigned int flags);
|
||||
CUresult CUDAAPI CuGraphicsResourceSetMapFlags (CUgraphicsResource resource,
|
||||
unsigned int flags);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_CUDA_LOADER_H__ */
|
||||
|
|
|
@ -44,25 +44,29 @@ typedef struct _GstnvdecCuvidVTable
|
|||
{
|
||||
gboolean loaded;
|
||||
|
||||
CUresult (*CuvidCtxLockCreate) (CUvideoctxlock * pLock, CUcontext ctx);
|
||||
CUresult (*CuvidCtxLockDestroy) (CUvideoctxlock lck);
|
||||
CUresult (*CuvidCtxLock) (CUvideoctxlock lck, unsigned int reserved_flags);
|
||||
CUresult (*CuvidCtxUnlock) (CUvideoctxlock lck,
|
||||
CUresult (CUDAAPI * CuvidCtxLockCreate) (CUvideoctxlock * pLock,
|
||||
CUcontext ctx);
|
||||
CUresult (CUDAAPI * CuvidCtxLockDestroy) (CUvideoctxlock lck);
|
||||
CUresult (CUDAAPI * CuvidCtxLock) (CUvideoctxlock lck,
|
||||
unsigned int reserved_flags);
|
||||
CUresult (*CuvidCreateDecoder) (CUvideodecoder * phDecoder,
|
||||
CUresult (CUDAAPI * CuvidCtxUnlock) (CUvideoctxlock lck,
|
||||
unsigned int reserved_flags);
|
||||
CUresult (CUDAAPI * CuvidCreateDecoder) (CUvideodecoder * phDecoder,
|
||||
CUVIDDECODECREATEINFO * pdci);
|
||||
CUresult (*CuvidDestroyDecoder) (CUvideodecoder hDecoder);
|
||||
CUresult (*CuvidDecodePicture) (CUvideodecoder hDecoder,
|
||||
CUresult (CUDAAPI * CuvidDestroyDecoder) (CUvideodecoder hDecoder);
|
||||
CUresult (CUDAAPI * CuvidDecodePicture) (CUvideodecoder hDecoder,
|
||||
CUVIDPICPARAMS * pPicParams);
|
||||
CUresult (*CuvidCreateVideoParser) (CUvideoparser * pObj,
|
||||
CUresult (CUDAAPI * CuvidCreateVideoParser) (CUvideoparser * pObj,
|
||||
CUVIDPARSERPARAMS * pParams);
|
||||
CUresult (*CuvidParseVideoData) (CUvideoparser obj,
|
||||
CUresult (CUDAAPI * CuvidParseVideoData) (CUvideoparser obj,
|
||||
CUVIDSOURCEDATAPACKET * pPacket);
|
||||
CUresult (*CuvidDestroyVideoParser) (CUvideoparser obj);
|
||||
CUresult (*CuvidMapVideoFrame) (CUvideodecoder hDecoder, int nPicIdx,
|
||||
guintptr * pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS * pVPP);
|
||||
CUresult (*CuvidUnmapVideoFrame) (CUvideodecoder hDecoder, guintptr DevPtr);
|
||||
CUresult (*CuvidGetDecoderCaps) (CUVIDDECODECAPS * pdc);
|
||||
CUresult (CUDAAPI * CuvidDestroyVideoParser) (CUvideoparser obj);
|
||||
CUresult (CUDAAPI * CuvidMapVideoFrame) (CUvideodecoder hDecoder,
|
||||
int nPicIdx, guintptr * pDevPtr, unsigned int *pPitch,
|
||||
CUVIDPROCPARAMS * pVPP);
|
||||
CUresult (CUDAAPI * CuvidUnmapVideoFrame) (CUvideodecoder hDecoder,
|
||||
guintptr DevPtr);
|
||||
CUresult (CUDAAPI * CuvidGetDecoderCaps) (CUVIDDECODECAPS * pdc);
|
||||
} GstnvdecCuvidVTable;
|
||||
|
||||
static GstnvdecCuvidVTable gst_cuvid_vtable = { 0, };
|
||||
|
@ -115,7 +119,7 @@ gst_cuvid_can_get_decoder_caps (void)
|
|||
return ! !gst_cuvid_vtable.CuvidGetDecoderCaps;
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidCtxLockCreate (CUvideoctxlock * pLock, CUcontext ctx)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidCtxLockCreate != NULL);
|
||||
|
@ -123,7 +127,7 @@ CuvidCtxLockCreate (CUvideoctxlock * pLock, CUcontext ctx)
|
|||
return gst_cuvid_vtable.CuvidCtxLockCreate (pLock, ctx);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidCtxLockDestroy (CUvideoctxlock lck)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidCtxLockDestroy != NULL);
|
||||
|
@ -131,7 +135,7 @@ CuvidCtxLockDestroy (CUvideoctxlock lck)
|
|||
return gst_cuvid_vtable.CuvidCtxLockDestroy (lck);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidCtxLock (CUvideoctxlock lck, unsigned int reserved_flags)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidCtxLock != NULL);
|
||||
|
@ -139,7 +143,7 @@ CuvidCtxLock (CUvideoctxlock lck, unsigned int reserved_flags)
|
|||
return gst_cuvid_vtable.CuvidCtxLock (lck, reserved_flags);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidCtxUnlock (CUvideoctxlock lck, unsigned int reserved_flags)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidCtxLockDestroy != NULL);
|
||||
|
@ -147,7 +151,7 @@ CuvidCtxUnlock (CUvideoctxlock lck, unsigned int reserved_flags)
|
|||
return gst_cuvid_vtable.CuvidCtxUnlock (lck, reserved_flags);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidCreateDecoder (CUvideodecoder * phDecoder, CUVIDDECODECREATEINFO * pdci)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidCreateDecoder != NULL);
|
||||
|
@ -155,7 +159,7 @@ CuvidCreateDecoder (CUvideodecoder * phDecoder, CUVIDDECODECREATEINFO * pdci)
|
|||
return gst_cuvid_vtable.CuvidCreateDecoder (phDecoder, pdci);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidDestroyDecoder (CUvideodecoder hDecoder)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidDestroyDecoder != NULL);
|
||||
|
@ -163,7 +167,7 @@ CuvidDestroyDecoder (CUvideodecoder hDecoder)
|
|||
return gst_cuvid_vtable.CuvidDestroyDecoder (hDecoder);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidDecodePicture (CUvideodecoder hDecoder, CUVIDPICPARAMS * pPicParams)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidDecodePicture != NULL);
|
||||
|
@ -171,7 +175,7 @@ CuvidDecodePicture (CUvideodecoder hDecoder, CUVIDPICPARAMS * pPicParams)
|
|||
return gst_cuvid_vtable.CuvidDecodePicture (hDecoder, pPicParams);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidCreateVideoParser (CUvideoparser * pObj, CUVIDPARSERPARAMS * pParams)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidCreateVideoParser != NULL);
|
||||
|
@ -179,7 +183,7 @@ CuvidCreateVideoParser (CUvideoparser * pObj, CUVIDPARSERPARAMS * pParams)
|
|||
return gst_cuvid_vtable.CuvidCreateVideoParser (pObj, pParams);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidParseVideoData (CUvideoparser obj, CUVIDSOURCEDATAPACKET * pPacket)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidParseVideoData != NULL);
|
||||
|
@ -187,7 +191,7 @@ CuvidParseVideoData (CUvideoparser obj, CUVIDSOURCEDATAPACKET * pPacket)
|
|||
return gst_cuvid_vtable.CuvidParseVideoData (obj, pPacket);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidDestroyVideoParser (CUvideoparser obj)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidDestroyVideoParser != NULL);
|
||||
|
@ -195,7 +199,7 @@ CuvidDestroyVideoParser (CUvideoparser obj)
|
|||
return gst_cuvid_vtable.CuvidDestroyVideoParser (obj);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidMapVideoFrame (CUvideodecoder hDecoder, int nPicIdx,
|
||||
guintptr * pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS * pVPP)
|
||||
{
|
||||
|
@ -205,7 +209,7 @@ CuvidMapVideoFrame (CUvideodecoder hDecoder, int nPicIdx,
|
|||
pPitch, pVPP);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidUnmapVideoFrame (CUvideodecoder hDecoder, guintptr DevPtr)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidUnmapVideoFrame != NULL);
|
||||
|
@ -213,7 +217,7 @@ CuvidUnmapVideoFrame (CUvideodecoder hDecoder, guintptr DevPtr)
|
|||
return gst_cuvid_vtable.CuvidUnmapVideoFrame (hDecoder, DevPtr);
|
||||
}
|
||||
|
||||
CUresult
|
||||
CUresult CUDAAPI
|
||||
CuvidGetDecoderCaps (CUVIDDECODECAPS * pdc)
|
||||
{
|
||||
g_assert (gst_cuvid_vtable.CuvidGetDecoderCaps != NULL);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define __GST_CUVID_LOADER_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include "stub/cuda.h"
|
||||
#include "nvcuvid.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -33,53 +34,54 @@ G_GNUC_INTERNAL
|
|||
gboolean gst_cuvid_can_get_decoder_caps (void);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidCtxLockCreate (CUvideoctxlock * pLock, CUcontext ctx);
|
||||
CUresult CUDAAPI CuvidCtxLockCreate (CUvideoctxlock * pLock,
|
||||
CUcontext ctx);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidCtxLockDestroy (CUvideoctxlock lck);
|
||||
CUresult CUDAAPI CuvidCtxLockDestroy (CUvideoctxlock lck);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidCtxLock (CUvideoctxlock lck,
|
||||
unsigned int reserved_flags);
|
||||
CUresult CUDAAPI CuvidCtxLock (CUvideoctxlock lck,
|
||||
unsigned int reserved_flags);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidCtxUnlock (CUvideoctxlock lck,
|
||||
unsigned int reserved_flags);
|
||||
CUresult CUDAAPI CuvidCtxUnlock (CUvideoctxlock lck,
|
||||
unsigned int reserved_flags);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidCreateDecoder (CUvideodecoder * phDecoder,
|
||||
CUVIDDECODECREATEINFO * pdci);
|
||||
CUresult CUDAAPI CuvidCreateDecoder (CUvideodecoder * phDecoder,
|
||||
CUVIDDECODECREATEINFO * pdci);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidDestroyDecoder (CUvideodecoder hDecoder);
|
||||
CUresult CUDAAPI CuvidDestroyDecoder (CUvideodecoder hDecoder);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidDecodePicture (CUvideodecoder hDecoder,
|
||||
CUVIDPICPARAMS * pPicParams);
|
||||
CUresult CUDAAPI CuvidDecodePicture (CUvideodecoder hDecoder,
|
||||
CUVIDPICPARAMS * pPicParams);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidCreateVideoParser (CUvideoparser * pObj,
|
||||
CUVIDPARSERPARAMS * pParams);
|
||||
CUresult CUDAAPI CuvidCreateVideoParser (CUvideoparser * pObj,
|
||||
CUVIDPARSERPARAMS * pParams);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidParseVideoData (CUvideoparser obj,
|
||||
CUVIDSOURCEDATAPACKET * pPacket);
|
||||
CUresult CUDAAPI CuvidParseVideoData (CUvideoparser obj,
|
||||
CUVIDSOURCEDATAPACKET * pPacket);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidDestroyVideoParser (CUvideoparser obj);
|
||||
CUresult CUDAAPI CuvidDestroyVideoParser (CUvideoparser obj);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidMapVideoFrame (CUvideodecoder hDecoder,
|
||||
int nPicIdx,
|
||||
guintptr * pDevPtr,
|
||||
unsigned int *pPitch,
|
||||
CUVIDPROCPARAMS * pVPP);
|
||||
CUresult CUDAAPI CuvidMapVideoFrame (CUvideodecoder hDecoder,
|
||||
int nPicIdx,
|
||||
guintptr * pDevPtr,
|
||||
unsigned int *pPitch,
|
||||
CUVIDPROCPARAMS * pVPP);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidUnmapVideoFrame (CUvideodecoder hDecoder,
|
||||
guintptr DevPtr);
|
||||
CUresult CUDAAPI CuvidUnmapVideoFrame (CUvideodecoder hDecoder,
|
||||
guintptr DevPtr);
|
||||
G_GNUC_INTERNAL
|
||||
CUresult CuvidGetDecoderCaps (CUVIDDECODECAPS * pdc);
|
||||
CUresult CUDAAPI CuvidGetDecoderCaps (CUVIDDECODECAPS * pdc);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_CUVID_LOADER_H__ */
|
||||
|
|
|
@ -93,7 +93,12 @@ typedef struct
|
|||
} CUDA_MEMCPY2D;
|
||||
|
||||
#define CUDA_VERSION 10000
|
||||
|
||||
#ifdef _WIN32
|
||||
#define CUDAAPI __stdcall
|
||||
#else
|
||||
#define CUDAAPI
|
||||
#endif
|
||||
|
||||
#define cuCtxCreate cuCtxCreate_v2
|
||||
#define cuCtxDestroy cuCtxDestroy_v2
|
||||
|
|
Loading…
Reference in a new issue