]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_overlay_opencl.c
avfilter: Constify all AVFilters
[ffmpeg] / libavfilter / vf_overlay_opencl.c
index 556ce350700686aa42f43ffbc041cef0059dfeea..8547bae2787d8e2fb2c86180af7e9be455e0ff9b 100644 (file)
@@ -100,19 +100,11 @@ static int overlay_opencl_load(AVFilterContext *avctx,
     ctx->command_queue = clCreateCommandQueue(ctx->ocf.hwctx->context,
                                               ctx->ocf.hwctx->device_id,
                                               0, &cle);
-    if (!ctx->command_queue) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to create OpenCL "
-               "command queue: %d.\n", cle);
-        err = AVERROR(EIO);
-        goto fail;
-    }
+    CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create OpenCL "
+                     "command queue %d.\n", cle);
 
     ctx->kernel = clCreateKernel(ctx->ocf.program, kernel, &cle);
-    if (!ctx->kernel) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to create kernel: %d.\n", cle);
-        err = AVERROR(EIO);
-        goto fail;
-    }
+    CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create kernel %d.\n", cle);
 
     ctx->initialised = 1;
     return 0;
@@ -209,21 +201,12 @@ static int overlay_opencl_blend(FFFrameSync *fs)
 
         cle = clEnqueueNDRangeKernel(ctx->command_queue, ctx->kernel, 2, NULL,
                                      global_work, NULL, 0, NULL, NULL);
-        if (cle != CL_SUCCESS) {
-            av_log(avctx, AV_LOG_ERROR, "Failed to enqueue "
-                   "overlay kernel for plane %d: %d.\n", cle, plane);
-            err = AVERROR(EIO);
-            goto fail;
-        }
+        CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to enqueue overlay kernel "
+                         "for plane %d: %d.\n", plane, cle);
     }
 
     cle = clFinish(ctx->command_queue);
-    if (cle != CL_SUCCESS) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to finish "
-               "command queue: %d.\n", cle);
-        err = AVERROR(EIO);
-        goto fail;
-    }
+    CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to finish command queue: %d.\n", cle);
 
     err = av_frame_copy_props(output, input_main);
 
@@ -330,7 +313,7 @@ static const AVFilterPad overlay_opencl_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_vf_overlay_opencl = {
+const AVFilter ff_vf_overlay_opencl = {
     .name            = "overlay_opencl",
     .description     = NULL_IF_CONFIG_SMALL("Overlay one video on top of another"),
     .priv_size       = sizeof(OverlayOpenCLContext),