PrepareSnapshotSize repair

This commit is contained in:
jianxingwu 2020-05-15 17:26:34 +08:00
parent 738176479d
commit 0da0b0c156

View file

@ -75,18 +75,18 @@ public static Bitmap Snapshot(MediaAnalysis source, Size? size = null, TimeSpan?
{
if (size.Value.Width == 0)
{
var ratio = source.PrimaryVideoStream.Height / (double) size.Value.Height;
var ratio = (double)size.Value.Height / source.PrimaryVideoStream.Height;
size = new Size((int) (source.PrimaryVideoStream.Width * ratio),
(int) (source.PrimaryVideoStream.Height * ratio));
size = new Size((int)(source.PrimaryVideoStream.Width * ratio),
(int)(source.PrimaryVideoStream.Height * ratio));
}
if (size.Value.Height == 0)
{
var ratio = source.PrimaryVideoStream.Width / (double) size.Value.Width;
var ratio = (double)size.Value.Width / source.PrimaryVideoStream.Width;
size = new Size((int) (source.PrimaryVideoStream.Width * ratio),
(int) (source.PrimaryVideoStream.Height * ratio));
size = new Size((int)(source.PrimaryVideoStream.Width * ratio),
(int)(source.PrimaryVideoStream.Height * ratio));
}
}