pub fn input_with_interrupt<P: AsRef<Path> + ?Sized, F>(
path: &P,
closure: F,
) -> Result<Input, Error>Expand description
Opens a media file for reading with interrupt callback.
Allows cancellation of long-running operations (network streams, slow I/O).
The callback is called periodically; returning true aborts the operation.
§Parameters
path- Path to the media fileclosure- Callback invoked periodically, returntrueto abort
§Example
ⓘ
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
let should_abort = Arc::new(AtomicBool::new(false));
let abort_flag = should_abort.clone();
let input = ffmpeg::format::input_with_interrupt(&"http://stream.example.com/live", move || {
abort_flag.load(Ordering::Relaxed)
})?;