Struct mpeg2ts_reader::pes::PesHeader[][src]

pub struct PesHeader<'buf> { /* fields omitted */ }

Header at the start of every PES packet.

The header identifies,

  • The stream identifier, returned by stream_id()
  • The the size of the packet, returned by pes_packet_length(), which may well be larger than the size of the payload buffer obtained from the header (the payload is likely split across multiple Transport Stream packets)

In addition, the header may provide access to either

  • an additional set of header data followed by a payload, when contents() returns PesContents::Parsed
  • just a payload on its own, when contents() returns PesContents::Payload

Implementations

impl<'buf> PesHeader<'buf>[src]

pub fn from_bytes(buf: &'buf [u8]) -> Option<PesHeader<'buf>>[src]

Wraps the given slice in a PesHeader, which will then provide method to parse the header fields within the slice.

Returns None if the buffer is too small to hold the PES header, or if the PES ‘start code prefix’ is missing.

TODO: should probably return Result.

pub fn stream_id(&self) -> StreamId[src]

Indicator of the type of stream per ISO/IEC 13818-1, Table 2-18.

pub fn pes_packet_length(&self) -> PesLength[src]

The overall length of the PES packet, once all pieces from the transport stream have been collected.

pub fn contents(&self) -> PesContents<'buf>[src]

Either PesContents::Parsed, or PesContents::Payload, depending on the value of stream_id()

Auto Trait Implementations

impl<'buf> RefUnwindSafe for PesHeader<'buf>

impl<'buf> Send for PesHeader<'buf>

impl<'buf> Sync for PesHeader<'buf>

impl<'buf> Unpin for PesHeader<'buf>

impl<'buf> UnwindSafe for PesHeader<'buf>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.