Macro cros_codecs::multiple_desc_type
source · macro_rules! multiple_desc_type { (enum $s:ident { $($v:ident($t:ty),)* } ) => { ... }; }
Expand description
Build a frame memory descriptor enum that supports multiple descriptor types.
This is useful for the case where the frames’ memory backing is not decided at compile-time. In this case, this macro can be used to list all the potential types supported at run-time, and the selected one can be built as the program is run.
Example
use cros_codecs::multiple_desc_type;
use cros_codecs::utils::DmabufFrame;
/// Frames' memory can be provided either by the backend, or via PRIME DMABUF handles.
multiple_desc_type! {
enum OwnedOrDmaDescriptor {
Owned(()),
Dmabuf(DmabufFrame),
}
}