History

avfilter/vf_chromashift: add support for commands

Paul B Mahol committed 6 years ago

Commit 9bd4df11 parent fbcb1412 files · +41 −19Browse files

Unified · Split

2 files
  1. doc/filters.texi +8 −0
  2. libavfilter/vf_chromashift.c +33 −19
doc/filters.texi+8−0
@@ -6925,6 +6925,10 @@ Set amount to shift chroma-red vertically. · 6924 unmodified lines
6925Set edge mode, can be @var{smear}, default, or @var{warp}.6925Set edge mode, can be @var{smear}, default, or @var{warp}.
6926@end table6926@end table
6927 6927
6928@subsection Commands
6929
6930This filter supports the all above options as @ref{commands}.
6931
6928@section ciescope6932@section ciescope
6929 6933
6930Display CIE color diagram with pixels overlaid onto it.6934Display CIE color diagram with pixels overlaid onto it.
@@ -15511,6 +15515,10 @@ Set amount to shift alpha vertically. · 8580 unmodified lines
15511Set edge mode, can be @var{smear}, default, or @var{warp}.15515Set edge mode, can be @var{smear}, default, or @var{warp}.
15512@end table15516@end table
15513 15517
15518@subsection Commands
15519
15520This filter supports the all above options as @ref{commands}.
15521
15514@section roberts15522@section roberts
15515Apply roberts cross operator to input video stream.15523Apply roberts cross operator to input video stream.
15516 15524
libavfilter/vf_chromashift.c+33−19
@@ -400,17 +400,29 @@ static int config_input(AVFilterLink *inlink) · 399 unmodified lines
400 return av_image_fill_linesizes(s->linesize, inlink->format, inlink->w);400 return av_image_fill_linesizes(s->linesize, inlink->format, inlink->w);
401}401}
402 402
403static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
404 char *res, int res_len, int flags)
405{
406 int ret;
407
408 ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
409 if (ret < 0)
410 return ret;
411
412 return config_input(ctx->inputs[0]);
413}
414
403#define OFFSET(x) offsetof(ChromaShiftContext, x)415#define OFFSET(x) offsetof(ChromaShiftContext, x)
404#define VF AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM416#define VFR AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
405 417
406static const AVOption chromashift_options[] = {418static const AVOption chromashift_options[] = {
407 { "cbh", "shift chroma-blue horizontally", OFFSET(cbh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },419 { "cbh", "shift chroma-blue horizontally", OFFSET(cbh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
408 { "cbv", "shift chroma-blue vertically", OFFSET(cbv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },420 { "cbv", "shift chroma-blue vertically", OFFSET(cbv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
409 { "crh", "shift chroma-red horizontally", OFFSET(crh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },421 { "crh", "shift chroma-red horizontally", OFFSET(crh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
410 { "crv", "shift chroma-red vertically", OFFSET(crv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },422 { "crv", "shift chroma-red vertically", OFFSET(crv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
411 { "edge", "set edge operation", OFFSET(edge), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = VF, "edge" },423 { "edge", "set edge operation", OFFSET(edge), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = VFR, "edge" },
412 { "smear", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = VF, "edge" },424 { "smear", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = VFR, "edge" },
413 { "wrap", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = VF, "edge" },425 { "wrap", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = VFR, "edge" },
414 { NULL },426 { NULL },
415};427};
416 428
@@ -443,20 +455,21 @@ AVFilter ff_vf_chromashift = { · 26 unmodified lines
443 .outputs = outputs,455 .outputs = outputs,
444 .inputs = inputs,456 .inputs = inputs,
445 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,457 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
458 .process_command = process_command,
446};459};
447 460
448static const AVOption rgbashift_options[] = {461static const AVOption rgbashift_options[] = {
449 { "rh", "shift red horizontally", OFFSET(rh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },462 { "rh", "shift red horizontally", OFFSET(rh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
450 { "rv", "shift red vertically", OFFSET(rv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },463 { "rv", "shift red vertically", OFFSET(rv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
451 { "gh", "shift green horizontally", OFFSET(gh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },464 { "gh", "shift green horizontally", OFFSET(gh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
452 { "gv", "shift green vertically", OFFSET(gv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },465 { "gv", "shift green vertically", OFFSET(gv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
453 { "bh", "shift blue horizontally", OFFSET(bh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },466 { "bh", "shift blue horizontally", OFFSET(bh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
454 { "bv", "shift blue vertically", OFFSET(bv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },467 { "bv", "shift blue vertically", OFFSET(bv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
455 { "ah", "shift alpha horizontally", OFFSET(ah), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },468 { "ah", "shift alpha horizontally", OFFSET(ah), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
456 { "av", "shift alpha vertically", OFFSET(av), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VF },469 { "av", "shift alpha vertically", OFFSET(av), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
457 { "edge", "set edge operation", OFFSET(edge), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = VF, "edge" },470 { "edge", "set edge operation", OFFSET(edge), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = VFR, "edge" },
458 { "smear", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = VF, "edge" },471 { "smear", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = VFR, "edge" },
459 { "wrap", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = VF, "edge" },472 { "wrap", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = VFR, "edge" },
460 { NULL },473 { NULL },
461};474};
462 475
@@ -471,4 +484,5 @@ AVFilter ff_vf_rgbashift = { · 8 unmodified lines
471 .outputs = outputs,484 .outputs = outputs,
472 .inputs = inputs,485 .inputs = inputs,
473 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,486 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
487 .process_command = process_command,
474};488};

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