forked from mirrors/gstreamer-rs
gstreamer: Add getters/setters for BinFlags and fix flags API for PadFlags
The BinFlags API was accidentally used for PadFlags, allowing to set BinFlags on pads which is not very useful.
This commit is contained in:
parent
8aac047af5
commit
775c5bfe27
2 changed files with 38 additions and 7 deletions
|
@ -7,6 +7,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
use Bin;
|
||||
use BinFlags;
|
||||
use Element;
|
||||
use LoggableError;
|
||||
|
||||
|
@ -48,6 +49,12 @@ pub trait GstBinExtManual: 'static {
|
|||
details: ::DebugGraphDetails,
|
||||
file_name: Q,
|
||||
);
|
||||
|
||||
fn set_bin_flags(&self, flags: BinFlags);
|
||||
|
||||
fn unset_bin_flags(&self, flags: BinFlags);
|
||||
|
||||
fn get_bin_flags(&self) -> BinFlags;
|
||||
}
|
||||
|
||||
impl<O: IsA<Bin>> GstBinExtManual for O {
|
||||
|
@ -170,6 +177,30 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
|
|||
) {
|
||||
::debug_bin_to_dot_file_with_ts(self, details, file_name)
|
||||
}
|
||||
|
||||
fn set_bin_flags(&self, flags: BinFlags) {
|
||||
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_bin_flags(&self, flags: BinFlags) {
|
||||
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_bin_flags(&self) -> BinFlags {
|
||||
unsafe {
|
||||
let ptr: *mut gst_sys::GstObject = self.as_ptr() as *mut _;
|
||||
let _guard = ::utils::MutexGuard::lock(&(*ptr).lock);
|
||||
from_glib((*ptr).flags)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe extern "C" fn do_latency_trampoline<
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
use miniobject::MiniObject;
|
||||
use BinFlags;
|
||||
use Buffer;
|
||||
use BufferList;
|
||||
use Event;
|
||||
|
@ -19,6 +18,7 @@ use FormattedValue;
|
|||
use GenericFormattedValue;
|
||||
use LoggableError;
|
||||
use Pad;
|
||||
use PadFlags;
|
||||
use PadLinkCheck;
|
||||
use PadLinkError;
|
||||
use PadLinkReturn;
|
||||
|
@ -261,11 +261,11 @@ pub trait PadExtManual: 'static {
|
|||
|
||||
fn store_sticky_event(&self, event: &Event) -> Result<FlowSuccess, FlowError>;
|
||||
|
||||
fn set_bin_flags(&self, flags: BinFlags);
|
||||
fn set_pad_flags(&self, flags: PadFlags);
|
||||
|
||||
fn unset_bin_flags(&self, flags: BinFlags);
|
||||
fn unset_pad_flags(&self, flags: PadFlags);
|
||||
|
||||
fn get_bin_flags(&self) -> BinFlags;
|
||||
fn get_pad_flags(&self) -> PadFlags;
|
||||
}
|
||||
|
||||
impl<O: IsA<Pad>> PadExtManual for O {
|
||||
|
@ -992,7 +992,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
ret.into_result()
|
||||
}
|
||||
|
||||
fn set_bin_flags(&self, flags: BinFlags) {
|
||||
fn set_pad_flags(&self, flags: PadFlags) {
|
||||
unsafe {
|
||||
let ptr: *mut gst_sys::GstObject = self.as_ptr() as *mut _;
|
||||
let _guard = ::utils::MutexGuard::lock(&(*ptr).lock);
|
||||
|
@ -1000,7 +1000,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn unset_bin_flags(&self, flags: BinFlags) {
|
||||
fn unset_pad_flags(&self, flags: PadFlags) {
|
||||
unsafe {
|
||||
let ptr: *mut gst_sys::GstObject = self.as_ptr() as *mut _;
|
||||
let _guard = ::utils::MutexGuard::lock(&(*ptr).lock);
|
||||
|
@ -1008,7 +1008,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_bin_flags(&self) -> BinFlags {
|
||||
fn get_pad_flags(&self) -> PadFlags {
|
||||
unsafe {
|
||||
let ptr: *mut gst_sys::GstObject = self.as_ptr() as *mut _;
|
||||
let _guard = ::utils::MutexGuard::lock(&(*ptr).lock);
|
||||
|
|
Loading…
Reference in a new issue