Skip to main content

AdaptationField

Struct AdaptationField 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§discontinuity_indicator: bool

A timing/continuity discontinuity starts at this packet.

§random_access_indicator: bool

This packet is a random-access point.

§elementary_stream_priority_indicator: bool

Elementary-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: usize

Number 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>

Source

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).

Source

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>

Source§

fn clone(&self) -> AdaptationField<'a>

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<'a> Debug for AdaptationField<'a>

Source§

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

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

impl<'a> Eq for AdaptationField<'a>

Source§

impl<'a> PartialEq for AdaptationField<'a>

Source§

fn eq(&self, other: &AdaptationField<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Serialize for AdaptationField<'a>

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<'a> StructuralPartialEq for AdaptationField<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for AdaptationField<'a>

§

impl<'a> RefUnwindSafe for AdaptationField<'a>

§

impl<'a> Send for AdaptationField<'a>

§

impl<'a> Sync for AdaptationField<'a>

§

impl<'a> Unpin for AdaptationField<'a>

§

impl<'a> UnsafeUnpin for AdaptationField<'a>

§

impl<'a> UnwindSafe for AdaptationField<'a>

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> 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.