forked from mirrors/gstreamer-rs
clock: Add support for setting/getting/unsetting clock flags
This commit is contained in:
parent
1faf41986b
commit
4e60a0aea4
1 changed files with 31 additions and 0 deletions
|
@ -18,6 +18,7 @@ use std::cmp;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use Clock;
|
use Clock;
|
||||||
use ClockError;
|
use ClockError;
|
||||||
|
use ClockFlags;
|
||||||
use ClockReturn;
|
use ClockReturn;
|
||||||
use ClockSuccess;
|
use ClockSuccess;
|
||||||
use ClockTime;
|
use ClockTime;
|
||||||
|
@ -183,6 +184,12 @@ pub trait ClockExtManual: 'static {
|
||||||
fn new_single_shot_id(&self, time: ClockTime) -> Option<ClockId>;
|
fn new_single_shot_id(&self, time: ClockTime) -> Option<ClockId>;
|
||||||
|
|
||||||
fn single_shot_id_reinit(&self, id: &ClockId, time: ClockTime) -> Result<(), glib::BoolError>;
|
fn single_shot_id_reinit(&self, id: &ClockId, time: ClockTime) -> Result<(), glib::BoolError>;
|
||||||
|
|
||||||
|
fn set_clock_flags(&self, flags: ClockFlags);
|
||||||
|
|
||||||
|
fn unset_clock_flags(&self, flags: ClockFlags);
|
||||||
|
|
||||||
|
fn get_clock_flags(&self) -> ClockFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O: IsA<Clock>> ClockExtManual for O {
|
impl<O: IsA<Clock>> ClockExtManual for O {
|
||||||
|
@ -241,6 +248,30 @@ impl<O: IsA<Clock>> ClockExtManual for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_clock_flags(&self, flags: ClockFlags) {
|
||||||
|
unsafe {
|
||||||
|
let ptr: *mut gst_sys::GstObject = self.as_ptr() as *mut _;
|
||||||
|
let _guard = ::utils::MutexGuard::lock(&(*ptr).lock);
|
||||||
|
(*ptr).flags |= flags.to_glib();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn unset_clock_flags(&self, flags: ClockFlags) {
|
||||||
|
unsafe {
|
||||||
|
let ptr: *mut gst_sys::GstObject = self.as_ptr() as *mut _;
|
||||||
|
let _guard = ::utils::MutexGuard::lock(&(*ptr).lock);
|
||||||
|
(*ptr).flags &= !flags.to_glib();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_clock_flags(&self) -> ClockFlags {
|
||||||
|
unsafe {
|
||||||
|
let ptr: *mut gst_sys::GstObject = self.as_ptr() as *mut _;
|
||||||
|
let _guard = ::utils::MutexGuard::lock(&(*ptr).lock);
|
||||||
|
from_glib((*ptr).flags)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in a new issue