Skip to main content

AcquiredFrameView

Struct AcquiredFrameView 

Source
pub struct AcquiredFrameView<'a> { /* private fields */ }
Expand description

A view scope of AcquiredFrameHandle, which ends when it drops. Its getters lend values that stay valid until then, and its owner can’t be consumed while it lives.

Keeps an acquired frame’s texture and sync objects in place while you use them.

See mln_acquired_frame_view_begin in the C API reference.

§Errors

  • Status::TargetLost when the session failed, or you detached, abandoned, or disposed it.

Implementations§

Source§

impl AcquiredFrameView<'_>

Source

pub fn get_dma_buf(&self) -> Result<Lent<'_, DmaBufFrame>>

Gets the dmabuf of an acquired frame.

Wait for AcquiredFrameView::get_producer_sync() before you read the buffer. Once you release or discard the frame, the session may render into the buffer again. You can map a buffer with DRM_FORMAT_MOD_LINEAR, which has one plane, with mmap, and bracket your reads with DMA_BUF_IOCTL_SYNC.

The session owns the planes’ file descriptors, so don’t close them. To keep the buffer after you release the frame, duplicate each file descriptor with dup. A duplicate keeps the buffer’s memory, but not its contents.

See mln_acquired_frame_get_dma_buf in the C API reference.

§Errors
  • Status::TargetLost when the session failed, or you detached, abandoned, or disposed it.
Source

pub fn get_open_gl_texture(&self) -> Result<Lent<'_, OpenGlTextureFrame>>

Gets the OpenGL texture of an acquired frame.

See mln_acquired_frame_get_open_gl_texture in the C API reference.

§Errors
  • Status::TargetLost when the session failed, or you detached, abandoned, or disposed it.
Source

pub fn get_producer_sync(&self) -> Result<Lent<'_, GpuSync>>

Reads what to wait for before you read an acquired frame’s texture.

See mln_acquired_frame_get_producer_sync in the C API reference.

§Errors
  • Status::TargetLost when the session failed, or you detached, abandoned, or disposed it.
Source

pub fn get_vulkan_texture(&self) -> Result<Lent<'_, VulkanTextureFrame>>

Gets the Vulkan image of an acquired frame.

See mln_acquired_frame_get_vulkan_texture in the C API reference.

§Errors
  • Status::TargetLost when the session failed, or you detached, abandoned, or disposed it.

Trait Implementations§

Source§

impl Debug for AcquiredFrameView<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for AcquiredFrameView<'a>

§

impl<'a> RefUnwindSafe for AcquiredFrameView<'a>

§

impl<'a> Send for AcquiredFrameView<'a>

§

impl<'a> Sync for AcquiredFrameView<'a>

§

impl<'a> Unpin for AcquiredFrameView<'a>

§

impl<'a> UnsafeUnpin for AcquiredFrameView<'a>

§

impl<'a> UnwindSafe for AcquiredFrameView<'a>

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
§

impl<T> ErasedDestructor for T
where T: 'static,

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, 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.