Commit d460310e authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

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 062403bd
but a part was missing.
parent 044e3985
...@@ -67,6 +67,10 @@ final_type = true ...@@ -67,6 +67,10 @@ final_type = true
# Use Result<FlowSuccess, FlowError> # Use Result<FlowSuccess, FlowError>
ignore = true ignore = true
[[object.signal]]
name = "eos"
concurrency = "send"
[[object.function]] [[object.function]]
name = "set_caps" name = "set_caps"
[[object.function.parameter]] [[object.function.parameter]]
......
...@@ -59,7 +59,7 @@ pub struct AppSinkCallbacksBuilder { ...@@ -59,7 +59,7 @@ pub struct AppSinkCallbacksBuilder {
} }
impl 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 { Self {
eos: Some(RefCell::new(Box::new(eos))), eos: Some(RefCell::new(Box::new(eos))),
..self ..self
...@@ -67,7 +67,7 @@ impl AppSinkCallbacksBuilder { ...@@ -67,7 +67,7 @@ impl AppSinkCallbacksBuilder {
} }
pub fn new_preroll< 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, self,
new_preroll: F, new_preroll: F,
...@@ -79,7 +79,7 @@ impl AppSinkCallbacksBuilder { ...@@ -79,7 +79,7 @@ impl AppSinkCallbacksBuilder {
} }
pub fn new_sample< 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, self,
new_sample: F, new_sample: F,
...@@ -177,7 +177,7 @@ impl AppSink { ...@@ -177,7 +177,7 @@ impl AppSink {
} }
pub fn connect_new_sample< 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, &self,
f: F, f: F,
...@@ -194,7 +194,7 @@ impl AppSink { ...@@ -194,7 +194,7 @@ impl AppSink {
} }
pub fn connect_new_preroll< 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, &self,
f: F, f: F,
...@@ -212,7 +212,7 @@ impl AppSink { ...@@ -212,7 +212,7 @@ impl AppSink {
} }
unsafe extern "C" fn new_sample_trampoline< 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, this: *mut gst_app_sys::GstAppSink,
f: glib_sys::gpointer, f: glib_sys::gpointer,
...@@ -223,7 +223,7 @@ unsafe extern "C" fn new_sample_trampoline< ...@@ -223,7 +223,7 @@ unsafe extern "C" fn new_sample_trampoline<
} }
unsafe extern "C" fn new_preroll_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, this: *mut gst_app_sys::GstAppSink,
f: glib_sys::gpointer, f: glib_sys::gpointer,
......
...@@ -157,7 +157,7 @@ impl AppSink { ...@@ -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 { unsafe {
let f: Box_<F> = Box_::new(f); let f: Box_<F> = Box_::new(f);
connect_raw(self.as_ptr() as *mut _, b"eos\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"eos\0".as_ptr() as *const _,
...@@ -225,7 +225,7 @@ impl AppSink { ...@@ -225,7 +225,7 @@ impl AppSink {
unsafe impl Send for AppSink {} unsafe impl Send for AppSink {}
unsafe impl Sync 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); let f: &F = &*(f as *const F);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment