pub struct TsHeader {
pub tei: bool,
pub pusi: bool,
pub pid: Pid,
pub scrambling: ScramblingControl,
pub adaptation_field_control: AdaptationFieldControl,
pub continuity_counter: ContinuityCounter,
}Expand description
Parsed TS header — the 4-byte transport header fields.
Fields§
§tei: boolTransport Error Indicator — set by the demodulator when an uncorrectable error is present in the packet.
pusi: boolPayload Unit Start Indicator — first byte of the payload is a new PES packet or PSI section header when set.
pid: Pid13-bit Packet Identifier.
scrambling: ScramblingControl2-bit transport_scrambling_control (ISO/IEC 13818-1 Table 2-4; DVB
assigns 01/10/11, see ScramblingControl).
adaptation_field_control: AdaptationFieldControl2-bit adaptation_field_control (ISO/IEC 13818-1 Table 2-5): whether
the adaptation field and/or the payload follow the header.
The enum, not a pair of flags: the reserved 00 state is a named
variant and swapping the two flags is no longer possible.
continuity_counter: ContinuityCounter4-bit continuity_counter (wraps 0..=15 per PID).
Implementations§
Source§impl TsHeader
impl TsHeader
Sourcepub const fn serialized_len() -> usize
pub const fn serialized_len() -> usize
Number of bytes written by serialize_into.
Sourcepub fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
pub fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
Serialize this header into the first 4 bytes of buf.
Sourcepub fn has_adaptation(&self) -> bool
pub fn has_adaptation(&self) -> bool
Whether an adaptation field follows the header
(adaptation_field_control bit 1, ISO/IEC 13818-1 Table 2-5).
Sourcepub fn has_payload(&self) -> bool
pub fn has_payload(&self) -> bool
Whether a payload follows the header/adaptation field
(adaptation_field_control bit 0, ISO/IEC 13818-1 Table 2-5).
Trait Implementations§
impl Eq for TsHeader
Source§impl Serialize for TsHeader
impl Serialize for TsHeader
Source§type Error = Error
type Error = Error
Parse impl, but need not be).Source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
serialize_into will write.Source§fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
buf. Returns the number of bytes
written (always equal to serialized_len()).Source§fn try_to_bytes(&self) -> Result<Vec<u8>, Self::Error>
fn try_to_bytes(&self) -> Result<Vec<u8>, Self::Error>
Vec and serialize into it, returning the serializer’s error instead of
panicking. This is the only
allocate-and-serialize entry point: there is deliberately no panicking
to_bytes (hand-built values, or values assembled from damaged wire data,
can violate a wire constraint, so the error must reach the caller).