History

avfilter/vf_deband: add support for commands

Paul B Mahol committed 5 years ago

Commit dd011651 parent 178a0d62 files · +21 −3Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/vf_deband.c+17−3
@@ -49,7 +49,7 @@ typedef struct DebandContext { · 48 unmodified lines
49} DebandContext;49} DebandContext;
50 50
51#define OFFSET(x) offsetof(DebandContext, x)51#define OFFSET(x) offsetof(DebandContext, x)
52#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM52#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
53 53
54static const AVOption deband_options[] = {54static const AVOption deband_options[] = {
55 { "1thr", "set 1st plane threshold", OFFSET(threshold[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0.00003, 0.5, FLAGS },55 { "1thr", "set 1st plane threshold", OFFSET(threshold[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0.00003, 0.5, FLAGS },
@@ -389,8 +389,10 @@ static int config_input(AVFilterLink *inlink) · 333 unmodified lines
389 s->thr[2] = ((1 << desc->comp[2].depth) - 1) * s->threshold[2];389 s->thr[2] = ((1 << desc->comp[2].depth) - 1) * s->threshold[2];
390 s->thr[3] = ((1 << desc->comp[3].depth) - 1) * s->threshold[3];390 s->thr[3] = ((1 << desc->comp[3].depth) - 1) * s->threshold[3];
391 391
392 s->x_pos = av_malloc(s->planewidth[0] * s->planeheight[0] * sizeof(*s->x_pos));392 if (!s->x_pos)
393 s->y_pos = av_malloc(s->planewidth[0] * s->planeheight[0] * sizeof(*s->y_pos));393 s->x_pos = av_malloc(s->planewidth[0] * s->planeheight[0] * sizeof(*s->x_pos));
394 if (!s->y_pos)
395 s->y_pos = av_malloc(s->planewidth[0] * s->planeheight[0] * sizeof(*s->y_pos));
394 if (!s->x_pos || !s->y_pos)396 if (!s->x_pos || !s->y_pos)
395 return AVERROR(ENOMEM);397 return AVERROR(ENOMEM);
396 398
@@ -432,6 +434,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 35 unmodified lines
432 return ff_filter_frame(outlink, out);434 return ff_filter_frame(outlink, out);
433}435}
434 436
437static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
438 char *res, int res_len, int flags)
439{
440 int ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
441
442 if (ret < 0)
443 return ret;
444
445 return config_input(ctx->inputs[0]);
446}
447
435static av_cold void uninit(AVFilterContext *ctx)448static av_cold void uninit(AVFilterContext *ctx)
436{449{
437 DebandContext *s = ctx->priv;450 DebandContext *s = ctx->priv;
@@ -468,4 +481,5 @@ AVFilter ff_vf_deband = { · 30 unmodified lines
468 .inputs = avfilter_vf_deband_inputs,481 .inputs = avfilter_vf_deband_inputs,
469 .outputs = avfilter_vf_deband_outputs,482 .outputs = avfilter_vf_deband_outputs,
470 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,483 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
484 .process_command = process_command,
471};485};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t