use super::capabilities::HwAccelCapabilities;
pub trait HwProbe: Send + Sync {
fn probe(&self) -> HwAccelCapabilities;
}
pub struct SystemProbe;
pub struct MockProbe(pub HwAccelCapabilities);
impl HwProbe for MockProbe {
fn probe(&self) -> HwAccelCapabilities {
self.0.clone()
}
}
#[cfg(target_os = "macos")]
impl HwProbe for SystemProbe {
fn probe(&self) -> HwAccelCapabilities {
crate::hw_accel::macos::probe_macos()
}
}
#[cfg(target_os = "linux")]
impl HwProbe for SystemProbe {
fn probe(&self) -> HwAccelCapabilities {
crate::hw_accel::linux::probe_linux()
}
}
#[cfg(target_os = "windows")]
impl HwProbe for SystemProbe {
fn probe(&self) -> HwAccelCapabilities {
tracing::warn!(
"HW accel detection not yet implemented on Windows; \
returning empty capabilities"
);
HwAccelCapabilities::none()
}
}
#[cfg(target_arch = "wasm32")]
impl HwProbe for SystemProbe {
fn probe(&self) -> HwAccelCapabilities {
HwAccelCapabilities::none()
}
}
#[cfg(not(any(
target_os = "macos",
target_os = "linux",
target_os = "windows",
target_arch = "wasm32"
)))]
impl HwProbe for SystemProbe {
fn probe(&self) -> HwAccelCapabilities {
HwAccelCapabilities::none()
}
}