[FFmpeg-cvslog] Merge commit '52067b3c0e5ddbcf7021a093420798420351a9e2'

James Almer git at videolan.org
Sat Oct 21 21:36:07 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Oct 21 15:35:14 2017 -0300| [5045cf27aacb3f53f10a465a84e9f52bc95c1594] | committer: James Almer

Merge commit '52067b3c0e5ddbcf7021a093420798420351a9e2'

* commit '52067b3c0e5ddbcf7021a093420798420351a9e2':
  lavfi: Drop deprecated filter initialization

Merged-by: James Almer <jamrial at gmail.com>

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

 libavfilter/avfilter.c |  7 -------
 libavfilter/avfilter.h | 15 ---------------
 libavfilter/version.h  |  3 ---
 3 files changed, 25 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 07c35d7dda..da0cb791d2 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -931,13 +931,6 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options,
     return count;
 }
 
-#if FF_API_AVFILTER_INIT_FILTER
-int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque)
-{
-    return avfilter_init_str(filter, args);
-}
-#endif
-
 int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
 {
     int ret = 0;
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 3d7bd33215..2f6b26050e 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -729,21 +729,6 @@ attribute_deprecated
 AVFilter **av_filter_next(AVFilter **filter);
 #endif
 
-#if FF_API_AVFILTER_INIT_FILTER
-/**
- * Initialize a filter.
- *
- * @param filter the filter to initialize
- * @param args   A string of parameters to use when initializing the filter.
- *               The format and meaning of this string varies by filter.
- * @param opaque Any extra non-string data needed by the filter. The meaning
- *               of this parameter varies by filter.
- * @return       zero on success
- */
-attribute_deprecated
-int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
-#endif
-
 /**
  * Initialize a filter with the supplied parameters.
  *
diff --git a/libavfilter/version.h b/libavfilter/version.h
index ad2178241e..49933e93eb 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -52,9 +52,6 @@
 #ifndef FF_API_OLD_FILTER_OPTS_ERROR
 #define FF_API_OLD_FILTER_OPTS_ERROR        (LIBAVFILTER_VERSION_MAJOR < 8)
 #endif
-#ifndef FF_API_AVFILTER_INIT_FILTER
-#define FF_API_AVFILTER_INIT_FILTER         (LIBAVFILTER_VERSION_MAJOR < 7)
-#endif
 #ifndef FF_API_OLD_FILTER_REGISTER
 #define FF_API_OLD_FILTER_REGISTER          (LIBAVFILTER_VERSION_MAJOR < 7)
 #endif


======================================================================

diff --cc libavfilter/avfilter.c
index 07c35d7dda,439eee4dd4..da0cb791d2
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@@ -846,98 -528,39 +846,91 @@@ void avfilter_free(AVFilterContext *fil
      av_free(filter);
  }
  
 -/* process a list of value1:value2:..., each value corresponding
 - * to subsequent AVOption, in the order they are declared */
 -static int process_unnamed_options(AVFilterContext *ctx, AVDictionary **options,
 -                                   const char *args)
 +int ff_filter_get_nb_threads(AVFilterContext *ctx)
 +{
 +     if (ctx->nb_threads > 0)
 +         return FFMIN(ctx->nb_threads, ctx->graph->nb_threads);
 +     return ctx->graph->nb_threads;
 +}
 +
 +static int process_options(AVFilterContext *ctx, AVDictionary **options,
 +                           const char *args)
  {
      const AVOption *o = NULL;
 -    const char *p = args;
 -    char *val;
 +    int ret, count = 0;
 +    char *av_uninit(parsed_key), *av_uninit(value);
 +    const char *key;
 +    int offset= -1;
 +
 +    if (!args)
 +        return 0;
 +
 +    while (*args) {
 +        const char *shorthand = NULL;
  
 -    while (*p) {
          o = av_opt_next(ctx->priv, o);
 -        if (!o) {
 -            av_log(ctx, AV_LOG_ERROR, "More options provided than "
 -                   "this filter supports.\n");
 -            return AVERROR(EINVAL);
 +        if (o) {
 +            if (o->type == AV_OPT_TYPE_CONST || o->offset == offset)
 +                continue;
 +            offset = o->offset;
 +            shorthand = o->name;
          }
 -        if (o->type == AV_OPT_TYPE_CONST)
 -            continue;
  
 -        val = av_get_token(&p, ":");
 -        if (!val)
 -            return AVERROR(ENOMEM);
 +        ret = av_opt_get_key_value(&args, "=", ":",
 +                                   shorthand ? AV_OPT_FLAG_IMPLICIT_KEY : 0,
 +                                   &parsed_key, &value);
 +        if (ret < 0) {
 +            if (ret == AVERROR(EINVAL))
 +                av_log(ctx, 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_err2str(ret));
 +            return ret;
 +        }
 +        if (*args)
 +            args++;
 +        if (parsed_key) {
 +            key = parsed_key;
 +            while ((o = av_opt_next(ctx->priv, o))); /* discard all remaining shorthand */
 +        } else {
 +            key = shorthand;
 +        }
  
 -        av_dict_set(options, o->name, val, 0);
 +        av_log(ctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value);
  
 -        av_freep(&val);
 -        if (*p)
 -            p++;
 +        if (av_opt_find(ctx, key, NULL, 0, 0)) {
 +            ret = av_opt_set(ctx, key, value, 0);
 +            if (ret < 0) {
 +                av_free(value);
 +                av_free(parsed_key);
 +                return ret;
 +            }
 +        } else {
 +        av_dict_set(options, key, value, 0);
 +        if ((ret = av_opt_set(ctx->priv, key, value, AV_OPT_SEARCH_CHILDREN)) < 0) {
 +            if (!av_opt_find(ctx->priv, key, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
 +            if (ret == AVERROR_OPTION_NOT_FOUND)
 +                av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key);
 +            av_free(value);
 +            av_free(parsed_key);
 +            return ret;
 +            }
 +        }
 +        }
 +
 +        av_free(value);
 +        av_free(parsed_key);
 +        count++;
      }
  
 -    return 0;
 +    if (ctx->enable_str) {
 +        ret = set_enable_expr(ctx, ctx->enable_str);
 +        if (ret < 0)
 +            return ret;
 +    }
 +    return count;
  }
  
- #if FF_API_AVFILTER_INIT_FILTER
- int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque)
- {
-     return avfilter_init_str(filter, args);
- }
- #endif
- 
  int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
  {
      int ret = 0;
diff --cc libavfilter/version.h
index ad2178241e,ef2b34cc6f..49933e93eb
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@@ -49,12 -49,6 +49,9 @@@
   * the public API and may change, break or disappear at any time.
   */
  
 +#ifndef FF_API_OLD_FILTER_OPTS_ERROR
 +#define FF_API_OLD_FILTER_OPTS_ERROR        (LIBAVFILTER_VERSION_MAJOR < 8)
 +#endif
- #ifndef FF_API_AVFILTER_INIT_FILTER
- #define FF_API_AVFILTER_INIT_FILTER         (LIBAVFILTER_VERSION_MAJOR < 7)
- #endif
  #ifndef FF_API_OLD_FILTER_REGISTER
  #define FF_API_OLD_FILTER_REGISTER          (LIBAVFILTER_VERSION_MAJOR < 7)
  #endif



More information about the ffmpeg-cvslog mailing list