dvd: route AC-3 audio to the physically-correct sub-stream by probed channel count
Fixes the "Silence of the Lambs" R2 PAL wrong-substream rip: the feature's IFO declares one 5.1 AC-3 stream, but the scan assigned it the on-wire sub-stream id 0x80 purely by per-codec ordinal (ifo::assign_audio_sub_stream_ids). On this disc the physical 0x80 carries the 2.0 down-mix and the 5.1 main mix lives at a different 0x8x sub-stream, so the rip muxed 2.0 while labelling it "Dolby Digital 5.1" (the acmod fixup in mkv.rs then corrected only the Channels element, surfacing the mismatch as the "IFO claimed 6 but acmod says 2" warning — too late to re-route). New src/disc/dvd_audio_probe.rs probes each physical AC-3 sub-stream's real channel count from the head of the feature (the acmod/lfeon of its first frame after the 0x0B77 sync) and re-routes each IFO-declared AC-3 stream onto the physical sub-stream whose actual channel count matches the declared count, instead of trusting the ordinal. Wired into both mux demux paths (DiscStream::new and resolve::build_iso_pipeline) over the decrypting reader, so it works on CSS discs and the autorip ISO-remux path alike. Bounded 512-sector best-effort read; an empty/unreadable probe degrades to the original ordinal mapping (no regression on normal discs). The cell selection is left unchanged: the feature's cell 0 (cat=0x02, 302.4s) is chapter 1 of the movie (matches MakeMKV's chapter map and 1h53 duration exactly), so it must NOT be dropped — the perceived "wrong video at the start" was the wrong 2.0 audio over the opening, the same root cause. Diagnostics (--log-level 3): new tag=dvd.substream rows dump the ACTUAL acmod channel count of each physical 0x8x sub-stream read from the VOB, and the per-cell tag=dvd.cell verdict now spells out the keep/skip reason. With the existing tag=dvd.aattr (IFO declared sub_id + channels) a bug log alone now shows whether the ordinal 0x80 really carries the declared layout — no disc needed to diagnose this class. expose ac3::find_ac3_sync as pub(crate) for the probe.
This commit is contained in:
+11
-1
@@ -558,7 +558,7 @@ pub fn build_iso_pipeline<S: SectorSource + Send + 'static>(
|
||||
crate::decrypt::DecryptKeys::Aacs { .. } => 3,
|
||||
_ => 1,
|
||||
};
|
||||
let decrypting =
|
||||
let mut decrypting =
|
||||
crate::sector::DecryptingSectorSource::new(Box::new(reader) as Box<dyn SectorSource>, keys);
|
||||
// Grab the decrypt-loss counter before the decorator is moved into the
|
||||
// producer thread. It tracks bytes of scrambled AACS units no key could
|
||||
@@ -566,6 +566,16 @@ pub fn build_iso_pipeline<S: SectorSource + Send + 'static>(
|
||||
// through `lost_bytes()` so the mux abort gate sees a partial decrypt
|
||||
// failure rather than a clean rip.
|
||||
let decrypt_loss = decrypting.decrypt_loss();
|
||||
|
||||
// Wrong-substream fix (Silence-of-the-Lambs): before the prefetcher takes
|
||||
// the reader, probe the feature head through the (plaintext) decrypting
|
||||
// source and re-route the title's declared AC-3 audio onto the physically
|
||||
// correct `0x8x` sub-streams. No-op for non-DVD or an empty probe. Reset the
|
||||
// unit base afterward so the prefetcher's first batch starts clean.
|
||||
let mut title = title;
|
||||
crate::disc::dvd_audio_probe::probe_and_remap(&mut decrypting, &mut title);
|
||||
decrypting.set_unit_base(0);
|
||||
|
||||
let prefetched = crate::sector::PrefetchedSectorSource::new_with_events(
|
||||
decrypting,
|
||||
extents,
|
||||
|
||||
Reference in New Issue
Block a user