#include "formats.h"
#include "internal.h"
#include "video.h"
-#include "framesync2.h"
+#include "framesync.h"
static const char *const var_names[] = {
"w", ///< width of the input video
typedef struct LUT2Context {
const AVClass *class;
+ FFFrameSync fs;
char *comp_expr_str[4];
void (*lut2)(struct LUT2Context *s, AVFrame *dst, AVFrame *srcx, AVFrame *srcy);
- FFFrameSync fs;
} LUT2Context;
#define OFFSET(x) offsetof(LUT2Context, x)
LUT2Context *s = ctx->priv;
int i;
+ ff_framesync_uninit(&s->fs);
av_frame_free(&s->prev_frame);
for (i = 0; i < 4; i++) {
AVFilterContext *ctx = fs->parent;
LUT2Context *s = fs->opaque;
AVFilterLink *outlink = ctx->outputs[0];
- AVFrame *out, *srcx, *srcy;
+ AVFrame *out, *srcx = NULL, *srcy = NULL;
int ret;
- if ((ret = ff_framesync2_get_frame(&s->fs, 0, &srcx, 0)) < 0 ||
- (ret = ff_framesync2_get_frame(&s->fs, 1, &srcy, 0)) < 0)
+ if ((ret = ff_framesync_get_frame(&s->fs, 0, &srcx, 0)) < 0 ||
+ (ret = ff_framesync_get_frame(&s->fs, 1, &srcy, 0)) < 0)
return ret;
- if (ctx->is_disabled) {
+ if (ctx->is_disabled || !srcy) {
out = av_frame_clone(srcx);
if (!out)
return AVERROR(ENOMEM);
outlink->sample_aspect_ratio = srcx->sample_aspect_ratio;
outlink->frame_rate = srcx->frame_rate;
- if ((ret = ff_framesync2_init(&s->fs, ctx, 2)) < 0)
+ if ((ret = ff_framesync_init(&s->fs, ctx, 2)) < 0)
return ret;
in = s->fs.in;
in[0].time_base = srcx->time_base;
in[1].time_base = srcy->time_base;
- in[0].sync = 1;
+ in[0].sync = 2;
in[0].before = EXT_STOP;
in[0].after = EXT_INFINITY;
in[1].sync = 1;
if ((ret = config_output(outlink)) < 0)
return ret;
- return ff_framesync2_configure(&s->fs);
+ return ff_framesync_configure(&s->fs);
}
static int activate(AVFilterContext *ctx)
{
LUT2Context *s = ctx->priv;
- return ff_framesync2_activate(&s->fs);
+ return ff_framesync_activate(&s->fs);
}
static const AVFilterPad inputs[] = {
#define lut2_options options
-AVFILTER_DEFINE_CLASS(lut2);
+FRAMESYNC_DEFINE_CLASS(lut2, LUT2Context, fs);
AVFilter ff_vf_lut2 = {
.name = "lut2",
.description = NULL_IF_CONFIG_SMALL("Compute and apply a lookup table from two video inputs."),
+ .preinit = lut2_framesync_preinit,
.priv_size = sizeof(LUT2Context),
.priv_class = &lut2_class,
.uninit = uninit,