FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
dynlink_loader.h File Reference
#include "compat/cuda/dynlink_cuda.h"
#include "compat/cuda/dynlink_nvcuvid.h"
#include "compat/nvenc/nvEncodeAPI.h"
#include "compat/w32dlfcn.h"
#include "libavutil/log.h"
#include "libavutil/error.h"

Go to the source code of this file.

Data Structures

struct  CudaFunctions
 
struct  CuvidFunctions
 
struct  NvencFunctions
 

Macros

#define LIB_HANDLE   void*
 
#define CUDA_LIBNAME   "libcuda.so.1"
 
#define NVCUVID_LIBNAME   "libnvcuvid.so.1"
 
#define NVENC_LIBNAME   "libnvidia-encode.so.1"
 
#define LOAD_LIBRARY(l, path)
 
#define LOAD_SYMBOL(fun, tp, symbol)
 
#define LOAD_SYMBOL_OPT(fun, tp, symbol)
 
#define GENERIC_LOAD_FUNC_PREAMBLE(T, n, N)
 
#define GENERIC_LOAD_FUNC_FINALE(n)
 
#define GENERIC_FREE_FUNC()
 

Typedefs

typedef NVENCSTATUS NVENCAPI tNvEncodeAPICreateInstance (NV_ENCODE_API_FUNCTION_LIST *functionList)
 
typedef NVENCSTATUS NVENCAPI tNvEncodeAPIGetMaxSupportedVersion (uint32_t *version)
 

Functions

static void cuda_free_functions (CudaFunctions **functions)
 
static void cuvid_free_functions (CuvidFunctions **functions)
 
static void nvenc_free_functions (NvencFunctions **functions)
 
static int cuda_load_functions (CudaFunctions **functions)
 
static int cuvid_load_functions (CuvidFunctions **functions)
 
static int nvenc_load_functions (NvencFunctions **functions)
 

Macro Definition Documentation

#define LIB_HANDLE   void*

Definition at line 42 of file dynlink_loader.h.

#define CUDA_LIBNAME   "libcuda.so.1"

Definition at line 54 of file dynlink_loader.h.

Referenced by cuda_load_functions().

#define NVCUVID_LIBNAME   "libnvcuvid.so.1"

Definition at line 55 of file dynlink_loader.h.

Referenced by cuvid_load_functions().

#define NVENC_LIBNAME   "libnvidia-encode.so.1"

Definition at line 56 of file dynlink_loader.h.

Referenced by nvenc_load_functions().

#define LOAD_LIBRARY (   l,
  path 
)
Value:
do { \
if (!((l) = dlopen(path, RTLD_LAZY))) { \
av_log(NULL, AV_LOG_ERROR, "Cannot load %s\n", path); \
ret = AVERROR_UNKNOWN; \
goto error; \
} \
av_log(NULL, AV_LOG_TRACE, "Loaded lib: %s\n", path); \
} while (0)
#define NULL
Definition: coverity.c:32
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:202
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
static void error(const char *err)
if(ret< 0)
Definition: vf_mcdeint.c:279
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71

Definition at line 59 of file dynlink_loader.h.

#define LOAD_SYMBOL (   fun,
  tp,
  symbol 
)
Value:
do { \
if (!((f->fun) = (tp*)dlsym(f->lib, symbol))) { \
av_log(NULL, AV_LOG_ERROR, "Cannot load %s\n", symbol); \
ret = AVERROR_UNKNOWN; \
goto error; \
} \
av_log(NULL, AV_LOG_TRACE, "Loaded sym: %s\n", symbol); \
} while (0)
#define NULL
Definition: coverity.c:32
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:202
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
static void error(const char *err)
if(ret< 0)
Definition: vf_mcdeint.c:279
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71

Definition at line 69 of file dynlink_loader.h.

Referenced by cuda_load_functions(), cuvid_load_functions(), and nvenc_load_functions().

