diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2013-03-16 20:40:30 +0100 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2013-03-20 21:13:56 +0100 |
commit | befbcc374d8b8b00d6c70b64bfdc51dd25ba906d (patch) | |
tree | 9821744fe07554406fed2db5a03d16d14f01296b /libavfilter/avfilter.c | |
parent | cdd78a65f470aef5fd5d295bc0f7154d0cd442c1 (diff) | |
download | ffmpeg-befbcc374d8b8b00d6c70b64bfdc51dd25ba906d.tar.gz |
lavfi: add common code to handle options parsing.
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 1d278178fe..8a907dc085 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -24,6 +24,7 @@ #include "libavutil/channel_layout.h" #include "libavutil/common.h" #include "libavutil/imgutils.h" +#include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavutil/rational.h" #include "libavutil/samplefmt.h" @@ -556,6 +557,8 @@ void avfilter_free(AVFilterContext *filter) if (filter->filter->uninit) filter->filter->uninit(filter); + if (filter->filter->shorthand) + av_opt_free(filter->priv); for (i = 0; i < filter->nb_inputs; i++) { if ((link = filter->inputs[i])) { @@ -600,6 +603,17 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque { int ret=0; + if (filter->filter->shorthand) { + av_assert0(filter->priv); + av_assert0(filter->filter->priv_class); + *(const AVClass **)filter->priv = filter->filter->priv_class; + av_opt_set_defaults(filter->priv); + ret = av_opt_set_from_string(filter->priv, args, + filter->filter->shorthand, "=", ":"); + if (ret < 0) + return ret; + args = NULL; + } if (filter->filter->init_opaque) ret = filter->filter->init_opaque(filter, args, opaque); else if (filter->filter->init) |