pub struct ReceiverOptionsBuilder { /* private fields */ }Expand description
Builder for configuring a ReceiverOptions with ergonomic method chaining
Implementations§
Source§impl ReceiverOptionsBuilder
impl ReceiverOptionsBuilder
Sourcepub fn snapshot_preset(source: Source) -> Self
pub fn snapshot_preset(source: Source) -> Self
Preset for capturing snapshots (low resolution, RGBA, lowest bandwidth).
This preset is optimized for:
- Image export and snapshot capture
- AI/ML processing pipelines
- Thumbnail generation
- Low bandwidth environments
Configuration:
- Color format:
RGBX_RGBA(compatible with image encoding) - Bandwidth:
Lowest(reduces resolution and bitrate) - Video fields: Disabled (progressive frames only)
§Example
let options = ReceiverOptionsBuilder::snapshot_preset(sources[0].clone())
.name("Snapshot Receiver")
.build();
let receiver = Receiver::new(&ndi, &options)?;
// Capture and encode in one line (requires image-encoding feature)
#[cfg(feature = "image-encoding")]
{
let frame = receiver.video().capture(Duration::from_secs(5))?;
let png_bytes = frame.encode_png()?;
std::fs::write("snapshot.png", &png_bytes)?;
}Sourcepub fn high_quality_preset(source: Source) -> Self
pub fn high_quality_preset(source: Source) -> Self
Preset for high-quality video processing (full resolution, highest bandwidth).
This preset is optimized for:
- Professional video processing workflows
- Recording and archival
- Real-time video analysis requiring full quality
- Broadcasting and production
Configuration:
- Color format:
RGBX_RGBA(uncompressed, compatible with most tools) - Bandwidth:
Highest(full resolution and bitrate) - Video fields: Enabled (supports interlaced sources)
§Example
let options = ReceiverOptionsBuilder::high_quality_preset(sources[0].clone())
.name("High Quality Receiver")
.build();
let receiver = Receiver::new(&ndi, &options)?;
// Capture full quality frames
let frame = receiver.video().capture(Duration::from_secs(5))?;
println!("Captured {width}x{height} frame", width = frame.width(), height = frame.height());Sourcepub fn monitoring_preset(source: Source) -> Self
pub fn monitoring_preset(source: Source) -> Self
Preset for metadata and tally monitoring only (no video/audio).
This preset is optimized for:
- Tally light monitoring
- Connection status tracking
- PTZ control applications
- Minimal bandwidth overhead
Configuration:
- Bandwidth:
MetadataOnly(no video or audio data) - Color format: Default (not used for metadata-only)
- Video fields: Disabled (not applicable)
§Example
let options = ReceiverOptionsBuilder::monitoring_preset(sources[0].clone())
.name("Tally Monitor")
.build();
let receiver = Receiver::new(&ndi, &options)?;
// Poll for status changes
if let Some(status) = receiver.poll_status_change(Duration::from_millis(1000))? {
if let Some(tally) = status.tally {
println!("Tally: program={program}, preview={preview}",
program = tally.on_program, preview = tally.on_preview);
}
if let Some(connections) = status.connections {
println!("Active connections: {connections}");
}
}Sourcepub fn color(self, fmt: ReceiverColorFormat) -> Self
pub fn color(self, fmt: ReceiverColorFormat) -> Self
Set the color format for received video
Sourcepub fn bandwidth(self, bw: ReceiverBandwidth) -> Self
pub fn bandwidth(self, bw: ReceiverBandwidth) -> Self
Set the bandwidth mode for the receiver
Sourcepub fn allow_video_fields(self, allow: bool) -> Self
pub fn allow_video_fields(self, allow: bool) -> Self
Configure whether to allow video fields
Sourcepub fn build(self) -> ReceiverOptions
pub fn build(self) -> ReceiverOptions
Build the receiver options
This method is infallible and simply applies defaults for any unset options.
To create a Receiver, pass the resulting ReceiverOptions to Receiver::new().
§Example
let options = ReceiverOptions::builder(source).build();
let receiver = Receiver::new(&ndi, &options)?;Trait Implementations§
Source§impl Clone for ReceiverOptionsBuilder
impl Clone for ReceiverOptionsBuilder
Source§fn clone(&self) -> ReceiverOptionsBuilder
fn clone(&self) -> ReceiverOptionsBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ReceiverOptionsBuilder
impl RefUnwindSafe for ReceiverOptionsBuilder
impl Send for ReceiverOptionsBuilder
impl Sync for ReceiverOptionsBuilder
impl Unpin for ReceiverOptionsBuilder
impl UnsafeUnpin for ReceiverOptionsBuilder
impl UnwindSafe for ReceiverOptionsBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more