avfilter/vf_mix: add timeline support to tmix filter
This commit is contained in:
parent
6dc06e979c
commit
9e0e8e10c7
@ -348,6 +348,9 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
ThreadData td;
|
ThreadData td;
|
||||||
AVFrame *out;
|
AVFrame *out;
|
||||||
|
|
||||||
|
if (s->nb_inputs == 1)
|
||||||
|
return ff_filter_frame(outlink, in);
|
||||||
|
|
||||||
if (s->nb_frames < s->nb_inputs) {
|
if (s->nb_frames < s->nb_inputs) {
|
||||||
s->frames[s->nb_frames] = in;
|
s->frames[s->nb_frames] = in;
|
||||||
s->nb_frames++;
|
s->nb_frames++;
|
||||||
@ -358,6 +361,13 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
s->frames[s->nb_inputs - 1] = in;
|
s->frames[s->nb_inputs - 1] = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx->is_disabled) {
|
||||||
|
out = av_frame_clone(s->frames[0]);
|
||||||
|
if (!out)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
return ff_filter_frame(outlink, out);
|
||||||
|
}
|
||||||
|
|
||||||
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
|
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
|
||||||
if (!out)
|
if (!out)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
@ -371,7 +381,7 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const AVOption tmix_options[] = {
|
static const AVOption tmix_options[] = {
|
||||||
{ "frames", "set number of successive frames to mix", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=3}, 2, 128, .flags = FLAGS },
|
{ "frames", "set number of successive frames to mix", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=3}, 1, 128, .flags = FLAGS },
|
||||||
{ "weights", "set weight for each frame", OFFSET(weights_str), AV_OPT_TYPE_STRING, {.str="1 1 1"}, 0, 0, .flags = FLAGS },
|
{ "weights", "set weight for each frame", OFFSET(weights_str), AV_OPT_TYPE_STRING, {.str="1 1 1"}, 0, 0, .flags = FLAGS },
|
||||||
{ "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, INT16_MAX, .flags = FLAGS },
|
{ "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, INT16_MAX, .flags = FLAGS },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
@ -398,7 +408,7 @@ AVFilter ff_vf_tmix = {
|
|||||||
.inputs = inputs,
|
.inputs = inputs,
|
||||||
.init = init,
|
.init = init,
|
||||||
.uninit = uninit,
|
.uninit = uninit,
|
||||||
.flags = AVFILTER_FLAG_SLICE_THREADS,
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_TMIX_FILTER */
|
#endif /* CONFIG_TMIX_FILTER */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user