[FFmpeg-cvslog] lavfi/avfilter: process options for filters without a private class

Anton Khirnov git at videolan.org
Tue Jan 10 12:58:24 EET 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Jan  8 11:19:47 2023 +0100| [1c18530e936e2cc20e932415ad9f290e952c9d25] | committer: Anton Khirnov

lavfi/avfilter: process options for filters without a private class

It still makes sense to apply AVFilterContext-level options to such
filters.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c18530e936e2cc20e932415ad9f290e952c9d25
---

 libavfilter/avfilter.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 43dfb11bdb..c2ecdffa6f 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -812,7 +812,8 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options,
     while (*args) {
         const char *shorthand = NULL;
 
-        o = av_opt_next(ctx->priv, o);
+        if (ctx->filter->priv_class)
+            o = av_opt_next(ctx->priv, o);
         if (o) {
             if (o->type == AV_OPT_TYPE_CONST || o->offset == offset)
                 continue;
@@ -835,7 +836,10 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options,
             args++;
         if (parsed_key) {
             key = parsed_key;
-            while ((o = av_opt_next(ctx->priv, o))); /* discard all remaining shorthand */
+
+            /* discard all remaining shorthand */
+            if (ctx->filter->priv_class)
+                while ((o = av_opt_next(ctx->priv, o)));
         } else {
             key = shorthand;
         }
@@ -904,12 +908,6 @@ int avfilter_init_str(AVFilterContext *filter, const char *args)
     int ret = 0;
 
     if (args && *args) {
-        if (!filter->filter->priv_class) {
-            av_log(filter, AV_LOG_ERROR, "This filter does not take any "
-                   "options, but options were provided: %s.\n", args);
-            return AVERROR(EINVAL);
-        }
-
         ret = process_options(filter, &options, args);
         if (ret < 0)
             goto fail;



More information about the ffmpeg-cvslog mailing list