1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! PES (Packetized Elementary Stream) depacketization + PTS/DTS — ISO/IEC 13818-1
//! (Rec. ITU-T H.222.0) §2.4.3.6 / §2.4.3.7.
//!
//! `dvb-pes` is the sublayer between an MPEG-TS packet layer (e.g. `dvb-si`'s
//! `TsPacket` / `SiDemux`) and an elementary-stream consumer. Feed it the
//! payload bytes of TS packets for one PID (split on `payload_unit_start`), and
//! it yields [`PesPacket`]s carrying the `stream_id`, presentation/decoding
//! timestamps ([`Pts`]/[`Dts`], 33-bit @ 90 kHz), and the elementary-stream
//! bytes.
//!
//! It depends only on `dvb-common` and is `#![no_std]` (+ `alloc`), WASM-clean.
//!
//! ```
//! use dvb_pes::{PesPacket, StreamId};
//! // A minimal PES packet: start code, stream_id 0xE0 (video), len, header, PTS, payload.
//! let bytes = [
//! 0x00, 0x00, 0x01, 0xE0, 0x00, 0x0A, 0x80, 0x80, 0x05,
//! 0x21, 0x00, 0x01, 0x00, 0x01, // PTS = 0
//! 0xAA, 0xBB, // ES payload
//! ];
//! let pkt = PesPacket::parse(&bytes).unwrap();
//! assert_eq!(pkt.stream_id, StreamId(0xE0));
//! assert!(pkt.header.as_ref().unwrap().pts.is_some());
//! assert_eq!(pkt.payload, &[0xAA, 0xBB]);
//! ```
// Runnable examples, embedded so they render on docs.rs and stay in sync with
// the actual `examples/*.rs` files (shown, not compiled).
extern crate alloc;
pub use PesAssembler;
pub use ;
pub use ;
pub use StreamId;
pub use ;
/// The 3-byte `packet_start_code_prefix` that opens every PES packet (`0x000001`).
pub const PACKET_START_CODE_PREFIX: = ;