ges: Mark asset APIs as Send+sync

Those objects are MT. safe

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1278>
This commit is contained in:
Thibault Saunier 2023-06-16 11:31:37 -04:00 committed by GStreamer Marge Bot
parent 7f7c7a4165
commit a66fc95d2a
9 changed files with 107 additions and 25 deletions

View file

@ -59,11 +59,9 @@ generate = [
"GES.BaseTransitionClip", "GES.BaseTransitionClip",
"GES.BaseXmlFormatter", "GES.BaseXmlFormatter",
"GES.ChildrenControlMode", "GES.ChildrenControlMode",
"GES.ClipAsset",
"GES.CommandLineFormatter", "GES.CommandLineFormatter",
"GES.Edge", "GES.Edge",
"GES.EditMode", "GES.EditMode",
"GES.EffectAsset",
"GES.EffectClip", "GES.EffectClip",
"GES.Error", "GES.Error",
"GES.ExtractableCheckId", "GES.ExtractableCheckId",
@ -83,7 +81,6 @@ generate = [
"GES.PipelineFlags", "GES.PipelineFlags",
"GES.Source", "GES.Source",
"GES.SourceClip", "GES.SourceClip",
"GES.SourceClipAsset",
"GES.TestClip", "GES.TestClip",
"GES.TextHAlign", "GES.TextHAlign",
"GES.TextOverlay", "GES.TextOverlay",
@ -91,12 +88,9 @@ generate = [
"GES.TextVAlign", "GES.TextVAlign",
"GES.TitleClip", "GES.TitleClip",
"GES.TitleSource", "GES.TitleSource",
"GES.TrackElementAsset",
"GES.TrackType", "GES.TrackType",
"GES.Transition", "GES.Transition",
"GES.TransitionClip", "GES.TransitionClip",
"GES.UriClipAsset",
"GES.UriSourceAsset",
"GES.VideoSource", "GES.VideoSource",
"GES.VideoStandardTransitionType", "GES.VideoStandardTransitionType",
"GES.VideoTestPattern", "GES.VideoTestPattern",
@ -110,6 +104,7 @@ generate = [
[[object]] [[object]]
name = "GES.Asset" name = "GES.Asset"
status = "generate" status = "generate"
concurrency = "send+sync"
[[object.function]] [[object.function]]
name = "set_proxy" name = "set_proxy"
[object.function.return] [object.function.return]
@ -161,6 +156,11 @@ status = "generate"
[object.function.return] [object.function.return]
nullable_return_is_error = "Failed to split clip" nullable_return_is_error = "Failed to split clip"
[[object]]
name = "GES.ClipAsset"
status = "generate"
concurrency = "send+sync"
[[object]] [[object]]
name = "GES.Container" name = "GES.Container"
status = "generate" status = "generate"
@ -192,6 +192,11 @@ status = "generate"
[object.function.return] [object.function.return]
nullable_return_is_error = "Failed to create effect from description" nullable_return_is_error = "Failed to create effect from description"
[[object]]
name = "GES.EffectAsset"
status = "generate"
concurrency = "send+sync"
[[object]] [[object]]
name = "GES.Extractable" name = "GES.Extractable"
status = "generate" status = "generate"
@ -260,6 +265,11 @@ status = "generate"
[object.function.return] [object.function.return]
bool_return_is_error = "Failed to remove asset" bool_return_is_error = "Failed to remove asset"
[[object]]
name = "GES.SourceClipAsset"
status = "generate"
concurrency = "send+sync"
[[object]] [[object]]
name = "GES.Timeline" name = "GES.Timeline"
status = "generate" status = "generate"
@ -466,6 +476,11 @@ status = "generate"
name = "value" name = "value"
const = true const = true
[[object]]
name = "GES.TrackElementAsset"
status = "generate"
concurrency = "send+sync"
[[object]] [[object]]
name = "GES.UriClip" name = "GES.UriClip"
status = "generate" status = "generate"
@ -474,6 +489,16 @@ status = "generate"
[object.function.return] [object.function.return]
nullable_return_is_error = "Failed to create Uri clip from Uri" 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]] [[object]]
name = "Gst.Buffer" name = "Gst.Buffer"
status = "manual" status = "manual"

View file

@ -126,6 +126,9 @@ impl Asset {
} }
} }
unsafe impl Send for Asset {}
unsafe impl Sync for Asset {}
pub trait AssetExt: 'static { pub trait AssetExt: 'static {
#[doc(alias = "ges_asset_extract")] #[doc(alias = "ges_asset_extract")]
fn extract(&self) -> Result<Extractable, glib::Error>; fn extract(&self) -> Result<Extractable, glib::Error>;
@ -162,10 +165,13 @@ pub trait AssetExt: 'static {
fn unproxy(&self, proxy: &impl IsA<Asset>) -> Result<(), glib::error::BoolError>; fn unproxy(&self, proxy: &impl IsA<Asset>) -> Result<(), glib::error::BoolError>;
#[doc(alias = "proxy")] #[doc(alias = "proxy")]
fn connect_proxy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_proxy_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
#[doc(alias = "proxy-target")] #[doc(alias = "proxy-target")]
fn connect_proxy_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_proxy_target_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
} }
impl<O: IsA<Asset>> AssetExt for O { impl<O: IsA<Asset>> AssetExt for O {
@ -241,8 +247,11 @@ impl<O: IsA<Asset>> AssetExt for O {
} }
} }
fn connect_proxy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_proxy_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_proxy_trampoline<P: IsA<Asset>, F: Fn(&P) + 'static>( unsafe extern "C" fn notify_proxy_trampoline<
P: IsA<Asset>,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GESAsset, this: *mut ffi::GESAsset,
_param_spec: glib::ffi::gpointer, _param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
@ -263,8 +272,14 @@ impl<O: IsA<Asset>> AssetExt for O {
} }
} }
fn connect_proxy_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_proxy_target_notify<F: Fn(&Self) + Send + Sync + 'static>(
unsafe extern "C" fn notify_proxy_target_trampoline<P: IsA<Asset>, F: Fn(&P) + 'static>( &self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_proxy_target_trampoline<
P: IsA<Asset>,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GESAsset, this: *mut ffi::GESAsset,
_param_spec: glib::ffi::gpointer, _param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer, f: glib::ffi::gpointer,

