fix: export video scans error
This commit is contained in:
parent
22536ea395
commit
ced3a33034
@ -743,9 +743,13 @@ namespace Pixiview.Illust
|
||||
var success = await Task.Run(ugoira.ExportVideo); // ugoira.ExportGif
|
||||
if (success != null)
|
||||
{
|
||||
#if DEBUG
|
||||
msg = ResourceHelper.ExportSuccess;
|
||||
#else
|
||||
var result = await FileStore.SaveVideoToGalleryAsync(success);
|
||||
|
||||
msg = result ?? ResourceHelper.ExportSuccess;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,6 +443,9 @@ namespace Pixiview.Utils
|
||||
{
|
||||
videoWriter.StartSessionAtSourceTime(CMTime.Zero);
|
||||
var lastTime = CMTime.Zero;
|
||||
#if DEBUG
|
||||
bool log = false;
|
||||
#endif
|
||||
for (int i = 0; i < images.Length; i++)
|
||||
{
|
||||
while (true)
|
||||
@ -465,6 +468,24 @@ namespace Pixiview.Utils
|
||||
var cgImage = images[i].CGImage;
|
||||
var width = cgImage.Width;
|
||||
var height = cgImage.Height;
|
||||
var bitsPerComponent = cgImage.BitsPerComponent;
|
||||
var bytesPerRow = cgImage.BytesPerRow;
|
||||
var bytes = bytesPerRow >> 6 << 6;
|
||||
if (bytes < bytesPerRow)
|
||||
{
|
||||
bytes += 64;
|
||||
}
|
||||
#if DEBUG
|
||||
if (!log)
|
||||
{
|
||||
log = true;
|
||||
App.DebugPrint($"animation, width: {width}, height: {height}, type: {cgImage.UTType}\n" +
|
||||
$"bitmapInfo: {cgImage.BitmapInfo}\n" +
|
||||
$"bpc: {bitsPerComponent}\n" +
|
||||
$"bpp: {cgImage.BitsPerPixel}\n" +
|
||||
$"calculated: {bytesPerRow} => {bytes}");
|
||||
}
|
||||
#endif
|
||||
//var scan = cgImage.BytesPerRow;
|
||||
//var mod = scan % 16;
|
||||
//if (mod > 0)
|
||||
@ -474,8 +495,8 @@ namespace Pixiview.Utils
|
||||
//}
|
||||
using (CGBitmapContext bitmapContext = new CGBitmapContext(
|
||||
pxdata, width, height,
|
||||
cgImage.BitsPerComponent,
|
||||
4 * (width + width % 4),
|
||||
bitsPerComponent,
|
||||
bytes,
|
||||
rgbColorSpace,
|
||||
CGImageAlphaInfo.NoneSkipFirst))
|
||||
{
|
||||
@ -503,7 +524,7 @@ namespace Pixiview.Utils
|
||||
lastTime = CMTime.Add(lastTime, frameTime);
|
||||
break;
|
||||
}
|
||||
Thread.Sleep(16);
|
||||
Thread.Sleep(32);
|
||||
}
|
||||
}
|
||||
writerInput.MarkAsFinished();
|
||||
|
Loading…
x
Reference in New Issue
Block a user