mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 17:41:05 +00:00
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:
parent
044e3985a3
commit
d460310ed1
3 changed files with 13 additions and 9 deletions
|
@ -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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
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<
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
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))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue