Skip to main content

VideoColorInfo

Struct VideoColorInfo 

Source
pub struct VideoColorInfo { /* private fields */ }
Expand description

Color space, transfer curve, matrix coefficients, range, and HDR mastering metadata preserved across decode and presentation.

Implementations§

Source§

impl VideoColorInfo

Color-space constructors, CICP nclx decoding, and HDR helpers for VideoColorInfo.

Source

pub const fn sdr_bt709() -> Self

Constructs standard 8-bit limited-range ITU-R BT.709 SDR color metadata.

§Returns
  • Self - SDR BT.709 color metadata.
Source

pub const fn hdr10_bt2020_pq(max_cll_nits: u16, max_fall_nits: u16) -> Self

Constructs 10-bit HDR10 BT.2020 PQ ST.2084 color metadata with mastering light levels.

§Arguments
  • u16 - Maximum Content Light Level (MaxCLL) in nits.
  • u16 - Maximum Frame-Average Light Level (MaxFALL) in nits.
§Returns
  • Self - HDR10 BT.2020 PQ color metadata.
Source

pub const fn from_nclx( primaries_code: u16, transfer_code: u16, matrix_code: u16, full_range: bool, ) -> Self

Decodes ISO/IEC 23091-2 (colr nclx) CICP integer codes into VideoColorInfo.

§Arguments
  • u16 - CICP color primaries code.
  • u16 - CICP transfer characteristics code.
  • u16 - CICP matrix coefficients code.
  • bool - true for full-range quantization, false for studio limited range.
§Returns
  • Self - Decoded color space and HDR metadata.
Source

pub const fn to_nclx(&self) -> (u16, u16, u16, bool)

Encodes this color metadata back into ISO/IEC 23091-2 (nclx) CICP integer codes.

§Arguments
  • &Self - Color metadata reference.
§Returns
  • (u16, u16, u16, bool) - (primaries, transfer, matrix, full_range) tuple.
Source

pub const fn is_hdr(&self) -> bool

Returns true when the transfer function indicates HDR (PQ ST.2084 or HLG).

§Arguments
  • &Self - Color metadata reference.
§Returns
  • bool - true for HDR streams.
Source§

impl VideoColorInfo

Source

pub fn get_primaries(&self) -> ColorPrimaries

Source

pub fn get_mut_primaries(&mut self) -> &mut ColorPrimaries

Source

pub fn set_primaries(&mut self, val: ColorPrimaries) -> &mut Self

Source

pub fn get_transfer(&self) -> TransferCharacteristics

Source

pub fn get_mut_transfer(&mut self) -> &mut TransferCharacteristics

Source

pub fn set_transfer(&mut self, val: TransferCharacteristics) -> &mut Self

Source

pub fn get_matrix(&self) -> MatrixCoefficients

Source

pub fn get_mut_matrix(&mut self) -> &mut MatrixCoefficients

Source

pub fn set_matrix(&mut self, val: MatrixCoefficients) -> &mut Self

Source

pub fn get_range(&self) -> ColorRange

Source

pub fn get_mut_range(&mut self) -> &mut ColorRange

Source

pub fn set_range(&mut self, val: ColorRange) -> &mut Self

Source

pub fn get_bit_depth(&self) -> u8

Source

pub fn get_mut_bit_depth(&mut self) -> &mut u8

Source

pub fn set_bit_depth(&mut self, val: u8) -> &mut Self

Source

pub fn get_max_cll_nits(&self) -> u16

Source

pub fn get_mut_max_cll_nits(&mut self) -> &mut u16

Source

pub fn set_max_cll_nits(&mut self, val: u16) -> &mut Self

Source

pub fn get_max_fall_nits(&self) -> u16

Source

pub fn get_mut_max_fall_nits(&mut self) -> &mut u16

Source

pub fn set_max_fall_nits(&mut self, val: u16) -> &mut Self

Source§

impl VideoColorInfo

Source

pub fn new( primaries: ColorPrimaries, transfer: TransferCharacteristics, matrix: MatrixCoefficients, range: ColorRange, bit_depth: u8, max_cll_nits: u16, max_fall_nits: u16, ) -> Self

Trait Implementations§

Source§

impl Clone for VideoColorInfo

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for VideoColorInfo

Source§

impl Debug for VideoColorInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VideoColorInfo

Default SDR BT.709 color profile for VideoColorInfo.

Source§

fn default() -> Self

Creates standard 8-bit limited-range BT.709 SDR color metadata.

§Returns
  • Self - Default SDR color metadata.
Source§

impl<'de> Deserialize<'de> for VideoColorInfo

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for VideoColorInfo

Source§

impl Hash for VideoColorInfo

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for VideoColorInfo

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for VideoColorInfo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for VideoColorInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.