Struct PgsSegmentHeader

Source
pub struct PgsSegmentHeader {
    pub segment_type: PgsSegmentType,
    pub segment_length: u16,
    pub presentation_timestamp: u32,
    pub decoding_timestamp: u32,
}
Expand description

Struct representing the header of a PGS segment.

Fields§

§segment_type: PgsSegmentType§segment_length: u16

The length of the segment (excluding the header).

§presentation_timestamp: u32

The presentation timestamp (PTS) for the segment.

§decoding_timestamp: u32

The decoding timestamp (DTS) for the segment.

Implementations§

Source§

impl PgsSegmentHeader

Source

pub fn from_data(data: &[u8]) -> Result<PgsSegmentHeader>

Parses a PgsSegmentHeader from the provided raw data.

This function reads the necessary fields from the data buffer and constructs a PgsSegmentHeader. It checks the validity of the header, ensuring that the segment begins with the expected PG marker.

§Parameters
  • data: A slice of raw data representing the contents of the PGS segment header.
§Errors

Returns an error if the length of the data is less than the required header length or if the header is invalid.

§Returns

A PgsSegmentHeader constructed from the provided data.

Trait Implementations§

Source§

impl Debug for PgsSegmentHeader

Source§

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

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

impl Default for PgsSegmentHeader

Source§

fn default() -> Self

Provides a default implementation for the PgsSegmentHeader. This default header has a segment type of ERR and zero for all other fields.

Auto Trait Implementations§

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