#[non_exhaustive]pub struct AdaptationField<'a> {
pub discontinuity_indicator: bool,
pub random_access_indicator: bool,
pub elementary_stream_priority_indicator: bool,
pub pcr: Option<Pcr>,
pub opcr: Option<Pcr>,
pub splice_countdown: Option<i8>,
pub transport_private_data: Option<&'a [u8]>,
pub extension: Option<AdaptationFieldExtension>,
pub stuffing_len: usize,
}Expand description
Decoded adaptation field — full §2.4.3.4 layout including transport-private data and the adaptation-field extension sub-structure.
The transport_private_data slice borrows from the original packet buffer
(it is genuinely opaque caller-defined bytes per the spec — &[u8] is the
correct public type). All other fields are fully typed.
ISO/IEC 13818-1:2007 §2.4.3.4.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.discontinuity_indicator: boolA timing/continuity discontinuity starts at this packet.
random_access_indicator: boolThis packet is a random-access point.
elementary_stream_priority_indicator: boolElementary-stream priority hint.
pcr: Option<Pcr>Program Clock Reference, present iff the PCR flag is set.
opcr: Option<Pcr>Original PCR, present iff the OPCR flag is set.
splice_countdown: Option<i8>Splice countdown (packets until the splice point), iff the flag is set.
transport_private_data: Option<&'a [u8]>Opaque transport-private data (caller-defined; &[u8] is spec-correct here).
Present iff transport_private_data_flag is set in the flags byte
(ISO/IEC 13818-1:2007 §2.4.3.4).
extension: Option<AdaptationFieldExtension>Typed adaptation-field extension sub-structure, if the flag is set.
stuffing_len: usizeNumber of trailing 0xFF stuffing bytes that pad the adaptation-field
body out to its declared adaptation_field_length (ISO/IEC 13818-1:2007
§2.4.3.4 — “stuffing_byte: fixed 8-bit value 0xFF”).
Real encoders pad the adaptation field so the packet payload begins at a
fixed offset; these bytes are part of the wire image. Capturing the count
lets serialize_into reproduce the packet
byte-for-byte. Set to 0 when constructing an adaptation field with no
stuffing.
Implementations§
Source§impl<'a> AdaptationField<'a>
impl<'a> AdaptationField<'a>
Sourcepub fn serialized_len(&self) -> usize
pub fn serialized_len(&self) -> usize
Number of bytes written by serialize_into.
This is the body length excluding the leading adaptation_field_length
byte — it is the value carried in that length byte itself
(ISO/IEC 13818-1:2007 §2.4.3.4).
Sourcepub fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
pub fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
Serialize the adaptation field into buf.
Writes the body bytes — the flags byte plus optional fields in the
order specified by ISO/IEC 13818-1:2007 §2.4.3.4. The
adaptation_field_length byte itself is not written here; the caller
must prepend it (it equals serialized_len()).
Returns the number of bytes written on success, or
Error::OutputBufferTooSmall if buf is shorter than
serialized_len().
Trait Implementations§
Source§impl<'a> Clone for AdaptationField<'a>
impl<'a> Clone for AdaptationField<'a>
Source§fn clone(&self) -> AdaptationField<'a>
fn clone(&self) -> AdaptationField<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for AdaptationField<'a>
impl<'a> Debug for AdaptationField<'a>
impl<'a> Eq for AdaptationField<'a>
Source§impl<'a> PartialEq for AdaptationField<'a>
impl<'a> PartialEq for AdaptationField<'a>
Source§fn eq(&self, other: &AdaptationField<'a>) -> bool
fn eq(&self, other: &AdaptationField<'a>) -> bool
self and other values to be equal, and is used by ==.