[FFmpeg-cvslog] Merge commit '88fd836a015a5f3380df74592e440e7d1e5b8000'

James Almer git at videolan.org
Sat Oct 21 21:27:40 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Oct 21 15:27:03 2017 -0300| [0ed61546c4594480b7c09a0c79da24d78968fbf0] | committer: James Almer

Merge commit '88fd836a015a5f3380df74592e440e7d1e5b8000'

* commit '88fd836a015a5f3380df74592e440e7d1e5b8000':
  lavfi: Drop deprecated way of passing options for a few filters

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

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

 libavfilter/af_channelmap.c |  7 -------
 libavfilter/af_join.c       |  8 --------
 libavfilter/avfilter.c      | 11 +----------
 libavfilter/buffersrc.c     |  8 --------
 libavfilter/version.h       |  3 ---
 libavfilter/vf_aspect.c     | 46 ---------------------------------------------
 6 files changed, 1 insertion(+), 82 deletions(-)

diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
index 7c2be95bfd..285d76a3ef 100644
--- a/libavfilter/af_channelmap.c
+++ b/libavfilter/af_channelmap.c
@@ -149,13 +149,6 @@ static av_cold int channelmap_init(AVFilterContext *ctx)
             else
                 mode = MAP_PAIR_STR_STR;
         }
