pub struct AndroidNativeWindowHandle { /* private fields */ }Available on Android only.
Expand description
ANativeWindow* encoder input surface.
Implementations§
Source§impl AndroidNativeWindowHandle
impl AndroidNativeWindowHandle
Sourcepub unsafe fn try_from_raw(
window: *mut c_void,
keep_alive: Option<KeepAlive>,
) -> Result<Self, InvalidHandleError>
pub unsafe fn try_from_raw( window: *mut c_void, keep_alive: Option<KeepAlive>, ) -> Result<Self, InvalidHandleError>
Wrap an ANativeWindow* encoder input surface. Borrowing: the
handle is stored non-owningly, this type has no Drop, and every
obligation below extends to each Clone.
§Safety
windowmust point to a liveANativeWindowon which the caller holds a reference — fromANativeWindow_fromSurface,AMediaCodec_createInputSurface, or an equivalent. Null is rejected asInvalidHandleError::NullPointerand is not a caller obligation.- Refcount: no
ANativeWindow_acquireis issued and there is noDropthat wouldANativeWindow_release. The caller’s reference must outlive this value and everyCloneof it — park it inkeep_alive, or hold it directly when that isNone. Releasing while a clone survives is a use-after-free. - This is an output-side handle: the interop layer renders
into it and never treats it as an import source. The caller
must not concurrently dequeue or lock buffers from the same
window, since
ANativeWindowhas a single producer slot. AndroidNativeWindowHandleisSend + Sync; the caller asserts the window may be driven from the interop thread rather than the one that created it.
pub fn window(&self) -> *mut c_void
pub fn keep_alive(&self) -> Option<&KeepAlive>
Trait Implementations§
Source§impl Clone for AndroidNativeWindowHandle
impl Clone for AndroidNativeWindowHandle
Source§impl Debug for AndroidNativeWindowHandle
impl Debug for AndroidNativeWindowHandle
impl Send for AndroidNativeWindowHandle
impl Sync for AndroidNativeWindowHandle
Auto Trait Implementations§
impl !RefUnwindSafe for AndroidNativeWindowHandle
impl !UnwindSafe for AndroidNativeWindowHandle
impl Freeze for AndroidNativeWindowHandle
impl Unpin for AndroidNativeWindowHandle
impl UnsafeUnpin for AndroidNativeWindowHandle
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