mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
Merge commit '88fd836a015a5f3380df74592e440e7d1e5b8000'
* commit '88fd836a015a5f3380df74592e440e7d1e5b8000': lavfi: Drop deprecated way of passing options for a few filters Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
commit
0ed61546c4
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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(©);
|
||||
|
||||
if (ret < 0)
|
||||
|
@ -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 },
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user