From 48a1abed133d005aa4d7f49e4fdd5bef9aa263f5 Mon Sep 17 00:00:00 2001 From: Ruiling Song Date: Wed, 4 Jul 2018 02:16:24 +0800 Subject: lavfi/opencl: add macro for opencl error handling. Signed-off-by: Ruiling Song --- libavfilter/opencl.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libavfilter/opencl.h') diff --git a/libavfilter/opencl.h b/libavfilter/opencl.h index 7441b11614..1b7f117865 100644 --- a/libavfilter/opencl.h +++ b/libavfilter/opencl.h @@ -61,6 +61,18 @@ typedef struct OpenCLFilterContext { goto fail; \ } +/** + * A helper macro to handle OpenCL errors. It will assign errcode to + * variable err, log error msg, and jump to fail label on error. + */ +#define CL_FAIL_ON_ERROR(errcode, ...) do { \ + if (cle != CL_SUCCESS) { \ + av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \ + err = errcode; \ + goto fail; \ + } \ + } while(0) + /** * Return that all inputs and outputs support only AV_PIX_FMT_OPENCL. */ -- cgit v1.2.3