Skip to main content

Crate oxideav_mpegts

Crate oxideav_mpegts 

Source
Expand description

§oxideav-mpegts

Pure-Rust, clean-room MPEG-TS (Transport Stream) demuxer per ISO/IEC 13818-1, scoped at the bytes Blu-ray Disc ships inside a .m2ts file once the BDAV TP_extra_header has been stripped (see oxideav_bluray::iter_source_packets).

§Surface (Phase 1)

  • 188-byte TS packet parser (packet::TsPacket) — sync byte, transport_error_indicator, payload_unit_start_indicator, transport_priority, 13-bit PID, scrambling / adaptation / payload flags, continuity counter, optional adaptation field, payload slice.
  • PAT (Program Association Table) parser (psi::ProgramAssociationTable) — discovers the PMT PID for each program.
  • PMT (Program Map Table) parser (psi::ProgramMapTable) — discovers each elementary stream’s PID + stream_type + per-stream descriptor payloads.
  • PES packet reassembler (pes::PesReassembler) — joins TS payloads across packets per-PID, yields complete PES packets once the next start-indicator arrives or the stream ends. The resulting pes::PesPacket decodes every Table 2-17 optional header field — PES_scrambling_control / PES_priority / data_alignment_indicator / copyright / original_or_copy on flags1, plus the flag-gated bodies ESCR (27 MHz tick), ES_rate (50 bytes/s units), DSM_trick_mode (raw 8-bit byte), additional_copy_info, previous_PES_packet_CRC, and the full PES_extension body (pes::PesExtension — private data, pack header bytes, program_packet_sequence_counter, P-STD buffer, PES_extension_field_2).
  • Stream-type → ESID helpers in stream_type mapping the BD- relevant constants (0x1B AVC, 0x24 HEVC, 0x81 AC-3, 0x82 DTS, 0x90 PGS, etc.) to a richer enum.
  • PCR jitter and discontinuity tracking (clock::PcrTracker, clock::ContinuityTracker) — per-PCR-PID 27 MHz clock recovery, instantaneous bitrate estimate, time-base discontinuity classification (signalled vs. tolerance-exceeded), plus per-PID continuity-counter classification (continuous / duplicate / no-payload / dropped / discontinuity).

