This branch predates CI on `main`. `cargo fmt --all` only; no behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
51 lines
1.9 KiB
Rust
51 lines
1.9 KiB
Rust
//! Would keeping the predecessor (instead of falling back to `anchor`) recover
|
|
//! the streams the running decoder actually decodes?
|
|
//!
|
|
//! `voice_region_start_why.rs` shows the failing branch: the start filter
|
|
//! `end - s < 1_500_000` rejects `ADV`'s predecessor because its span is 3.6 MB,
|
|
//! so `start` falls back to `anchor` — a TOC offset, not a stream boundary.
|
|
//!
|
|
//! This does NOT patch the resolver. It asks the one question that decides whether
|
|
//! raising that cap is the fix: **from the predecessor, does `to_xma_riffs` return
|
|
//! the decoder's own byte_sizes?** For `ADV` those are known, so this is a test and
|
|
//! not a fit.
|
|
//!
|
|
//! cargo run -p sylpheed-formats --example voice_region_fix_test
|
|
|
|
use sylpheed_formats::media::{DirectorySource, DiscSource};
|
|
use sylpheed_formats::slb;
|
|
|
|
const ADV_PRED: u64 = 433_425_776;
|
|
const ADV_ANCHOR: u64 = 433_930_240;
|
|
const ADV_END: u64 = 437_044_592;
|
|
/// What the running decoder reported.
|
|
const WANT: [usize; 3] = [1_294_336, 1_118_208, 1_171_456];
|
|
|
|
fn main() {
|
|
let disc = std::env::var("SYLPHEED_DISC").expect("SYLPHEED_DISC");
|
|
let src = DirectorySource::new(std::path::PathBuf::from(&disc));
|
|
for (label, start) in [
|
|
("anchor (today)", ADV_ANCHOR),
|
|
("predecessor (proposed)", ADV_PRED),
|
|
] {
|
|
let bytes = src
|
|
.read_segment_range("dat/sound", start, (ADV_END - start) as usize)
|
|
.expect("region");
|
|
let sizes: Vec<usize> = slb::to_xma_riffs(&bytes)
|
|
.iter()
|
|
.map(|r| r.len() - 60)
|
|
.collect();
|
|
let hit = sizes.len() == 3 && sizes.iter().zip(WANT.iter()).all(|(a, b)| a == b);
|
|
println!(
|
|
"{label:24} start {start} span {:>9} -> {:?}{}",
|
|
ADV_END - start,
|
|
sizes,
|
|
if hit {
|
|
" <== MATCHES THE DECODER"
|
|
} else {
|
|
""
|
|
}
|
|
);
|
|
}
|
|
}
|