2020-12-15 10:53:31 +00:00
|
|
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
2018-03-19 10:53:01 +00:00
|
|
|
|
2020-11-21 13:46:48 +00:00
|
|
|
cfg_if::cfg_if! {
|
2018-03-19 10:53:01 +00:00
|
|
|
if #[cfg(windows)] {
|
|
|
|
use glib::translate::ToGlibPtr;
|
|
|
|
|
|
|
|
use std::mem;
|
|
|
|
use std::os::windows;
|
2020-11-27 13:37:49 +00:00
|
|
|
} else if #[cfg(feature = "dox")] {
|
2018-03-19 10:53:01 +00:00
|
|
|
// Declare a fake RawHandle for doc generation on unix
|
|
|
|
pub mod windows {
|
|
|
|
pub mod io {
|
|
|
|
pub struct RawHandle{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
use super::Bus;
|
|
|
|
|
2018-12-08 09:22:42 +00:00
|
|
|
pub trait WindowsBusExtManual: 'static {
|
2021-05-02 09:41:18 +00:00
|
|
|
#[doc(alias = "get_pollfd")]
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_bus_get_pollfd")]
|
2021-04-11 19:39:50 +00:00
|
|
|
fn pollfd(&self) -> windows::io::RawHandle;
|
2018-03-19 10:53:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl WindowsBusExtManual for Bus {
|
2021-04-11 19:39:50 +00:00
|
|
|
fn pollfd(&self) -> windows::io::RawHandle {
|
2018-03-19 10:53:01 +00:00
|
|
|
#[cfg(windows)]
|
|
|
|
unsafe {
|
2019-07-11 13:02:46 +00:00
|
|
|
let mut pollfd = mem::MaybeUninit::zeroed();
|
2020-11-21 13:46:48 +00:00
|
|
|
ffi::gst_bus_get_pollfd(self.to_glib_none().0, pollfd.as_mut_ptr());
|
2019-07-11 13:02:46 +00:00
|
|
|
let pollfd = pollfd.assume_init();
|
2018-03-19 10:53:01 +00:00
|
|
|
pollfd.fd as *mut _
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:49 +00:00
|
|
|
#[cfg(all(not(windows), feature = "dox"))]
|
2018-03-19 10:53:01 +00:00
|
|
|
windows::io::RawHandle {}
|
|
|
|
}
|
|
|
|
}
|