View file

@ -30,6 +30,9 @@ impl ClipAsset {
pub const NONE: Option<&'static ClipAsset> = None; pub const NONE: Option<&'static ClipAsset> = None;
} }
unsafe impl Send for ClipAsset {}
unsafe impl Sync for ClipAsset {}
pub trait ClipAssetExt: 'static { pub trait ClipAssetExt: 'static {
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(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); fn set_supported_formats(&self, supportedformats: TrackType);
#[doc(alias = "supported-formats")] #[doc(alias = "supported-formats")]
fn connect_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_supported_formats_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
} }
impl<O: IsA<ClipAsset>> ClipAssetExt for O { impl<O: IsA<ClipAsset>> ClipAssetExt for O {
@ -102,10 +108,13 @@ impl<O: IsA<ClipAsset>> ClipAssetExt for O {
} }
} }
fn connect_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_supported_formats_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_supported_formats_trampoline< unsafe extern "C" fn notify_supported_formats_trampoline<
P: IsA<ClipAsset>, P: IsA<ClipAsset>,
F: Fn(&P) + 'static, F: Fn(&P) + Send + Sync + 'static,
>( >(
this: *mut ffi::GESClipAsset, this: *mut ffi::GESClipAsset,
_param_spec: glib::ffi::gpointer, _param_spec: glib::ffi::gpointer,

View file

@ -17,3 +17,6 @@ glib::wrapper! {
impl EffectAsset { impl EffectAsset {
pub const NONE: Option<&'static EffectAsset> = None; pub const NONE: Option<&'static EffectAsset> = None;
} }
unsafe impl Send for EffectAsset {}
unsafe impl Sync for EffectAsset {}

View file

@ -17,3 +17,6 @@ glib::wrapper! {
impl SourceClipAsset { impl SourceClipAsset {
pub const NONE: Option<&'static SourceClipAsset> = None; pub const NONE: Option<&'static SourceClipAsset> = None;
} }
unsafe impl Send for SourceClipAsset {}
unsafe impl Sync for SourceClipAsset {}

View file

@ -27,6 +27,9 @@ impl TrackElementAsset {
pub const NONE: Option<&'static TrackElementAsset> = None; pub const NONE: Option<&'static TrackElementAsset> = None;
} }
unsafe impl Send for TrackElementAsset {}
unsafe impl Sync for TrackElementAsset {}
pub trait TrackElementAssetExt: 'static { pub trait TrackElementAssetExt: 'static {
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(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); fn set_track_type(&self, type_: TrackType);
#[doc(alias = "track-type")] #[doc(alias = "track-type")]
fn connect_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_track_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
} }
impl<O: IsA<TrackElementAsset>> TrackElementAssetExt for O { impl<O: IsA<TrackElementAsset>> TrackElementAssetExt for O {
@ -82,10 +88,13 @@ impl<O: IsA<TrackElementAsset>> TrackElementAssetExt for O {
} }
} }
fn connect_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_track_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_track_type_trampoline< unsafe extern "C" fn notify_track_type_trampoline<
P: IsA<TrackElementAsset>, P: IsA<TrackElementAsset>,
F: Fn(&P) + 'static, F: Fn(&P) + Send + Sync + 'static,
>( >(
this: *mut ffi::GESTrackElementAsset, this: *mut ffi::GESTrackElementAsset,
_param_spec: glib::ffi::gpointer, _param_spec: glib::ffi::gpointer,

View file

@ -65,6 +65,9 @@ impl UriClipAsset {
} }
} }
unsafe impl Send for UriClipAsset {}
unsafe impl Sync for UriClipAsset {}
pub trait UriClipAssetExt: 'static { pub trait UriClipAssetExt: 'static {
#[doc(alias = "ges_uri_clip_asset_get_duration")] #[doc(alias = "ges_uri_clip_asset_get_duration")]
#[doc(alias = "get_duration")] #[doc(alias = "get_duration")]
@ -97,12 +100,18 @@ pub trait UriClipAssetExt: 'static {
fn is_nested_timeline(&self) -> bool; fn is_nested_timeline(&self) -> bool;
#[doc(alias = "duration")] #[doc(alias = "duration")]
fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "is-nested-timeline")] #[doc(alias = "is-nested-timeline")]
fn connect_is_nested_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_is_nested_timeline_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId;
} }
impl<O: IsA<UriClipAsset>> UriClipAssetExt for O { impl<O: IsA<UriClipAsset>> UriClipAssetExt for O {
@ -160,10 +169,13 @@ impl<O: IsA<UriClipAsset>> UriClipAssetExt for O {
glib::ObjectExt::property(self.as_ref(), "is-nested-timeline") glib::ObjectExt::property(self.as_ref(), "is-nested-timeline")
} }
fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_duration_trampoline< unsafe extern "C" fn notify_duration_trampoline<
P: IsA<UriClipAsset>, P: IsA<UriClipAsset>,
F: Fn(&P) + 'static, F: Fn(&P) + Send + Sync + 'static,
>( >(
this: *mut ffi::GESUriClipAsset, this: *mut ffi::GESUriClipAsset,
_param_spec: glib::ffi::gpointer, _param_spec: glib::ffi::gpointer,
@ -187,10 +199,13 @@ impl<O: IsA<UriClipAsset>> UriClipAssetExt for O {
#[cfg(feature = "v1_18")] #[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn connect_is_nested_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_is_nested_timeline_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_is_nested_timeline_trampoline< unsafe extern "C" fn notify_is_nested_timeline_trampoline<
P: IsA<UriClipAsset>, P: IsA<UriClipAsset>,
F: Fn(&P) + 'static, F: Fn(&P) + Send + Sync + 'static,
>( >(
this: *mut ffi::GESUriClipAsset, this: *mut ffi::GESUriClipAsset,
_param_spec: glib::ffi::gpointer, _param_spec: glib::ffi::gpointer,

View file

@ -19,6 +19,9 @@ impl UriSourceAsset {
pub const NONE: Option<&'static UriSourceAsset> = None; pub const NONE: Option<&'static UriSourceAsset> = None;
} }
unsafe impl Send for UriSourceAsset {}
unsafe impl Sync for UriSourceAsset {}
pub trait UriSourceAssetExt: 'static { pub trait UriSourceAssetExt: 'static {
#[doc(alias = "ges_uri_source_asset_get_filesource_asset")] #[doc(alias = "ges_uri_source_asset_get_filesource_asset")]
#[doc(alias = "get_filesource_asset")] #[doc(alias = "get_filesource_asset")]

View file

@ -67,7 +67,7 @@ impl<O: IsA<crate::Formatter>> FormatterExtManual for O {
caps.to_glib_none().0, caps.to_glib_none().0,
version, version,
rank.into_glib(), rank.into_glib(),
); )
} }
} }
} }