diff options
author | Andrey Turkin <andrey.turkin@gmail.com> | 2016-05-29 15:23:26 +0300 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2016-05-31 16:04:53 +0200 |
commit | 0d021cc8b30a6f81c27fbeca7f99f1ee7a20acf8 (patch) | |
tree | 98ff47c1f0a27f999e2b6979b6ed9da88c8bea73 /libavcodec/nvenc.h | |
parent | f052ef30ef6534c811b9f349e8f17e32afbc9148 (diff) |
avcodec/nvenc: rework library load and GPU selection
Use explicit nvenc capability checks instead to determine usable devices
instead of SM versions.
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/nvenc.h')
-rw-r--r-- | libavcodec/nvenc.h | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 2c1d8d49d5..7abaf33756 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -29,7 +29,7 @@ #include "avcodec.h" #if CONFIG_CUDA -#include <cuda.h> +#include "libavutil/hwcontext_cuda.h" #else #if defined(_WIN32) @@ -77,17 +77,9 @@ typedef NVENCSTATUS (NVENCAPI *PNVENCODEAPICREATEINSTANCE)(NV_ENCODE_API_FUNCTIO typedef struct NvencDynLoadFunctions { #if !CONFIG_CUDA -#if defined(_WIN32) - HMODULE cuda_lib; -#else - void* cuda_lib; -#endif -#endif -#if defined(_WIN32) - HMODULE nvenc_lib; -#else - void* nvenc_lib; + void *cuda; #endif + void *nvenc; PCUINIT cu_init; PCUDEVICEGETCOUNT cu_device_get_count; @@ -100,8 +92,6 @@ typedef struct NvencDynLoadFunctions NV_ENCODE_API_FUNCTION_LIST nvenc_funcs; int nvenc_device_count; - CUdevice nvenc_devices[16]; - } NvencDynLoadFunctions; enum { @@ -133,6 +123,11 @@ enum { NVENC_TWO_PASSES = 8, }; +enum { + LIST_DEVICES = -2, + ANY_DEVICE, +}; + typedef struct NvencContext { AVClass *avclass; @@ -173,7 +168,7 @@ typedef struct NvencContext int rc; int cbr; int twopass; - int gpu; + int device; int flags; int async_depth; } NvencContext; |