lavfi/aspect: fail with AVERROR(EINVAL) in case of invalid specified aspect
Previously it was returning 0 in case the aspect was parsable but invalid. X-ColaCount: +10*PHIl
This commit is contained in:
parent
11642cd16f
commit
e19ccc89ef
@ -34,15 +34,14 @@ typedef struct {
|
|||||||
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
|
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
|
||||||
{
|
{
|
||||||
AspectContext *aspect = ctx->priv;
|
AspectContext *aspect = ctx->priv;
|
||||||
int ret;
|
|
||||||
aspect->ratio = (AVRational) {0, 1};
|
aspect->ratio = (AVRational) {0, 1};
|
||||||
|
|
||||||
if (args) {
|
if (args) {
|
||||||
if ((ret = av_parse_ratio(&aspect->ratio, args, 100, 0, ctx)) < 0 ||
|
if (av_parse_ratio(&aspect->ratio, args, 100, 0, ctx) ||
|
||||||
aspect->ratio.num < 0 || aspect->ratio.den <= 0) {
|
aspect->ratio.num < 0 || aspect->ratio.den <= 0) {
|
||||||
av_log(ctx, AV_LOG_ERROR,
|
av_log(ctx, AV_LOG_ERROR,
|
||||||
"Invalid string '%s' for aspect ratio.\n", args);
|
"Invalid string '%s' for aspect ratio.\n", args);
|
||||||
return ret;
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user