avfilter/vf_vectorscope: use enum for graticule items

This commit is contained in:
Paul B Mahol 2019-12-28 11:08:22 +01:00
parent 5c0d1f7896
commit 1669c970b1
1 changed files with 16 additions and 9 deletions

View File

@ -29,6 +29,13 @@
#include "internal.h"
#include "video.h"
enum GraticuleType {
GRAT_NONE,
GRAT_GREEN,
GRAT_COLOR,
NB_GRATICULES
};
enum VectorscopeMode {
GRAY,
COLOR,
@ -95,11 +102,11 @@ static const AVOption vectorscope_options[] = {
{ "instant", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "envelope" },
{ "peak", 0, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "envelope" },
{ "peak+instant", 0, 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, "envelope" },
{ "graticule", "set graticule", OFFSET(graticule), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "graticule"},
{ "g", "set graticule", OFFSET(graticule), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "graticule"},
{ "none", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "graticule" },
{ "green", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "graticule" },
{ "color", 0, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "graticule" },
{ "graticule", "set graticule", OFFSET(graticule), AV_OPT_TYPE_INT, {.i64=GRAT_NONE}, 0, NB_GRATICULES-1, FLAGS, "graticule"},
{ "g", "set graticule", OFFSET(graticule), AV_OPT_TYPE_INT, {.i64=GRAT_NONE}, 0, NB_GRATICULES-1, FLAGS, "graticule"},
{ "none", 0, 0, AV_OPT_TYPE_CONST, {.i64=GRAT_NONE}, 0, 0, FLAGS, "graticule" },
{ "green", 0, 0, AV_OPT_TYPE_CONST, {.i64=GRAT_GREEN}, 0, 0, FLAGS, "graticule" },
{ "color", 0, 0, AV_OPT_TYPE_CONST, {.i64=GRAT_COLOR}, 0, 0, FLAGS, "graticule" },
{ "opacity", "set graticule opacity", OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, FLAGS},
{ "o", "set graticule opacity", OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=0.75}, 0, 1, FLAGS},
{ "flags", "set graticule flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64=4}, 0, 7, FLAGS, "flags"},
@ -1281,14 +1288,14 @@ static int config_input(AVFilterLink *inlink)
s->graticulef = none_graticule;
if (s->is_yuv && s->size == 256) {
if (s->graticule == 1)
if (s->graticule == GRAT_GREEN)
s->graticulef = green_graticule;
else if (s->graticule == 2)
else if (s->graticule == GRAT_COLOR)
s->graticulef = color_graticule;
} else if (s->is_yuv) {
if (s->graticule == 1)
if (s->graticule == GRAT_GREEN)
s->graticulef = green_graticule16;
else if (s->graticule == 2)
else if (s->graticule == GRAT_COLOR)
s->graticulef = color_graticule16;
}