2022-05-29 18:16:35 +08:00
|
|
|
pub use self::vpxcodec::*;
|
2021-03-29 15:59:14 +08:00
|
|
|
|
|
|
|
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::*;
|
2022-07-07 01:27:21 +08:00
|
|
|
pub use self::x11::Frame;
|
2023-01-29 10:58:04 +08:00
|
|
|
pub use self::wayland::set_map_err;
|
2021-07-23 17:52:38 +08:00
|
|
|
} 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-06-01 17:52:21 +08:00
|
|
|
} else if #[cfg(target_os = "android")] {
|
2022-05-12 17:35:25 +08:00
|
|
|
mod android;
|
|
|
|
pub use self::android::*;
|
|
|
|
}else {
|
2021-03-29 15:59:14 +08:00
|
|
|
//TODO: Fallback implementation.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub mod codec;
|
|
|
|
mod convert;
|
2022-05-29 17:23:14 +08:00
|
|
|
#[cfg(feature = "hwcodec")]
|
|
|
|
pub mod hwcodec;
|
2022-09-15 20:40:29 +08:00
|
|
|
#[cfg(feature = "mediacodec")]
|
|
|
|
pub mod mediacodec;
|
2022-05-29 18:16:35 +08:00
|
|
|
pub mod vpxcodec;
|
2021-03-29 15:59:14 +08:00
|
|
|
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
|
2022-05-29 17:23:14 +08:00
|
|
|
pub const HW_STRIDE_ALIGN: usize = 0; // recommended by av_frame_get_buffer
|
2021-03-29 15:59:14 +08:00
|
|
|
|
2022-09-15 17:31:28 +08:00
|
|
|
pub mod record;
|
2021-03-29 15:59:14 +08:00
|
|
|
mod vpx;
|
2022-04-24 02:50:28 +08:00
|
|
|
|
|
|
|
#[inline]
|
2022-12-26 17:44:29 +08:00
|
|
|
pub fn would_block_if_equal(old: &mut Vec<u8>, b: &[u8]) -> std::io::Result<()> {
|
|
|
|
// does this really help?
|
2022-04-24 02:50:28 +08:00
|
|
|
if b == &old[..] {
|
|
|
|
return Err(std::io::ErrorKind::WouldBlock.into());
|
|
|
|
}
|
|
|
|
old.resize(b.len(), 0);
|
|
|
|
old.copy_from_slice(b);
|
|
|
|
Ok(())
|
2022-06-01 17:52:21 +08:00
|
|
|
}
|
2022-07-21 20:04:39 +08:00
|
|
|
|
|
|
|
pub trait TraitCapturer {
|
|
|
|
fn set_use_yuv(&mut self, use_yuv: bool);
|
|
|
|
fn frame<'a>(&'a mut self, timeout: std::time::Duration) -> std::io::Result<Frame<'a>>;
|
|
|
|
|
|
|
|
#[cfg(windows)]
|
|
|
|
fn is_gdi(&self) -> bool;
|
|
|
|
#[cfg(windows)]
|
|
|
|
fn set_gdi(&mut self) -> bool;
|
|
|
|
}
|
2022-07-27 06:34:27 -07:00
|
|
|
|
|
|
|
#[cfg(x11)]
|
|
|
|
#[inline]
|
|
|
|
pub fn is_x11() -> bool {
|
|
|
|
"x11" == hbb_common::platform::linux::get_display_server()
|
|
|
|
}
|
2022-11-29 16:36:35 +08:00
|
|
|
|
|
|
|
#[cfg(x11)]
|
|
|
|
#[inline]
|
2022-12-31 21:41:16 +08:00
|
|
|
pub fn is_cursor_embedded() -> bool {
|
2022-11-29 16:36:35 +08:00
|
|
|
if is_x11() {
|
2023-01-05 14:58:38 +08:00
|
|
|
x11::IS_CURSOR_EMBEDDED
|
2022-11-29 16:36:35 +08:00
|
|
|
} else {
|
2023-01-29 10:58:04 +08:00
|
|
|
wayland::is_cursor_embedded()
|
2022-11-29 16:36:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(x11))]
|
|
|
|
#[inline]
|
2022-12-31 21:41:16 +08:00
|
|
|
pub fn is_cursor_embedded() -> bool {
|
2022-11-29 16:36:35 +08:00
|
|
|
false
|
|
|
|
}
|