sws: merge handling frame start into a single block

Also, return an error code on failure rather than 0.
This commit is contained in:
Anton Khirnov 2021-05-20 17:02:16 +02:00
parent 1b11a324fe
commit ff753f41dd
1 changed files with 5 additions and 4 deletions

View File

@ -912,11 +912,12 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
if (srcSliceH == 0)
return 0;
if (frame_start && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
return 0;
}
if (frame_start) {
if (srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
return AVERROR(EINVAL);
}
if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1;
}