appsink: Properly mark appsink callbacks as Send-only

They can only be called from a single thread at a time, unlike some of
the appsrc callbacks.

This change was partially done in 062403bdac
but a part was missing.
This commit is contained in:
Sebastian Dröge 2019-04-24 15:44:55 +03:00
parent 044e3985a3
commit d460310ed1
3 changed files with 13 additions and 9 deletions

View file

@ -67,6 +67,10 @@ final_type = true
# Use Result<FlowSuccess, FlowError>
ignore = true
[[object.signal]]
name = "eos"
concurrency = "send"
[[object.function]]
name = "set_caps"
[[object.function.parameter]]

View file

@ -59,7 +59,7 @@ pub struct AppSinkCallbacksBuilder {
}
impl AppSinkCallbacksBuilder {
pub fn eos<F: Fn(&AppSink) + Send + Sync + 'static>(self, eos: F) -> Self {
pub fn eos<F: Fn(&AppSink) + Send + 'static>(self, eos: F) -> Self {
Self {
eos: Some(RefCell::new(Box::new(eos))),
..self
@ -67,7 +67,7 @@ impl AppSinkCallbacksBuilder {
}
pub fn new_preroll<
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static,
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_preroll: F,
@ -79,7 +79,7 @@ impl AppSinkCallbacksBuilder {
}
pub fn new_sample<
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static,
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
self,
new_sample: F,
@ -177,7 +177,7 @@ impl AppSink {
}
pub fn connect_new_sample<
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static,
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
&self,
f: F,
@ -194,7 +194,7 @@ impl AppSink {
}
pub fn connect_new_preroll<
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static,
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
&self,
f: F,
@ -212,7 +212,7 @@ impl AppSink {
}
unsafe extern "C" fn new_sample_trampoline<
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static,
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
this: *mut gst_app_sys::GstAppSink,
f: glib_sys::gpointer,
@ -223,7 +223,7 @@ unsafe extern "C" fn new_sample_trampoline<
}
unsafe extern "C" fn new_preroll_trampoline<
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + Sync + 'static,
F: Fn(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static,
>(
this: *mut gst_app_sys::GstAppSink,
f: glib_sys::gpointer,

View file

@ -157,7 +157,7 @@ impl AppSink {
}
}
pub fn connect_eos<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
pub fn connect_eos<F: Fn(&AppSink) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"eos\0".as_ptr() as *const _,
@ -225,7 +225,7 @@ impl AppSink {
unsafe impl Send for AppSink {}
unsafe impl Sync for AppSink {}
unsafe extern "C" fn eos_trampoline<F: Fn(&AppSink) + Send + Sync + 'static>(this: *mut gst_app_sys::GstAppSink, f: glib_sys::gpointer) {
unsafe extern "C" fn eos_trampoline<F: Fn(&AppSink) + Send + 'static>(this: *mut gst_app_sys::GstAppSink, f: glib_sys::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}