[FFmpeg-cvslog] lavfi: Drop deprecated way of passing options for a few filters
Vittorio Giovara
git at videolan.org
Sat Oct 21 21:27:32 EEST 2017
ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Mon Dec 5 12:38:32 2016 -0500| [88fd836a015a5f3380df74592e440e7d1e5b8000] | committer: Vittorio Giovara
lavfi: Drop deprecated way of passing options for a few filters
Deprecated in 02/2013.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=88fd836a015a5f3380df74592e440e7d1e5b8000
---
libavfilter/af_channelmap.c | 7 -----
libavfilter/af_join.c | 8 -----
libavfilter/avfilter.c | 76 ---------------------------------------------
libavfilter/buffersrc.c | 8 -----
libavfilter/version.h | 3 --
libavfilter/vf_aspect.c | 46 ---------------------------
6 files changed, 148 deletions(-)
diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
index 572549808f..e214bdbcc1 100644
--- a/libavfilter/af_channelmap.c
+++ b/libavfilter/af_channelmap.c
@@ -150,13 +150,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 4d86c8b357..b61033f7a2 100644
--- a/libavfilter/af_join.c
+++ b/libavfilter/af_join.c
@@ -104,14 +104,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 99531e5690..d9c204e766 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -624,87 +624,11 @@ int avfilter_init_str(AVFilterContext *filter, const char *args)
return AVERROR(EINVAL);
}
-#if FF_API_OLD_FILTER_OPTS
- if (!strcmp(filter->filter->name, "scale") &&
- strchr(args, ':') && strchr(args, ':') < strchr(args, '=')) {
- /* old w:h:flags=<flags> syntax */
- char *copy = av_strdup(args);
- char *p;
-
- av_log(filter, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option "
- "syntax is deprecated. Use either <w>:<h>:<flags> or "
- "w=<w>:h=<h>:flags=<flags>.\n");
-
- if (!copy) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- p = strrchr(copy, ':');
- if (p) {
- *p++ = 0;
- ret = av_dict_parse_string(&options, p, "=", ":", 0);
- }
- if (ret >= 0)
- ret = process_unnamed_options(filter, &options, copy);
- av_freep(©);
-
- if (ret < 0)
- goto fail;
- } else
-#endif
-
if (strchr(args, '=')) {
/* assume a list of key1=value1:key2=value2:... */
ret = av_dict_parse_string(&options, args, "=", ":", 0);
if (ret < 0)
goto fail;
-#if FF_API_OLD_FILTER_OPTS
- } else 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")) {
- /* 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
-
- 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++;
- }
-
- if (strchr(p, ':')) {
- av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
- "'|' to separate the list items.\n");
- }
-
- while ((p = strchr(p, ':')))
- *p++ = '|';
-
- ret = process_unnamed_options(filter, &options, copy);
- av_freep(©);
-
- if (ret < 0)
- goto fail;
-#endif
} else {
ret = process_unnamed_options(filter, &options, args);
if (ret < 0)
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index f553508cf1..df00971514 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -244,14 +244,6 @@ static const AVOption video_options[] = {
{ "width", NULL, OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, 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 },
-#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 },
{ "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 },
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 9a0a2c90ad..bb437efa02 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_AVFILTER_OPEN
#define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 7)
#endif
diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c
index 2c2821318e..6a6430f2db 100644
--- a/libavfilter/vf_aspect.c
+++ b/libavfilter/vf_aspect.c
@@ -66,27 +66,9 @@ typedef struct AspectContext {
const AVClass *class;
AVRational dar;
AVRational sar;
-#if FF_API_OLD_FILTER_OPTS
- float aspect_num, aspect_den;
-#endif
char *ratio_expr;
} AspectContext;
-#if FF_API_OLD_FILTER_OPTS
-static av_cold int init(AVFilterContext *ctx)
-{
- AspectContext *s = ctx->priv;
-
- if (s->aspect_num > 0 && s->aspect_den > 0) {
- av_log(ctx, AV_LOG_WARNING, "This syntax is deprecated, use "
- "dar=<number> or dar=num/den.\n");
- s->sar = s->dar = av_d2q(s->aspect_num / s->aspect_den, INT_MAX);
- }
-
- return 0;
-}
-#endif
-
static int filter_frame(AVFilterLink *link, AVFrame *frame)
{
AspectContext *s = link->dst->priv;
@@ -138,14 +120,8 @@ static int setdar_config_props(AVFilterLink *inlink)
AVRational dar;
int ret;
-#if FF_API_OLD_FILTER_OPTS
- if (!(s->aspect_num > 0 && 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,
@@ -166,10 +142,6 @@ static int setdar_config_props(AVFilterLink *inlink)
}
static const AVOption setdar_options[] = {
-#if FF_API_OLD_FILTER_OPTS
- { "dar_num", NULL, OFFSET(aspect_num), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
- { "dar_den", NULL, OFFSET(aspect_den), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
-#endif
{ "dar", "display aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS },
{ NULL },
};
@@ -204,10 +176,6 @@ AVFilter ff_vf_setdar = {
.name = "setdar",
.description = NULL_IF_CONFIG_SMALL("Set the frame display aspect ratio."),
-#if FF_API_OLD_FILTER_OPTS
- .init = init,
-#endif
-
.priv_size = sizeof(AspectContext),
.priv_class = &setdar_class,
@@ -224,14 +192,8 @@ static int setsar_config_props(AVFilterLink *inlink)
AspectContext *s = inlink->dst->priv;
int ret;
-#if FF_API_OLD_FILTER_OPTS
- if (!(s->aspect_num > 0 && 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;
@@ -239,10 +201,6 @@ static int setsar_config_props(AVFilterLink *inlink)
}
static const AVOption setsar_options[] = {
-#if FF_API_OLD_FILTER_OPTS
- { "sar_num", NULL, OFFSET(aspect_num), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
- { "sar_den", NULL, OFFSET(aspect_den), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, 0, FLT_MAX, FLAGS },
-#endif
{ "sar", "sample (pixel) aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS },
{ NULL },
};
@@ -277,10 +235,6 @@ AVFilter ff_vf_setsar = {
.name = "setsar",
.description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."),
-#if FF_API_OLD_FILTER_OPTS
- .init = init,
-#endif
-
.priv_size = sizeof(AspectContext),
.priv_class = &setsar_class,
More information about the ffmpeg-cvslog
mailing list