pub trait CaptureKind: FrameFree<Instance = *mut NDIlib_recv_instance_type> + Sized {
type Ref<'rx>;
type Owned;
const FRAME_TYPE: c_uint;
// Required methods
unsafe fn capture_into(
instance: *mut NDIlib_recv_instance_type,
frame: *mut Self::RawFrame,
timeout_ms: u32,
) -> c_uint;
unsafe fn make_ref<'rx>(guard: Guard<'rx, Self>) -> Result<Self::Ref<'rx>>;
fn ref_to_owned(frame: &Self::Ref<'_>) -> Result<Self::Owned>;
}Expand description
Single source of truth describing one NDI frame kind (video, audio, or metadata).
Each implementor wires together the FFI frame struct, the borrowed and owned
Rust frame types, and the four SDK calls those entail — capture, the
frame-type discriminant, freeing, and the borrowed/owned conversions. Every
generic capture path (capture_raw, Receiver’s
Capture view, and the async views) is written once
against this trait, so adding or changing a kind happens in exactly one
place.
This is a sealed trait — it cannot be implemented outside this crate.
Implementations exist for VideoKind, AudioKind, and MetadataKind.
§Safety
Implementors must ensure the members agree on the same
RawFrame: capture_into populates it via
NDIlib_recv_capture_v3, free frees frames so populated,
and make_ref wraps one that capture_into reported as
FRAME_TYPE.
Required Associated Constants§
Sourceconst FRAME_TYPE: c_uint
const FRAME_TYPE: c_uint
The frame-type discriminant NDIlib_recv_capture_v3 returns for this kind.
Required Associated Types§
Required Methods§
Sourceunsafe fn capture_into(
instance: *mut NDIlib_recv_instance_type,
frame: *mut Self::RawFrame,
timeout_ms: u32,
) -> c_uint
unsafe fn capture_into( instance: *mut NDIlib_recv_instance_type, frame: *mut Self::RawFrame, timeout_ms: u32, ) -> c_uint
Sourceunsafe fn make_ref<'rx>(guard: Guard<'rx, Self>) -> Result<Self::Ref<'rx>>
unsafe fn make_ref<'rx>(guard: Guard<'rx, Self>) -> Result<Self::Ref<'rx>>
Wrap a freshly captured frame guard in its borrowed view, validating any kind-specific invariants (e.g. FourCC) during construction.
§Safety
guard must own a frame that capture_into reported as
FRAME_TYPE.
Sourcefn ref_to_owned(frame: &Self::Ref<'_>) -> Result<Self::Owned>
fn ref_to_owned(frame: &Self::Ref<'_>) -> Result<Self::Owned>
Copy a borrowed view into an owned, 'static frame.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.