Skip to main content

mediaway_common/
formats.rs

1//! Pixel and sample format tags shared by encode/decode/device.
2
3#![forbid(unsafe_code)]
4
5/// Video pixel layout (planar / packed). Extend as backends need.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7#[non_exhaustive]
8pub enum PixelFormat {
9    /// 8-bit NV12 (YUV 4:2:0 semi-planar) — common HW encode input.
10    Nv12,
11    /// 8-bit I420 / YUV420P.
12    I420,
13    /// 8-bit BGRA packed.
14    Bgra8,
15    /// 8-bit RGBA packed.
16    Rgba8,
17    /// 8-bit YUYV / YUY2 packed (YUV 4:2:2, `Y0 U0 Y1 V0` byte order) — the
18    /// most common raw format real V4L2 UVC webcams expose natively. Added
19    /// for `mediaway-device-linux`'s V4L2 camera backend; see that crate's
20    /// `adr/0002-v4l2-camera-capture.md`.
21    Yuyv,
22}
23
24/// Audio PCM / sample layout.
25#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
26#[non_exhaustive]
27pub enum SampleFormat {
28    /// Signed 16-bit little-endian interleaved PCM.
29    S16,
30    /// Signed 32-bit little-endian interleaved PCM.
31    S32,
32    /// IEEE float32 interleaved PCM.
33    F32,
34}