summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-05-13 09:13:47 +0200
committerAnton Khirnov <anton@khirnov.net>2016-05-19 14:17:03 +0200
commit6f58b4dc477e22237c4e89f6e2a1435aaa45a4d3 (patch)
tree0c04952630f33ad9517a4cc07afb570de9c45928 /libavcodec
parentf11ec8cee72fd2f1d26c4cbc675597422d106e17 (diff)
nvenc: drop the hard dependency on CUDA
The code needs only a few definitions from cuda.h, so define them directly when CUDA is not enabled. CUDA is still required for accepting HW frames as input. Based on the code by Timo Rothenpieler <timo@rothenpieler.org>.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/nvenc.c1
-rw-r--r--libavcodec/nvenc.h19
2 files changed, 18 insertions, 2 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 7564985964..bdd26bb0ea 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -21,7 +21,6 @@
#include "config.h"
-#include <cuda.h>
#include <nvEncodeAPI.h>
#include <string.h>
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 8cd5991f4c..e7e6182196 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -19,7 +19,6 @@
#ifndef AVCODEC_NVENC_H
#define AVCODEC_NVENC_H
-#include <cuda.h>
#include <nvEncodeAPI.h>
#include "config.h"
@@ -29,6 +28,24 @@
#include "avcodec.h"
+#if CONFIG_CUDA
+#include <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 NVENCFrame {