mpeg-ps
MPEG-2 Program Stream parser — ISO/IEC 13818-1 (Rec. ITU-T H.222.0) §2.5.
Parses the .mpg/.vob framing that wraps PES packets: the pack header
(42-bit SCR + program_mux_rate), the optional system header (rate/audio/video
bounds + per-stream P-STD buffer bounds), and the program stream map (PSM).
MPEG-1 (ISO/IEC 11172-1) packs are recognised and rejected with
Error::Mpeg1NotSupported, never mis-parsed.
#![no_std] + alloc; depends only on broadcast-common and mpeg-pes.
Quick start
use PackHeader;
use Parse;
let bytes = ;
let h = parse.unwrap;
assert_eq!;
use fs;
use program_stream;
let data = read.unwrap;
let = parse_all_packs.unwrap;
println!;
For damaged streams, program_stream::scan_packs returns a PackScan:
every pack that parsed (packs), every span it had to skip with the error
(skipped, resynchronising on the next pack_start_code), and the
remaining tail — instead of abandoning the stream at the first bad pack.
The call is exercised by a doctest on scan_packs, so it cannot rot.
Examples
Features
| Feature | Default | Description |
|---|---|---|
std |
yes | Link the standard library. Without it the crate is #![no_std] + alloc. |
serde |
no | serde::Serialize derives on public types. |
Minimum Supported Rust Version
1.95.0
License
MIT OR Apache-2.0