pub struct NetworkOptions {
pub connect_timeout: Duration,
pub read_timeout: Duration,
pub reconnect_on_error: bool,
pub max_reconnect_attempts: u32,
}Expand description
Shared network configuration for network-backed decoders and live outputs.
These settings map directly to FFmpeg AVFormatContext options that control
connection and read timeouts, and to application-level reconnection logic.
§FFmpeg option keys
Pass the converted microsecond values via av_dict_set on the
AVFormatContext before opening the stream:
connect_timeout→ key"timeout", valueconnect_timeout.as_micros()read_timeout→ key"rw_timeout", valueread_timeout.as_micros()
§Defaults
use ff_format::network::NetworkOptions;
use std::time::Duration;
let opts = NetworkOptions::default();
assert_eq!(opts.connect_timeout, Duration::from_secs(10));
assert_eq!(opts.read_timeout, Duration::from_secs(30));
assert!(!opts.reconnect_on_error);
assert_eq!(opts.max_reconnect_attempts, 3);Fields§
§connect_timeout: DurationMaximum time to wait when establishing a connection.
Maps to the FFmpeg "timeout" option key (value in microseconds).
Default: 10 seconds.
read_timeout: DurationMaximum time to wait for data after the connection is open.
Maps to the FFmpeg "rw_timeout" option key (value in microseconds).
Default: 30 seconds.
reconnect_on_error: boolWhether to attempt reconnection when a read error occurs.
When false, max_reconnect_attempts is ignored.
Default: false.
max_reconnect_attempts: u32Maximum number of reconnection attempts before giving up.
Ignored when reconnect_on_error is false.
Default: 3.
Trait Implementations§
Source§impl Clone for NetworkOptions
impl Clone for NetworkOptions
Source§fn clone(&self) -> NetworkOptions
fn clone(&self) -> NetworkOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more