avfilter/dualinput: simplify
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
5c7d86cbde
commit
cd1b22d8e8
@ -66,18 +66,12 @@ int ff_dualinput_init(AVFilterContext *ctx, FFDualInputContext *s)
|
|||||||
return ff_framesync_configure(&s->fs);
|
return ff_framesync_configure(&s->fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_dualinput_filter_frame_main(FFDualInputContext *s,
|
int ff_dualinput_filter_frame(FFDualInputContext *s,
|
||||||
AVFilterLink *inlink, AVFrame *in)
|
AVFilterLink *inlink, AVFrame *in)
|
||||||
{
|
{
|
||||||
return ff_framesync_filter_frame(&s->fs, inlink, in);
|
return ff_framesync_filter_frame(&s->fs, inlink, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_dualinput_filter_frame_second(FFDualInputContext *s,
|
|
||||||
AVFilterLink *inlink, AVFrame *in)
|
|
||||||
{
|
|
||||||
return ff_framesync_filter_frame(&s->fs, inlink, in);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ff_dualinput_request_frame(FFDualInputContext *s, AVFilterLink *outlink)
|
int ff_dualinput_request_frame(FFDualInputContext *s, AVFilterLink *outlink)
|
||||||
{
|
{
|
||||||
return ff_framesync_request_frame(&s->fs, outlink);
|
return ff_framesync_request_frame(&s->fs, outlink);
|
||||||
|
@ -39,8 +39,7 @@ typedef struct {
|
|||||||
} FFDualInputContext;
|
} FFDualInputContext;
|
||||||
|
|
||||||
int ff_dualinput_init(AVFilterContext *ctx, FFDualInputContext *s);
|
int ff_dualinput_init(AVFilterContext *ctx, FFDualInputContext *s);
|
||||||
int ff_dualinput_filter_frame_main(FFDualInputContext *s, AVFilterLink *inlink, AVFrame *in);
|
int ff_dualinput_filter_frame(FFDualInputContext *s, AVFilterLink *inlink, AVFrame *in);
|
||||||
int ff_dualinput_filter_frame_second(FFDualInputContext *s, AVFilterLink *inlink, AVFrame *in);
|
|
||||||
int ff_dualinput_request_frame(FFDualInputContext *s, AVFilterLink *outlink);
|
int ff_dualinput_request_frame(FFDualInputContext *s, AVFilterLink *outlink);
|
||||||
void ff_dualinput_uninit(FFDualInputContext *s);
|
void ff_dualinput_uninit(FFDualInputContext *s);
|
||||||
|
|
||||||
|
@ -422,27 +422,21 @@ static int request_frame(AVFilterLink *outlink)
|
|||||||
return ff_dualinput_request_frame(&b->dinput, outlink);
|
return ff_dualinput_request_frame(&b->dinput, outlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int filter_frame_top(AVFilterLink *inlink, AVFrame *buf)
|
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
|
||||||
{
|
{
|
||||||
BlendContext *b = inlink->dst->priv;
|
BlendContext *b = inlink->dst->priv;
|
||||||
return ff_dualinput_filter_frame_main(&b->dinput, inlink, buf);
|
return ff_dualinput_filter_frame(&b->dinput, inlink, buf);
|
||||||
}
|
|
||||||
|
|
||||||
static int filter_frame_bottom(AVFilterLink *inlink, AVFrame *buf)
|
|
||||||
{
|
|
||||||
BlendContext *b = inlink->dst->priv;
|
|
||||||
return ff_dualinput_filter_frame_second(&b->dinput, inlink, buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const AVFilterPad blend_inputs[] = {
|
static const AVFilterPad blend_inputs[] = {
|
||||||
{
|
{
|
||||||
.name = "top",
|
.name = "top",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.filter_frame = filter_frame_top,
|
.filter_frame = filter_frame,
|
||||||
},{
|
},{
|
||||||
.name = "bottom",
|
.name = "bottom",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.filter_frame = filter_frame_bottom,
|
.filter_frame = filter_frame,
|
||||||
},
|
},
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
@ -667,16 +667,10 @@ static int config_output(AVFilterLink *outlink)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int filter_frame_main(AVFilterLink *inlink, AVFrame *inpicref)
|
static int filter_frame_hald(AVFilterLink *inlink, AVFrame *inpicref)
|
||||||
{
|
{
|
||||||
LUT3DContext *s = inlink->dst->priv;
|
LUT3DContext *s = inlink->dst->priv;
|
||||||
return ff_dualinput_filter_frame_main(&s->dinput, inlink, inpicref);
|
return ff_dualinput_filter_frame(&s->dinput, inlink, inpicref);
|
||||||
}
|
|
||||||
|
|
||||||
static int filter_frame_clut(AVFilterLink *inlink, AVFrame *inpicref)
|
|
||||||
{
|
|
||||||
LUT3DContext *s = inlink->dst->priv;
|
|
||||||
return ff_dualinput_filter_frame_second(&s->dinput, inlink, inpicref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_frame(AVFilterLink *outlink)
|
static int request_frame(AVFilterLink *outlink)
|
||||||
@ -766,12 +760,12 @@ static const AVFilterPad haldclut_inputs[] = {
|
|||||||
{
|
{
|
||||||
.name = "main",
|
.name = "main",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.filter_frame = filter_frame_main,
|
.filter_frame = filter_frame_hald,
|
||||||
.config_props = config_input,
|
.config_props = config_input,
|
||||||
},{
|
},{
|
||||||
.name = "clut",
|
.name = "clut",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.filter_frame = filter_frame_clut,
|
.filter_frame = filter_frame_hald,
|
||||||
.config_props = config_clut,
|
.config_props = config_clut,
|
||||||
},
|
},
|
||||||
{ NULL }
|
{ NULL }
|
||||||
|
@ -549,16 +549,10 @@ static AVFrame *do_blend(AVFilterContext *ctx, AVFrame *mainpic,
|
|||||||
return mainpic;
|
return mainpic;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int filter_frame_main(AVFilterLink *inlink, AVFrame *inpicref)
|
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
|
||||||
{
|
{
|
||||||
OverlayContext *s = inlink->dst->priv;
|
OverlayContext *s = inlink->dst->priv;
|
||||||
return ff_dualinput_filter_frame_main(&s->dinput, inlink, inpicref);
|
return ff_dualinput_filter_frame(&s->dinput, inlink, inpicref);
|
||||||
}
|
|
||||||
|
|
||||||
static int filter_frame_over(AVFilterLink *inlink, AVFrame *inpicref)
|
|
||||||
{
|
|
||||||
OverlayContext *s = inlink->dst->priv;
|
|
||||||
return ff_dualinput_filter_frame_second(&s->dinput, inlink, inpicref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_frame(AVFilterLink *outlink)
|
static int request_frame(AVFilterLink *outlink)
|
||||||
@ -606,14 +600,14 @@ static const AVFilterPad avfilter_vf_overlay_inputs[] = {
|
|||||||
.name = "main",
|
.name = "main",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.config_props = config_input_main,
|
.config_props = config_input_main,
|
||||||
.filter_frame = filter_frame_main,
|
.filter_frame = filter_frame,
|
||||||
.needs_writable = 1,
|
.needs_writable = 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "overlay",
|
.name = "overlay",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.config_props = config_input_overlay,
|
.config_props = config_input_overlay,
|
||||||
.filter_frame = filter_frame_over,
|
.filter_frame = filter_frame,
|
||||||
},
|
},
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
@ -320,16 +320,10 @@ static int config_output(AVFilterLink *outlink)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int filter_frame_main(AVFilterLink *inlink, AVFrame *inpicref)
|
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
|
||||||
{
|
{
|
||||||
PSNRContext *s = inlink->dst->priv;
|
PSNRContext *s = inlink->dst->priv;
|
||||||
return ff_dualinput_filter_frame_main(&s->dinput, inlink, inpicref);
|
return ff_dualinput_filter_frame(&s->dinput, inlink, inpicref);
|
||||||
}
|
|
||||||
|
|
||||||
static int filter_frame_ref(AVFilterLink *inlink, AVFrame *inpicref)
|
|
||||||
{
|
|
||||||
PSNRContext *s = inlink->dst->priv;
|
|
||||||
return ff_dualinput_filter_frame_second(&s->dinput, inlink, inpicref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_frame(AVFilterLink *outlink)
|
static int request_frame(AVFilterLink *outlink)
|
||||||
@ -359,11 +353,11 @@ static const AVFilterPad psnr_inputs[] = {
|
|||||||
{
|
{
|
||||||
.name = "main",
|
.name = "main",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.filter_frame = filter_frame_main,
|
.filter_frame = filter_frame,
|
||||||
},{
|
},{
|
||||||
.name = "reference",
|
.name = "reference",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.filter_frame = filter_frame_ref,
|
.filter_frame = filter_frame,
|
||||||
.config_props = config_input_ref,
|
.config_props = config_input_ref,
|
||||||
},
|
},
|
||||||
{ NULL }
|
{ NULL }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user