Expand description
Discover NDI sources and send and receive video, audio and metadata.
Supports NDI 6 with optional async adapters, image encoding, Advanced SDK operations, and recording/playback. Default desktop and Android builds need no SDK at build time. Advanced native operations need Advanced headers and libclang; Apple mobile targets link an SDK archive.
§Quick Start
use grafton_ndi::{Ndi, FinderOptions, Finder};
use std::time::Duration;
// Select the default NDI runtime and start it
let ndi = Ndi::new()?;
// Find sources on the network
let finder = Finder::new(&ndi, &FinderOptions::new())?;
// Discover sources
let sources = finder.find_sources(Duration::from_secs(5))?;
for source in sources {
println!("Found: {}", source);
}§Choose a workflow
runtime: runtime selection, initialization and lifetime.finder: source discovery and caching.receiverandsender: capture and publish media.framesandframesync: frame layouts and clock-driven capture.capabilities: check optional runtime operations.routinganddiscovery_server: redirect connections and use Discovery Servers.audio_conversionandvideo_conversion: checked media conversions.
Cargo features enable asynchronous (tokio or smol), advanced,
file (file-io), and image encoders (image-encoding). None is on by default.
See the user guides for setup, platform support, examples, limitations and migration instructions.
Re-exports§
pub use capabilities::Capabilities;pub use capabilities::Capability;pub use capabilities::CapabilityRefusal;pub use capabilities::CapabilityStatus;pub use capabilities::RuntimeFeature;pub use capabilities::RuntimeInfo;pub use capabilities::SdkEdition;pub use capabilities::SdkLinkage;pub use capabilities::SdkVersion;pub use finder::Finder;pub use finder::FinderOptions;pub use finder::Source;pub use finder::SourceAddress;pub use finder::SourceCache;pub use finder::SourceWatch;pub use frames::AudioChannels;pub use frames::AudioFormat;pub use frames::AudioFrame;pub use frames::AudioFrameBuilder;pub use frames::AudioFrameRef;pub use frames::AudioSource;pub use frames::BorrowedAudioFrame;pub use frames::BorrowedAudioFrameBuilder;pub use frames::BorrowedVideoFrame;pub use frames::BorrowedVideoFrameBuilder;pub use frames::FormatCategory;pub use frames::FrameMetadataStatus;pub use frames::MetadataFrame;pub use frames::MetadataFrameRef;pub use frames::MetadataSource;pub use frames::PixelFormat;pub use frames::PixelFormatInfo;pub use frames::ScanType;pub use frames::VideoFrame;pub use frames::VideoFrameBuilder;pub use frames::VideoFrameRef;pub use frames::VideoPlane;pub use frames::VideoPlanes;pub use frames::VideoRows;pub use frames::VideoSource;pub use framesync::AudioInputFormat;pub use framesync::FrameSync;pub use framesync::FrameSyncAudioRef;pub use framesync::FrameSyncAudioRequest;pub use framesync::FrameSyncVideoRef;pub use receiver::AudioMode;pub use receiver::ConnectionStats;pub use receiver::EventMode;pub use receiver::FrameSyncAttached;pub use receiver::MetadataMode;pub use receiver::Ptz;pub use receiver::RawCapture;pub use receiver::ReceiveDelay;pub use receiver::Receiver;pub use receiver::ReceiverBandwidth;pub use receiver::ReceiverColorFormat;pub use receiver::ReceiverEvent;pub use receiver::ReceiverItem;pub use receiver::ReceiverItemRef;pub use receiver::ReceiverMode;pub use receiver::ReceiverOptions;pub use receiver::ReceiverStatus;pub use receiver::SettingChange;pub use receiver::SourceNameChange;pub use receiver::Tally;pub use receiver::VideoMode;pub use runtime::Ndi;pub use runtime::ProcessLifetimeRuntime;pub use runtime::Runtime;pub use runtime::RuntimeOptions;pub use sender::AudioSendMode;pub use sender::RawSend;pub use sender::RawVideo;pub use sender::Sender;pub use sender::SenderMode;pub use sender::SenderOptions;pub use error::*;
Modules§
- advanced
- NDI Advanced SDK operations.
- asynchronous
- Async discovery and receivers for Tokio and smol.
- audio_
conversion - Checked interleaved audio inputs and native FLTP conversion helpers.
- capabilities
- Facts about the selected native SDK, separate from hardware and license availability.
- discovery_
server - Discovery Server monitoring and explicitly enabled remote control.
- file
- Recording NDI sources to disk and playing recordings back, through the NDI File library.
- finder
- NDI source discovery and network browsing.
- frames
- Frame types for video, audio, and metadata.
- framesync
- Frame synchronization for clock-corrected video/audio capture.
- image_
encoding - Still images from video frames: the
image-encodingfeature. - receiver
- NDI receiving functionality for video, audio, and metadata.
- routing
- Redirect source selection without receiving or forwarding media in Rust.
- runtime
- Select an NDI implementation and manage its initialization lifetime.
- sender
- NDI sending functionality for video, audio, and metadata.
- video_
conversion - Checked native conversion between complete V210 groups and NDI P216.
Structs§
- Allocation
Failure - An allocation failed after the operation passed its validation and budgets.
- Audio
Length Defect - Exact values reported by
AudioDataLength. - Color
Info - The color description a video frame carries in its
ndi_color_infometadata. - Compact
Diagnostic - Exact diagnostic evidence, inline on 64-bit targets and boxed on 32-bit targets.
- Diagnostic
Duration - Exact timeout evidence, stored in three 32-bit words without allocation.
- Diagnostic
Integer - An exact signed 64-bit diagnostic value with 32-bit alignment.
- Diagnostic
Size - An exact unsigned byte count with 32-bit alignment.
- Discovery
Address Failure - The rejected native Discovery Server address, retained only for diagnostics.
- FourCc
- A four-character code: the SDK’s identifier for a pixel or audio format or codec.
- Frame
Rate - A frame rate in frames per second, as the fraction
numerator / denominator. - Frame
Rate Defect - Exact values reported by
FrameRate. - Load
Attempt - One refused native library location, in the order it was tried.
- Load
Failure - A failed search, with a typed cause for every attempted location.
- Media
Types - A set of media types: any combination of
VIDEO,AUDIOandMETADATA. - Native
Function - The native SDK entry point that produced a result.
- Picture
Aspect Ratio - The displayed picture’s width divided by its height.
- PtzDefect
- Exact values reported by
PtzValue. - Received
Timestamp - A received media timestamp in signed 100-nanosecond ticks.
- Rejected
- A failed operation that hands back the value it would have consumed.
- SdkTimestamp
- A reading of the SDK’s clock, in 100-nanosecond ticks since the Unix epoch.
- Selection
Failure - A selection conflict, with the library identities needed to act on it.
- Timecode
- The editorial timecode a frame carries, in 100-nanosecond ticks.
- Video
Dimensions Defect - Exact values reported by
CompressedVideoDimensions.
Enums§
- Allocation
Kind - The storage an operation could not allocate.
- Audio
Count Kind - The audio count that failed validation.
- Color
Metadata Defect - The syntactic defect in an
ndi_color_infoelement. - Color
Primaries - The color primaries of a
ColorInfo. - Discovery
Defect - The malformed native discovery data.
- Error
- Every error this crate reports, from the core API, the
advancedmodule and the File API alike. - Frame
Defect - Typed causes of
crate::Error::InvalidFrame. - Image
Axis Kind - The image axis that exceeded an encoder limit.
- Image
Codec Kind - The image encoder that refused output.
- Image
Setting Kind - A numerical codec setting checked by the image encoder.
- Initialization
Failure - Why the selected native runtime could not initialize.
- Input
Defect - Typed causes of
crate::Error::InvalidInput. - Layout
Defect - A refusal of the shared media layout and value checks.
- Library
Kind - Which native library a failed selection sought.
- Load
Origin - Why a native library location was considered.
- Load
Refusal - Why a candidate could not provide a usable implementation.
- Queue
Limit - Which bounded queue was full, carried by
Error::QueueFull. - Resource
Kind - The resource budget exhausted by a discovery operation.
- SdkResult
Defect - Typed causes of
crate::Error::UnexpectedSdkResult. - Selection
Conflict - Why an irreversible runtime or File selection cannot meet a request.
- Spawn
Failure - Why an async blocking operation could not run.
- Stream
Tier - Which of a source’s two video streams: the full-quality program stream or the low-bandwidth preview stream.
- Transfer
Function - The transfer function of a
ColorInfo. - Version
Text Defect - Why a runtime’s version text could not be read.
- YuvMatrix
- The matrix that relates YCbCr to RGB, in a
ColorInfoand in image encoding’s color policy.
Constants§
- MAX_
TIMEOUT - The largest finite timeout:
u32::MAX - 1milliseconds (~49.7 days).
Type Aliases§
- Result
- Alias for Result with our Error type