Expand description
AsyncReceiver on the smol runtime: the
generic asynchronous::AsyncReceiver with
Smol, which run blocking work with smol::unblock.
§Example
use grafton_ndi::{Ndi, ReceiverOptions, asynchronous::smol::AsyncReceiver};
fn main() -> Result<(), grafton_ndi::Error> {
::smol::block_on(async {
let ndi = Ndi::new()?;
// ... obtain source ...
let options = ReceiverOptions::snapshot_preset(source);
let receiver = grafton_ndi::Receiver::new(&ndi, &options)?;
let async_receiver = AsyncReceiver::new(receiver);
// Capture without blocking the runtime
match async_receiver.capture_video_with(std::time::Duration::from_millis(100), |frame| {
(frame.width(), frame.height())
}).await? {
Some(size) => println!("Got dimensions: {size:?}"),
None => println!("No frame available"),
}
Ok(())
})
}See mixed_media_async.rs for a complete smol example.
Type Aliases§
- Async
Finder - Source discovery on the smol runtime, owning a finder or source cache.
- Async
Receiver - An
AsyncReceiveron the smol runtime. - Async
Source Cache - Cached discovery on the smol runtime.
- Async
Source Watch - An owned discovery cursor on the smol runtime.