[FFmpeg-devel] [PATCH] lavfi: add error message to help users convert to new lavfi syntax.

Ronald S. Bultje rsbultje at gmail.com
Tue Aug 18 02:05:05 CEST 2015


---
 libavfilter/avfilter.c | 13 ++++++++++++-
 libavfilter/version.h  |  3 +++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 7cc4334..4d833f0 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -895,7 +895,7 @@ int avfilter_init_str(AVFilterContext *filter, const char *args)
             return AVERROR(EINVAL);
         }
 
-#if FF_API_OLD_FILTER_OPTS
+#if FF_API_OLD_FILTER_OPTS || FF_API_OLD_FILTER_OPTS_ERROR
             if (   !strcmp(filter->filter->name, "format")     ||
                    !strcmp(filter->filter->name, "noformat")   ||
                    !strcmp(filter->filter->name, "frei0r")     ||
@@ -955,12 +955,23 @@ int avfilter_init_str(AVFilterContext *filter, const char *args)
             while ((p = strchr(p, ':')))
                 *p++ = '|';
 
+#if FF_API_OLD_FILTER_OPTS
             if (deprecated)
                 av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
                        "'|' to separate the list items.\n");
 
             av_log(filter, AV_LOG_DEBUG, "compat: called with args=[%s]\n", copy);
             ret = process_options(filter, &options, copy);
+#else
+            if (deprecated) {
+                av_log(filter, AV_LOG_ERROR, "This syntax is deprecated. Use "
+                       "'|' to separate the list items ('%s' instead of '%s')\n",
+                       copy, args);
+                ret = AVERROR(EINVAL);
+            } else {
+                ret = process_options(filter, &options, copy);
+            }
+#endif
             av_freep(&copy);
 
             if (ret < 0)
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 90a6dc0..6fc4145 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -61,6 +61,9 @@
 #ifndef FF_API_OLD_FILTER_OPTS
 #define FF_API_OLD_FILTER_OPTS              (LIBAVFILTER_VERSION_MAJOR < 6)
 #endif
+#ifndef FF_API_OLD_FILTER_OPTS_ERROR
+#define FF_API_OLD_FILTER_OPTS_ERROR        (LIBAVFILTER_VERSION_MAJOR < 7)
+#endif
 #ifndef FF_API_AVFILTER_OPEN
 #define FF_API_AVFILTER_OPEN                (LIBAVFILTER_VERSION_MAJOR < 6)
 #endif
-- 
2.1.2



More information about the ffmpeg-devel mailing list