pub struct Pcr {
pub ticks_27mhz: u64,
}Expand description
27 MHz Program Clock Reference sample. Stored as the composed
base × 300 + extension value so callers can do plain integer
arithmetic and ask for either component back when needed.
The full 27 MHz value uses 42 bits; we store it in a u64 and
expose modular subtraction so wraparound at 2^33 × 300 ticks
(≈ 26.5 hours) is correct without callers having to think about
it.
Fields§
§ticks_27mhz: u64Composed 27 MHz value: base × 300 + extension.
Range is 0 ..= (2^33 - 1) × 300 + 299.
Implementations§
Source§impl Pcr
impl Pcr
Sourcepub fn from_base_ext(base_90khz: u64, extension: u16) -> Self
pub fn from_base_ext(base_90khz: u64, extension: u16) -> Self
Build from the 33-bit base + 9-bit extension as they sit in the adaptation field.
Sourcepub fn from_ticks_27mhz(ticks: u64) -> Self
pub fn from_ticks_27mhz(ticks: u64) -> Self
Build from an already-composed 27 MHz tick count.
Sourcepub fn base_90khz(self) -> u64
pub fn base_90khz(self) -> u64
33-bit program_clock_reference_base half (90 kHz).
Sourcepub fn delta_ticks(self, other: Pcr) -> i64
pub fn delta_ticks(self, other: Pcr) -> i64
Difference self - other, in 27 MHz ticks, on the modular
PCR ring (i.e. wraps correctly when other is greater than
self by less than half the modulus).
Result is signed: positive when self is “after” other.