mux: codec-agnostic PictureInfo + provenance; measure field order, never guess
Carry per-picture truth and byte-exact source provenance THROUGH the stream so the muxer (and the upcoming video index) read MEASURED facts instead of assuming them. Honest data in, honest data out. - codec/coding.rs: codec-agnostic PictureInfo (CodingType / FieldOrder + the accessors field_order/coding_type/nb_fields/progressive/keyframe). Each codec folds its raw signals in; consumers use only accessors, never branch on codec. - mpeg2: builds PictureInfo from the picture coding extension and carries it + SourcePos (source_marks, parallel to pts_marks) on every emitted frame. - pes / codec::Frame: additive `coding` + `source`, forwarded through the highway; None for audio/subtitle and the network/stdio deserialize hop. - mkvstream: DEFER muxer construction until the first coded picture, set the video track's FieldOrder from the MEASURED value, THEN write the header — right the first time, no guess, no seek-back. An interlaced track that arrives with no measured order is LOGGED loudly and left UNDETERMINED, never faked. - mkv: MkvTrack::video no longer guesses TFF (a bitstream property the scan cannot know is UNDETERMINED at build). Removed VideoStream::top_field_first (the dead scan-time guess) crate-wide. - Tests: parser population (every PictureInfo facet + per-PES source carry) and mux-stream consumption (measured -> correct; missing -> UNDETERMINED, not faked). Two obsolete tests updated only after confirming (their own comments) they existed to enforce the deleted hardcoded-TFF.
This commit is contained in:
@@ -152,7 +152,6 @@ impl Disc {
|
||||
// the measured field order (H.264/HEVC pic_struct, VC-1
|
||||
// pulldown) from the codec parser instead of the TFF
|
||||
// fallback; needs the parser→title channel (see dvd.rs).
|
||||
top_field_first: None,
|
||||
// TODO(spec): prefer the HEVC/H.264 VUI colour_description
|
||||
// (measured CICP) over this MPLS playlist-nibble guess
|
||||
// once the parser surfaces it through the output title.
|
||||
|
||||
@@ -57,7 +57,6 @@ impl Disc {
|
||||
// PipelinedPesStream/DiscStream into the output title (mirroring
|
||||
// the existing `codec_private` handshake). Until then `None`
|
||||
// means the muxer falls back to TFF (correct for ~all DVDs).
|
||||
top_field_first: None,
|
||||
// TODO(spec): DVD MPEG-2 carries no VUI; the colour signalling is
|
||||
// the sequence_display_extension colour_description when present.
|
||||
// Surface it from `Mpeg2Parser` (same handshake as above) and set
|
||||
|
||||
@@ -196,14 +196,6 @@ pub struct VideoStream {
|
||||
pub secondary: bool,
|
||||
/// Extra label (e.g. "Dolby Vision EL")
|
||||
pub label: String,
|
||||
/// Field-display order MEASURED from the elementary stream's interlace
|
||||
/// signalling (MPEG-2 picture coding extension `top_field_first`, H.264/HEVC
|
||||
/// `pic_struct`), when available: `Some(true)` = top-field-first,
|
||||
/// `Some(false)` = bottom-field-first. `None` = not measured — the muxer
|
||||
/// falls back to TFF for interlaced content (the dominant DVD/HD case). The
|
||||
/// container FieldOrder must agree with the bitstream, so a measured BFF
|
||||
/// stream must NOT be stamped TFF. Ignored for progressive video.
|
||||
pub top_field_first: Option<bool>,
|
||||
/// CICP colour signalling (matrix, transfer, primaries, full_range) MEASURED
|
||||
/// from the bitstream — HEVC/H.264 VUI `colour_description` or MPEG-2
|
||||
/// `sequence_display_extension`. `Some(...)` takes precedence over the
|
||||
@@ -3805,7 +3797,6 @@ mod tests {
|
||||
display_aspect: None,
|
||||
secondary: false,
|
||||
label: String::new(),
|
||||
top_field_first: None,
|
||||
measured_cicp: None,
|
||||
})],
|
||||
chapters: Vec::new(),
|
||||
|
||||
Reference in New Issue
Block a user