The crate ships no decoders — every payload byte stays as a &[u8] slice. A downstream pipeline (e.g. oxideav-cli’s remux bluray:// … path) iterates packets, drives a reassembler per PID, and hands the resulting PES payloads to a muxer.

§What’s NOT in scope

  • PSIP / DVB SI tables beyond PAT + PMT + CAT + TSDT + SDT + EIT (no NIT, BAT, TDT/TOT yet). The SDT (psi::ServiceDescriptionTable, ETSI EN 300 468 §5.2.3) is parsed including its per-service service_descriptor (tag 0x48) for human-readable service / provider names. The EIT (psi::EventInformationTable, §5.2.4) is parsed across all four table_id classifications, decoding each event’s MJD/BCD start_time, BCD duration, and per-event descriptor loop — the short_event_descriptor (tag 0x4D) names the event.
  • Conditional Access (CA) descriptors / scrambling.
  • Re-multiplexing — this is a demux-only crate. The MKV writer in oxideav-mkv owns the output side.

Re-exports§

pub use clock::ContinuityEvent;
pub use clock::ContinuityTracker;
pub use clock::DiscontinuityReason;
pub use clock::Pcr;
pub use clock::PcrEvent;
pub use clock::PcrTracker;
pub use clock::PCR_MODULUS_27MHZ;
pub use clock::PCR_TOLERANCE_27MHZ;
pub use descriptor::iter_descriptors;
pub use descriptor::parse_descriptors;
pub use descriptor::AudioStreamDescriptor;
pub use descriptor::AvcVideoDescriptor;
pub use descriptor::CaDescriptor;
pub use descriptor::DataStreamAlignmentDescriptor;
pub use descriptor::Descriptor;
pub use descriptor::DescriptorBody;
pub use descriptor::DescriptorIter;
pub use descriptor::HevcVideoDescriptor;
pub use descriptor::Iso639Language;
pub use descriptor::MaximumBitrateDescriptor;
pub use descriptor::ServiceDescriptor;
pub use descriptor::ShortEventDescriptor;
pub use descriptor::SmoothingBufferDescriptor;
pub use descriptor::StdDescriptor;
pub use descriptor::SystemClockDescriptor;
pub use descriptor::VideoStreamDescriptor;
pub use error::TsError;
pub use packet::iter_packets;
pub use packet::AdaptationField;
pub use packet::AdaptationFieldExtension;
pub use packet::TsPacket;
pub use packet::TsPacketIter;
pub use packet::TS_PACKET_LEN;
pub use packet::TS_SYNC_BYTE;
pub use pes::PStdBuffer;
pub use pes::PesExtension;
pub use pes::PesPacket;
pub use pes::PesReassembler;
pub use pes::ProgramPacketSequenceCounter;
pub use psi::iter_sections;
pub use psi::mpeg2_crc32;
pub use psi::ConditionalAccessTable;
pub use psi::EitDateTime;
pub use psi::EitDuration;
pub use psi::EitEvent;
pub use psi::EventInformationTable;
pub use psi::PmtStream;
pub use psi::ProgramAssociationTable;
pub use psi::ProgramMapTable;
pub use psi::PsiSectionAssembler;
pub use psi::RunningStatus;
pub use psi::SdtService;
pub use psi::SectionIter;
pub use psi::ServiceDescriptionTable;
pub use psi::TransportStreamDescriptionTable;
pub use psi::CAT_PID;
pub use psi::CAT_TABLE_ID;
pub use psi::EIT_ACTUAL_PF_TABLE_ID;
pub use psi::EIT_ACTUAL_SCHEDULE_FIRST;
pub use psi::EIT_ACTUAL_SCHEDULE_LAST;
pub use psi::EIT_OTHER_PF_TABLE_ID;
pub use psi::EIT_OTHER_SCHEDULE_FIRST;
pub use psi::EIT_OTHER_SCHEDULE_LAST;
pub use psi::EIT_PID;
pub use psi::MAX_PSI_SECTION_LEN;
pub use psi::PAT_PID;
pub use psi::PAT_TABLE_ID;
pub use psi::PMT_TABLE_ID;
pub use psi::SDT_ACTUAL_TABLE_ID;
pub use psi::SDT_OTHER_TABLE_ID;
pub use psi::SDT_PID;
pub use psi::TSDT_PID;
pub use psi::TSDT_TABLE_ID;
pub use stream_type::StreamType;
pub use demuxer::open as open_demuxer;
pub use demuxer::probe as probe_mpegts;
pub use demuxer::MpegTsDemuxer;
pub use muxer::open as open_muxer;
pub use muxer::MpegTsMuxer;
pub use registry::register;
pub use registry::register_containers;

Modules§

clock
Program Clock Reference (PCR) recovery and continuity tracking per ISO/IEC 13818-1.
demuxer
Container Demuxer implementation reading 188-byte MPEG-TS packets from a ReadSeek source.
descriptor
Program / elementary-stream descriptor parser per ISO/IEC 13818-1 §2.6 (“Program and program element descriptors”).
error
Error type for the demuxer surface.
muxer
Container Muxer implementation that writes elementary-stream Packets into a 188-byte MPEG-TS file per ISO/IEC 13818-1.
packet
188-byte MPEG-TS packet parser per ISO/IEC 13818-1 §2.4.3.
pes
PES (Packetized Elementary Stream) reassembly per ISO/IEC 13818-1 §2.4.3.6.
psi
Program-Specific Information tables — PAT + PMT.
registry
Wiring into oxideav-core’s container registry. The Demuxer factory + probe + extension hooks land here so a downstream RuntimeContext populated by oxideav-meta::register_all ends up with a working "mpegts" container.
stream_type
stream_type byte → richer enum, scoped to BD-relevant values.