lavfi: Drop deprecated way of passing options for a few filters
Deprecated in 02/2013.
This commit is contained in:
parent
07a2b15594
commit
88fd836a01
@ -150,13 +150,6 @@ static av_cold int channelmap_init(AVFilterContext *ctx)
|
|||||||
else
|
else
|
||||||
mode = MAP_PAIR_STR_STR;
|
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) {
|
if (mode != MAP_NONE) {
|
||||||
|
@ -104,14 +104,6 @@ static int parse_maps(AVFilterContext *ctx)
|
|||||||
char separator = '|';
|
char separator = '|';
|
||||||
char *cur = s->map;
|
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) {
|
while (cur && *cur) {
|
||||||
char *sep, *next, *p;
|
char *sep, *next, *p;
|
||||||
uint64_t in_channel = 0, out_channel = 0;
|
uint64_t in_channel = 0, out_channel = 0;
|
||||||
|
@ -624,87 +624,11 @@ int avfilter_init_str(AVFilterContext *filter, const char *args)
|
|||||||
return AVERROR(EINVAL);
|
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, '=')) {
|
if (strchr(args, '=')) {
|
||||||
/* assume a list of key1=value1:key2=value2:... */
|
/* assume a list of key1=value1:key2=value2:... */
|
||||||
ret = av_dict_parse_string(&options, args, "=", ":", 0);
|
ret = av_dict_parse_string(&options, args, "=", ":", 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
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 {
|
} else {
|
||||||
ret = process_unnamed_options(filter, &options, args);
|
ret = process_unnamed_options(filter, &options, args);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -244,14 +244,6 @@ static const AVOption video_options[] = {
|
|||||||
{ "width", NULL, OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, V },
|
{ "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 },
|
{ "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_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 },
|
{ "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 },
|
{ "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 },
|
{ "frame_rate", NULL, OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, DBL_MAX, V },
|
||||||
|
@ -49,9 +49,6 @@
|
|||||||
* the public API and may change, break or disappear at any time.
|
* 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
|
#ifndef FF_API_AVFILTER_OPEN
|
||||||
#define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 7)
|
#define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 7)
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,27 +66,9 @@ typedef struct AspectContext {
|
|||||||
const AVClass *class;
|
const AVClass *class;
|
||||||
AVRational dar;
|
AVRational dar;
|
||||||
AVRational sar;
|
AVRational sar;
|
||||||
#if FF_API_OLD_FILTER_OPTS
|
|
||||||
float aspect_num, aspect_den;
|
|
||||||
#endif
|
|
||||||
char *ratio_expr;
|
char *ratio_expr;
|
||||||
} AspectContext;
|
} 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)
|
static int filter_frame(AVFilterLink *link, AVFrame *frame)
|
||||||
{
|
{
|
||||||
AspectContext *s = link->dst->priv;
|
AspectContext *s = link->dst->priv;
|
||||||
@ -138,14 +120,8 @@ static int setdar_config_props(AVFilterLink *inlink)
|
|||||||
AVRational dar;
|
AVRational dar;
|
||||||
int ret;
|
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)))
|
if ((ret = get_aspect_ratio(inlink, &s->dar)))
|
||||||
return ret;
|
return ret;
|
||||||
#if FF_API_OLD_FILTER_OPTS
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (s->dar.num && s->dar.den) {
|
if (s->dar.num && s->dar.den) {
|
||||||
av_reduce(&s->sar.num, &s->sar.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[] = {
|
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 },
|
{ "dar", "display aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
@ -204,10 +176,6 @@ AVFilter ff_vf_setdar = {
|
|||||||
.name = "setdar",
|
.name = "setdar",
|
||||||
.description = NULL_IF_CONFIG_SMALL("Set the frame display aspect ratio."),
|
.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_size = sizeof(AspectContext),
|
||||||
.priv_class = &setdar_class,
|
.priv_class = &setdar_class,
|
||||||
|
|
||||||
@ -224,14 +192,8 @@ static int setsar_config_props(AVFilterLink *inlink)
|
|||||||
AspectContext *s = inlink->dst->priv;
|
AspectContext *s = inlink->dst->priv;
|
||||||
int ret;
|
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)))
|
if ((ret = get_aspect_ratio(inlink, &s->sar)))
|
||||||
return ret;
|
return ret;
|
||||||
#if FF_API_OLD_FILTER_OPTS
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inlink->sample_aspect_ratio = s->sar;
|
inlink->sample_aspect_ratio = s->sar;
|
||||||
|
|
||||||
@ -239,10 +201,6 @@ static int setsar_config_props(AVFilterLink *inlink)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const AVOption setsar_options[] = {
|
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 },
|
{ "sar", "sample (pixel) aspect ratio", OFFSET(ratio_expr), AV_OPT_TYPE_STRING, { .str = "1" }, .flags = FLAGS },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
@ -277,10 +235,6 @@ AVFilter ff_vf_setsar = {
|
|||||||
.name = "setsar",
|
.name = "setsar",
|
||||||
.description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."),
|
.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_size = sizeof(AspectContext),
|
||||||
.priv_class = &setsar_class,
|
.priv_class = &setsar_class,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user