pub struct PesHeader<'buf> { /* private fields */ }Expand description
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()returnsPesContents::Parsed - just a payload on its own, when
contents()returnsPesContents::Payload
Implementations§
Source§impl<'buf> PesHeader<'buf>
impl<'buf> PesHeader<'buf>
Sourcepub fn from_bytes(buf: &'buf [u8]) -> Option<PesHeader<'buf>>
pub fn from_bytes(buf: &'buf [u8]) -> Option<PesHeader<'buf>>
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.
Sourcepub fn stream_id(&self) -> StreamId
pub fn stream_id(&self) -> StreamId
Indicator of the type of stream per ISO/IEC 13818-1, Table 2-18.
Sourcepub fn pes_packet_length(&self) -> PesLength
pub fn pes_packet_length(&self) -> PesLength
The overall length of the PES packet, once all pieces from the transport stream have been collected.
Sourcepub fn contents(&self) -> PesContents<'buf>
pub fn contents(&self) -> PesContents<'buf>
Either PesContents::Parsed, or PesContents::Payload, depending on the value of
stream_id()
Auto Trait Implementations§
impl<'buf> Freeze for PesHeader<'buf>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more