]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_deshake.c
Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'
[ffmpeg] / libavfilter / vf_deshake.c
index 6b2a3d4c7d53f885ae4d3d7cbf362813157c6b92..d03671c45345b835e03d5c3f14a979af0951ccb7 100644 (file)
@@ -331,7 +331,7 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2,
     av_free(angles);
 }
 
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
 {
     DeshakeContext *deshake = ctx->priv;
     char filename[256] = {0};
@@ -377,7 +377,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
         deshake->cx &= ~15;
     }
 
-    av_log(ctx, AV_LOG_INFO, "cx: %d, cy: %d, cw: %d, ch: %d, rx: %d, ry: %d, edge: %d blocksize: %d contrast: %d search: %d\n",
+    av_log(ctx, AV_LOG_VERBOSE, "cx: %d, cy: %d, cw: %d, ch: %d, rx: %d, ry: %d, edge: %d blocksize: %d contrast: %d search: %d\n",
            deshake->cx, deshake->cy, deshake->cw, deshake->ch,
            deshake->rx, deshake->ry, deshake->edge, deshake->blocksize * 2, deshake->contrast, deshake->search);
 
@@ -420,11 +420,12 @@ static av_cold void uninit(AVFilterContext *ctx)
     avfilter_unref_buffer(deshake->ref);
     if (deshake->fp)
         fclose(deshake->fp);
-    avcodec_close(deshake->avctx);
+    if (deshake->avctx)
+        avcodec_close(deshake->avctx);
     av_freep(&deshake->avctx);
 }
 
-static void end_frame(AVFilterLink *link)
+static int end_frame(AVFilterLink *link)
 {
     DeshakeContext *deshake = link->dst->priv;
     AVFilterBufferRef *in  = link->cur_buf;
@@ -434,6 +435,7 @@ static void end_frame(AVFilterLink *link)
     float alpha = 2.0 / deshake->refcount;
     char tmp[256];
 
+    link->cur_buf = NULL; /* it is in 'in' now */
     if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) {
         // Find the most likely global motion for the current frame
         find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0], in->data[0], link->w, link->h, in->linesize[0], &t);
@@ -528,12 +530,12 @@ static void end_frame(AVFilterLink *link)
 
     // Draw the transformed frame information
     ff_draw_slice(link->dst->outputs[0], 0, link->h, 1);
-    ff_end_frame(link->dst->outputs[0]);
-    avfilter_unref_buffer(out);
+    return ff_end_frame(link->dst->outputs[0]);
 }
 
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
+static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
 {
+    return 0;
 }
 
 AVFilter avfilter_vf_deshake = {