mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
sws: group the parameters validity checks together
Also, fail with an error code rather than 0.
This commit is contained in:
parent
c05cab34a9
commit
2730639259
@ -890,6 +890,15 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) {
|
||||||
|
av_log(c, AV_LOG_ERROR, "bad src image pointers\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
if (!check_image_pointers((const uint8_t* const*)dst, c->dstFormat, dstStride)) {
|
||||||
|
av_log(c, AV_LOG_ERROR, "bad dst image pointers\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
if (c->gamma_flag && c->cascaded_context[0])
|
if (c->gamma_flag && c->cascaded_context[0])
|
||||||
return scale_gamma(c, srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride);
|
return scale_gamma(c, srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride);
|
||||||
|
|
||||||
@ -905,15 +914,6 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
|
|||||||
if (srcSliceH == 0)
|
if (srcSliceH == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) {
|
|
||||||
av_log(c, AV_LOG_ERROR, "bad src image pointers\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (!check_image_pointers((const uint8_t* const*)dst, c->dstFormat, dstStride)) {
|
|
||||||
av_log(c, AV_LOG_ERROR, "bad dst image pointers\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
|
if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
|
||||||
av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
|
av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user