Skip to main content

ColorInfo

Struct ColorInfo 

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

The color description a video frame carries in its ndi_color_info metadata.

NDI 6 describes a frame’s colorimetry with one element in its metadata, standing alone or inside an ndi_metadata_group:

<ndi_color_info primaries="bt_2020" transfer="bt_2100_pq" matrix="bt_2020"/>

Each attribute may be missing, and its accessor then returns None. A missing matrix means BT.709 and a missing transfer means SDR, which is how image encoding reads them; missing primaries are unknown. Separate attributes with XML whitespace. Color values may contain decimal or hexadecimal character references. The reader recognizes predefined XML entities and reads color values without expanding custom entities.

Every video frame’s color_info method reads it, for example VideoFrame::color_info. That read refuses received metadata withheld as non-UTF-8 or unterminated text, including when its status was preserved on an owned copy. Measured with the 6.4 SDK, the SDK passes the element through unchanged to receivers in every color format, YUV and RGB, but does not apply it: it converts between YUV and RGB with BT.709 coefficients whatever the element says.

Document type declarations are skipped without expanding entities or loading external definitions.

Implementations§

Source§

impl ColorInfo

Source

pub const fn primaries(&self) -> Option<ColorPrimaries>

The color primaries, or None when the element does not give them.

Source

pub const fn transfer(&self) -> Option<TransferFunction>

The transfer function, or None when the element does not give one, which means SDR.

Source

pub const fn matrix(&self) -> Option<YuvMatrix>

The YUV matrix, or None when the element does not give one, which means BT.709.

Source

pub const fn is_hdr(&self) -> bool

Whether the transfer function is HDR: TransferFunction::Pq or TransferFunction::Hlg.

Trait Implementations§

Source§

impl Clone for ColorInfo

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 ColorInfo

Source§

impl Debug for ColorInfo

Source§

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

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

impl Eq for ColorInfo

Source§

impl Hash for ColorInfo

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 ColorInfo

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 StructuralPartialEq for ColorInfo

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> 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.