Get rid of manual usage of callback_guard!

This commit is contained in:
Sebastian Dröge 2018-06-24 14:44:38 +03:00
parent 2085d170be
commit e0972ae1e5
24 changed files with 2 additions and 125 deletions

View file

@ -7,7 +7,6 @@
// except according to those terms.
use ffi;
use glib::source::CallbackGuard;
use glib::translate::*;
use glib_ffi::gpointer;
use gst;
@ -104,7 +103,6 @@ impl AppSinkCallbacksBuilder {
}
unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gpointer) {
let _guard = CallbackGuard::new();
let callbacks = &*(callbacks as *const AppSinkCallbacks);
callbacks
@ -117,7 +115,6 @@ unsafe extern "C" fn trampoline_new_preroll(
appsink: *mut ffi::GstAppSink,
callbacks: gpointer,
) -> gst_ffi::GstFlowReturn {
let _guard = CallbackGuard::new();
let callbacks = &*(callbacks as *const AppSinkCallbacks);
callbacks
@ -132,7 +129,6 @@ unsafe extern "C" fn trampoline_new_sample(
appsink: *mut ffi::GstAppSink,
callbacks: gpointer,
) -> gst_ffi::GstFlowReturn {
let _guard = CallbackGuard::new();
let callbacks = &*(callbacks as *const AppSinkCallbacks);
callbacks
@ -144,7 +140,6 @@ unsafe extern "C" fn trampoline_new_sample(
}
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<AppSinkCallbacks>::from_raw(ptr as *mut _);
}

View file

@ -7,7 +7,6 @@
// except according to those terms.
use ffi;
use glib::source::CallbackGuard;
use glib::translate::*;
use glib_ffi::{gboolean, gpointer};
use gst;
@ -110,7 +109,6 @@ unsafe extern "C" fn trampoline_need_data(
length: u32,
callbacks: gpointer,
) {
let _guard = CallbackGuard::new();
let callbacks = &*(callbacks as *const AppSrcCallbacks);
callbacks
@ -120,7 +118,6 @@ unsafe extern "C" fn trampoline_need_data(
}
unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbacks: gpointer) {
let _guard = CallbackGuard::new();
let callbacks = &*(callbacks as *const AppSrcCallbacks);
callbacks
@ -134,7 +131,6 @@ unsafe extern "C" fn trampoline_seek_data(
offset: u64,
callbacks: gpointer,
) -> gboolean {
let _guard = CallbackGuard::new();
let callbacks = &*(callbacks as *const AppSrcCallbacks);
callbacks
@ -146,7 +142,6 @@ unsafe extern "C" fn trampoline_seek_data(
}
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<AppSrcCallbacks>::from_raw(ptr as *mut _);
}

View file

@ -19,12 +19,6 @@ extern crate gstreamer_sys as gst_ffi;
#[macro_use]
extern crate glib;
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
macro_rules! skip_assert_initialized {
() => {};
}

View file

@ -18,12 +18,6 @@ extern crate gstreamer as gst;
extern crate gstreamer_audio_sys as ffi;
extern crate gstreamer_sys as gst_ffi;
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
macro_rules! assert_initialized_main_thread {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {

View file

@ -15,12 +15,6 @@ extern crate gstreamer_sys as gst_ffi;
#[macro_use]
extern crate glib;
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
macro_rules! assert_initialized_main_thread {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {

View file

@ -15,12 +15,6 @@ extern crate gstreamer_sys as gst_ffi;
#[macro_use]
extern crate glib;
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
macro_rules! assert_initialized_main_thread {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {

View file

@ -71,7 +71,6 @@ unsafe extern "C" fn notify_timeout_trampoline<P>(
) where
P: IsA<Discoverer>,
{
callback_guard!();
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&Discoverer::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -22,12 +22,6 @@ extern crate gstreamer_sys as gst_ffi;
static PBUTILS_INIT: Once = ONCE_INIT;
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
macro_rules! assert_initialized_main_thread {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {

View file

@ -18,12 +18,6 @@ extern crate gstreamer_video as gst_video;
#[macro_use]
extern crate glib;
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
macro_rules! skip_assert_initialized {
() => {};
}

View file

@ -105,7 +105,6 @@ unsafe extern "C" fn duration_changed_trampoline(
object: u64,
f: glib_ffi::gpointer,
) {
callback_guard!();
let f: &&(Fn(&Player, gst::ClockTime) + Send + 'static) = transmute(f);
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
}
@ -115,7 +114,6 @@ unsafe extern "C" fn position_updated_trampoline(
object: u64,
f: glib_ffi::gpointer,
) {
callback_guard!();
let f: &&(Fn(&Player, gst::ClockTime) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
}
@ -125,7 +123,6 @@ unsafe extern "C" fn seek_done_trampoline(
object: u64,
f: glib_ffi::gpointer,
) {
callback_guard!();
let f: &&(Fn(&Player, gst::ClockTime) + Send + 'static) = transmute(f);
f(&from_glib_borrow(this), gst::ClockTime(Some(object)))
}

View file

@ -27,12 +27,6 @@ extern crate gstreamer_rtsp_server_sys as ffi;
extern crate gstreamer_rtsp_sys as gst_rtsp_ffi;
extern crate gstreamer_sys as gst_ffi;
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
macro_rules! assert_initialized_main_thread {
() => {
if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {

View file

@ -1,7 +1,7 @@
use ffi;
use glib;
use glib::object::IsA;
use glib::source::{CallbackGuard, Continue, Priority};
use glib::source::{Continue, Priority};
use glib::translate::*;
use glib_ffi;
use glib_ffi::{gboolean, gpointer};
@ -13,14 +13,12 @@ unsafe extern "C" fn trampoline_watch(
pool: *mut ffi::GstRTSPSessionPool,
func: gpointer,
) -> gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &RefCell<Box<FnMut(&RTSPSessionPool) -> Continue + Send + 'static>> = transmute(func);
(&mut *func.borrow_mut())(&from_glib_borrow(pool)).to_glib()
}
unsafe extern "C" fn destroy_closure_watch(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<RefCell<Box<FnMut(&RTSPSessionPool) -> Continue + Send + 'static>>>::from_raw(
ptr as *mut _,
);

View file

@ -54,7 +54,6 @@ pub fn convert_sample_async<F>(
) where
F: FnOnce(Result<gst::Sample, glib::Error>) + Send + 'static,
{
callback_guard!();
let callback: &mut Option<Box<F>> = mem::transmute(user_data);
let callback = callback.take().unwrap();
@ -68,7 +67,6 @@ pub fn convert_sample_async<F>(
where
F: FnOnce(Result<gst::Sample, glib::Error>) + Send + 'static,
{
callback_guard!();
let _: Box<Option<Box<F>>> = Box::from_raw(user_data as *mut _);
}

View file

@ -32,12 +32,6 @@ macro_rules! skip_assert_initialized {
() => {};
}
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]

View file

@ -29,12 +29,6 @@ macro_rules! skip_assert_initialized {
() => {};
}
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value};
#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]

View file

@ -67,7 +67,6 @@ impl GstRc<BufferRef> {
}
unsafe extern "C" fn drop_box<T>(vec: glib_ffi::gpointer) {
callback_guard!();
let slice: Box<T> = Box::from_raw(vec as *mut T);
drop(slice);
}

View file

@ -8,7 +8,7 @@
use ffi;
use glib;
use glib::source::{CallbackGuard, Continue, Priority, SourceId};
use glib::source::{Continue, Priority, SourceId};
use glib::translate::*;
use glib_ffi;
use glib_ffi::{gboolean, gpointer};
@ -25,14 +25,12 @@ unsafe extern "C" fn trampoline_watch(
msg: *mut ffi::GstMessage,
func: gpointer,
) -> gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &RefCell<Box<FnMut(&Bus, &Message) -> Continue + Send + 'static>> = transmute(func);
(&mut *func.borrow_mut())(&from_glib_borrow(bus), &Message::from_glib_borrow(msg)).to_glib()
}
unsafe extern "C" fn destroy_closure_watch(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<RefCell<Box<FnMut(&Bus, &Message) -> Continue + Send + 'static>>>::from_raw(
ptr as *mut _,
);
@ -50,14 +48,12 @@ unsafe extern "C" fn trampoline_sync(
msg: *mut ffi::GstMessage,
func: gpointer,
) -> ffi::GstBusSyncReply {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let f: &&(Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static) = transmute(func);
f(&from_glib_borrow(bus), &Message::from_glib_borrow(msg)).to_glib()
}
unsafe extern "C" fn destroy_closure_sync(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<Box<Fn(&Bus, &Message) -> BusSyncReply + Send + Sync + 'static>>::from_raw(ptr as *mut _);
}

View file

@ -8,7 +8,6 @@
use ffi;
use glib;
use glib::source::CallbackGuard;
use glib::translate::*;
use glib::IsA;
use glib_ffi;
@ -38,7 +37,6 @@ unsafe extern "C" fn trampoline_wait_async(
id: gpointer,
func: gpointer,
) -> gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let f: &&(Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static) = transmute(func);
f(
@ -49,7 +47,6 @@ unsafe extern "C" fn trampoline_wait_async(
}
unsafe extern "C" fn destroy_closure_wait_async(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<Box<Fn(&Clock, ClockTime, &ClockId) -> bool + Send + 'static>>::from_raw(ptr as *mut _);
}

View file

@ -585,7 +585,6 @@ impl<O: IsA<Element>> ElementExtManual for O {
element: *mut ffi::GstElement,
user_data: glib_ffi::gpointer,
) {
callback_guard!();
let user_data: &mut Option<Box<F>> = &mut *(user_data as *mut _);
let callback = user_data.take().unwrap();

View file

@ -261,7 +261,6 @@ unsafe extern "C" fn rs_iterator_copy<T, I: IteratorImpl<T>>(
) where
for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static,
{
callback_guard!();
let it = it as *const RsIterator<T, I>;
let copy = copy as *mut RsIterator<T, I>;
@ -272,7 +271,6 @@ unsafe extern "C" fn rs_iterator_free<T, I: IteratorImpl<T>>(it: *mut ffi::GstIt
where
for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static,
{
callback_guard!();
let it = it as *mut RsIterator<T, I>;
let _ = (*it).imp.take();
}
@ -284,7 +282,6 @@ unsafe extern "C" fn rs_iterator_next<T, I: IteratorImpl<T>>(
where
for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static,
{
callback_guard!();
let it = it as *mut RsIterator<T, I>;
match (*it).imp.as_mut().map(|imp| imp.next()).unwrap() {
Some(Ok(value)) => {
@ -305,7 +302,6 @@ unsafe extern "C" fn rs_iterator_resync<T, I: IteratorImpl<T>>(it: *mut ffi::Gst
where
for<'a> T: FromValueOptional<'a> + StaticType + ToValue + Send + 'static,
{
callback_guard!();
let it = it as *mut RsIterator<T, I>;
(*it).imp.as_mut().map(|imp| imp.resync()).unwrap();
}
@ -353,7 +349,6 @@ unsafe extern "C" fn filter_trampoline<T>(value: gconstpointer, func: gconstpoin
where
for<'a> T: FromValueOptional<'a> + 'static,
{
callback_guard!();
let value = value as *const gobject_ffi::GValue;
let func = func as *const gobject_ffi::GValue;
@ -372,8 +367,6 @@ where
}
unsafe extern "C" fn filter_boxed_ref<T: 'static>(boxed: gpointer) -> gpointer {
callback_guard!();
let boxed = Arc::from_raw(boxed as *const (Box<Fn(T) -> bool + Send + Sync + 'static>));
let copy = Arc::clone(&boxed);
@ -384,16 +377,12 @@ unsafe extern "C" fn filter_boxed_ref<T: 'static>(boxed: gpointer) -> gpointer {
}
unsafe extern "C" fn filter_boxed_unref<T: 'static>(boxed: gpointer) {
callback_guard!();
let _ = Arc::from_raw(boxed as *const (Box<Fn(T) -> bool + Send + Sync + 'static>));
}
unsafe extern "C" fn filter_boxed_get_type<T: StaticType + 'static>() -> glib_ffi::GType {
use std::sync::{Once, ONCE_INIT};
callback_guard!();
static mut TYPE: glib_ffi::GType = gobject_ffi::G_TYPE_INVALID;
static ONCE: Once = ONCE_INIT;
@ -429,7 +418,6 @@ unsafe extern "C" fn find_trampoline<T>(value: gconstpointer, func: gconstpointe
where
for<'a> T: FromValueOptional<'a> + 'static,
{
callback_guard!();
let value = value as *const gobject_ffi::GValue;
let func = func as *const &mut (FnMut(T) -> bool);
@ -447,7 +435,6 @@ unsafe extern "C" fn foreach_trampoline<T>(value: *const gobject_ffi::GValue, fu
where
for<'a> T: FromValueOptional<'a> + 'static,
{
callback_guard!();
let func = func as *const &mut (FnMut(T));
let value = &*(value as *const glib::Value);
let value = value.get::<T>().unwrap();
@ -463,7 +450,6 @@ unsafe extern "C" fn fold_trampoline<T, U>(
where
for<'a> T: FromValueOptional<'a> + 'static,
{
callback_guard!();
let func = func as *const &mut (FnMut(U, T) -> Result<U, U>);
let value = &*(value as *const glib::Value);
let value = value.get::<T>().unwrap();

View file

@ -32,12 +32,6 @@ extern crate muldiv;
use glib::translate::{from_glib, from_glib_full};
macro_rules! callback_guard {
() => {
let _guard = ::glib::CallbackGuard::new();
};
}
macro_rules! assert_initialized_main_thread {
() => {
if unsafe { ::ffi::gst_is_initialized() } != ::glib_ffi::GTRUE {

View file

@ -28,7 +28,6 @@ use std::mem::transmute;
use std::ptr;
use glib;
use glib::source::CallbackGuard;
use glib::translate::{from_glib, from_glib_borrow, from_glib_full, from_glib_none, mut_override,
FromGlib, ToGlib, ToGlibPtr};
use glib::Object;
@ -861,7 +860,6 @@ unsafe extern "C" fn trampoline_pad_probe(
info: *mut ffi::GstPadProbeInfo,
func: gpointer,
) -> ffi::GstPadProbeReturn {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &mut PadProbeInfo) -> PadProbeReturn + Send + Sync + 'static) =
transmute(func);
@ -943,7 +941,6 @@ unsafe extern "C" fn trampoline_activate_function(
pad: *mut ffi::GstPad,
parent: *mut ffi::GstObject,
) -> glib_ffi::gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>) -> bool + Send + Sync + 'static) =
transmute((*pad).activatedata);
@ -957,7 +954,6 @@ unsafe extern "C" fn trampoline_activatemode_function(
mode: ffi::GstPadMode,
active: glib_ffi::gboolean,
) -> glib_ffi::gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>, ::PadMode, bool) -> bool
+ Send
@ -977,7 +973,6 @@ unsafe extern "C" fn trampoline_chain_function(
parent: *mut ffi::GstObject,
buffer: *mut ffi::GstBuffer,
) -> ffi::GstFlowReturn {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>, ::Buffer) -> ::FlowReturn
+ Send
@ -996,7 +991,6 @@ unsafe extern "C" fn trampoline_chain_list_function(
parent: *mut ffi::GstObject,
list: *mut ffi::GstBufferList,
) -> ffi::GstFlowReturn {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>, ::BufferList) -> ::FlowReturn
+ Send
@ -1015,7 +1009,6 @@ unsafe extern "C" fn trampoline_event_function(
parent: *mut ffi::GstObject,
event: *mut ffi::GstEvent,
) -> glib_ffi::gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>, ::Event) -> bool + Send + Sync + 'static) =
transmute((*pad).eventdata);
@ -1032,7 +1025,6 @@ unsafe extern "C" fn trampoline_event_full_function(
parent: *mut ffi::GstObject,
event: *mut ffi::GstEvent,
) -> ffi::GstFlowReturn {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>, ::Event) -> ::FlowReturn
+ Send
@ -1053,7 +1045,6 @@ unsafe extern "C" fn trampoline_getrange_function(
length: u32,
buffer: *mut *mut ffi::GstBuffer,
) -> ffi::GstFlowReturn {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>, u64, u32) -> Result<::Buffer, ::FlowReturn>
+ Send
@ -1078,7 +1069,6 @@ unsafe extern "C" fn trampoline_iterate_internal_links_function(
pad: *mut ffi::GstPad,
parent: *mut ffi::GstObject,
) -> *mut ffi::GstIterator {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>) -> ::Iterator<Pad> + Send + Sync + 'static) =
transmute((*pad).iterintlinkdata);
@ -1096,7 +1086,6 @@ unsafe extern "C" fn trampoline_link_function(
parent: *mut ffi::GstObject,
peer: *mut ffi::GstPad,
) -> ffi::GstPadLinkReturn {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>, &::Pad) -> ::PadLinkReturn
+ Send
@ -1115,7 +1104,6 @@ unsafe extern "C" fn trampoline_query_function(
parent: *mut ffi::GstObject,
query: *mut ffi::GstQuery,
) -> glib_ffi::gboolean {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>, &mut ::QueryRef) -> bool
+ Send
@ -1133,7 +1121,6 @@ unsafe extern "C" fn trampoline_unlink_function(
pad: *mut ffi::GstPad,
parent: *mut ffi::GstObject,
) {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &&(Fn(&Pad, &Option<::Object>) + Send + Sync + 'static) =
transmute((*pad).unlinkdata);
@ -1142,19 +1129,16 @@ unsafe extern "C" fn trampoline_unlink_function(
}
unsafe extern "C" fn destroy_closure(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<Box<Fn()>>::from_raw(ptr as *mut _);
}
unsafe extern "C" fn trampoline_pad_task(func: gpointer) {
let _guard = CallbackGuard::new();
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))]
let func: &RefCell<Box<FnMut() + Send + 'static>> = transmute(func);
(&mut *func.borrow_mut())()
}
unsafe extern "C" fn destroy_closure_pad_task(ptr: gpointer) {
let _guard = CallbackGuard::new();
Box::<RefCell<Box<FnMut() + Send + 'static>>>::from_raw(ptr as *mut _);
}

View file

@ -44,7 +44,6 @@ impl Promise {
promise: *mut ffi::GstPromise,
user_data: glib_ffi::gpointer,
) {
callback_guard!();
let user_data: &mut Option<Box<F>> = &mut *(user_data as *mut _);
let callback = user_data.take().unwrap();

View file

@ -116,18 +116,15 @@ unsafe extern "C" fn type_find_trampoline(
find: *mut ffi::GstTypeFind,
user_data: glib_ffi::gpointer,
) {
callback_guard!();
let func: &&(Fn(&mut TypeFind) + Send + Sync + 'static) = mem::transmute(user_data);
func(&mut *(find as *mut TypeFind));
}
unsafe extern "C" fn type_find_closure_drop(data: glib_ffi::gpointer) {
callback_guard!();
Box::<Box<Fn(&mut TypeFind) + Send + Sync + 'static>>::from_raw(data as *mut _);
}
unsafe extern "C" fn type_find_peek(data: glib_ffi::gpointer, offset: i64, size: u32) -> *const u8 {
callback_guard!();
let find: &mut &mut TypeFindImpl = &mut *(data as *mut &mut TypeFindImpl);
match find.peek(offset, size) {
None => ptr::null(),
@ -140,7 +137,6 @@ unsafe extern "C" fn type_find_suggest(
probability: u32,
caps: *mut ffi::GstCaps,
) {
callback_guard!();
let find: &mut &mut TypeFindImpl = &mut *(data as *mut &mut TypeFindImpl);
find.suggest(from_glib(probability as i32), &from_glib_borrow(caps));
}
@ -148,7 +144,6 @@ unsafe extern "C" fn type_find_suggest(
unsafe extern "C" fn type_find_get_length(data: glib_ffi::gpointer) -> u64 {
use std::u64;
callback_guard!();
let find: &mut &mut TypeFindImpl = &mut *(data as *mut &mut TypeFindImpl);
find.get_length().unwrap_or(u64::MAX)
}