Skip to content

Commit f890a6d

Browse files
committed
compat/cuda: make cuvidGetDecoderCaps optional
1 parent cb3358b commit f890a6d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compat/cuda/dynlink_loader.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@
7676
av_log(NULL, AV_LOG_TRACE, "Loaded sym: %s\n", symbol); \
7777
} while (0)
7878

79+
#define LOAD_SYMBOL_OPT(fun, tp, symbol) \
80+
do { \
81+
if (!((f->fun) = (tp*)dlsym(f->lib, symbol))) { \
82+
av_log(NULL, AV_LOG_DEBUG, "Cannot load optional %s\n", symbol); \
83+
} else { \
84+
av_log(NULL, AV_LOG_TRACE, "Loaded sym: %s\n", symbol); \
85+
} \
86+
} while (0)
87+
7988
#define GENERIC_LOAD_FUNC_PREAMBLE(T, n, N) \
8089
T *f; \
8190
int ret; \
@@ -205,7 +214,7 @@ static inline int cuvid_load_functions(CuvidFunctions **functions)
205214
{
206215
GENERIC_LOAD_FUNC_PREAMBLE(CuvidFunctions, cuvid, NVCUVID_LIBNAME);
207216

208-
LOAD_SYMBOL(cuvidGetDecoderCaps, tcuvidGetDecoderCaps, "cuvidGetDecoderCaps");
217+
LOAD_SYMBOL_OPT(cuvidGetDecoderCaps, tcuvidGetDecoderCaps, "cuvidGetDecoderCaps");
209218
LOAD_SYMBOL(cuvidCreateDecoder, tcuvidCreateDecoder, "cuvidCreateDecoder");
210219
LOAD_SYMBOL(cuvidDestroyDecoder, tcuvidDestroyDecoder, "cuvidDestroyDecoder");
211220
LOAD_SYMBOL(cuvidDecodePicture, tcuvidDecodePicture, "cuvidDecodePicture");

0 commit comments

Comments
 (0)