diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-02-25 21:21:29 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-04-09 19:09:03 +0200 |
commit | 7536c671040f1f3ebc9f0d3b7831dac71436b775 (patch) | |
tree | 2fffb60c7a5af429e858caa2d7e0b0488a6785da /libavfilter/vf_yadif.c | |
parent | b83e9efc53e5491716625aa31c69006b1119b280 (diff) | |
download | ffmpeg-7536c671040f1f3ebc9f0d3b7831dac71436b775.tar.gz |
vf_yadif: switch to an AVOptions-based system.
Diffstat (limited to 'libavfilter/vf_yadif.c')
-rw-r--r-- | libavfilter/vf_yadif.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 37e9887421..faa487f7df 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -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, |