moq_video/output.rs
1//! Where a frame's pixels live once an operation hands it back.
2
3/// The representation a decoder or scaler hands frames back in.
4///
5/// A choice, not a promise of GPU residency. [`Native`](Self::Native) lets a
6/// hardware backend keep its picture where it made it, which on a software
7/// backend is CPU memory anyway. [`Cpu`](Self::Cpu) is the portable exit: the
8/// result is always [`Surface::I420`](crate::Surface::I420), downloaded when it
9/// had to be. `#[non_exhaustive]` so a narrower choice (a specific device, a
10/// shareable handle) can be added without breaking a `match`.
11#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
12#[non_exhaustive]
13pub enum Output {
14 /// The backend's natural representation: a GPU surface from a hardware
15 /// decoder or scaler, CPU pixels from a software one. The default, since it
16 /// never pays for a download nobody asked for. Match on each
17 /// [`Surface`](crate::Surface) rather than assuming either.
18 #[default]
19 Native,
20 /// CPU-resident [`I420`](crate::I420), whatever produced it. A hardware
21 /// decode pays a download per picture; a backend that can decode straight
22 /// to system memory does that instead.
23 Cpu,
24}