SHA256
Add RenderSession.OnComplete
This commit is contained in:
1 parent
6840395041
commit
4e67cb9b09
4 files changed
+816
-728
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
|
||||
namespace ADOFAIRenderer.API;
|
||||
|
||||
@@ -62,6 +63,25 @@ public class RenderResult
|
||||
ErrorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public static RenderResult CreateSuccess(string outputPath, long totalFrames, double fps, TimeSpan renderDuration)
|
||||
{
|
||||
var fileSizeBytes = 0L;
|
||||
if (!string.IsNullOrEmpty(outputPath) && File.Exists(outputPath))
|
||||
{
|
||||
try { fileSizeBytes = new FileInfo(outputPath).Length; }
|
||||
catch { /* ignored */ }
|
||||
}
|
||||
|
||||
var videoDuration = fps > 0 ? totalFrames / fps : 0.0;
|
||||
return new RenderResult(true, outputPath, totalFrames, videoDuration, renderDuration, fileSizeBytes);
|
||||
}
|
||||
|
||||
public static RenderResult CreateFailure(string? errorMessage, long totalFrames, double fps, TimeSpan renderDuration)
|
||||
{
|
||||
var videoDuration = fps > 0 ? totalFrames / fps : 0.0;
|
||||
return new RenderResult(false, string.Empty, totalFrames, videoDuration, renderDuration, 0, errorMessage ?? "Rendering failed or was cancelled.");
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Success
|
||||
|
||||
Reference in new issue
Block a user