pub struct Escr {
pub base: u64,
pub extension: u16,
}Expand description
Elementary Stream Clock Reference: 33-bit base (90 kHz) + 9-bit extension (27 MHz) — ISO/IEC 13818-1 §2.4.3.7, Table 2-21.
Wire layout (6 bytes, 48 bits):
2×reserved(1) | ESCR_base[32:30](3) | marker(1) | ESCR_base[29:15](15) | marker(1) | ESCR_base[14:0](15) | marker(1) | ESCR_ext(9) | marker(1).
Fields§
§base: u6433-bit base (90 kHz units).
extension: u169-bit extension (27 MHz units, 0..=299).
Implementations§
Source§impl Escr
impl Escr
Sourcepub fn from_27mhz(ticks: u64) -> Self
pub fn from_27mhz(ticks: u64) -> Self
Construct from an absolute 27 MHz clock value.
Sourcepub fn from_field_bytes(b: &[u8; 6]) -> Result<Self>
pub fn from_field_bytes(b: &[u8; 6]) -> Result<Self>
Decode from the 6-byte ESCR field.
Bit layout (ISO/IEC 13818-1 §2.4.3.7, Table 2-21):
B0[7:6]=reserved, B0[5:3]=base[32:30], B0[2]=marker,
B0[1:0]=base[29:28], B1[7:0]=base[27:20],
B2[7:3]=base[19:15], B2[2]=marker, B2[1:0]=base[14:13],
B3[7:0]=base[12:5],
B4[7:3]=base[4:0], B4[2]=marker, B4[1:0]=ext[8:7],
B5[7:1]=ext[6:0], B5[0]=marker.
Sourcepub fn to_field_bytes(self) -> [u8; 6]
pub fn to_field_bytes(self) -> [u8; 6]
Encode as the 6-byte ESCR field.
Reserved bits are set to 1 per the spec convention.
Exact inverse of from_field_bytes.