-#if FF_API_OLD_FILTER_OPTS
-        if (strchr(mapping, ',')) {
-            av_log(ctx, AV_LOG_WARNING, "This syntax is deprecated, use "
-                   "'|' to separate the mappings.\n");
-            separator = ',';
-        }
-#endif
     }
 
     if (mode != MAP_NONE) {
diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
index f8af0a1804..33df685691 100644
--- a/libavfilter/af_join.c
+++ b/libavfilter/af_join.c
@@ -112,14 +112,6 @@ static int parse_maps(AVFilterContext *ctx)
     char separator = '|';
     char *cur      = s->map;
 
-#if FF_API_OLD_FILTER_OPTS
-    if (cur && strchr(cur, ',')) {
-        av_log(ctx, AV_LOG_WARNING, "This syntax is deprecated, use '|' to "
-               "separate the mappings.\n");
-        separator = ',';
-    }
-#endif
-
     while (cur && *cur) {
         char *sep, *next, *p;
         uint64_t in_channel = 0, out_channel = 0;
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index f0f849b326..a08895dacf 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -996,7 +996,7 @@ int avfilter_init_str(AVFilterContext *filter, const char *args)
             return AVERROR(EINVAL);
         }
 
-#if FF_API_OLD_FILTER_OPTS || FF_API_OLD_FILTER_OPTS_ERROR
+#if FF_API_OLD_FILTER_OPTS_ERROR
             if (   !strcmp(filter->filter->name, "format")     ||
                    !strcmp(filter->filter->name, "noformat")   ||
                    !strcmp(filter->filter->name, "frei0r")     ||
@@ -1056,14 +1056,6 @@ 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",
@@ -1072,7 +1064,6 @@ int avfilter_init_str(AVFilterContext *filter, const char *args)
             } else {
                 ret = process_options(filter, &options, copy);
             }
-#endif
             av_freep(&copy);
 
             if (ret < 0)
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index ad5aedd5f7..cd56f8ca45 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -304,14 +304,6 @@ static const AVOption buffer_options[] = {
     { "video_size",    NULL,                     OFFSET(w),                AV_OPT_TYPE_IMAGE_SIZE,                .flags = V },
     { "height",        NULL,                     OFFSET(h),                AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
     { "pix_fmt",       NULL,                     OFFSET(pix_fmt),          AV_OPT_TYPE_PIXEL_FMT, { .i64 = AV_PIX_FMT_NONE }, .min = AV_PIX_FMT_NONE, .max = INT_MAX, .flags = V },
-#if FF_API_OLD_FILTER_OPTS
-    /* those 4 are for compatibility with the old option passing system where each filter
-     * did its own parsing */
-    { "time_base_num", "deprecated, do not use", OFFSET(time_base.num),    AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
-    { "time_base_den", "deprecated, do not use", OFFSET(time_base.den),    AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
-    { "sar_num",       "deprecated, do not use", OFFSET(pixel_aspect.num), AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
-    { "sar_den",       "deprecated, do not use", OFFSET(pixel_aspect.den), AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
-#endif
     { "sar",           "sample aspect ratio",    OFFSET(pixel_aspect),     AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
     { "pixel_aspect",  "sample aspect ratio",    OFFSET(pixel_aspect),     AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
     { "time_base",     NULL,                     OFFSET(time_base),        AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
diff --git a/libavfilter/version.h b/libavfilter/version.h
index a350f47686..e3bdd0253f 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -49,9 +49,6 @@
  * the public API and may change, break or disappear at any time.
  */
 
-#ifndef FF_API_OLD_FILTER_OPTS
-#define FF_API_OLD_FILTER_OPTS              (LIBAVFILTER_VERSION_MAJOR < 7)
-#endif
 #ifndef FF_API_OLD_FILTER_OPTS_ERROR
 #define FF_API_OLD_FILTER_OPTS_ERROR        (LIBAVFILTER_VERSION_MAJOR < 8)
 #endif
diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c
index bf30824851..4c93639554 100644
--- a/libavfilter/vf_aspect.c
+++ b/libavfilter/vf_aspect.c
@@ -61,35 +61,9 @@ typedef struct AspectContext {
     AVRational dar;
     AVRational sar;
     int max;
-#if FF_API_OLD_FILTER_OPTS
-    float aspect_den;
-#endif
     char *ratio_expr;
 } AspectContext;
 
-static av_cold int init(AVFilterContext *ctx)
-{
-#if FF_API_OLD_FILTER_OPTS
-    AspectContext *s = ctx->priv;
-    int ret;
-
-    if (s->ratio_expr && s->aspect_den > 0) {
-        double num;
-        av_log(ctx, AV_LOG_WARNING,
-               "num:den syntax is deprecated, please use num/den or named options instead\n");
-        ret = av_expr_parse_and_eval(&num, s->ratio_expr, NULL, NULL,
-                                     NULL, NULL, NULL, NULL, NULL, 0, ctx);
-        if (ret < 0) {
-            av_log(ctx, AV_LOG_ERROR, "Unable to parse ratio numerator \"%s\"\n", s->ratio_expr);
-            return AVERROR(EINVAL);
-        }
-        s->sar = s->dar = av_d2q(num / s->aspect_den, s->max);
-    }
-#endif
-
-    return 0;
-}
-
 static int filter_frame(AVFilterLink *link, AVFrame *frame)
 {
     AspectContext *s = link->dst->priv;
@@ -159,14 +133,8 @@ static int setdar_config_props(AVFilterLink *inlink)
     AVRational old_sar = inlink->sample_aspect_ratio;
     int ret;
 
-#if FF_API_OLD_FILTER_OPTS
-    if (!(s->ratio_expr && s->aspect_den > 0)) {
-#endif
     if ((ret = get_aspect_ratio(inlink, &s->dar)))
         return ret;
-#if FF_API_OLD_FILTER_OPTS
-    }
-#endif
 
     if (s->dar.num && s->dar.den) {
         av_reduce(&s->sar.num, &s->sar.den,
@@ -191,9 +159,6 @@ static const AVOption setdar_options[] = {
     { "dar",   "set display aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
     { "ratio", "set display aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
     { "r",     "set display aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
-#if FF_API_OLD_FILTER_OPTS
-    { "dar_den", NULL, OFFSET(aspect_den), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
-#endif
     { "max",   "set max value for nominator or denominator in the ratio", OFFSET(max), AV_OPT_TYPE_INT, {.i64=100}, 1, INT_MAX, FLAGS },
     { NULL }
 };
@@ -221,7 +186,6 @@ static const AVFilterPad avfilter_vf_setdar_outputs[] = {
 AVFilter ff_vf_setdar = {
     .name        = "setdar",
     .description = NULL_IF_CONFIG_SMALL("Set the frame display aspect ratio."),
-    .init        = init,
     .priv_size   = sizeof(AspectContext),
     .priv_class  = &setdar_class,
     .inputs      = avfilter_vf_setdar_inputs,
@@ -239,14 +203,8 @@ static int setsar_config_props(AVFilterLink *inlink)
     AVRational old_dar, dar;
     int ret;
 
-#if FF_API_OLD_FILTER_OPTS
-    if (!(s->ratio_expr && s->aspect_den > 0)) {
-#endif
     if ((ret = get_aspect_ratio(inlink, &s->sar)))
         return ret;
-#if FF_API_OLD_FILTER_OPTS
-    }
-#endif
 
     inlink->sample_aspect_ratio = s->sar;
 
@@ -263,9 +221,6 @@ static const AVOption setsar_options[] = {
     { "sar",   "set sample (pixel) aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
     { "ratio", "set sample (pixel) aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
     { "r",     "set sample (pixel) aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
-#if FF_API_OLD_FILTER_OPTS
-    { "sar_den", NULL, OFFSET(aspect_den), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
-#endif
     { "max",   "set max value for nominator or denominator in the ratio", OFFSET(max), AV_OPT_TYPE_INT, {.i64=100}, 1, INT_MAX, FLAGS },
     { NULL }
 };
@@ -293,7 +248,6 @@ static const AVFilterPad avfilter_vf_setsar_outputs[] = {
 AVFilter ff_vf_setsar = {
     .name        = "setsar",
     .description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."),
-    .init        = init,
     .priv_size   = sizeof(AspectContext),
     .priv_class  = &setsar_class,
     .inputs      = avfilter_vf_setsar_inputs,


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

diff --cc libavfilter/avfilter.c
index f0f849b326,d9c204e766..a08895dacf
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@@ -996,91 -624,13 +996,82 @@@ int avfilter_init_str(AVFilterContext *
              return AVERROR(EINVAL);
          }
  
- #if FF_API_OLD_FILTER_OPTS || FF_API_OLD_FILTER_OPTS_ERROR
 -        if (strchr(args, '=')) {
 -            /* assume a list of key1=value1:key2=value2:... */
 -            ret = av_dict_parse_string(&options, args, "=", ":", 0);
++#if FF_API_OLD_FILTER_OPTS_ERROR
 +            if (   !strcmp(filter->filter->name, "format")     ||
 +                   !strcmp(filter->filter->name, "noformat")   ||
 +                   !strcmp(filter->filter->name, "frei0r")     ||
 +                   !strcmp(filter->filter->name, "frei0r_src") ||
 +                   !strcmp(filter->filter->name, "ocv")        ||
 +                   !strcmp(filter->filter->name, "pan")        ||
 +                   !strcmp(filter->filter->name, "pp")         ||
 +                   !strcmp(filter->filter->name, "aevalsrc")) {
 +            /* a hack for compatibility with the old syntax
 +             * replace colons with |s */
 +            char *copy = av_strdup(args);
 +            char *p    = copy;
 +            int nb_leading = 0; // number of leading colons to skip
 +            int deprecated = 0;
 +
 +            if (!copy) {
 +                ret = AVERROR(ENOMEM);
 +                goto fail;
 +            }
 +
 +            if (!strcmp(filter->filter->name, "frei0r") ||
 +                !strcmp(filter->filter->name, "ocv"))
 +                nb_leading = 1;
 +            else if (!strcmp(filter->filter->name, "frei0r_src"))
 +                nb_leading = 3;
 +
 +            while (nb_leading--) {
 +                p = strchr(p, ':');
 +                if (!p) {
 +                    p = copy + strlen(copy);
 +                    break;
 +                }
 +                p++;
 +            }
 +
 +            deprecated = strchr(p, ':') != NULL;
 +
 +            if (!strcmp(filter->filter->name, "aevalsrc")) {
 +                deprecated = 0;
 +                while ((p = strchr(p, ':')) && p[1] != ':') {
 +                    const char *epos = strchr(p + 1, '=');
 +                    const char *spos = strchr(p + 1, ':');
 +                    const int next_token_is_opt = epos && (!spos || epos < spos);
 +                    if (next_token_is_opt) {
 +                        p++;
 +                        break;
 +                    }
 +                    /* next token does not contain a '=', assume a channel expression */
 +                    deprecated = 1;
 +                    *p++ = '|';
 +                }
 +                if (p && *p == ':') { // double sep '::' found
 +                    deprecated = 1;
 +                    memmove(p, p + 1, strlen(p));
 +                }
 +            } else
 +            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)
                  goto fail;
 -        } else {
 -            ret = process_unnamed_options(filter, &options, args);
 +        } else
 +#endif
 +        {
 +            ret = process_options(filter, &options, args);
              if (ret < 0)
                  goto fail;
          }
diff --cc libavfilter/buffersrc.c
index ad5aedd5f7,df00971514..cd56f8ca45
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@@ -290,33 -236,17 +290,25 @@@ static av_cold int init_video(AVFilterC
      return 0;
  }
  
 +unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src)
 +{
 +    return ((BufferSourceContext *)buffer_src->priv)->nb_failed_requests;
 +}
 +
  #define OFFSET(x) offsetof(BufferSourceContext, x)
 -#define A AV_OPT_FLAG_AUDIO_PARAM
 -#define V AV_OPT_FLAG_VIDEO_PARAM
 +#define A AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM
 +#define V AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
  
 -static const AVOption video_options[] = {
 +static const AVOption buffer_options[] = {
      { "width",         NULL,                     OFFSET(w),                AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
 +    { "video_size",    NULL,                     OFFSET(w),                AV_OPT_TYPE_IMAGE_SIZE,                .flags = V },
      { "height",        NULL,                     OFFSET(h),                AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
 -    { "pix_fmt",       NULL,                     OFFSET(pix_fmt_str),      AV_OPT_TYPE_STRING,                    .flags = V },
 +    { "pix_fmt",       NULL,                     OFFSET(pix_fmt),          AV_OPT_TYPE_PIXEL_FMT, { .i64 = AV_PIX_FMT_NONE }, .min = AV_PIX_FMT_NONE, .max = INT_MAX, .flags = V },
- #if FF_API_OLD_FILTER_OPTS
-     /* those 4 are for compatibility with the old option passing system where each filter
-      * did its own parsing */
-     { "time_base_num", "deprecated, do not use", OFFSET(time_base.num),    AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
-     { "time_base_den", "deprecated, do not use", OFFSET(time_base.den),    AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
-     { "sar_num",       "deprecated, do not use", OFFSET(pixel_aspect.num), AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
-     { "sar_den",       "deprecated, do not use", OFFSET(pixel_aspect.den), AV_OPT_TYPE_INT,      { .i64 = 0 }, 0, INT_MAX, V },
- #endif
      { "sar",           "sample aspect ratio",    OFFSET(pixel_aspect),     AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
 +    { "pixel_aspect",  "sample aspect ratio",    OFFSET(pixel_aspect),     AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
      { "time_base",     NULL,                     OFFSET(time_base),        AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
      { "frame_rate",    NULL,                     OFFSET(frame_rate),       AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
 +    { "sws_param",     NULL,                     OFFSET(sws_param),        AV_OPT_TYPE_STRING,                    .flags = V },
      { NULL },
  };
  
diff --cc libavfilter/version.h
index a350f47686,bb437efa02..e3bdd0253f
--- 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
- #define FF_API_OLD_FILTER_OPTS              (LIBAVFILTER_VERSION_MAJOR < 7)
- #endif
 +#ifndef FF_API_OLD_FILTER_OPTS_ERROR
 +#define FF_API_OLD_FILTER_OPTS_ERROR        (LIBAVFILTER_VERSION_MAJOR < 8)
 +#endif
  #ifndef FF_API_AVFILTER_OPEN
  #define FF_API_AVFILTER_OPEN                (LIBAVFILTER_VERSION_MAJOR < 7)
  #endif
diff --cc libavfilter/vf_aspect.c
index bf30824851,6a6430f2db..4c93639554
--- a/libavfilter/vf_aspect.c
+++ b/libavfilter/vf_aspect.c
@@@ -60,10 -66,6 +60,7 @@@ typedef struct AspectContext 
      const AVClass *class;
      AVRational dar;
      AVRational sar;
 +    int max;
- #if FF_API_OLD_FILTER_OPTS
-     float aspect_den;
- #endif
      char *ratio_expr;
  } AspectContext;
  
@@@ -155,18 -118,10 +129,12 @@@ static int setdar_config_props(AVFilter
  {
      AspectContext *s = inlink->dst->priv;
      AVRational dar;
 +    AVRational old_dar;
 +    AVRational old_sar = inlink->sample_aspect_ratio;
      int ret;
  
- #if FF_API_OLD_FILTER_OPTS
-     if (!(s->ratio_expr && s->aspect_den > 0)) {
- #endif
      if ((ret = get_aspect_ratio(inlink, &s->dar)))
          return ret;
- #if FF_API_OLD_FILTER_OPTS
-     }
- #endif
  
      if (s->dar.num && s->dar.den) {
          av_reduce(&s->sar.num, &s->sar.den,
@@@ -188,17 -142,16 +156,14 @@@
  }
  
  static const AVOption setdar_options[] = {
 -    { "dar", "display aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS },
 -    { NULL },
 +    { "dar",   "set display aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
 +    { "ratio", "set display aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
 +    { "r",     "set display aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
- #if FF_API_OLD_FILTER_OPTS
-     { "dar_den", NULL, OFFSET(aspect_den), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
- #endif
 +    { "max",   "set max value for nominator or denominator in the ratio", OFFSET(max), AV_OPT_TYPE_INT, {.i64=100}, 1, INT_MAX, FLAGS },
 +    { NULL }
  };
  
 -static const AVClass setdar_class = {
 -    .class_name = "setdar",
 -    .item_name  = av_default_item_name,
 -    .option     = setdar_options,
 -    .version    = LIBAVUTIL_VERSION_INT,
 -};
 +AVFILTER_DEFINE_CLASS(setdar);
  
  static const AVFilterPad avfilter_vf_setdar_inputs[] = {
      {
@@@ -219,15 -173,16 +184,14 @@@ static const AVFilterPad avfilter_vf_se
  };
  
  AVFilter ff_vf_setdar = {
 -    .name      = "setdar",
 +    .name        = "setdar",
      .description = NULL_IF_CONFIG_SMALL("Set the frame display aspect ratio."),
-     .init        = init,
 -
 -    .priv_size = sizeof(AspectContext),
 -    .priv_class = &setdar_class,
 -
 -    .inputs    = avfilter_vf_setdar_inputs,
 -
 -    .outputs   = avfilter_vf_setdar_outputs,
 +    .priv_size   = sizeof(AspectContext),
 +    .priv_class  = &setdar_class,
 +    .inputs      = avfilter_vf_setdar_inputs,
 +    .outputs     = avfilter_vf_setdar_outputs,
  };
 +
  #endif /* CONFIG_SETDAR_FILTER */
  
  #if CONFIG_SETSAR_FILTER
@@@ -235,18 -190,10 +199,12 @@@
  static int setsar_config_props(AVFilterLink *inlink)
  {
      AspectContext *s = inlink->dst->priv;
 +    AVRational old_sar = inlink->sample_aspect_ratio;
 +    AVRational old_dar, dar;
      int ret;
  
- #if FF_API_OLD_FILTER_OPTS
-     if (!(s->ratio_expr && s->aspect_den > 0)) {
- #endif
      if ((ret = get_aspect_ratio(inlink, &s->sar)))
          return ret;
- #if FF_API_OLD_FILTER_OPTS
-     }
- #endif
  
      inlink->sample_aspect_ratio = s->sar;
  
@@@ -260,17 -201,16 +218,14 @@@
  }
  
  static const AVOption setsar_options[] = {
 -    { "sar", "sample (pixel) aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS },
 -    { NULL },
 +    { "sar",   "set sample (pixel) aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
 +    { "ratio", "set sample (pixel) aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
 +    { "r",     "set sample (pixel) aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
- #if FF_API_OLD_FILTER_OPTS
-     { "sar_den", NULL, OFFSET(aspect_den), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
- #endif
 +    { "max",   "set max value for nominator or denominator in the ratio", OFFSET(max), AV_OPT_TYPE_INT, {.i64=100}, 1, INT_MAX, FLAGS },
 +    { NULL }
  };
  
 -static const AVClass setsar_class = {
 -    .class_name = "setsar",
 -    .item_name  = av_default_item_name,
 -    .option     = setsar_options,
 -    .version    = LIBAVUTIL_VERSION_INT,
 -};
 +AVFILTER_DEFINE_CLASS(setsar);
  
  static const AVFilterPad avfilter_vf_setsar_inputs[] = {
      {
@@@ -291,13 -232,14 +246,12 @@@ static const AVFilterPad avfilter_vf_se
  };
  
  AVFilter ff_vf_setsar = {
 -    .name      = "setsar",
 +    .name        = "setsar",
      .description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."),
-     .init        = init,
 -
 -    .priv_size = sizeof(AspectContext),
 -    .priv_class = &setsar_class,
 -
 -    .inputs    = avfilter_vf_setsar_inputs,
 -
 -    .outputs   = avfilter_vf_setsar_outputs,
 +    .priv_size   = sizeof(AspectContext),
 +    .priv_class  = &setsar_class,
 +    .inputs      = avfilter_vf_setsar_inputs,
 +    .outputs     = avfilter_vf_setsar_outputs,
  };
 +
  #endif /* CONFIG_SETSAR_FILTER */



More information about the ffmpeg-cvslog mailing list