Skip to content

Commit

Permalink
swscale/swscale: combine the input/output checks in sws_frame_setup()
Browse files Browse the repository at this point in the history
Cosmetic change in preparation for the next commit.

Signed-off-by: James Almer <jamrial@gmail.com>
  • Loading branch information
jamrial committed Jan 22, 2025
1 parent 6ecc96f commit abdc207
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions libswscale/swscale.c
Original file line number Diff line number Diff line change
Expand Up @@ -1442,21 +1442,18 @@ int sws_frame_setup(SwsContext *ctx, const AVFrame *dst, const AVFrame *src)
for (int field = 0; field < 2; field++) {
SwsFormat src_fmt = ff_fmt_from_frame(src, field);
SwsFormat dst_fmt = ff_fmt_from_frame(dst, field);
int src_ok, dst_ok;

if ((src->flags ^ dst->flags) & AV_FRAME_FLAG_INTERLACED) {
err_msg = "Cannot convert interlaced to progressive frames or vice versa.\n";
ret = AVERROR(EINVAL);
goto fail;
}

if (!ff_test_fmt(&src_fmt, 0)) {
err_msg = "Unsupported input";
ret = AVERROR(ENOTSUP);
goto fail;
}

if (!ff_test_fmt(&dst_fmt, 1)) {
err_msg = "Unsupported output";
src_ok = ff_test_fmt(&src_fmt, 0);
dst_ok = ff_test_fmt(&dst_fmt, 1);
if ((!src_ok || !dst_ok)) {
err_msg = src_ok ? "Unsupported output" : "Unsupported input";
ret = AVERROR(ENOTSUP);
goto fail;
}
Expand Down

0 comments on commit abdc207

Please sign in to comment.