SHA256
71 lines
2.3 KiB
C#
71 lines
2.3 KiB
C#
using System;
|
|
|
|
namespace ADOFAIRenderer.API
|
|
{
|
|
/// <summary>
|
|
/// Represents the result and metadata of a completed or cancelled render session.
|
|
/// </summary>
|
|
public class RenderResult
|
|
{
|
|
/// <summary>
|
|
/// Indicates whether the rendering session completed successfully.
|
|
/// </summary>
|
|
public bool Success { get; }
|
|
|
|
/// <summary>
|
|
/// The absolute output path of the rendered video file. Empty string if rendering failed or output was not created.
|
|
/// </summary>
|
|
public string OutputPath { get; }
|
|
|
|
/// <summary>
|
|
/// Total number of video frames sent to the encoder.
|
|
/// </summary>
|
|
public long TotalFrames { get; }
|
|
|
|
/// <summary>
|
|
/// The calculated video duration in seconds (based on TotalFrames and FPS).
|
|
/// </summary>
|
|
public double VideoDuration { get; }
|
|
|
|
/// <summary>
|
|
/// Total wall-clock time spent rendering.
|
|
/// </summary>
|
|
public TimeSpan RenderDuration { get; }
|
|
|
|
/// <summary>
|
|
/// File size of the output video in bytes (0 if failed or file does not exist).
|
|
/// </summary>
|
|
public long FileSizeBytes { get; }
|
|
|
|
/// <summary>
|
|
/// Error message or reason if rendering failed or was cancelled; <c>null</c> on success.
|
|
/// </summary>
|
|
public string? ErrorMessage { get; }
|
|
|
|
public RenderResult(
|
|
bool success,
|
|
string outputPath,
|
|
long totalFrames,
|
|
double videoDuration,
|
|
TimeSpan renderDuration,
|
|
long fileSizeBytes = 0,
|
|
string? errorMessage = null)
|
|
{
|
|
Success = success;
|
|
OutputPath = outputPath;
|
|
TotalFrames = totalFrames;
|
|
VideoDuration = videoDuration;
|
|
RenderDuration = renderDuration;
|
|
FileSizeBytes = fileSizeBytes;
|
|
ErrorMessage = errorMessage;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Success
|
|
? $"[RenderResult: Success, Output={OutputPath}, Frames={TotalFrames}, VideoDuration={VideoDuration:F2}s, Time={RenderDuration.TotalSeconds:F1}s, Size={FileSizeBytes / 1024.0 / 1024.0:F2}MB]"
|
|
: $"[RenderResult: Failed/Cancelled, Error={ErrorMessage ?? "Unknown"}]";
|
|
}
|
|
}
|
|
}
|