Skip to main content

Module routing

Module routing 

Source
Expand description

Redirect source selection without receiving or forwarding media in Rust.

A Router is an NDI source that carries no media of its own. Receivers connect to it by name and are redirected to whichever source it currently routes to, so one process can switch what many receivers see without touching a frame.

use grafton_ndi::{routing::{Router, RouterOptions}, Finder, FinderOptions, Ndi};
use std::time::Duration;

let ndi = Ndi::new()?;
let mut router = Router::new(&ndi, &RouterOptions::new("Program"))?;

let finder = Finder::new(&ndi, &FinderOptions::default())?;
finder.watch().wait_for_change(Duration::from_secs(2))?;
if let Some(camera) = finder.current_sources()?.first() {
    router.set_route(camera)?;
}

Structs§

Router
A native routing source. Dropping it removes its advertisement.
RouterOptions
A router’s advertised name and optional discovery groups.