2021-03-29 15:59:14 +08:00
|
|
|
pub use self::codec::*;
|
|
|
|
|
|
|
|
cfg_if! {
|
|
|
|
if #[cfg(quartz)] {
|
|
|
|
mod quartz;
|
|
|
|
pub use self::quartz::*;
|
|
|
|
} else if #[cfg(x11)] {
|
2021-07-23 17:52:38 +08:00
|
|
|
cfg_if! {
|
|
|
|
if #[cfg(feature="wayland")] {
|
|
|
|
mod linux;
|
|
|
|
mod wayland;
|
2021-03-29 15:59:14 +08:00
|
|
|
mod x11;
|
2021-07-23 17:52:38 +08:00
|
|
|
pub use self::linux::*;
|
|
|
|
} else {
|
|
|
|
mod x11;
|
|
|
|
pub use self::x11::*;
|
|
|
|
}
|
|
|
|
}
|
2021-03-29 15:59:14 +08:00
|
|
|
} else if #[cfg(dxgi)] {
|
|
|
|
mod dxgi;
|
|
|
|
pub use self::dxgi::*;
|
2022-05-12 17:35:25 +08:00
|
|
|
} else if #[cfg(android)] {
|
|
|
|
mod android;
|
|
|
|
pub use self::android::*;
|
|
|
|
}else {
|
2021-03-29 15:59:14 +08:00
|
|
|
//TODO: Fallback implementation.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub mod codec;
|
|
|
|
mod convert;
|
|
|
|
pub use self::convert::*;
|
2022-04-12 23:31:42 +08:00
|
|
|
pub const STRIDE_ALIGN: usize = 64; // commonly used in libvpx vpx_img_alloc caller
|
2021-03-29 15:59:14 +08:00
|
|
|
|
|
|
|
mod vpx;
|
2022-04-24 02:50:28 +08:00
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn would_block_if_equal(old: &mut Vec<u128>, b: &[u8]) -> std::io::Result<()> {
|
|
|
|
let b = unsafe {
|
|
|
|
std::slice::from_raw_parts::<u128>(b.as_ptr() as _, b.len() / 16)
|
|
|
|
};
|
|
|
|
if b == &old[..] {
|
|
|
|
return Err(std::io::ErrorKind::WouldBlock.into());
|
|
|
|
}
|
|
|
|
old.resize(b.len(), 0);
|
|
|
|
old.copy_from_slice(b);
|
|
|
|
Ok(())
|
2022-05-12 17:35:25 +08:00
|
|
|
}
|