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:07:28 +0200 |
commit | 33b97faaba2744f0a2fd65c0ef9ecc2de3fad7ff (patch) | |
tree | b809727d96642ad7b9c798018a2b3991bd6a9b4a /libavfilter/vf_setpts.c | |
parent | 95f1f56a21bc2f824af6fb97ca7ab35cdd0c401e (diff) | |
download | ffmpeg-33b97faaba2744f0a2fd65c0ef9ecc2de3fad7ff.tar.gz |
vf_setpts: switch to an AVOptions-based system.
Diffstat (limited to 'libavfilter/vf_setpts.c')
-rw-r--r-- | libavfilter/vf_setpts.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/libavfilter/vf_setpts.c b/libavfilter/vf_setpts.c index 02fb4bd0c5..98947a6816 100644 --- a/libavfilter/vf_setpts.c +++ b/libavfilter/vf_setpts.c @@ -29,6 +29,7 @@ #include "libavutil/eval.h" #include "libavutil/internal.h" #include "libavutil/mathematics.h" +#include "libavutil/opt.h" #include "libavutil/time.h" #include "avfilter.h" #include "internal.h" @@ -67,6 +68,8 @@ enum var_name { }; typedef struct { + const AVClass *class; + char *expr_str; AVExpr *expr; double var_values[VAR_VARS_NB]; } SetPTSContext; @@ -76,9 +79,9 @@ static av_cold int init(AVFilterContext *ctx, const char *args) SetPTSContext *setpts = ctx->priv; int ret; - if ((ret = av_expr_parse(&setpts->expr, args ? args : "PTS", + if ((ret = av_expr_parse(&setpts->expr, setpts->expr_str, var_names, NULL, NULL, NULL, NULL, 0, ctx)) < 0) { - av_log(ctx, AV_LOG_ERROR, "Error while parsing expression '%s'\n", args); + av_log(ctx, AV_LOG_ERROR, "Error while parsing expression '%s'\n", setpts->expr_str); return ret; } @@ -145,6 +148,20 @@ static av_cold void uninit(AVFilterContext *ctx) setpts->expr = NULL; } +#define OFFSET(x) offsetof(SetPTSContext, x) +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM +static const AVOption options[] = { + { "expr", "Expression determining the frame timestamp", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "PTS" }, .flags = FLAGS }, + { NULL }, +}; + +static const AVClass setpts_class = { + .class_name = "setpts", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; + static const AVFilterPad avfilter_vf_setpts_inputs[] = { { .name = "default", @@ -171,6 +188,7 @@ AVFilter avfilter_vf_setpts = { .uninit = uninit, .priv_size = sizeof(SetPTSContext), + .priv_class = &setpts_class, .inputs = avfilter_vf_setpts_inputs, .outputs = avfilter_vf_setpts_outputs, |