]> git.sesse.net Git - ffmpeg/commitdiff
nvenc: drop the hard dependency on CUDA
authorAnton Khirnov <anton@khirnov.net>
Fri, 13 May 2016 07:13:47 +0000 (09:13 +0200)
committerAnton Khirnov <anton@khirnov.net>
Thu, 19 May 2016 12:17:03 +0000 (14:17 +0200)
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>.

configure
libavcodec/nvenc.c
libavcodec/nvenc.h

index d99a7c842345291a1d4bdd0526c1924752a2f36f..6bab581a005f6f9a8dc7c4e5a6cab5b5e30b3667 100755 (executable)
--- a/configure
+++ b/configure
@@ -4665,7 +4665,6 @@ if enabled libdc1394; then
 fi
 
 if enabled nvenc; then
-    enabled cuda || check_header cuda.h || die "ERROR: cuda.h not found."
     check_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found."
     check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" ||
         die "ERROR: NVENC API version 5 or older is not supported"
index 7564985964a50592ffa831d4a5b78274d3c20313..bdd26bb0eabb004fa092f54ff42a251d0fc7899b 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "config.h"
 
-#include <cuda.h>
 #include <nvEncodeAPI.h>
 #include <string.h>
 
index 8cd5991f4c5892b06f4d247649d8c2d7c3f90ad0..e7e6182196d4ed49554ac1af108f35933346b1eb 100644 (file)
@@ -19,7 +19,6 @@
 #ifndef AVCODEC_NVENC_H
 #define AVCODEC_NVENC_H
 
-#include <cuda.h>
 #include <nvEncodeAPI.h>
 
 #include "config.h"
 
 #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 {