Skip to main content

PictureState

Trait PictureState 

Source
pub trait PictureState: Sealed { }
Expand description

A Picture will only have valid YUV data after a sequence of operations are performed in a particular order. This order correspond to the following VA-API calls: vaBeginPicture, vaRenderPicture, vaEndPicture and vaSyncSurface. This trait enforces this ordering by implementing the Typestate pattern to constrain what operations are available in what particular states.

The states for the state machine are:

  • PictureNew -> PictureBegin
  • PictureBegin -> PictureRender
  • PictureRender ->PictureEnd
  • PictureEnd -> PictureSync

Where the surface can be reclaimed in both PictureNew and PictureSync, as either no operation took place (as in PictureNew), or it is guaranteed that the operation has already completed (as in PictureSync).

More information about the Typestate pattern can be found at http://cliffle.com/blog/rust-typestate/

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§