1use crate::pixel_format::PixelFormat;
2use std::time::Duration;
3
4#[cfg(unix)]
5use std::os::unix::io::RawFd;
6
7#[derive(Debug)]
10pub struct Frame<'a> {
11 pub data: &'a [u8],
13
14 pub width: u32,
16
17 pub height: u32,
19
20 pub stride: usize,
23
24 pub format: PixelFormat,
26
27 pub sequence: u64,
29
30 pub timestamp: Timestamp,
32
33 pub metadata: FrameMetadata,
35
36 pub backend_handle: &'a dyn BackendBufferHandle,
38}
39
40#[derive(Debug, Clone, Copy)]
41pub struct Timestamp {
42 pub hw_raw_ns: u64,
44
45 pub system_synced: Duration,
48}
49
50#[derive(Debug, Clone, Default)]
51pub struct FrameMetadata {
52 pub actual_exposure_us: Option<u32>, pub actual_gain_db: Option<f32>, pub trigger_fired: bool, pub strobe_active: bool, }
57
58#[cfg(unix)]
61pub trait AsDmaBuf {
62 fn as_dmabuf_fd(&self) -> Option<RawFd>;
65}
66
67#[cfg(windows)]
69pub trait AsDxResource {
70 fn as_resource_handle(&self) -> Option<*mut std::ffi::c_void>;
71}
72
73pub trait BackendBufferHandle: std::fmt::Debug + Send + Sync {}
75
76impl BackendBufferHandle for () {}