Skip to main content

EditorVideoStream

Struct EditorVideoStream 

Source
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: u64

Index the underlying forward stream will produce next.

§cache: FrameCache§spawn_count: u64

Implementations§

Source§

impl EditorVideoStream

Source

pub fn open(path: &Path) -> Result<Self>

Probe path and prepare a seekable stream with the default cache size. No decode pipe is spawned until the first frame call.

§Errors

Returns the underlying probe error if gst-discoverer-1.0 can’t read the file (missing tool, unreadable media).

Source

pub fn open_with_cache(path: &Path, cache_frames: usize) -> Result<Self>

As open with an explicit cache capacity (frames).

§Errors

See open.

Source

pub fn width(&self) -> u32

Frame width in pixels.

Source

pub fn height(&self) -> u32

Frame height in pixels.

Source

pub fn frame_rate(&self) -> f32

Source frame rate (fps).

Source

pub fn frame_count(&self) -> Option<u64>

Total frame count, if the container reported a duration.

Source

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.

Source

fn last_index(&self) -> Option<u64>

Source

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.

Source

pub fn seek_to_time(&mut self, time: Duration) -> Option<VideoFrame>

Seek to the frame nearest time and return it.

Source

fn respawn(&mut self) -> Option<()>

Trait Implementations§

Source§

impl Debug for EditorVideoStream

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more