#[test]
fn format_types_should_be_accessible_without_any_feature() {
let _: avio::VideoCodec = avio::VideoCodec::default();
let _: avio::AudioCodec = avio::AudioCodec::default();
let _: avio::PixelFormat = avio::PixelFormat::default();
let _: avio::SampleFormat = avio::SampleFormat::default();
let _: avio::ChannelLayout = avio::ChannelLayout::default();
let _: avio::Rational = avio::Rational::default();
let _: avio::Timestamp = avio::Timestamp::default();
let _: avio::MediaInfo = avio::MediaInfo::default();
}
#[cfg(feature = "probe")]
#[test]
fn probe_feature_should_expose_probe_error_and_open() {
let result = avio::open("/no/such/file.mp4");
assert!(matches!(result, Err(avio::ProbeError::FileNotFound { .. })));
}
#[cfg(feature = "decode")]
#[test]
fn decode_feature_should_expose_decode_error_and_decoders() {
let _: avio::DecodeError = avio::DecodeError::decoding_failed("test");
let _: avio::SeekMode = avio::SeekMode::Keyframe;
let _: avio::HardwareAccel = avio::HardwareAccel::None;
let pool = avio::VecPool::new(4);
assert_eq!(pool.capacity(), 4);
}
#[cfg(feature = "encode")]
#[test]
fn encode_feature_should_expose_encode_error_and_bitrate_mode() {
let _: avio::EncodeError = avio::EncodeError::Cancelled;
let _: avio::BitrateMode = avio::BitrateMode::Cbr(2_000_000);
let _: avio::BitrateMode = avio::BitrateMode::Crf(28);
}
#[cfg(feature = "filter")]
#[test]
fn filter_feature_should_expose_filter_error_and_graph_builder() {
let _: avio::FilterError = avio::FilterError::BuildFailed;
let _builder: avio::FilterGraphBuilder = avio::FilterGraphBuilder::new();
let _: avio::ToneMap = avio::ToneMap::Hable;
let _: avio::HwAccel = avio::HwAccel::Cuda;
}
#[cfg(feature = "pipeline")]
#[test]
fn pipeline_feature_should_expose_pipeline_error_and_builder() {
let _: avio::PipelineError = avio::PipelineError::NoInput;
let _builder: avio::PipelineBuilder = avio::Pipeline::builder();
let _t: avio::ThumbnailPipeline = avio::ThumbnailPipeline::new("/no/such/file.mp4");
let _cb: avio::ProgressCallback = Box::new(|_: &avio::Progress| true);
}
#[cfg(feature = "stream")]
#[test]
fn stream_feature_should_expose_stream_error_and_output_builders() {
let _: avio::StreamError = avio::StreamError::InvalidConfig {
reason: "test".into(),
};
let _hls: avio::HlsOutput = avio::HlsOutput::new("/tmp/hls");
let _dash: avio::DashOutput = avio::DashOutput::new("/tmp/dash");
let _ladder: avio::AbrLadder = avio::AbrLadder::new("/no/such/file.mp4");
let _r: avio::Rendition = avio::Rendition {
width: 1280,
height: 720,
bitrate: 3_000_000,
};
}
#[cfg(all(feature = "filter", feature = "pipeline", feature = "stream"))]
#[test]
fn all_features_should_expose_symbols_without_conflicts() {
assert!(std::mem::size_of::<avio::EncodeProgress>() > 0);
let p = avio::Progress {
frames_processed: 5,
total_frames: Some(10),
elapsed: std::time::Duration::from_secs(1),
};
assert_eq!(p.percent(), Some(50.0));
let _: avio::FilterError = avio::FilterError::BuildFailed;
let _: avio::PipelineError = avio::PipelineError::Cancelled;
let _: avio::StreamError = avio::StreamError::InvalidConfig {
reason: "all-features test".into(),
};
}