summaryrefslogtreecommitdiff
path: root/libavcodec/nvenc.h
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2016-10-10 12:55:59 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2016-11-22 10:34:27 +0100
commita66835bcb16ce4659737edefd8d3f3791dad54c8 (patch)
treed59812f462e5f66d2826ac06a90185945b9c82dd /libavcodec/nvenc.h
parenta0c9e76942ed1c5d0223d840f43161ba8141a0a5 (diff)
avcodec/nvenc: use dynamically loaded CUDA
Diffstat (limited to 'libavcodec/nvenc.h')
-rw-r--r--libavcodec/nvenc.h46
1 files changed, 3 insertions, 43 deletions
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index bad659aece..5bc0cba84c 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -23,29 +23,12 @@
#include "config.h"
+#include "compat/cuda/dynlink_loader.h"
#include "libavutil/fifo.h"
#include "libavutil/opt.h"
#include "avcodec.h"
-#if CONFIG_CUDA
-#include "libavutil/hwcontext_cuda.h"
-#else
-
-#if defined(_WIN32)
-#define CUDAAPI __stdcall
-#else
-#define CUDAAPI
-#endif
-
-typedef enum cudaError_enum {
- CUDA_SUCCESS = 0
-} CUresult;
-typedef int CUdevice;
-typedef void* CUcontext;
-typedef void* CUdeviceptr;
-#endif
-
#define MAX_REGISTERED_FRAMES 64
typedef struct NvencSurface
@@ -64,33 +47,10 @@ typedef struct NvencSurface
int lockCount;
} NvencSurface;
-typedef CUresult(CUDAAPI *PCUINIT)(unsigned int Flags);
-typedef CUresult(CUDAAPI *PCUDEVICEGETCOUNT)(int *count);
-typedef CUresult(CUDAAPI *PCUDEVICEGET)(CUdevice *device, int ordinal);
-typedef CUresult(CUDAAPI *PCUDEVICEGETNAME)(char *name, int len, CUdevice dev);
-typedef CUresult(CUDAAPI *PCUDEVICECOMPUTECAPABILITY)(int *major, int *minor, CUdevice dev);
-typedef CUresult(CUDAAPI *PCUCTXCREATE)(CUcontext *pctx, unsigned int flags, CUdevice dev);
-typedef CUresult(CUDAAPI *PCUCTXPOPCURRENT)(CUcontext *pctx);
-typedef CUresult(CUDAAPI *PCUCTXDESTROY)(CUcontext ctx);
-
-typedef NVENCSTATUS (NVENCAPI *PNVENCODEAPIGETMAXSUPPORTEDVERSION)(uint32_t* version);
-typedef NVENCSTATUS (NVENCAPI *PNVENCODEAPICREATEINSTANCE)(NV_ENCODE_API_FUNCTION_LIST *functionList);
-
typedef struct NvencDynLoadFunctions
{
-#if !CONFIG_CUDA
- void *cuda;
-#endif
- void *nvenc;
-
- PCUINIT cu_init;
- PCUDEVICEGETCOUNT cu_device_get_count;
- PCUDEVICEGET cu_device_get;
- PCUDEVICEGETNAME cu_device_get_name;
- PCUDEVICECOMPUTECAPABILITY cu_device_compute_capability;
- PCUCTXCREATE cu_ctx_create;
- PCUCTXPOPCURRENT cu_ctx_pop_current;
- PCUCTXDESTROY cu_ctx_destroy;
+ CudaFunctions *cuda_dl;
+ NvencFunctions *nvenc_dl;
NV_ENCODE_API_FUNCTION_LIST nvenc_funcs;
int nvenc_device_count;