diff --git a/gstreamer-app/src/app_sink.rs b/gstreamer-app/src/app_sink.rs index c75d17c87..ee7f363bb 100644 --- a/gstreamer-app/src/app_sink.rs +++ b/gstreamer-app/src/app_sink.rs @@ -17,6 +17,7 @@ use gst_app_sys; use gst_sys; use std::boxed::Box as Box_; use std::cell::RefCell; +use std::mem::transmute; use std::panic; use std::ptr; use std::sync::atomic::{AtomicBool, Ordering}; @@ -294,7 +295,9 @@ impl AppSink { connect_raw( self.as_ptr() as *mut _, b"new-sample\0".as_ptr() as *const _, - Some(*(&new_sample_trampoline:: as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn()>( + new_sample_trampoline:: as *const (), + )), Box_::into_raw(f), ) } @@ -311,7 +314,9 @@ impl AppSink { connect_raw( self.as_ptr() as *mut _, b"new-preroll\0".as_ptr() as *const _, - Some(*(&new_preroll_trampoline:: as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn()>( + new_preroll_trampoline:: as *const (), + )), Box_::into_raw(f), ) } diff --git a/gstreamer-base/src/aggregator.rs b/gstreamer-base/src/aggregator.rs index 66aa4fa74..2b5643df9 100644 --- a/gstreamer-base/src/aggregator.rs +++ b/gstreamer-base/src/aggregator.rs @@ -19,6 +19,8 @@ use gst_base_sys; #[cfg(any(feature = "v1_16", feature = "dox"))] use std::boxed::Box as Box_; use std::mem; +#[cfg(any(feature = "v1_16", feature = "dox"))] +use std::mem::transmute; use std::ptr; use Aggregator; @@ -100,7 +102,9 @@ impl> AggregatorExtManual for O { connect_raw( self.as_ptr() as *mut _, b"notify::min-upstream-latency\0".as_ptr() as *const _, - Some(*(¬ify_min_upstream_latency_trampoline:: as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn()>( + notify_min_upstream_latency_trampoline:: as *const (), + )), Box_::into_raw(f), ) } diff --git a/gstreamer-pbutils/src/discoverer.rs b/gstreamer-pbutils/src/discoverer.rs index acb9c947e..4737c8738 100644 --- a/gstreamer-pbutils/src/discoverer.rs +++ b/gstreamer-pbutils/src/discoverer.rs @@ -23,6 +23,7 @@ use gobject_sys; use gst_pbutils_sys; use std::boxed::Box as Box_; +use std::mem::transmute; impl Discoverer { pub fn set_property_timeout(&self, timeout: gst::ClockTime) { @@ -59,7 +60,9 @@ impl Discoverer { connect_raw( self.as_ptr() as *mut _, b"notify::timeout\0".as_ptr() as *const _, - Some(*(¬ify_timeout_trampoline:: as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn()>( + notify_timeout_trampoline:: as *const (), + )), Box_::into_raw(f), ) } diff --git a/gstreamer-player/src/player.rs b/gstreamer-player/src/player.rs index d6587c511..d9ba4f2e0 100644 --- a/gstreamer-player/src/player.rs +++ b/gstreamer-player/src/player.rs @@ -15,6 +15,7 @@ use glib_sys; use gst; use gst_player_sys; use std::boxed::Box as Box_; +use std::mem::transmute; use Player; use PlayerSignalDispatcher; use PlayerVideoRenderer; @@ -71,7 +72,9 @@ impl Player { connect_raw( self.as_ptr() as *mut _, b"duration-changed\0".as_ptr() as *const _, - Some(*(&duration_changed_trampoline:: as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn()>( + duration_changed_trampoline:: as *const (), + )), Box_::into_raw(f), ) } @@ -87,7 +90,9 @@ impl Player { connect_raw( self.as_ptr() as *mut _, b"position-updated\0".as_ptr() as *const _, - Some(*(&position_updated_trampoline:: as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn()>( + position_updated_trampoline:: as *const (), + )), Box_::into_raw(f), ) } @@ -103,7 +108,9 @@ impl Player { connect_raw( self.as_ptr() as *mut _, b"seek-done\0".as_ptr() as *const _, - Some(*(&seek_done_trampoline:: as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn()>( + seek_done_trampoline:: as *const (), + )), Box_::into_raw(f), ) } diff --git a/gstreamer-rtsp-server/src/rtsp_auth.rs b/gstreamer-rtsp-server/src/rtsp_auth.rs index 100c67bac..2503e3319 100644 --- a/gstreamer-rtsp-server/src/rtsp_auth.rs +++ b/gstreamer-rtsp-server/src/rtsp_auth.rs @@ -6,6 +6,7 @@ use glib::translate::*; use gst_rtsp_server_sys; use std::boxed::Box as Box_; +use std::mem::transmute; use RTSPAuth; use RTSPToken; @@ -58,7 +59,9 @@ impl> RTSPAuthExtManual for O { connect_raw( self.as_ptr() as *mut _, b"accept-certificate\0".as_ptr() as *const _, - Some(*(&accept_certificate_trampoline:: as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn()>( + accept_certificate_trampoline:: as *const (), + )), Box_::into_raw(f), ) } diff --git a/gstreamer-rtsp-server/src/rtsp_session_pool.rs b/gstreamer-rtsp-server/src/rtsp_session_pool.rs index d51d23e23..e8555b080 100644 --- a/gstreamer-rtsp-server/src/rtsp_session_pool.rs +++ b/gstreamer-rtsp-server/src/rtsp_session_pool.rs @@ -6,6 +6,7 @@ use glib_sys; use glib_sys::{gboolean, gpointer}; use gst_rtsp_server_sys; use std::cell::RefCell; +use std::mem::transmute; use RTSPSessionPool; unsafe extern "C" fn trampoline_watch Continue + Send + 'static>( @@ -48,7 +49,10 @@ impl> RTSPSessionPoolExtManual for O { ); glib_sys::g_source_set_callback( source, - Some(*(&trampoline_watch:: as *const _ as *const _)), + Some(transmute::< + _, + unsafe extern "C" fn(glib_sys::gpointer) -> i32, + >(trampoline_watch:: as *const ())), into_raw_watch(func), Some(destroy_closure_watch::), ); diff --git a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs index b2de19d70..dc7e2a738 100644 --- a/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs +++ b/gstreamer-rtsp-server/src/subclass/rtsp_media_factory.rs @@ -16,6 +16,8 @@ use glib::subclass::prelude::*; use RTSPMediaFactory; use RTSPMediaFactoryClass; +use std::mem::transmute; + pub trait RTSPMediaFactoryImpl: RTSPMediaFactoryImplExt + ObjectImpl + Send + Sync + 'static { @@ -290,7 +292,9 @@ where media as *mut _, PIPELINE_QUARK.to_glib(), pipeline as *mut _, - Some(*(&gobject_sys::g_object_unref as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn(glib_sys::gpointer)>( + gobject_sys::g_object_unref as *const (), + )), ); pipeline as *mut _ diff --git a/gstreamer/src/bin.rs b/gstreamer/src/bin.rs index 1406e7cce..ab97e95ca 100644 --- a/gstreamer/src/bin.rs +++ b/gstreamer/src/bin.rs @@ -22,6 +22,7 @@ use glib::GString; use gst_sys; use std::boxed::Box as Box_; +use std::mem::transmute; use std::path; pub trait GstBinExtManual: 'static { @@ -98,7 +99,9 @@ impl> GstBinExtManual for O { connect_raw( self.as_ptr() as *mut _, b"do-latency\0".as_ptr() as *const _, - Some(*(&do_latency_trampoline:: as *const _ as *const _)), + Some(transmute::<_, unsafe extern "C" fn()>( + do_latency_trampoline:: as *const (), + )), Box_::into_raw(f), ) } diff --git a/gstreamer/src/bus.rs b/gstreamer/src/bus.rs index 1a17a5cb9..9fdbb80ea 100644 --- a/gstreamer/src/bus.rs +++ b/gstreamer/src/bus.rs @@ -16,6 +16,7 @@ use glib_sys; use glib_sys::{gboolean, gpointer}; use gst_sys; use std::cell::RefCell; +use std::mem::transmute; use std::pin::Pin; use std::task::{Context, Poll}; @@ -93,7 +94,10 @@ impl Bus { let source = gst_sys::gst_bus_create_watch(self.to_glib_none().0); glib_sys::g_source_set_callback( source, - Some(*(&trampoline_watch:: as *const _ as *const _)), + Some(transmute::< + _, + unsafe extern "C" fn(glib_sys::gpointer) -> i32, + >(trampoline_watch:: as *const ())), into_raw_watch(func), Some(destroy_closure_watch::), );