diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-10-08 12:42:40 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2019-10-14 11:28:54 +0200 |
commit | a918b833a5ea640b6c8fa1125ae420999055b753 (patch) | |
tree | d1ef14f79e7a90dc76ce8de5fe880f1b5df48358 | |
parent | f3746d31f9486bcc266f17738861cc8a5c9c1eb7 (diff) | |
download | ffmpeg-a918b833a5ea640b6c8fa1125ae420999055b753.tar.gz |
avfilter/avfilter: add ff_filter_process_command()
-rw-r--r-- | libavfilter/avfilter.c | 13 | ||||
-rw-r--r-- | libavfilter/internal.h | 7 |
2 files changed, 20 insertions, 0 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 93e866b79c..09f33e0e7c 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -884,6 +884,19 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, return count; } +int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, + const char *arg, char *res, int res_len, int flags) +{ + const AVOption *o; + + if (!ctx->filter->priv_class) + return 0; + o = av_opt_find2(ctx->priv, cmd, NULL, AV_OPT_FLAG_RUNTIME_PARAM | AV_OPT_FLAG_FILTERING_PARAM, AV_OPT_SEARCH_CHILDREN, NULL); + if (!o) + return AVERROR(ENOSYS); + return av_opt_set(ctx->priv, cmd, arg, 0); +} + int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) { int ret = 0; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 498bd3328d..1d77808082 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -412,6 +412,13 @@ static inline int ff_norm_qscale(int qscale, int type) int ff_filter_get_nb_threads(AVFilterContext *ctx); /** + * Generic processing of user supplied commands that are set + * in the same way as the filter options. + */ +int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, + const char *arg, char *res, int res_len, int flags); + +/** * Perform any additional setup required for hardware frames. * * link->hw_frames_ctx must be set before calling this function. |