struct SurfaceState {
gl: Option<GLContext>,
render: Option<MpvRenderContext>,
mpv: *mut mpv_handle,
frame_ready: Arc<AtomicBool>,
callback_ctx: *mut Arc<AtomicBool>,
logged_first_draw: bool,
logged_first_frame: bool,
logged_size: (i32, i32),
logged_no_gl: bool,
logged_no_window: bool,
logged_no_size: bool,
logged_render_fail: bool,
}Expand description
Everything the draw handler needs, shared with the GTK callbacks.
Fields§
§gl: Option<GLContext>§render: Option<MpvRenderContext>§mpv: *mut mpv_handle§frame_ready: Arc<AtomicBool>Set by mpv’s update callback (on an mpv thread), cleared by the frame clock (on the main thread). The whole cross-thread contract.
callback_ctx: *mut Arc<AtomicBool>The boxed clone of frame_ready handed to mpv, reclaimed on teardown.
Null when no callback is registered.
logged_first_draw: bool§logged_first_frame: bool§logged_size: (i32, i32)Last size we logged, so a size change re-reports rather than staying silent.
logged_no_gl: bool§logged_no_window: bool§logged_no_size: bool§logged_render_fail: boolImplementations§
Source§impl SurfaceState
impl SurfaceState
Sourcefn teardown(&mut self)
fn teardown(&mut self)
Tear down in the order DR-232 requires, with the GL context current.
The update callback is unregistered before the context is freed (inside
destroy), and the GL objects go while their context is still bound.
Getting this wrong is DR-184 on Android restated — a surface outliving
its player — and is the likeliest cause of the one unexplained SIGSEGV
the spike recorded.
Auto Trait Implementations§
impl Freeze for SurfaceState
impl RefUnwindSafe for SurfaceState
impl !Send for SurfaceState
impl !Sync for SurfaceState
impl Unpin for SurfaceState
impl UnsafeUnpin for SurfaceState
impl UnwindSafe for SurfaceState
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
Mutably borrows from an owned value. Read more