提交 6f58b4dc 编写于 作者: A Anton Khirnov

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>.
上级 f11ec8ce
...@@ -4665,7 +4665,6 @@ if enabled libdc1394; then ...@@ -4665,7 +4665,6 @@ if enabled libdc1394; then
fi fi
if enabled nvenc; then 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_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found."
check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" || check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" ||
die "ERROR: NVENC API version 5 or older is not supported" die "ERROR: NVENC API version 5 or older is not supported"
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "config.h" #include "config.h"
#include <cuda.h>
#include <nvEncodeAPI.h> #include <nvEncodeAPI.h>
#include <string.h> #include <string.h>
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#ifndef AVCODEC_NVENC_H #ifndef AVCODEC_NVENC_H
#define AVCODEC_NVENC_H #define AVCODEC_NVENC_H
#include <cuda.h>
#include <nvEncodeAPI.h> #include <nvEncodeAPI.h>
#include "config.h" #include "config.h"
...@@ -29,6 +28,24 @@ ...@@ -29,6 +28,24 @@
#include "avcodec.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 #define MAX_REGISTERED_FRAMES 64
typedef struct NVENCFrame { typedef struct NVENCFrame {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册