[FFmpeg-cvslog] avfilter/vf_vectorscope: use enum for graticule items

Paul B Mahol git at videolan.org
Sat Dec 28 15:02:49 EET 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Dec 28 11:08:22 2019 +0100| [1669c970b11f324aab744eb361e0f93ba8c00cb1] | committer: Paul B Mahol

avfilter/vf_vectorscope: use enum for graticule items

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1669c970b11f324aab744eb361e0f93ba8c00cb1
---

 libavfilter/vf_vectorscope.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_vectorscope.c b/libavfilter/vf_vectorscope.c
index e3e00797d0..c782414ffe 100644
--- a/libavfilter/vf_vectorscope.c
+++ b/libavfilter/vf_vectorscope.c
@@ -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;
     }
 



More information about the ffmpeg-cvslog mailing list