]> git.sesse.net Git - ffmpeg/commitdiff
vf_yadif: switch to an AVOptions-based system.
authorAnton Khirnov <anton@khirnov.net>
Mon, 25 Feb 2013 20:21:29 +0000 (21:21 +0100)
committerAnton Khirnov <anton@khirnov.net>
Tue, 9 Apr 2013 17:09:03 +0000 (19:09 +0200)
doc/filters.texi
libavfilter/vf_yadif.c
libavfilter/yadif.h

index e19ea15ff5eed747eb0c939a0ca273a58078723f..0e7acda7b1e9e06c022ffabb1f08a1232da8900e 100644 (file)
@@ -2214,10 +2214,12 @@ Flip the input video vertically.
 Deinterlace the input video ("yadif" means "yet another deinterlacing
 filter").
 
-It accepts the optional parameters: @var{mode}:@var{parity}:@var{auto}.
+This filter accepts the following options:
+
+@table @option
 
-@var{mode} specifies the interlacing mode to adopt, accepts one of the
-following values:
+@item mode
+The interlacing mode to adopt, accepts one of the following values:
 
 @table @option
 @item 0
@@ -2232,8 +2234,9 @@ like 1 but skips spatial interlacing check
 
 Default value is 0.
 
-@var{parity} specifies the picture field parity assumed for the input
-interlaced video, accepts one of the following values:
+@item parity
+The picture field parity assumed for the input interlaced video, accepts one of
+the following values:
 
 @table @option
 @item 0
@@ -2248,8 +2251,9 @@ Default value is -1.
 If interlacing is unknown or decoder does not export this information,
 top field first will be assumed.
 
-@var{auto} specifies if deinterlacer should trust the interlaced flag
-and only deinterlace frames marked as interlaced
+@item auto
+Whether deinterlacer should trust the interlaced flag and only deinterlace
+frames marked as interlaced
 
 @table @option
 @item 0
@@ -2260,6 +2264,8 @@ only deinterlace frames marked as interlaced
 
 Default value is 0.
 
+@end table
+
 @c man end VIDEO FILTERS
 
 @chapter Video Sources
index 37e9887421e522cca986e2f95d5ee67bd992c5cb..faa487f7dfe3fc0ab232333e0949b86cd72c3713 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "libavutil/cpu.h"
 #include "libavutil/common.h"
+#include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "avfilter.h"
 #include "formats.h"
@@ -429,24 +430,6 @@ static int query_formats(AVFilterContext *ctx)
     return 0;
 }
 
-static av_cold int init(AVFilterContext *ctx, const char *args)
-{
-    YADIFContext *yadif = ctx->priv;
-
-    yadif->mode = 0;
-    yadif->parity = -1;
-    yadif->auto_enable = 0;
-
-    if (args)
-        sscanf(args, "%d:%d:%d",
-               &yadif->mode, &yadif->parity, &yadif->auto_enable);
-
-    av_log(ctx, AV_LOG_VERBOSE, "mode:%d parity:%d auto_enable:%d\n",
-           yadif->mode, yadif->parity, yadif->auto_enable);
-
-    return 0;
-}
-
 static int config_props(AVFilterLink *link)
 {
     YADIFContext *s = link->src->priv;
@@ -471,6 +454,25 @@ static int config_props(AVFilterLink *link)
     return 0;
 }
 
+#define OFFSET(x) offsetof(YADIFContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption options[] = {
+    { "mode",   NULL, OFFSET(mode),        AV_OPT_TYPE_INT, { .i64 = 0  },  0, 3, FLAGS },
+    { "parity", NULL, OFFSET(parity),      AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, FLAGS, "parity" },
+        { "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, .unit = "parity" },
+        { "tff",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0  }, .unit = "parity" },
+        { "bff",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1  }, .unit = "parity" },
+    { "auto",   NULL, OFFSET(auto_enable), AV_OPT_TYPE_INT, { .i64 = 0  },  0, 1, FLAGS },
+    { NULL },
+};
+
+static const AVClass yadif_class = {
+    .class_name = "yadif",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+
 static const AVFilterPad avfilter_vf_yadif_inputs[] = {
     {
         .name             = "default",
@@ -497,7 +499,7 @@ AVFilter avfilter_vf_yadif = {
     .description   = NULL_IF_CONFIG_SMALL("Deinterlace the input image"),
 
     .priv_size     = sizeof(YADIFContext),
-    .init          = init,
+    .priv_class    = &yadif_class,
     .uninit        = uninit,
     .query_formats = query_formats,
 
index a9cbecf471e4c6f102b4a85e0872975754cefc5d..665922d925f25adf0c358afcc7a1bea99dd666a7 100644 (file)
@@ -23,6 +23,7 @@
 #include "avfilter.h"
 
 typedef struct YADIFContext {
+    const AVClass *class;
     /**
      * 0: send 1 frame for each frame
      * 1: send 1 frame for each field