//! `FakePlayer` runs the conformance suite. //! //! It is correct by construction, so a failure here means the *suite* is wrong, //! not an engine. That is what makes it safe to trust the same cases when they //! fail against a real one. //! //! TRACES: UR-081 | DR-243 | UT-220 use std::time::Duration; use super::conformance::Harness; use super::fake_player::FakePlayer; use super::media::MediaItem; use super::media_player::OpenRequest; use crate::repository::stream_selection::StreamSelection; struct FakeHarness { player: FakePlayer, } impl FakeHarness { fn new() -> Self { Self { player: FakePlayer::new().with_duration(Duration::from_secs(7200)), } } } impl Harness for FakeHarness { type Player = FakePlayer; fn player(&mut self) -> &mut FakePlayer { &mut self.player } fn request(&self, start: Duration) -> OpenRequest { let selection = StreamSelection::local_file("http://example.invalid/stream.mp4"); let media = MediaItem::sample("fake-item", &selection.url); OpenRequest::new(media, selection).starting_at(start) } fn settle(&mut self) { self.player.complete_open(); } fn audible(&mut self) -> Option { Some(self.player.audible) } /// Exact: the fake has no keyframes to round to, so any drift is a bug. fn seek_tolerance(&self) -> Duration { Duration::ZERO } } crate::media_player_conformance!(fake, FakeHarness::new());