Bind vendor stream labels by PID, not by per-title ordinal

A vendor label list describes ONE playlist's stream table, but
apply_labels re-numbered it from 1 inside every title. Where sibling
playlists cover the identical feature clip and enumerate different
subtitle sets, identical ordinals resolve to different PIDs, and the
same physical stream came out flagged forced in one title and not in
the other. On the title such a disc offers as its rip target that put
`forced` on an 873 MB full-dialogue English subtitle track — the
reported "I see English and English (Forced), they are identical".

The blobs are not wrong; the binding was. The list carries no playlist
id, but it carries a language per slot, and that sequence is a
fingerprint: on the corpus exactly one title's per-type language
sequence reproduces the list position for position, and content
confirms that title's binding is the correct one. So binding is now
two-tier:

  * The title whose whole per-type language sequence sits on the list
    (>= 2 streams, longest wins) is the ANCHOR — the table the list is
    describing. Each of its slots yields a `(clip, PID) -> label` fact,
    and a PID is the same elementary stream in every playlist that
    plays that clip, so sibling playlists bind through the map. A slot
    the anchor never showed us is not bound at all.

  * Streams no anchor fact reaches still bind by the STN ordinal, but a
    label whose language contradicts the stream it would land on is
    dropped. Subtitle labels carry nothing but the qualifier, so an
    unverifiable one is all risk and no gain: off the authoritative
    path they additionally require both sides to STATE a language and
    state the same one. Unlabelled beats mislabelled — the muxer's
    demotable() guard can only clear a wrong `forced` on discs whose
    authoring uses forced_on_flag, and half the measured discs never
    set it.

Measured over 44 disc images, 9 change and every cross-title label
conflict goes away: 171 forced flags that contradicted a sibling
playlist are cleared, 61 correct ones are recovered on playlists that
had been missing them, 5 subtitle qualifiers and 1 audio purpose bound
against a contradicting language are dropped. No title gains a label it
did not have.

Known residual: on one disc the featurette playlists keep two forced
flags (down from nine) where a shifted list happens to coincide on
language. Ruling those out needs the list's provenance — which slots
are the vendor's and which were merged in by the MPLS gap-fill — and a
whole-sequence gate without it costs correct flags on discs whose
vendor slots are interleaved with gap-filled ones.
This commit is contained in:
Matthew Jackson
2026-08-02 17:50:20 -07:00
parent 0d4aab99df
commit 94377c75fd
2 changed files with 424 additions and 9 deletions
+22
View File
@@ -54,6 +54,28 @@
`output()` now takes the source provenance explicitly. One of the crate's own
tests had been asserting the wrong value, which is why the suite never caught
it.
- **A vendor label list was re-numbered from 1 inside every title, so the same
label landed on a different physical stream in each.** A label list describes
ONE playlist's stream table, but it was applied to every title on the disc by
per-type ordinal. Where sibling playlists cover the identical feature clip
and enumerate different subtitle sets — one carrying a full track the other
omits — identical ordinals resolve to different PIDs, and the same stream
came out flagged forced in one title and not in the other. On the title such
a disc actually offers as the rip target, that put `forced` on an
873 MB full-dialogue English subtitle track: the user is shown "English" and
"English (Forced)", picks either, and gets the same subtitles. Labels are now
bound to the stream a PID identifies, not to a position in a list. The title
whose per-type stream-language sequence reproduces the label list is treated
as the table the list describes; the `(clip, PID)` facts it yields bind every
other playlist over that clip, so a flag lands on the same elementary stream
whichever playlist enumerates it, and a stream the list never described is
left alone. Streams no such fact reaches still bind by ordinal, but a label
whose language contradicts the stream it would land on is now dropped rather
than applied — an unlabelled track is a far smaller harm than a mislabelled
one, all the more since the muxer can only undo a wrong `forced` on discs
whose authoring sets `forced_on_flag` at all. Across the disc-image corpus
this cleared every cross-title label conflict, on both affected vendor
formats.
- **Vendor stream labels were numbered by parsed entry, not by stream slot.**
Label blobs contain entries the parser deliberately does not interpret, but
those entries still occupy a stream-number slot. Counting only the parsed