2018-03-19 10:53:01 +00:00
|
|
|
// Copyright (C) 2016-2018 Sebastian Dröge <sebastian@centricular.com>
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
#[macro_use]
|
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-25 14:54:02 +00:00
|
|
|
} else if #[cfg(all(not(doctest), doc))] {
|
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 {
|
2018-03-19 10:53:01 +00:00
|
|
|
fn get_pollfd(&self) -> windows::io::RawHandle;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl WindowsBusExtManual for Bus {
|
|
|
|
fn get_pollfd(&self) -> windows::io::RawHandle {
|
|
|
|
#[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-25 14:54:02 +00:00
|
|
|
#[cfg(all(not(windows), all(not(doctest), doc)))]
|
2018-03-19 10:53:01 +00:00
|
|
|
windows::io::RawHandle {}
|
|
|
|
}
|
|
|
|
}
|