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: u16The length of the segment (excluding the header).
presentation_timestamp: u32The presentation timestamp (PTS) for the segment.
decoding_timestamp: u32The decoding timestamp (DTS) for the segment.
Implementations§
Source§impl PgsSegmentHeader
impl PgsSegmentHeader
Sourcepub fn from_data(data: &[u8]) -> Result<PgsSegmentHeader>
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.