pub trait SurfacePool<M> {
    // Required methods
    fn coded_resolution(&self) -> Resolution;
    fn set_coded_resolution(&mut self, resolution: Resolution);
    fn add_surfaces(&mut self, descriptors: Vec<M>) -> Result<(), Error>;
    fn num_free_surfaces(&self) -> usize;
    fn num_managed_surfaces(&self) -> usize;
    fn clear(&mut self);
    fn take_free_surface(&mut self) -> Option<Box<dyn AsRef<M>>>;
}
Expand description

Trait for a pool of surfaces in a particular format.

This is mostly useful for the decoder where the user is expected to manage how the decoded frames buffers are allocated and when.

The M generic parameter is the type of the descriptors for the memory backing the surfaces.

Required Methods§

source

fn coded_resolution(&self) -> Resolution

Returns the coded resolution of the pool.

All the frames maintained by this pool are guaranteed to be able to contain the coded resolution.

source

fn set_coded_resolution(&mut self, resolution: Resolution)

Update the coded resolution of the pool.

Frames managed by this pool that can not contain the new resolution are dropped.

source

fn add_surfaces(&mut self, descriptors: Vec<M>) -> Result<(), Error>

Add new surfaces to the pool, using descriptors as backing memory.

source

fn num_free_surfaces(&self) -> usize

Returns new number of surfaces currently available in this pool.

source

fn num_managed_surfaces(&self) -> usize

Returns the total number of managed surfaces in this pool.

source

fn clear(&mut self)

Remove all surfaces from this pool.

source

fn take_free_surface(&mut self) -> Option<Box<dyn AsRef<M>>>

Returns an object holding one of the available surfaces from this pool. The surface will be available for rendering again once the returned object is dropped.

This is useful to prevent decoding from happening by holding all the available surfaces.

Returns None if there is no free surface at the time of calling.

Implementations on Foreign Types§

source§

impl<M: SurfaceMemoryDescriptor + 'static> SurfacePool<M> for Rc<RefCell<VaSurfacePool<M>>>

source§

fn coded_resolution(&self) -> Resolution

source§

fn set_coded_resolution(&mut self, resolution: Resolution)

source§

fn add_surfaces(&mut self, descriptors: Vec<M>) -> Result<(), Error>

source§

fn num_free_surfaces(&self) -> usize

source§

fn num_managed_surfaces(&self) -> usize

source§

fn clear(&mut self)

source§

fn take_free_surface(&mut self) -> Option<Box<dyn AsRef<M>>>

Implementors§