#define LOAD_SYMBOL_OPT (   fun,
  tp,
  symbol 
)
Value:
do { \
if (!((f->fun) = (tp*)dlsym(f->lib, symbol))) { \
av_log(NULL, AV_LOG_DEBUG, "Cannot load optional %s\n", symbol); \
} else { \
av_log(NULL, AV_LOG_TRACE, "Loaded sym: %s\n", symbol); \
} \
} while (0)
#define NULL
Definition: coverity.c:32
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:202
#define av_log(a,...)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
if(ret< 0)
Definition: vf_mcdeint.c:279

Definition at line 79 of file dynlink_loader.h.

Referenced by cuvid_load_functions().

#define GENERIC_LOAD_FUNC_PREAMBLE (   T,
  n,
  N 
)
Value:
T *f; \
int ret; \
\
n##_free_functions(functions); \
\
f = *functions = av_mallocz(sizeof(*f)); \
if (!f) \
return AVERROR(ENOMEM); \
LOAD_LIBRARY(f->lib, N);
static const struct drawtext_function functions[]
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:222
#define N
Definition: vf_pp7.c:73
#define AVERROR(e)
Definition: error.h:43
return
#define T(x)
Definition: vp56_arith.h:29
int n
Definition: avisynth_c.h:684
int
if(ret< 0)
Definition: vf_mcdeint.c:279

Definition at line 88 of file dynlink_loader.h.

Referenced by cuda_load_functions(), cuvid_load_functions(), and nvenc_load_functions().

#define GENERIC_LOAD_FUNC_FINALE (   n)
Value:
return 0; \
n##_free_functions(functions); \
return ret;
static const struct drawtext_function functions[]
return
int n
Definition: avisynth_c.h:684
static void error(const char *err)

Definition at line 100 of file dynlink_loader.h.

Referenced by cuda_load_functions(), cuvid_load_functions(), and nvenc_load_functions().

#define GENERIC_FREE_FUNC ( )
Value:
if (!functions) \
if (*functions && (*functions)->lib) \
dlclose((*functions)->lib); \
static const struct drawtext_function functions[]
return
if(ret< 0)
Definition: vf_mcdeint.c:279
#define av_freep(p)

Definition at line 106 of file dynlink_loader.h.

Referenced by cuda_free_functions(), cuvid_free_functions(), and nvenc_free_functions().

Typedef Documentation

typedef NVENCSTATUS NVENCAPI tNvEncodeAPICreateInstance(NV_ENCODE_API_FUNCTION_LIST *functionList)

Definition at line 162 of file dynlink_loader.h.

typedef NVENCSTATUS NVENCAPI tNvEncodeAPIGetMaxSupportedVersion(uint32_t *version)

Definition at line 163 of file dynlink_loader.h.

Function Documentation

static void cuda_free_functions ( CudaFunctions **  functions)
inlinestatic

Definition at line 173 of file dynlink_loader.h.

Referenced by cuda_device_uninit(), and ff_nvenc_encode_close().

static void cuvid_free_functions ( CuvidFunctions **  functions)
inlinestatic

Definition at line 179 of file dynlink_loader.h.

Referenced by cuvid_decode_end().

static void nvenc_free_functions ( NvencFunctions **  functions)
inlinestatic

Definition at line 184 of file dynlink_loader.h.

Referenced by ff_nvenc_encode_close().

static int cuda_load_functions ( CudaFunctions **  functions)
inlinestatic

Definition at line 190 of file dynlink_loader.h.

Referenced by cuda_device_init(), and nvenc_load_libraries().

static int cuvid_load_functions ( CuvidFunctions **  functions)
inlinestatic

Definition at line 213 of file dynlink_loader.h.

Referenced by cuvid_decode_init().

static int nvenc_load_functions ( NvencFunctions **  functions)
inlinestatic

Definition at line 247 of file dynlink_loader.h.

Referenced by nvenc_load_libraries().