From 15c6390139096b7e7634bf0f6aaab1cd8b3aa509 Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler Date: Fri, 8 Feb 2019 22:47:01 +0100 Subject: avutil/cuda_check: avoid pointlessly exporting same symbol from two libraries --- libavutil/cuda_check.h | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'libavutil/cuda_check.h') diff --git a/libavutil/cuda_check.h b/libavutil/cuda_check.h index b8e5f65cbb..ec1705b000 100644 --- a/libavutil/cuda_check.h +++ b/libavutil/cuda_check.h @@ -23,10 +23,28 @@ /** * Wrap a CUDA function call and print error information if it fails. */ +static inline int ff_cuda_check(void *avctx, + void *cuGetErrorName_fn, void *cuGetErrorString_fn, + CUresult err, const char *func) +{ + const char *err_name; + const char *err_string; -int ff_cuda_check(void *avctx, - void *cuGetErrorName_fn, void *cuGetErrorString_fn, - CUresult err, const char *func); + av_log(avctx, AV_LOG_TRACE, "Calling %s\n", func); + + if (err == CUDA_SUCCESS) + return 0; + + ((tcuGetErrorName *)cuGetErrorName_fn)(err, &err_name); + ((tcuGetErrorString *)cuGetErrorString_fn)(err, &err_string); + + av_log(avctx, AV_LOG_ERROR, "%s failed", func); + if (err_name && err_string) + av_log(avctx, AV_LOG_ERROR, " -> %s: %s", err_name, err_string); + av_log(avctx, AV_LOG_ERROR, "\n"); + + return AVERROR_EXTERNAL; +} /** * Convenience wrapper for ff_cuda_check when directly linking libcuda. -- cgit v1.2.3