Skip to main content

Module fanout

Module fanout 

Source
Expand description

Multi-target fan-out wrapper.

FanoutOutput delivers each frame to multiple StreamOutput targets simultaneously. When one or more targets fail, all remaining targets in the list still receive the frame before any error is returned.

§Example

use ff_stream::{FanoutOutput, LiveHlsOutput, RtmpOutput, StreamOutput};

let hls = LiveHlsOutput::new("/var/www/live")
    .video(1280, 720, 30.0)
    .build()?;

let rtmp = RtmpOutput::new("rtmp://ingest.example.com/live/key")
    .video(1280, 720, 30.0)
    .build()?;

let mut fanout = FanoutOutput::new(vec![
    Box::new(hls),
    Box::new(rtmp),
]);

// for each decoded frame:
fanout.push_video(&video_frame)?;
fanout.push_audio(&audio_frame)?;

// when done:
Box::new(fanout).finish()?;

Structs§

FanoutOutput
A StreamOutput wrapper that fans frames out to multiple targets.