swscale/swscale: combine the input/output checks in sws_frame_setup()

Cosmetic change in preparation for the next commit.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2025-01-22 12:12:13 -03:00
parent 6ecc96f4d0
commit abdc20727c

View file

@ -1442,6 +1442,7 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src)
for (int field = 0; field < 2; field++) { for (int field = 0; field < 2; field++) {
SwsFormat src_fmt = ff_fmt_from_frame(src, field); SwsFormat src_fmt = ff_fmt_from_frame(src, field);
SwsFormat dst_fmt = ff_fmt_from_frame(dst, field); SwsFormat dst_fmt = ff_fmt_from_frame(dst, field);
int src_ok, dst_ok;
if ((src->flags ^ dst->flags) & AV_FRAME_FLAG_INTERLACED) { if ((src->flags ^ dst->flags) & AV_FRAME_FLAG_INTERLACED) {
err_msg = "Cannot convert interlaced to progressive frames or vice versa.\n"; err_msg = "Cannot convert interlaced to progressive frames or vice versa.\n";
@ -1449,14 +1450,10 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src)
goto fail; goto fail;
} }
if (!ff_test_fmt(&src_fmt, 0)) { src_ok = ff_test_fmt(&src_fmt, 0);
err_msg = "Unsupported input"; dst_ok = ff_test_fmt(&dst_fmt, 1);
ret = AVERROR(ENOTSUP); if ((!src_ok || !dst_ok)) {
goto fail; err_msg = src_ok ? "Unsupported output" : "Unsupported input";
}
if (!ff_test_fmt(&dst_fmt, 1)) {
err_msg = "Unsupported output";
ret = AVERROR(ENOTSUP); ret = AVERROR(ENOTSUP);
goto fail; goto fail;
} }