mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 04:51:09 +00:00
Return () instead of bool for some functions
See https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/171
This commit is contained in:
parent
333d71f92b
commit
b20e4454f1
4 changed files with 23 additions and 20 deletions
|
@ -867,6 +867,11 @@ trait = false
|
|||
# Work-around for 1.14 switch from transfer-floating to transfer-full
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "add_stream"
|
||||
# Ignore return value which is always `true`
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Plugin"
|
||||
status = "generate"
|
||||
|
|
|
@ -9,7 +9,6 @@ use ffi;
|
|||
use glib::GString;
|
||||
use glib::StaticType;
|
||||
use glib::Value;
|
||||
use glib::object::IsA;
|
||||
use glib::object::ObjectType;
|
||||
use glib::signal::SignalHandlerId;
|
||||
use glib::signal::connect_raw;
|
||||
|
@ -28,13 +27,6 @@ glib_wrapper! {
|
|||
}
|
||||
|
||||
impl StreamCollection {
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn add_stream<P: IsA<Stream>>(&self, stream: &P) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_stream_collection_add_stream(self.to_glib_none().0, stream.as_ref().to_glib_full()))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn get_size(&self) -> u32 {
|
||||
unsafe {
|
||||
|
|
|
@ -39,25 +39,22 @@ unsafe extern "C" fn trampoline_wait_async(
|
|||
func: gpointer,
|
||||
) -> gboolean {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
|
||||
let f: &&(Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static) = transmute(func);
|
||||
let f: &&(Fn(&Clock, ClockTime, &ClockId) + Send + 'static) = transmute(func);
|
||||
f(
|
||||
&from_glib_borrow(clock),
|
||||
from_glib(time),
|
||||
&from_glib_borrow(id),
|
||||
)
|
||||
.to_glib()
|
||||
);
|
||||
glib_ffi::GTRUE
|
||||
}
|
||||
|
||||
unsafe extern "C" fn destroy_closure_wait_async(ptr: gpointer) {
|
||||
Box::<Box<Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static>>::from_raw(ptr as *mut _);
|
||||
Box::<Box<Fn(&Clock, ClockTime, &ClockId) + Send + 'static>>::from_raw(ptr as *mut _);
|
||||
}
|
||||
|
||||
fn into_raw_wait_async<F: Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static>(
|
||||
func: F,
|
||||
) -> gpointer {
|
||||
fn into_raw_wait_async<F: Fn(&Clock, ClockTime, &ClockId) + Send + 'static>(func: F) -> gpointer {
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||
let func: Box<Box<Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static>> =
|
||||
Box::new(Box::new(func));
|
||||
let func: Box<Box<Fn(&Clock, ClockTime, &ClockId) + Send + 'static>> = Box::new(Box::new(func));
|
||||
Box::into_raw(func) as gpointer
|
||||
}
|
||||
|
||||
|
@ -81,7 +78,7 @@ impl ClockId {
|
|||
|
||||
pub fn wait_async<F>(&self, func: F) -> Result<ClockSuccess, ClockError>
|
||||
where
|
||||
F: Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static,
|
||||
F: Fn(&Clock, ClockTime, &ClockId) + Send + 'static,
|
||||
{
|
||||
let ret: ClockReturn = unsafe {
|
||||
from_glib(ffi::gst_clock_id_wait_async(
|
||||
|
@ -269,8 +266,6 @@ mod tests {
|
|||
let id = clock.new_single_shot_id(now + 20 * ::MSECOND).unwrap();
|
||||
let res = id.wait_async(move |_, _, _| {
|
||||
sender.send(()).unwrap();
|
||||
|
||||
true
|
||||
});
|
||||
|
||||
assert!(res == Ok(ClockSuccess::Ok));
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
use ffi;
|
||||
use glib::object::IsA;
|
||||
use glib::translate::*;
|
||||
use Stream;
|
||||
use StreamCollection;
|
||||
|
@ -80,6 +81,16 @@ impl StreamCollection {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
pub fn add_stream<P: IsA<Stream>>(&self, stream: &P) {
|
||||
unsafe {
|
||||
ffi::gst_stream_collection_add_stream(
|
||||
self.to_glib_none().0,
|
||||
stream.as_ref().to_glib_full(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> Iter {
|
||||
Iter::new(self)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue