*/
#include "avfilter.h"
+#include "formats.h"
+#include "video.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
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};
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);
PIX_FMT_YUVJ444P, PIX_FMT_YUVJ440P, PIX_FMT_NONE
};
- avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
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;
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);
deshake->ref = in;
// Draw the transformed frame information
- avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1);
- avfilter_end_frame(link->dst->outputs[0]);
- avfilter_unref_buffer(out);
+ ff_draw_slice(link->dst->outputs[0], 0, link->h, 1);
+ 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 = {