diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-01-16 15:54:54 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-02-12 10:16:41 +0100 |
commit | 80cf509e7315bd77aad4a0cce8dd15a85e6e6ed4 (patch) | |
tree | 4c5f8c10a0d283af7b698b4666fa253d704ed252 /libavfilter/avfilter.c | |
parent | 926059dbf36c00807720a9160a43b4fa13f0d6ae (diff) | |
download | ffmpeg-80cf509e7315bd77aad4a0cce8dd15a85e6e6ed4.tar.gz |
lavfi/avfilter: export process_options()
Also, replace an AVFilterContext argument with a logging context+private
class, as those are the only things needed in this function.
Will be useful in future commits.
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index ed363351ad..2f9f962f29 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -776,8 +776,8 @@ int ff_filter_get_nb_threads(AVFilterContext *ctx) return ctx->graph->nb_threads; } -static int process_options(AVFilterContext *ctx, AVDictionary **options, - const char *args) +int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, + AVDictionary **options, const char *args) { const AVOption *o = NULL; int ret; @@ -791,8 +791,8 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, while (*args) { const char *shorthand = NULL; - if (ctx->filter->priv_class) - o = av_opt_next(ctx->priv, o); + if (priv_class) + o = av_opt_next(&priv_class, o); if (o) { if (o->type == AV_OPT_TYPE_CONST || o->offset == offset) continue; @@ -805,9 +805,9 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, &parsed_key, &value); if (ret < 0) { if (ret == AVERROR(EINVAL)) - av_log(ctx, AV_LOG_ERROR, "No option name near '%s'\n", args); + av_log(logctx, AV_LOG_ERROR, "No option name near '%s'\n", args); else - av_log(ctx, AV_LOG_ERROR, "Unable to parse '%s': %s\n", args, + av_log(logctx, AV_LOG_ERROR, "Unable to parse '%s': %s\n", args, av_err2str(ret)); return ret; } @@ -817,13 +817,13 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, key = parsed_key; /* discard all remaining shorthand */ - if (ctx->filter->priv_class) - while ((o = av_opt_next(ctx->priv, o))); + if (priv_class) + while ((o = av_opt_next(&priv_class, o))); } else { key = shorthand; } - av_log(ctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value); + av_log(logctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value); av_dict_set(options, key, value, AV_DICT_MULTIKEY); @@ -887,7 +887,7 @@ int avfilter_init_str(AVFilterContext *filter, const char *args) int ret = 0; if (args && *args) { - ret = process_options(filter, &options, args); + ret = ff_filter_opt_parse(filter, filter->filter->priv_class, &options, args); if (ret < 0) goto fail; } |