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-11-02 11:24:39 +00:00
|
|
|
|
2020-11-22 08:50:28 +00:00
|
|
|
use crate::TestClock;
|
2018-11-02 11:24:39 +00:00
|
|
|
use glib::translate::*;
|
|
|
|
use std::ptr;
|
|
|
|
|
|
|
|
impl TestClock {
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_test_clock_has_id")]
|
2018-11-02 11:24:39 +00:00
|
|
|
pub fn has_id(&self, id: &gst::ClockId) -> bool {
|
2018-11-03 18:28:58 +00:00
|
|
|
unsafe {
|
2020-11-22 08:50:28 +00:00
|
|
|
from_glib(ffi::gst_test_clock_has_id(
|
2018-11-03 18:28:58 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
id.to_glib_none().0,
|
|
|
|
))
|
|
|
|
}
|
2018-11-02 11:24:39 +00:00
|
|
|
}
|
|
|
|
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_test_clock_peek_next_pending_id")]
|
2018-11-02 11:24:39 +00:00
|
|
|
pub fn peek_next_pending_id(&self) -> Option<gst::ClockId> {
|
|
|
|
unsafe {
|
|
|
|
let mut id = ptr::null_mut();
|
2020-11-22 08:50:28 +00:00
|
|
|
let ret: bool = from_glib(ffi::gst_test_clock_peek_next_pending_id(
|
2018-11-03 18:28:58 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
&mut id,
|
|
|
|
));
|
2018-11-02 11:24:39 +00:00
|
|
|
if ret {
|
|
|
|
from_glib_full(id)
|
|
|
|
} else {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:49 +00:00
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_test_clock_process_id")]
|
2020-05-02 19:12:13 +00:00
|
|
|
pub fn process_id(&self, pending_id: &gst::ClockId) -> bool {
|
|
|
|
unsafe {
|
2020-11-22 08:50:28 +00:00
|
|
|
from_glib(ffi::gst_test_clock_process_id(
|
2020-05-02 19:12:13 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
pending_id.to_glib_none().0,
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_test_clock_process_id_list")]
|
2018-11-02 11:24:39 +00:00
|
|
|
pub fn process_id_list(&self, pending_list: &[&gst::ClockId]) -> u32 {
|
|
|
|
unsafe {
|
2020-11-22 08:50:28 +00:00
|
|
|
ffi::gst_test_clock_process_id_list(
|
2018-11-03 18:28:58 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
pending_list.to_glib_none().0,
|
|
|
|
)
|
2018-11-02 11:24:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_test_clock_process_next_clock_id")]
|
2018-11-02 11:24:39 +00:00
|
|
|
pub fn process_next_clock_id(&self) -> Option<gst::ClockId> {
|
|
|
|
unsafe {
|
2020-11-22 08:50:28 +00:00
|
|
|
from_glib_full(ffi::gst_test_clock_process_next_clock_id(
|
2018-11-03 18:28:58 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
))
|
2018-11-02 11:24:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_test_clock_wait_for_multiple_pending_ids")]
|
2018-11-02 11:24:39 +00:00
|
|
|
pub fn wait_for_multiple_pending_ids(&self, count: u32) -> Vec<gst::ClockId> {
|
|
|
|
unsafe {
|
|
|
|
let mut pending_list = ptr::null_mut();
|
2020-11-22 08:50:28 +00:00
|
|
|
ffi::gst_test_clock_wait_for_multiple_pending_ids(
|
2018-11-03 18:28:58 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
count,
|
|
|
|
&mut pending_list,
|
|
|
|
);
|
2018-11-02 11:24:39 +00:00
|
|
|
FromGlibPtrContainer::from_glib_full(pending_list)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_test_clock_wait_for_next_pending_id")]
|
2018-11-02 11:24:39 +00:00
|
|
|
pub fn wait_for_next_pending_id(&self) -> gst::ClockId {
|
|
|
|
unsafe {
|
|
|
|
let mut id = ptr::null_mut();
|
2020-11-22 08:50:28 +00:00
|
|
|
ffi::gst_test_clock_wait_for_next_pending_id(self.to_glib_none().0, &mut id);
|
2018-11-02 11:24:39 +00:00
|
|
|
from_glib_full(id)
|
|
|
|
}
|
|
|
|
}
|
2019-04-23 15:47:13 +00:00
|
|
|
|
2020-11-27 13:37:49 +00:00
|
|
|
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_test_clock_timed_wait_for_multiple_pending_ids")]
|
2019-04-23 15:47:13 +00:00
|
|
|
pub fn timed_wait_for_multiple_pending_ids(
|
|
|
|
&self,
|
|
|
|
count: u32,
|
|
|
|
timeout_ms: u32,
|
|
|
|
) -> (bool, Vec<gst::ClockId>) {
|
|
|
|
unsafe {
|
|
|
|
let mut pending_list = ptr::null_mut();
|
2020-11-22 08:50:28 +00:00
|
|
|
let res = ffi::gst_test_clock_timed_wait_for_multiple_pending_ids(
|
2019-04-23 15:47:13 +00:00
|
|
|
self.to_glib_none().0,
|
|
|
|
count,
|
|
|
|
timeout_ms,
|
|
|
|
&mut pending_list,
|
|
|
|
);
|
|
|
|
(
|
|
|
|
from_glib(res),
|
|
|
|
FromGlibPtrContainer::from_glib_full(pending_list),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2018-11-02 11:24:39 +00:00
|
|
|
}
|