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(unix)] {
|
|
|
|
use glib::translate::ToGlibPtr;
|
|
|
|
|
|
|
|
use std::mem;
|
|
|
|
use std::os::unix;
|
2020-11-27 13:37:49 +00:00
|
|
|
} else if #[cfg(feature = "dox")] {
|
2018-03-19 10:53:01 +00:00
|
|
|
// Declare a fake RawFd for doc generation on windows
|
|
|
|
pub mod unix {
|
|
|
|
pub mod io {
|
|
|
|
pub struct RawFd{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
use super::Bus;
|
|
|
|
|
2018-12-08 09:22:42 +00:00
|
|
|
pub trait UnixBusExtManual: 'static {
|
2018-03-19 10:53:01 +00:00
|
|
|
fn get_pollfd(&self) -> unix::io::RawFd;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl UnixBusExtManual for Bus {
|
|
|
|
fn get_pollfd(&self) -> unix::io::RawFd {
|
|
|
|
#[cfg(unix)]
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:49 +00:00
|
|
|
#[cfg(all(not(unix), feature = "dox"))]
|
2018-03-19 10:53:01 +00:00
|
|
|
unix::io::RawFd {}
|
|
|
|
}
|
|
|
|
}
|