pub struct PlayerRunner { /* private fields */ }Expand description
Exclusive owner of the decode pipeline. Move to a background thread and
call run.
Configure with set_sink,
use_proxy_if_available, and
set_hardware_accel before calling run.
Implementations§
Source§impl PlayerRunner
impl PlayerRunner
Sourcepub fn set_hardware_accel(&mut self, accel: HardwareAccel) -> &mut Self
pub fn set_hardware_accel(&mut self, accel: HardwareAccel) -> &mut Self
Configure hardware acceleration. Call before run.
The setting takes effect at the start of run(). HardwareAccel::Auto
(the default) probes available backends and falls back to software.
HardwareAccel::None forces CPU-only decoding.
Sourcepub fn active_source(&self) -> &Path
pub fn active_source(&self) -> &Path
Returns the path currently being decoded (original or active proxy).
Sourcepub fn with_frame_cache_budget(self, bytes: usize) -> Self
pub fn with_frame_cache_budget(self, bytes: usize) -> Self
Enable an in-memory RGBA frame cache with the given byte budget.
When the budget is set, frames decoded during playback are stored and served on cache hit without re-decoding, enabling instant scrubbing. The cache is invalidated automatically whenever a seek targets a PTS outside the currently cached range.
Example: runner.with_frame_cache_budget(512 * 1024 * 1024) for 512 MB.
Sourcepub fn duration(&self) -> Option<Duration>
pub fn duration(&self) -> Option<Duration>
Container-reported duration, or None for live / streaming sources.
Sourcepub fn use_proxy_if_available(&mut self, proxy_dir: &Path) -> bool
pub fn use_proxy_if_available(&mut self, proxy_dir: &Path) -> bool
Activate a lower-resolution proxy if one exists in proxy_dir.
Must be called before run. Returns true if a proxy was
found and activated; false if no proxy exists or activation failed.
Proxy lookup order: half → quarter → eighth; first match wins.
Sourcepub fn run(self) -> Result<(), PreviewError>
pub fn run(self) -> Result<(), PreviewError>
A/V sync presentation loop.
Blocks until a PlayerCommand::Stop is received, the end of file is
reached, or an unrecoverable decode error occurs.
At the top of each frame, all pending commands are drained from the
channel. Consecutive PlayerCommand::Seek commands are coalesced —
only the last one executes.
Emits PlayerEvent::SeekCompleted after each successful seek,
PlayerEvent::PositionUpdate after each presented video frame,
PlayerEvent::Error on non-fatal decode errors, and
PlayerEvent::Eof before returning.
§Errors
Returns PreviewError if a seek fails.