pub struct EditorVideoStream {
path: PathBuf,
meta: VideoMetadata,
stream: Option<GstreamerPipeStream>,
next_index: u64,
cache: FrameCache,
spawn_count: u64,
}Expand description
A frame-indexed, seekable view over a video file, backed by the
forward-only GstreamerPipeStream plus an LRU frame cache.
Construct with EditorVideoStream::open, then pull any frame by
index with EditorVideoStream::frame (or seek by time with
EditorVideoStream::seek_to_time). Out-of-range indices clamp to the
last frame.
Fields§
§path: PathBuf§meta: VideoMetadata§stream: Option<GstreamerPipeStream>§next_index: u64Index the underlying forward stream will produce next.
cache: FrameCache§spawn_count: u64Implementations§
Source§impl EditorVideoStream
impl EditorVideoStream
Sourcepub fn open_with_cache(path: &Path, cache_frames: usize) -> Result<Self>
pub fn open_with_cache(path: &Path, cache_frames: usize) -> Result<Self>
Sourcepub fn frame_rate(&self) -> f32
pub fn frame_rate(&self) -> f32
Source frame rate (fps).
Sourcepub fn frame_count(&self) -> Option<u64>
pub fn frame_count(&self) -> Option<u64>
Total frame count, if the container reported a duration.
Sourcepub fn spawn_count(&self) -> u64
pub fn spawn_count(&self) -> u64
How many times the underlying decode pipe has been (re)spawned. Diagnostic — used by tests to assert the cache avoids re-spawns.
fn last_index(&self) -> Option<u64>
Sourcepub fn frame(&mut self, index: u64) -> Option<VideoFrame>
pub fn frame(&mut self, index: u64) -> Option<VideoFrame>
Return the frame at index, decoding (and re-spawning) as needed.
Out-of-range indices clamp to the last frame. Returns None only
when the decode pipe can’t be spawned or the stream ends early.
Sourcepub fn seek_to_time(&mut self, time: Duration) -> Option<VideoFrame>
pub fn seek_to_time(&mut self, time: Duration) -> Option<VideoFrame>
Seek to the frame nearest time and return it.