39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
namespace HardwareControl.Core.UsbCamera
|
|
{
|
|
/// <summary>
|
|
/// 一帧图像。ImageData 由 <c>CopyImage()</c> 生成,
|
|
/// 调用方可以安全地在回调返回后继续持有、排队或异步发送。
|
|
/// </summary>
|
|
public class FrameArrivedEventArgs : EventArgs
|
|
{
|
|
public byte[] ImageData { get; }
|
|
public long FrameIndex { get; }
|
|
public TimeSpan Timestamp { get; }
|
|
public DateTimeOffset CapturedAt { get; }
|
|
|
|
/// <summary>采集格式与 MIME 类型,随帧一起传递。</summary>
|
|
public CameraFrameFormat Format { get; }
|
|
|
|
public string MimeType => Format.MimeType;
|
|
public int Width => Format.Width;
|
|
public int Height => Format.Height;
|
|
|
|
public FrameArrivedEventArgs(
|
|
byte[] imageData,
|
|
long frameIndex,
|
|
TimeSpan timestamp,
|
|
DateTimeOffset capturedAt,
|
|
CameraFrameFormat format)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(imageData);
|
|
ArgumentNullException.ThrowIfNull(format);
|
|
|
|
ImageData = imageData;
|
|
FrameIndex = frameIndex;
|
|
Timestamp = timestamp;
|
|
CapturedAt = capturedAt;
|
|
Format = format;
|
|
}
|
|
}
|
|
}
|