[WIP] Audio codec probe/detection + CLI audio-info + viewer audio panel

Snapshot of local WIP before rebasing onto the movie/voice remote work.
- audio.rs: AudioCodec enum, AudioInfo::probe (RIFF/WAVE parse, raw-XMA2
  Shannon-entropy heuristic looks_like_raw_xma2), from_wav, riff_data_span.
- cli/main.rs: `audio-info` subcommand (cmd_audio_info).
- viewer ui.rs/iso_loader.rs: draw_audio_detail panel wiring.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-07-20 20:42:48 +02:00
parent 3e1040b472
commit 8ed8c85f18
5 changed files with 496 additions and 62 deletions

View File

@@ -165,6 +165,8 @@ pub enum PakContent {
Ratc(Vec<RatcEntry>),
/// Plain-text / XML payload, with its encoding label.
Text { text: String, encoding: String },
/// An audio stream (WAV / XMA / raw XMA2) — metadata only; XMA isn't decoded.
Audio(sylpheed_formats::AudioInfo),
}
/// One child in a presented RATC bundle.
@@ -978,6 +980,12 @@ fn classify_content(payload: &[u8]) -> PakContent {
encoding: encoding.to_string(),
};
}
// Last resort: a self-describing WAV/XMA header, or a header-less high-
// entropy blob (the game's raw XMA2 sound-bank streams).
let audio = sylpheed_formats::AudioInfo::probe(payload);
if audio.codec != sylpheed_formats::AudioCodec::Unknown {
return PakContent::Audio(audio);
}
PakContent::None
}