From a66fc95d2adc189987a86e4c29cdf5f344be8e93 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 16 Jun 2023 11:31:37 -0400 Subject: [PATCH] ges: Mark asset APIs as Send+sync Those objects are MT. safe Part-of: --- gstreamer-editing-services/Gir.toml | 37 ++++++++++++++++--- gstreamer-editing-services/src/auto/asset.rs | 27 +++++++++++--- .../src/auto/clip_asset.rs | 15 ++++++-- .../src/auto/effect_asset.rs | 3 ++ .../src/auto/source_clip_asset.rs | 3 ++ .../src/auto/track_element_asset.rs | 15 ++++++-- .../src/auto/uri_clip_asset.rs | 27 +++++++++++--- .../src/auto/uri_source_asset.rs | 3 ++ gstreamer-editing-services/src/formatter.rs | 2 +- 9 files changed, 107 insertions(+), 25 deletions(-) diff --git a/gstreamer-editing-services/Gir.toml b/gstreamer-editing-services/Gir.toml index 459eb2d00..f020e81a2 100644 --- a/gstreamer-editing-services/Gir.toml +++ b/gstreamer-editing-services/Gir.toml @@ -59,11 +59,9 @@ generate = [ "GES.BaseTransitionClip", "GES.BaseXmlFormatter", "GES.ChildrenControlMode", - "GES.ClipAsset", "GES.CommandLineFormatter", "GES.Edge", "GES.EditMode", - "GES.EffectAsset", "GES.EffectClip", "GES.Error", "GES.ExtractableCheckId", @@ -83,7 +81,6 @@ generate = [ "GES.PipelineFlags", "GES.Source", "GES.SourceClip", - "GES.SourceClipAsset", "GES.TestClip", "GES.TextHAlign", "GES.TextOverlay", @@ -91,12 +88,9 @@ generate = [ "GES.TextVAlign", "GES.TitleClip", "GES.TitleSource", - "GES.TrackElementAsset", "GES.TrackType", "GES.Transition", "GES.TransitionClip", - "GES.UriClipAsset", - "GES.UriSourceAsset", "GES.VideoSource", "GES.VideoStandardTransitionType", "GES.VideoTestPattern", @@ -110,6 +104,7 @@ generate = [ [[object]] name = "GES.Asset" status = "generate" +concurrency = "send+sync" [[object.function]] name = "set_proxy" [object.function.return] @@ -161,6 +156,11 @@ status = "generate" [object.function.return] nullable_return_is_error = "Failed to split clip" +[[object]] +name = "GES.ClipAsset" +status = "generate" +concurrency = "send+sync" + [[object]] name = "GES.Container" status = "generate" @@ -192,6 +192,11 @@ status = "generate" [object.function.return] nullable_return_is_error = "Failed to create effect from description" +[[object]] +name = "GES.EffectAsset" +status = "generate" +concurrency = "send+sync" + [[object]] name = "GES.Extractable" status = "generate" @@ -260,6 +265,11 @@ status = "generate" [object.function.return] bool_return_is_error = "Failed to remove asset" +[[object]] +name = "GES.SourceClipAsset" +status = "generate" +concurrency = "send+sync" + [[object]] name = "GES.Timeline" status = "generate" @@ -466,6 +476,11 @@ status = "generate" name = "value" const = true +[[object]] +name = "GES.TrackElementAsset" +status = "generate" +concurrency = "send+sync" + [[object]] name = "GES.UriClip" status = "generate" @@ -474,6 +489,16 @@ status = "generate" [object.function.return] nullable_return_is_error = "Failed to create Uri clip from Uri" +[[object]] +name = "GES.UriClipAsset" +status = "generate" +concurrency = "send+sync" + +[[object]] +name = "GES.UriSourceAsset" +status = "generate" +concurrency = "send+sync" + [[object]] name = "Gst.Buffer" status = "manual" diff --git a/gstreamer-editing-services/src/auto/asset.rs b/gstreamer-editing-services/src/auto/asset.rs index 3375cf00e..6e5222435 100644 --- a/gstreamer-editing-services/src/auto/asset.rs +++ b/gstreamer-editing-services/src/auto/asset.rs @@ -126,6 +126,9 @@ impl Asset { } } +unsafe impl Send for Asset {} +unsafe impl Sync for Asset {} + pub trait AssetExt: 'static { #[doc(alias = "ges_asset_extract")] fn extract(&self) -> Result; @@ -162,10 +165,13 @@ pub trait AssetExt: 'static { fn unproxy(&self, proxy: &impl IsA) -> Result<(), glib::error::BoolError>; #[doc(alias = "proxy")] - fn connect_proxy_notify(&self, f: F) -> SignalHandlerId; + fn connect_proxy_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "proxy-target")] - fn connect_proxy_target_notify(&self, f: F) -> SignalHandlerId; + fn connect_proxy_target_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> AssetExt for O { @@ -241,8 +247,11 @@ impl> AssetExt for O { } } - fn connect_proxy_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_proxy_trampoline, F: Fn(&P) + 'static>( + fn connect_proxy_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_proxy_trampoline< + P: IsA, + F: Fn(&P) + Send + Sync + 'static, + >( this: *mut ffi::GESAsset, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, @@ -263,8 +272,14 @@ impl> AssetExt for O { } } - fn connect_proxy_target_notify(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn notify_proxy_target_trampoline, F: Fn(&P) + 'static>( + fn connect_proxy_target_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_proxy_target_trampoline< + P: IsA, + F: Fn(&P) + Send + Sync + 'static, + >( this: *mut ffi::GESAsset, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, diff --git a/gstreamer-editing-services/src/auto/clip_asset.rs b/gstreamer-editing-services/src/auto/clip_asset.rs index 2ca53161e..5133aa4a2 100644 --- a/gstreamer-editing-services/src/auto/clip_asset.rs +++ b/gstreamer-editing-services/src/auto/clip_asset.rs @@ -30,6 +30,9 @@ impl ClipAsset { pub const NONE: Option<&'static ClipAsset> = None; } +unsafe impl Send for ClipAsset {} +unsafe impl Sync for ClipAsset {} + pub trait ClipAssetExt: 'static { #[cfg(feature = "v1_18")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] @@ -51,7 +54,10 @@ pub trait ClipAssetExt: 'static { fn set_supported_formats(&self, supportedformats: TrackType); #[doc(alias = "supported-formats")] - fn connect_supported_formats_notify(&self, f: F) -> SignalHandlerId; + fn connect_supported_formats_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> ClipAssetExt for O { @@ -102,10 +108,13 @@ impl> ClipAssetExt for O { } } - fn connect_supported_formats_notify(&self, f: F) -> SignalHandlerId { + fn connect_supported_formats_notify( + &self, + f: F, + ) -> SignalHandlerId { unsafe extern "C" fn notify_supported_formats_trampoline< P: IsA, - F: Fn(&P) + 'static, + F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GESClipAsset, _param_spec: glib::ffi::gpointer, diff --git a/gstreamer-editing-services/src/auto/effect_asset.rs b/gstreamer-editing-services/src/auto/effect_asset.rs index 0e0a82a3d..64bf33d7d 100644 --- a/gstreamer-editing-services/src/auto/effect_asset.rs +++ b/gstreamer-editing-services/src/auto/effect_asset.rs @@ -17,3 +17,6 @@ glib::wrapper! { impl EffectAsset { pub const NONE: Option<&'static EffectAsset> = None; } + +unsafe impl Send for EffectAsset {} +unsafe impl Sync for EffectAsset {} diff --git a/gstreamer-editing-services/src/auto/source_clip_asset.rs b/gstreamer-editing-services/src/auto/source_clip_asset.rs index b89c64482..be20926be 100644 --- a/gstreamer-editing-services/src/auto/source_clip_asset.rs +++ b/gstreamer-editing-services/src/auto/source_clip_asset.rs @@ -17,3 +17,6 @@ glib::wrapper! { impl SourceClipAsset { pub const NONE: Option<&'static SourceClipAsset> = None; } + +unsafe impl Send for SourceClipAsset {} +unsafe impl Sync for SourceClipAsset {} diff --git a/gstreamer-editing-services/src/auto/track_element_asset.rs b/gstreamer-editing-services/src/auto/track_element_asset.rs index e7b8403d8..ba19b428c 100644 --- a/gstreamer-editing-services/src/auto/track_element_asset.rs +++ b/gstreamer-editing-services/src/auto/track_element_asset.rs @@ -27,6 +27,9 @@ impl TrackElementAsset { pub const NONE: Option<&'static TrackElementAsset> = None; } +unsafe impl Send for TrackElementAsset {} +unsafe impl Sync for TrackElementAsset {} + pub trait TrackElementAssetExt: 'static { #[cfg(feature = "v1_18")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] @@ -42,7 +45,10 @@ pub trait TrackElementAssetExt: 'static { fn set_track_type(&self, type_: TrackType); #[doc(alias = "track-type")] - fn connect_track_type_notify(&self, f: F) -> SignalHandlerId; + fn connect_track_type_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> TrackElementAssetExt for O { @@ -82,10 +88,13 @@ impl> TrackElementAssetExt for O { } } - fn connect_track_type_notify(&self, f: F) -> SignalHandlerId { + fn connect_track_type_notify( + &self, + f: F, + ) -> SignalHandlerId { unsafe extern "C" fn notify_track_type_trampoline< P: IsA, - F: Fn(&P) + 'static, + F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GESTrackElementAsset, _param_spec: glib::ffi::gpointer, diff --git a/gstreamer-editing-services/src/auto/uri_clip_asset.rs b/gstreamer-editing-services/src/auto/uri_clip_asset.rs index f29bcc54e..36df8e4d1 100644 --- a/gstreamer-editing-services/src/auto/uri_clip_asset.rs +++ b/gstreamer-editing-services/src/auto/uri_clip_asset.rs @@ -65,6 +65,9 @@ impl UriClipAsset { } } +unsafe impl Send for UriClipAsset {} +unsafe impl Sync for UriClipAsset {} + pub trait UriClipAssetExt: 'static { #[doc(alias = "ges_uri_clip_asset_get_duration")] #[doc(alias = "get_duration")] @@ -97,12 +100,18 @@ pub trait UriClipAssetExt: 'static { fn is_nested_timeline(&self) -> bool; #[doc(alias = "duration")] - fn connect_duration_notify(&self, f: F) -> SignalHandlerId; + fn connect_duration_notify( + &self, + f: F, + ) -> SignalHandlerId; #[cfg(feature = "v1_18")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[doc(alias = "is-nested-timeline")] - fn connect_is_nested_timeline_notify(&self, f: F) -> SignalHandlerId; + fn connect_is_nested_timeline_notify( + &self, + f: F, + ) -> SignalHandlerId; } impl> UriClipAssetExt for O { @@ -160,10 +169,13 @@ impl> UriClipAssetExt for O { glib::ObjectExt::property(self.as_ref(), "is-nested-timeline") } - fn connect_duration_notify(&self, f: F) -> SignalHandlerId { + fn connect_duration_notify( + &self, + f: F, + ) -> SignalHandlerId { unsafe extern "C" fn notify_duration_trampoline< P: IsA, - F: Fn(&P) + 'static, + F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GESUriClipAsset, _param_spec: glib::ffi::gpointer, @@ -187,10 +199,13 @@ impl> UriClipAssetExt for O { #[cfg(feature = "v1_18")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] - fn connect_is_nested_timeline_notify(&self, f: F) -> SignalHandlerId { + fn connect_is_nested_timeline_notify( + &self, + f: F, + ) -> SignalHandlerId { unsafe extern "C" fn notify_is_nested_timeline_trampoline< P: IsA, - F: Fn(&P) + 'static, + F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GESUriClipAsset, _param_spec: glib::ffi::gpointer, diff --git a/gstreamer-editing-services/src/auto/uri_source_asset.rs b/gstreamer-editing-services/src/auto/uri_source_asset.rs index 8f8ad0f16..2a29bee46 100644 --- a/gstreamer-editing-services/src/auto/uri_source_asset.rs +++ b/gstreamer-editing-services/src/auto/uri_source_asset.rs @@ -19,6 +19,9 @@ impl UriSourceAsset { pub const NONE: Option<&'static UriSourceAsset> = None; } +unsafe impl Send for UriSourceAsset {} +unsafe impl Sync for UriSourceAsset {} + pub trait UriSourceAssetExt: 'static { #[doc(alias = "ges_uri_source_asset_get_filesource_asset")] #[doc(alias = "get_filesource_asset")] diff --git a/gstreamer-editing-services/src/formatter.rs b/gstreamer-editing-services/src/formatter.rs index 4f53f1ed5..f8cdca8b0 100644 --- a/gstreamer-editing-services/src/formatter.rs +++ b/gstreamer-editing-services/src/formatter.rs @@ -67,7 +67,7 @@ impl> FormatterExtManual for O { caps.to_glib_none().0, version, rank.into_glib(), - ); + ) } } }