AACS pipeline reshape + TrueHD metadata + central consts + clippy/fmt clean
- AACS: delete in-lib keydb parser (Step 3); boil-down primitives (mk_from_dk/vuk_from_mk/uk_from_vuk) + newtypes; KeySource->get_uk(ctx)+ ResolveCtx; Unlocker->unlock()->Result<Vid,UnlockError> + AacsCertUnlocker; OEM bus-key gate (AacsBusKeyUnavailable); structured ResolutionTrace (Step 4). - TrueHD: sample-rate from major-sync, Atmos label, 44.1k AU duration. - consts: central media/format constants module; 17 duplicate const-defs centralized (sector/TS-packet/source-packet); mpls stream-entry + category codes named. - clippy --all-targets -D warnings clean (1.86); fmt clean; 2199 lib tests.
This commit is contained in:
+1
-1
@@ -385,7 +385,7 @@ mod tests {
|
||||
meta.titles.get("fra").map(String::as_str),
|
||||
Some("Aurora Drift (Partie Deux)")
|
||||
);
|
||||
assert!(meta.descriptions.get("eng").is_none());
|
||||
assert!(!meta.descriptions.contains_key("eng"));
|
||||
assert_eq!(
|
||||
meta.descriptions.get("fra").map(String::as_str),
|
||||
Some("Suite du film fictif.")
|
||||
|
||||
@@ -323,6 +323,11 @@ fn parse_language_streams_text(text: &str) -> Vec<StreamLabel> {
|
||||
labels
|
||||
}
|
||||
|
||||
// NOTE: `parse_menu_base` / `parse_menu_base_text` are defined just below this
|
||||
// module and structurally belong above it. They are left in place (with the
|
||||
// lint allowed) rather than relocated here — a ~120-line block move that is
|
||||
// safer to do as its own focused change than inline.
|
||||
#[allow(clippy::items_after_test_module)]
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
+1
-1
@@ -288,7 +288,7 @@ mod tests {
|
||||
// ignores; the point is that read_to_end stops at the cap rather
|
||||
// than following a (potentially huge) declared size.
|
||||
let mut payload = MINIMAL_CLASS.to_vec();
|
||||
payload.extend(std::iter::repeat(0u8).take(4096));
|
||||
payload.extend(std::iter::repeat_n(0u8, 4096));
|
||||
let mut jar = open(build_stored_zip(
|
||||
"Padded.class",
|
||||
&payload,
|
||||
|
||||
+35
-2
@@ -441,15 +441,37 @@ fn codec_hint_adds_detail(hint: &str) -> bool {
|
||||
}
|
||||
|
||||
pub(crate) fn generate_audio_label(
|
||||
codec: &crate::disc::Codec,
|
||||
channels: &crate::disc::AudioChannels,
|
||||
secondary: bool,
|
||||
) -> String {
|
||||
generate_audio_label_inner(codec, channels, secondary, false)
|
||||
}
|
||||
|
||||
/// Atmos-aware variant: same codec/channel string as [`generate_audio_label`]
|
||||
/// with the object-audio marker folded into the codec brand
|
||||
/// (e.g. "Dolby TrueHD Atmos 7.1"). The "Atmos" string lives here in the label
|
||||
/// layer, not in the core parser. Used when a bitstream probe detected an Atmos
|
||||
/// substream and the stream still carries the basic (non-editorial) label.
|
||||
pub(crate) fn generate_audio_label_atmos(
|
||||
codec: &crate::disc::Codec,
|
||||
channels: &crate::disc::AudioChannels,
|
||||
secondary: bool,
|
||||
) -> String {
|
||||
generate_audio_label_inner(codec, channels, secondary, true)
|
||||
}
|
||||
|
||||
fn generate_audio_label_inner(
|
||||
codec: &crate::disc::Codec,
|
||||
channels: &crate::disc::AudioChannels,
|
||||
_secondary: bool,
|
||||
atmos: bool,
|
||||
) -> String {
|
||||
use crate::disc::{AudioChannels, Codec};
|
||||
|
||||
// Full marketing names for disc audio codecs.
|
||||
// These are codec brand identifiers, not user-facing English prose.
|
||||
let codec_name = match codec {
|
||||
let base_name = match codec {
|
||||
Codec::TrueHd => "Dolby TrueHD",
|
||||
Codec::Ac3 => "Dolby Digital",
|
||||
Codec::Ac3Plus => "Dolby Digital Plus",
|
||||
@@ -465,6 +487,15 @@ pub(crate) fn generate_audio_label(
|
||||
_ => return String::new(),
|
||||
};
|
||||
|
||||
// Atmos is an object-audio extension riding a lossless carrier (TrueHD or
|
||||
// DD+). Fold the marker into the brand name; "Atmos" is a label-layer
|
||||
// string, never asserted by the core parser.
|
||||
let codec_name = if atmos && matches!(codec, Codec::TrueHd | Codec::Ac3Plus) {
|
||||
std::borrow::Cow::Owned(format!("{base_name} Atmos"))
|
||||
} else {
|
||||
std::borrow::Cow::Borrowed(base_name)
|
||||
};
|
||||
|
||||
// Channel layout
|
||||
let channel_str = match channels {
|
||||
AudioChannels::Mono => "1.0",
|
||||
@@ -1090,7 +1121,9 @@ mod registry_tests {
|
||||
// and as a marker for "these parsers exist."
|
||||
let _ = (name, detect, parse);
|
||||
}
|
||||
assert!(!PARSERS.is_empty(), "PARSERS array must not be empty");
|
||||
// The loop above touches every registry entry; iterating a non-empty
|
||||
// fixed-size array is the assertion (a `.is_empty()` check would be
|
||||
// const-folded). The test fails to compile if the tuple shape changes.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -536,8 +536,8 @@ mod tests {
|
||||
fn parse_token_all_regions_recognized() {
|
||||
for region in REGIONS {
|
||||
let token = format!("eng_MLP_{}_", region);
|
||||
let l =
|
||||
parse_token_inner(&token, None).expect(&format!("region {} should parse", region));
|
||||
let l = parse_token_inner(&token, None)
|
||||
.unwrap_or_else(|| panic!("region {region} should parse"));
|
||||
assert_eq!(l.variant, *region, "region {} should be in variant", region);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user