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
55
56
57
58
59
60
//! The transmux media intermediate representation (IR).
//!
//! This is the neutral hub form every demuxer produces and every muxer
//! consumes (the transmux side of the `broadcast-common` container-mux
//! vocabulary, [`broadcast_common::Unpackage`] / [`broadcast_common::Package`]):
//!
//! - [`Media`] — a set of elementary [`Track`]s, plus the movie timescale and
//! an optional recovered PCR timeline ([`PcrSample`]).
//! - [`Track`] — one elementary track: its identity/codec config
//! ([`TrackSpec`] wrapping [`CodecConfig`]) plus its decode-ordered
//! [`Sample`]s, an absolute decode-time anchor, and optional CENC/CBCS
//! crypto metadata ([`TrackEncryption`]).
//! - [`Sample`] — one coded access unit: data bytes, absolute optional
//! `dts`/`pts` (media plane step 2c), optional duration, [`SampleFlags`],
//! and optional debug-only [`Provenance`].
//! - [`CodecConfig`] — per-track codec configuration (decoder config record +
//! geometry, or the opaque [`CodecConfig::Data`] carriage for PMT-listed
//! streams this crate does not decode — see [`DataCarriage`]).
//! - [`FragmentTrackData`] — one track's samples for a single media segment,
//! the input shape [`crate::pipeline::build_media_segment`] consumes.
//! - [`DemuxEvent`] — the streaming-demux event vocabulary (media plane step
//! 2e), drained from [`crate::ts_demux::StreamingTsDemux`] /
//! [`crate::flv_stream::StreamingFlvDemux`]; [`EventProvenance`] carries the
//! container-native identity (e.g. a TS PID) a neutral event needs to omit
//! from its primary fields.
//!
//! # Invariants
//!
//! - [`Sample::dts`]/[`Sample::pts`] are stored *absolutely*, in the track's
//! media timescale (media plane step 2c) — `None` only for section-carried
//! tracks (SCTE-35/DSM-CC/private sections), which have no timestamp at
//! all, never fabricated. [`Track::start_decode_time`] is kept in lockstep
//! as the track's anchor (equal to its first sample's `dts` when the track
//! is timed) — the DTS the track's first sample sits at on the
//! presentation timeline (maps onto the fragment `tfdt`
//! `baseMediaDecodeTime`, ISO/IEC 14496-12:2015 §8.8.12).
//! - 33-bit (TS) / 32-bit (RTP) rollover is unwrapped once, at the demux edge
//! (`crate::ts_demux`, `crate::rtp`) — never re-derived downstream.
//! - Samples within a [`Track`] are always in decode order.
//! - [`Track::encryption`], when present, must have exactly one
//! [`crate::cenc::SampleEncryptionEntry`] per [`Track::samples`] entry.
//!
//! This module is a pure type consolidation (media plane step 2a): the
//! packagers/depackagers built on this IR ([`Fmp4Demux`](crate::media::Fmp4Demux),
//! [`CmafMux`](crate::media::CmafMux), [`HlsPackager`](crate::media::HlsPackager))
//! and the segment-authoring machinery ([`crate::pipeline::build_init_segment`] /
//! [`crate::pipeline::build_media_segment`]) stay in their existing modules —
//! only the data types moved.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;