Skip to main content

Crate mpeg_ts

Crate mpeg_ts 

Source
Expand description

MPEG-2 Transport Stream framing — ITU-T H.222.0 / ISO/IEC 13818-1.

Parses and serializes the MPEG-TS packet layer: 188-byte TS packets, adaptation fields, PCR, PSI section reassembly and packetization, byte-stream resynchronisation, and a scheduler-mux for SI tables.

§Primary types

ModuleTypeDescription
tsts::TsPacketZero-copy borrowed view of a 188-byte TS packet (ITU-T H.222.0 §2.4.3.2)
ownedowned::OwnedTsPacketOwned 188-byte TS packet — for queuing, cloning, and in-place mutation
tsts::SectionReassemblerPer-PID PSI section assembly from TS payloads (§2.4.4)
muxmux::SectionPacketizerPacketize PSI sections back into TS packets with correct CC and padding
muxmux::SiMuxRate-scheduled SI table mux: upsert per-PID section sets, poll for TS packets
resyncresync::TsResyncByte-stream resynchroniser — recovers 188/204-byte packet alignment from raw bytes
pidpid::PidTyped 13-bit PID newtype with well-known constants
sectionsection::SectionGeneric PSI/SI section header parser (table_id, section_length, version, CRC)

§no_std + embedded

mpeg-ts is #![no_std] + alloc. It runs on bare-metal targets with a heap (e.g. thumbv7em-none-eabi). Enable the std feature for std::error::Error impls.

§Feature flags

FeatureDefaultDescription
stdyesstd::error::Error impls; disable for embedded
serdeyesserde::Serialize for packet/section types

§Spec

  • ITU-T H.222.0 (= ISO/IEC 13818-1): §2.4.3.2 (TS packet), §2.4.3.3 (adaptation field), §2.4.3.4 (PCR), §2.4.4 (PSI section). All wire layouts are cited by clause in the module-level doc comments.

Re-exports§

pub use error::Error;
pub use error::Result;
pub use owned::OwnedTsPacket;
pub use ts::AdaptationField;
pub use ts::AdaptationFieldControl;
pub use ts::AdaptationFieldExtension;
pub use ts::Ltw;
pub use ts::Pcr;
pub use ts::ScramblingControl;
pub use ts::SeamlessSplice;
pub use ts::TsHeader;
pub use ts::TsPacket;

Modules§

error
Error type returned by every parser and builder in this crate.
mux
Section → TS packetizer (the byte-exact inverse of SectionReassembler::feed).
owned
Owned 188-byte TS packet with pre-parsed header fields.
pid
MPEG-TS Packet Identifier (PID) types and well-known PID constants.
pusi
PUSI-delimited payload reassembler — generic non-PSI PID payload accumulation.
resync
Stateful TS byte-stream resynchroniser — ITU-T H.222.0 §2.4.3.2 (= ISO/IEC 13818-1 §2.4.3.2).
section
Generic PSI/SI section framing — ITU-T H.222.0 §2.4 (= ISO/IEC 13818-1) and ETSI EN 300 468 §5.1.1.
ts
MPEG-TS packet parser and section reassembler — ITU-T H.222.0 §2.4 (= ISO/IEC 13818-1).