Module: libav Branch: master Commit: 6f58b4dc477e22237c4e89f6e2a1435aaa45a4d3
Author: Anton Khirnov <[email protected]> Committer: Anton Khirnov <[email protected]> Date: Fri May 13 09:13:47 2016 +0200 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 <[email protected]>. --- configure | 1 - libavcodec/nvenc.c | 1 - libavcodec/nvenc.h | 19 ++++++++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/configure b/configure index d99a7c8..6bab581 100755 --- 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" diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 7564985..bdd26bb 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 8cd5991..e7e6182 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 { _______________________________________________ libav-commits mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-commits
