pub mod backend;
pub mod error;
pub use backend::{discover_device_selectors, AvbBackend, AvbSelector};
pub use error::Error;
use crate::types::{DacCapabilities, OutputModel};
pub fn default_capabilities() -> DacCapabilities {
DacCapabilities {
pps_min: 1,
pps_max: 100_000,
max_points_per_chunk: 4096,
output_model: OutputModel::NetworkFifo,
}
}
pub(crate) fn normalize_device_name(name: &str) -> String {
name.split_whitespace()
.collect::<Vec<_>>()
.join(" ")
.trim()
.to_ascii_lowercase()
}
const BLACKLISTED_DEVICE_NAMES: &[&str] = &["studio display speakers"];
pub(crate) fn is_blacklisted_device(name: &str) -> bool {
let lower = name.to_ascii_lowercase();
BLACKLISTED_DEVICE_NAMES
.iter()
.any(|blocked| lower == *blocked)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn blacklist_matches_exact_name_case_insensitively() {
assert!(is_blacklisted_device("Studio Display Speakers"));
assert!(is_blacklisted_device("studio display speakers"));
assert!(is_blacklisted_device("STUDIO DISPLAY SPEAKERS"));
}
#[test]
fn blacklist_does_not_match_partial_or_unrelated() {
assert!(!is_blacklisted_device("Apple Studio Display"));
assert!(!is_blacklisted_device("Studio Display"));
assert!(!is_blacklisted_device("Broadcom NetXtreme"));
assert!(!is_blacklisted_device("MOTU AVB 24Ao"));
assert!(!is_blacklisted_device("Built-in Output"));
}
}