new option minimum-aspect-ratio-audio

This commit is contained in:
stax76
2022-06-19 18:06:08 +02:00
parent f6ad169f9d
commit a148c88435
5 changed files with 26 additions and 11 deletions

View File

@@ -437,11 +437,14 @@ namespace mpvnet
if (Core.IsAudio) autoFitHeight = Convert.ToInt32(workingArea.Height * App.AutofitAudio);
if (Core.IsImage) autoFitHeight = Convert.ToInt32(workingArea.Height * App.AutofitImage);
if (Core.VideoSize.Height == 0 || Core.VideoSize.Width == 0 ||
Core.VideoSize.Width / (float)Core.VideoSize.Height < App.MinimumAspectRatio)
if (Core.VideoSize.Height == 0 || Core.VideoSize.Width == 0)
Core.VideoSize = new Size((int)(autoFitHeight * (16 / 9f)), autoFitHeight);
float minAspectRatio = Core.IsAudio ? App.MinimumAspectRatioAudio : App.MinimumAspectRatio;
if (minAspectRatio != 0 && Core.VideoSize.Width / (float)Core.VideoSize.Height < minAspectRatio)
Core.VideoSize = new Size((int)(autoFitHeight * minAspectRatio), autoFitHeight);
Size videoSize = Core.VideoSize;
int height = videoSize.Height;