mod fixtures;
use fixtures::*;
use ff_decode::{DecodeError, SeekMode, VideoDecoder};
use ff_format::NetworkOptions;
#[test]
fn file_video_decoder_should_not_be_live_dash() {
let decoder = VideoDecoder::open(test_video_path())
.build()
.expect("Failed to open test video");
assert!(
!decoder.is_live(),
"File-backed VideoDecoder must report is_live=false (DASH regression guard)"
);
}
#[test]
fn dash_mpd_open_should_not_return_file_not_found() {
let result = VideoDecoder::open("http://127.0.0.1:65535/nonexistent/manifest.mpd")
.network(NetworkOptions::default())
.build();
if let Err(DecodeError::FileNotFound { path }) = result {
panic!("HTTP MPD URL must not produce FileNotFound; path={path:?}");
}
}
#[test]
fn dash_live_decoder_should_report_is_live() {
let decoder = match VideoDecoder::open("http://localhost:8080/dash/live/manifest.mpd")
.network(NetworkOptions::default())
.build()
{
Ok(d) => d,
Err(e) => {
println!("Skipping: no live DASH server available ({e})");
return;
}
};
assert!(
decoder.is_live(),
"Live DASH (type=dynamic) must report is_live=true"
);
}
#[test]
fn dash_live_decoder_seek_should_return_seek_not_supported() {
let mut decoder = match VideoDecoder::open("http://localhost:8080/dash/live/manifest.mpd")
.network(NetworkOptions::default())
.build()
{
Ok(d) => d,
Err(e) => {
println!("Skipping: no live DASH server available ({e})");
return;
}
};
if !decoder.is_live() {
println!("Skipping: decoder did not detect live DASH source (VOD manifest?)");
return;
}
let result = decoder.seek(std::time::Duration::from_secs(5), SeekMode::Keyframe);
assert!(
matches!(result, Err(DecodeError::SeekNotSupported)),
"Expected SeekNotSupported on live DASH stream, got: {result:?}"
);
}