Refactor video dimension validation in GenerateVideoWithHardSubs

This commit refactors the validation of video dimensions in GenerateVideoWithHardSubs class. Instead of checking width and height separately, a new Dimension object is created and validated with IsValid(). This simplifies the code and improves readability.

Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
This commit is contained in:
Ivandro Jao 2024-04-30 12:41:32 +01:00
parent 93c9e9947a
commit 6323937c30

View File

@ -2202,14 +2202,15 @@ namespace Nikse.SubtitleEdit.Forms
vInfo = UiUtil.GetVideoInfo(videoFileName); vInfo = UiUtil.GetVideoInfo(videoFileName);
} }
if (vInfo.Width == 0 || vInfo.Height == 0) var dimension = new Dimension(vInfo.Height, vInfo.Width);
// skip audio or damaged files
if (!dimension.IsValid())
{ {
SeLogger.Error("Skipping burn-in file with no video: " + videoFileName); SeLogger.Error("Skipping burn-in file with no video: " + videoFileName);
// return; // skip audio or damaged files
return new Dimension();
} }
return new Dimension(vInfo.Height, vInfo.Width); return dimension;
} }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) private void deleteToolStripMenuItem_Click(object sender, EventArgs e)