Skip to main content

FrameFree

Trait FrameFree 

Source
pub trait FrameFree: Sealed + 'static {
    type Instance: Copy;
    type RawFrame: Default + Copy;

    const REF_DEBUG_NAME: &'static str;

    // Required method
    unsafe fn free(instance: Self::Instance, frame: &mut Self::RawFrame);
}
Expand description

The free strategy for one captured-frame family: the SDK instance handle type plus the SDK call that releases a single frame.

This is the single axis along which the RAII Guard varies. The receiver kinds (VideoKind, AudioKind, MetadataKind) free through NDIlib_recv_free_*; the FrameSync strategies (FrameSyncVideoFree, FrameSyncAudioFree) free through NDIlib_framesync_free_*. Factoring the free call out of CaptureKind lets both families reuse one guard and one borrowed-reference core instead of maintaining parallel copies.

This is a sealed trait — it cannot be implemented outside this crate.

§Safety

Implementors must ensure free releases a frame that was populated by the matching SDK capture call through the same instance.

Required Associated Constants§

Source

const REF_DEBUG_NAME: &'static str

The Debug struct name of the borrowed reference that wraps this guard (e.g. "VideoFrameRef" or "FrameSyncVideoRef"), so the shared generic Debug impls render the historically-correct type name.

Required Associated Types§

Source

type Instance: Copy

The SDK instance handle that owns the frame buffers (and through which they must be freed).

Source

type RawFrame: Default + Copy

The raw FFI frame type from the NDI SDK.

Required Methods§

Source

unsafe fn free(instance: Self::Instance, frame: &mut Self::RawFrame)

Free a single captured frame through its owning instance.

§Safety
  • instance must be the instance that produced frame (the FrameSync strategies additionally tolerate a null instance by short-circuiting).
  • frame must have been populated by a successful capture for this strategy and not already freed.

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.

Implementors§

Source§

impl FrameFree for AudioKind

Source§

const REF_DEBUG_NAME: &'static str = "AudioFrameRef"

Source§

type Instance = *mut NDIlib_recv_instance_type

Source§

type RawFrame = NDIlib_audio_frame_v3_t

Source§

impl FrameFree for FrameSyncAudioFree

Source§

const REF_DEBUG_NAME: &'static str = "FrameSyncAudioRef"

Source§

type Instance = *mut NDIlib_framesync_instance_type

Source§

type RawFrame = NDIlib_audio_frame_v3_t

Source§

impl FrameFree for FrameSyncVideoFree

Source§

const REF_DEBUG_NAME: &'static str = "FrameSyncVideoRef"

Source§

type Instance = *mut NDIlib_framesync_instance_type

Source§

type RawFrame = NDIlib_video_frame_v2_t

Source§

impl FrameFree for MetadataKind

Source§

const REF_DEBUG_NAME: &'static str = "MetadataFrameRef"

Source§

type Instance = *mut NDIlib_recv_instance_type

Source§

type RawFrame = NDIlib_metadata_frame_t

Source§

impl FrameFree for VideoKind

Source§

const REF_DEBUG_NAME: &'static str = "VideoFrameRef"

Source§

type Instance = *mut NDIlib_recv_instance_type

Source§

type RawFrame = NDIlib_video_frame_v2_t