Skip to main content

VideoWidgetState

Struct VideoWidgetState 

Source
pub struct VideoWidgetState {
    pub config: VideoConfig,
    pub started: bool,
    pub gl_texture_id: Option<u32>,
    pub on_frame: OptionOnVideoFrame,
    pub frames: OptionRefAny,
    pub decode_callback: Option<ThreadCallback>,
    pub current_frame: Option<ImageRef>,
    pub thread_id: Option<ThreadId>,
    pub seek_sender: Option<Sender<ThreadSendMsg>>,
}
Expand description

Live state for one video widget, carried across relayout by [merge_video_state].

Fields§

§config: VideoConfig

The requested playback configuration (source + autoplay/loop).

§started: bool

true once the decode thread has been started.

§gl_texture_id: Option<u32>

The stable external GL texture id once installed.

§on_frame: OptionOnVideoFrame

Optional user hook invoked with each decoded frame (effects / save / send). Re-set on every fresh build (see [merge_video_state]).

§frames: OptionRefAny

Optional pre-decoded frames to replay (a RefAny holding a Vec<VideoFrame>); when set, the replay worker cycles these instead of the built-in test pattern. Carried forward by [merge_video_state].

§decode_callback: Option<ThreadCallback>

The off-main-thread streaming decode worker (mirrors the map widget’s fetch_callback). Set via VideoWidget::dom_with_decoder. When present, AfterMount spawns it on a background Thread instead of the replay / test-pattern workers, so the VK decode runs off the main thread.

§current_frame: Option<ImageRef>

The latest decoded frame to display, as a CPU ImageRef (RGBA8). The VirtualView render callback ([video_widget_render]) reads this on each re-render; video_writeback stores it and triggers an in-place VirtualView re-render - so the frame renders on cpurender AND webrender, exactly like the map widget’s tile cache. (Replaces the GL present_frame path for video; camera/screencap still use present_frame.)

§thread_id: Option<ThreadId>

The decode worker’s ThreadId (set by AfterMount). Lets the resize callback message the running worker (info.get_thread(id).sender.send(..)) so it can re-target the decoder to the new physical-pixel size - a cheap image swap, no relayout. Carried across relayout by [merge_video_state].

§seek_sender: Option<Sender<ThreadSendMsg>>

Clone of the worker’s main→worker Sender (set by AfterMount, carried by merge). Lets [merge_video_state] - which has no CallbackInfo - push a seek to the running worker when config.timestamp changes (scrubbing).

Trait Implementations§

Source§

impl Debug for VideoWidgetState

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.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.