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: VideoConfigThe requested playback configuration (source + autoplay/loop).
started: booltrue once the decode thread has been started.
gl_texture_id: Option<u32>The stable external GL texture id once installed.
on_frame: OptionOnVideoFrameOptional user hook invoked with each decoded frame (effects / save /
send). Re-set on every fresh build (see [merge_video_state]).
frames: OptionRefAnyOptional 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§
Auto Trait Implementations§
impl Freeze for VideoWidgetState
impl RefUnwindSafe for VideoWidgetState
impl Send for VideoWidgetState
impl Sync for VideoWidgetState
impl Unpin for VideoWidgetState
impl UnsafeUnpin for VideoWidgetState
impl UnwindSafe for VideoWidgetState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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