Struct cros_libva::Image

source ·
pub struct Image<'a> { /* private fields */ }
Expand description

Wrapper around VAImage that is tied to the lifetime of a given Picture.

An image is used to either get the surface data to client memory, or to copy image data in client memory to a surface.

Implementations§

source§

impl<'a> Image<'a>

source

pub fn derive_from<D: SurfaceMemoryDescriptor>( surface: &'a Surface<D>, visible_rect: (u32, u32), ) -> Result<Self, VaError>

Create a new derived image from this surface using vaDeriveImage.

Derived images are a direct view (i.e. without any copy) on the buffer content of surface. On the other hand, not all Surfaces can be derived.

visible_rect is the visible rectangle inside surface that we want to access.

source

pub fn create_from<D: SurfaceMemoryDescriptor>( surface: &'a Surface<D>, format: VAImageFormat, coded_resolution: (u32, u32), visible_rect: (u32, u32), ) -> Result<Image<'_>, VaError>

Create new image from surface using vaCreateImage and vaGetImage.

visible_rect is the visible rectangle inside surface that we want to access.

The image will contain a copy of surface‘s data’ in the desired format and coded_resolution, meaning the data can be scaled if coded_resolution and visible_rect differ.

source

pub fn image(&self) -> &_VAImage

Get a reference to the underlying VAImage that describes this image.

source

pub fn is_derived(&self) -> bool

Returns whether this image is directly derived from its underlying Picture, as opposed to being a view/copy of said Picture in a guaranteed pixel format.

source

pub fn display_resolution(&self) -> (u32, u32)

Returns the display resolution as passed in by the client. This is a value that is less than or equal to the coded resolution.

source

pub fn coded_resolution(&self) -> (u32, u32)

Returns the coded resolution. This value can be larger than the value passed in when the image was created if the driver needs to.

Trait Implementations§

source§

impl<'a> AsMut<[u8]> for Image<'a>

source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<'a> AsRef<[u8]> for Image<'a>

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'a> Drop for Image<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Image<'a>

§

impl<'a> RefUnwindSafe for Image<'a>

§

impl<'a> !Send for Image<'a>

§

impl<'a> !Sync for Image<'a>

§

impl<'a> Unpin for Image<'a>

§

impl<'a> !UnwindSafe for Image<'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
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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.