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