Skip to main content

LtcFrame

Struct LtcFrame 

Source
pub struct LtcFrame {
    pub hours: u8,
    pub minutes: u8,
    pub seconds: u8,
    pub frames: u8,
    pub drop_frame_flag: bool,
    pub color_frame_flag: bool,
    pub flag_bit_27: bool,
    pub flag_bit_43: bool,
    pub flag_bit_58: bool,
    pub flag_bit_59: bool,
    pub user_bits: [u8; 8],
}
Expand description

A parsed (or to-be-serialized) 80-bit LTC codeword (§9.2): the BCD time address, drop/color frame flags, the four rate-dependent flag bits (polarity correction / BGF0 / BGF1 / BGF2 — see FrameRate), the eight 4-bit binary groups (“user bits”, §8.1), and the fixed synchronization word (always SYNC_WORD on serialize; validated on parse).

This models only the logical codeword content — not the §9.3 biphase-mark modulation that carries it as an analog/digital audio signal (see docs/st12-1.md’s “Scope” section).

Fields§

§hours: u8

Hours, 00-23 (§9.2.1, Table 2 bits 48-51/56-57).

§minutes: u8

Minutes, 00-59 (Table 2 bits 32-35/40-42).

§seconds: u8

Seconds, 00-59 (Table 2 bits 16-19/24-26).

§frames: u8

Frames, 00-29 (Table 2 bits 0-3/8-9); the caller applies the tighter per-FrameRate bound if it needs one (see MAX_FRAMES).

§drop_frame_flag: bool

Drop frame flag, bit 10 (§8.3.1): set when NTSC drop-frame compensation (§5.2.2) is in effect. Fixed bit position across all frame rates; reserved-zero where not applicable (§9.2.2 note).

§color_frame_flag: bool

Color frame flag, bit 11 (§8.3.2). Fixed bit position across all frame rates; reserved-zero where not applicable (§9.2.2 note).

§flag_bit_27: bool

The wire bit at position 27 (Table 3): 30-frame/24-frame’s polarity correction bit, or 25-frame’s BGF0 — see LtcFrame::polarity_correction / LtcFrame::binary_group_flags to resolve its meaning for a given FrameRate.

§flag_bit_43: bool

The wire bit at position 43 (Table 3): 30-frame/24-frame’s BGF0, or 25-frame’s BGF2.

§flag_bit_58: bool

The wire bit at position 58 (Table 3): BGF1 in all three frame rates.

§flag_bit_59: bool

The wire bit at position 59 (Table 3): 30-frame/24-frame’s BGF2, or 25-frame’s polarity correction bit.

§user_bits: [u8; 8]

The eight 4-bit binary groups (“user bits”), each 0x0-0xF, in first..eighth order (Table 4 bits 4-7/12-15/20-23/28-31/36-39/44-47/ 52-55/60-63). Their collective meaning is given by LtcFrame::binary_group_flags.usage().

Implementations§

Source§

impl LtcFrame

Source

pub fn polarity_correction(&self, rate: FrameRate) -> bool

Resolve the §9.2.3 biphase-mark polarity-correction bit for rate (Table 3: bit 27 for 30-frame/24-frame, bit 59 for 25-frame).

Source

pub fn binary_group_flags(&self, rate: FrameRate) -> BinaryGroupFlags

Resolve the §8.3.3 binary group flags (BGF2/BGF1/BGF0) for rate (Table 3’s per-rate bit-position mapping).

Trait Implementations§

Source§

impl Clone for LtcFrame

Source§

fn clone(&self) -> LtcFrame

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 LtcFrame

Source§

impl Debug for LtcFrame

Source§

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

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

impl<'de> Deserialize<'de> for LtcFrame

Available on crate feature serde only.
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 LtcFrame

Source§

impl Hash for LtcFrame

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<'a> Parse<'a> for LtcFrame

Source§

type Error = Error

The error type this implementer returns. Typically the enclosing crate’s Error enum.
Source§

fn parse(bytes: &'a [u8]) -> Result<Self>

Parse bytes as Self. Returns Err(Self::Error) on any protocol violation or buffer underrun.
Source§

impl PartialEq for LtcFrame

Source§

fn eq(&self, other: &LtcFrame) -> 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 LtcFrame

Available on crate feature serde only.
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 Serialize for LtcFrame

Source§

type Error = Error

The error type this implementer returns (usually the same as the corresponding Parse impl, but need not be).
Source§

fn serialized_len(&self) -> usize

Number of bytes serialize_into will write.
Source§

fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>

Write the serialised form into buf. Returns the number of bytes written (always equal to serialized_len()).
Source§

fn to_bytes(&self) -> Vec<u8>
where Self::Error: Debug,

Convenience: allocate a Vec and serialise into it. Read more
Source§

impl StructuralPartialEq for LtcFrame

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.