pub struct NDI;Expand description
Manages the NDI runtime lifecycle.
The NDI struct is the entry point for all NDI operations. It ensures the NDI
runtime is properly initialized and cleaned up. Multiple instances can exist
simultaneously - they share the same underlying runtime through reference counting.
§Examples
use grafton_ndi::NDI;
// Create an NDI instance
let ndi = NDI::new()?;
// The runtime stays alive as long as any NDI instance exists
let ndi2 = ndi.clone(); // Cheap reference-counted clone
// Runtime is automatically cleaned up when all instances are droppedImplementations§
Source§impl NDI
impl NDI
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Creates a new NDI instance.
This method is the single entry point for creating NDI instances. It is thread-safe and can be called from multiple threads. The first call initializes the NDI runtime, subsequent calls increment a reference count. When the last instance is dropped, the runtime is automatically destroyed.
§Errors
Returns Error::InitializationFailed if the NDI SDK fails to initialize.
§Examples
let ndi = NDI::new()?;
// Use NDI operations...Sourcepub fn is_supported_cpu() -> bool
pub fn is_supported_cpu() -> bool
Checks if the current CPU is supported by the NDI SDK.
The NDI SDK requires certain CPU features (e.g., SSE4.2 on x86_64).
§Examples
if grafton_ndi::NDI::is_supported_cpu() {
println!("CPU is supported by NDI");
} else {
eprintln!("CPU lacks required features for NDI");
}Sourcepub fn is_running() -> bool
pub fn is_running() -> bool
Checks if the NDI runtime is currently initialized.
This can be useful for diagnostic purposes or conditional initialization.
§Examples
if grafton_ndi::NDI::is_running() {
println!("NDI runtime is active");
}