fix(core): distinguish HDR evidence
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
//! Pure domain types shared by the arr crates.
|
//! Pure domain types shared by the arr crates.
|
||||||
|
//!
|
||||||
|
//! This crate must never depend on `axum`, `sqlx` or `reqwest`.
|
||||||
|
|
||||||
use std::{collections::BTreeMap, path::PathBuf, time::SystemTime};
|
use std::{collections::BTreeMap, path::PathBuf, time::SystemTime};
|
||||||
|
|
||||||
@@ -60,13 +62,27 @@ pub enum Source {
|
|||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
|
pub struct DolbyVisionProfile {
|
||||||
|
pub profile: u8,
|
||||||
|
pub compatibility_id: Option<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum HdrFormat {
|
pub enum HdrFormat {
|
||||||
Sdr,
|
Sdr,
|
||||||
Hdr10,
|
Hdr10,
|
||||||
Hdr10Plus,
|
Hdr10Plus,
|
||||||
Hlg,
|
Hlg,
|
||||||
DolbyVision { profile: u8 },
|
DolbyVision(DolbyVisionProfile),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
|
pub enum HdrClaim {
|
||||||
|
Hdr10,
|
||||||
|
Hdr10Plus,
|
||||||
|
Hlg,
|
||||||
|
DolbyVision,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
@@ -77,7 +93,7 @@ pub enum RequiredAudio {
|
|||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct HdrRules {
|
pub struct HdrRules {
|
||||||
pub rejected_dolby_vision_profiles: Vec<u8>,
|
pub rejected_dolby_vision_profiles: Vec<DolbyVisionProfile>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
@@ -152,7 +168,7 @@ pub struct ProbedMedia {
|
|||||||
pub enum Rule {
|
pub enum Rule {
|
||||||
RequiredAudio,
|
RequiredAudio,
|
||||||
DubBlacklist(Language),
|
DubBlacklist(Language),
|
||||||
DolbyVisionProfile(u8),
|
DolbyVisionProfile(DolbyVisionProfile),
|
||||||
Resolution(Resolution),
|
Resolution(Resolution),
|
||||||
Source(Source),
|
Source(Source),
|
||||||
Size,
|
Size,
|
||||||
@@ -180,7 +196,7 @@ pub struct MediaFile {
|
|||||||
pub struct ParsedRelease {
|
pub struct ParsedRelease {
|
||||||
pub resolution: Option<Resolution>,
|
pub resolution: Option<Resolution>,
|
||||||
pub source: Option<Source>,
|
pub source: Option<Source>,
|
||||||
pub hdr: Vec<HdrFormat>,
|
pub hdr: Vec<HdrClaim>,
|
||||||
pub audio_languages: Vec<Language>,
|
pub audio_languages: Vec<Language>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +257,7 @@ pub struct MovieOwner {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{HdrFormat, Language, Rule, Verdict};
|
use super::{DolbyVisionProfile, HdrFormat, Language, Rule, Verdict};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn portuguese_variants_are_distinct() {
|
fn portuguese_variants_are_distinct() {
|
||||||
@@ -252,14 +268,23 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn dolby_vision_profile_is_preserved() {
|
fn dolby_vision_profile_is_preserved() {
|
||||||
assert_ne!(
|
assert_ne!(
|
||||||
HdrFormat::DolbyVision { profile: 5 },
|
HdrFormat::DolbyVision(DolbyVisionProfile {
|
||||||
HdrFormat::DolbyVision { profile: 8 }
|
profile: 8,
|
||||||
|
compatibility_id: Some(1),
|
||||||
|
}),
|
||||||
|
HdrFormat::DolbyVision(DolbyVisionProfile {
|
||||||
|
profile: 8,
|
||||||
|
compatibility_id: Some(2),
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn non_eligible_verdicts_name_the_rule() {
|
fn non_eligible_verdicts_name_the_rule() {
|
||||||
let rule = Rule::DolbyVisionProfile(5);
|
let rule = Rule::DolbyVisionProfile(DolbyVisionProfile {
|
||||||
|
profile: 5,
|
||||||
|
compatibility_id: None,
|
||||||
|
});
|
||||||
assert_eq!(Verdict::Rejected(rule.clone()), Verdict::Rejected(rule));
|
assert_eq!(Verdict::Rejected(rule.clone()), Verdict::Rejected(rule));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user