gstreamer_editing_services/auto/track_element_asset.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, Asset, MetaContainer, TrackType};
7use glib::{
8 prelude::*,
9 signal::{connect_raw, SignalHandlerId},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 ///
16 ///
17 /// ## Properties
18 ///
19 ///
20 /// #### `track-type`
21 /// Readable | Writeable | Construct
22 /// <details><summary><h4>Asset</h4></summary>
23 ///
24 ///
25 /// #### `extractable-type`
26 /// The [`Extractable`][crate::Extractable] object type that can be extracted from the asset.
27 ///
28 /// Readable | Writeable | Construct Only
29 ///
30 ///
31 /// #### `id`
32 /// The ID of the asset. This should be unique amongst all assets with
33 /// the same [`extractable-type`][struct@crate::Asset#extractable-type]. Depending on the associated
34 /// [`Extractable`][crate::Extractable] implementation, this id may convey some information
35 /// about the [`glib::Object`][crate::glib::Object] that should be extracted. Note that, as such, the
36 /// ID will have an expected format, and you can not choose this value
37 /// arbitrarily. By default, this will be set to the type name of the
38 /// [`extractable-type`][struct@crate::Asset#extractable-type], but you should check the documentation
39 /// of the extractable type to see whether they differ from the
40 /// default behaviour.
41 ///
42 /// Readable | Writeable | Construct Only
43 ///
44 ///
45 /// #### `proxy`
46 /// The default proxy for this asset, or [`None`] if it has no proxy. A
47 /// proxy will act as a substitute for the original asset when the
48 /// original is requested (see [`Asset::request()`][crate::Asset::request()]).
49 ///
50 /// Setting this property will not usually remove the existing proxy, but
51 /// will replace it as the default (see [`AssetExt::set_proxy()`][crate::prelude::AssetExt::set_proxy()]).
52 ///
53 /// Readable | Writeable
54 ///
55 ///
56 /// #### `proxy-target`
57 /// The asset that this asset is a proxy for, or [`None`] if it is not a
58 /// proxy for another asset.
59 ///
60 /// Note that even if this asset is acting as a proxy for another asset,
61 /// but this asset is not the default [`proxy`][struct@crate::Asset#proxy], then `proxy`-target
62 /// will *still* point to this other asset. So you should check the
63 /// [`proxy`][struct@crate::Asset#proxy] property of `target`-proxy before assuming it is the
64 /// current default proxy for the target.
65 ///
66 /// Note that the [`notify`][struct@crate::glib::Object#notify] for this property is emitted after
67 /// the [`proxy`][struct@crate::Asset#proxy] [`notify`][struct@crate::glib::Object#notify] for the corresponding (if any)
68 /// asset it is now the proxy of/no longer the proxy of.
69 ///
70 /// Readable
71 /// </details>
72 ///
73 /// # Implements
74 ///
75 /// [`TrackElementAssetExt`][trait@crate::prelude::TrackElementAssetExt], [`AssetExt`][trait@crate::prelude::AssetExt], [`trait@glib::ObjectExt`], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt]
76 #[doc(alias = "GESTrackElementAsset")]
77 pub struct TrackElementAsset(Object<ffi::GESTrackElementAsset, ffi::GESTrackElementAssetClass>) @extends Asset, @implements MetaContainer;
78
79 match fn {
80 type_ => || ffi::ges_track_element_asset_get_type(),
81 }
82}
83
84impl TrackElementAsset {
85 pub const NONE: Option<&'static TrackElementAsset> = None;
86}
87
88unsafe impl Send for TrackElementAsset {}
89unsafe impl Sync for TrackElementAsset {}
90
91mod sealed {
92 pub trait Sealed {}
93 impl<T: super::IsA<super::TrackElementAsset>> Sealed for T {}
94}
95
96/// Trait containing all [`struct@TrackElementAsset`] methods.
97///
98/// # Implementors
99///
100/// [`EffectAsset`][struct@crate::EffectAsset], [`TrackElementAsset`][struct@crate::TrackElementAsset], [`UriSourceAsset`][struct@crate::UriSourceAsset]
101pub trait TrackElementAssetExt: IsA<TrackElementAsset> + sealed::Sealed + 'static {
102 /// Result: [`true`] if `self` has a natural framerate [`false`] otherwise
103 ///
104 /// # Returns
105 ///
106 ///
107 /// ## `framerate_n`
108 /// The framerate numerator
109 ///
110 /// ## `framerate_d`
111 /// The framerate denominator
112 #[cfg(feature = "v1_18")]
113 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
114 #[doc(alias = "ges_track_element_asset_get_natural_framerate")]
115 #[doc(alias = "get_natural_framerate")]
116 fn natural_framerate(&self) -> Option<(i32, i32)> {
117 unsafe {
118 let mut framerate_n = std::mem::MaybeUninit::uninit();
119 let mut framerate_d = std::mem::MaybeUninit::uninit();
120 let ret = from_glib(ffi::ges_track_element_asset_get_natural_framerate(
121 self.as_ref().to_glib_none().0,
122 framerate_n.as_mut_ptr(),
123 framerate_d.as_mut_ptr(),
124 ));
125 if ret {
126 Some((framerate_n.assume_init(), framerate_d.assume_init()))
127 } else {
128 None
129 }
130 }
131 }
132
133 /// Get the GESAssetTrackType the [`TrackElement`][crate::TrackElement] extracted from `self_`
134 /// should get into
135 ///
136 /// # Returns
137 ///
138 /// a [`TrackType`][crate::TrackType]
139 #[doc(alias = "ges_track_element_asset_get_track_type")]
140 #[doc(alias = "get_track_type")]
141 #[doc(alias = "track-type")]
142 fn track_type(&self) -> TrackType {
143 unsafe {
144 from_glib(ffi::ges_track_element_asset_get_track_type(
145 self.as_ref().to_glib_none().0,
146 ))
147 }
148 }
149
150 /// Set the [`TrackType`][crate::TrackType] the [`TrackElement`][crate::TrackElement] extracted from `self_`
151 /// should get into
152 /// ## `type_`
153 /// A [`TrackType`][crate::TrackType]
154 #[doc(alias = "ges_track_element_asset_set_track_type")]
155 #[doc(alias = "track-type")]
156 fn set_track_type(&self, type_: TrackType) {
157 unsafe {
158 ffi::ges_track_element_asset_set_track_type(
159 self.as_ref().to_glib_none().0,
160 type_.into_glib(),
161 );
162 }
163 }
164
165 #[doc(alias = "track-type")]
166 fn connect_track_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
167 &self,
168 f: F,
169 ) -> SignalHandlerId {
170 unsafe extern "C" fn notify_track_type_trampoline<
171 P: IsA<TrackElementAsset>,
172 F: Fn(&P) + Send + Sync + 'static,
173 >(
174 this: *mut ffi::GESTrackElementAsset,
175 _param_spec: glib::ffi::gpointer,
176 f: glib::ffi::gpointer,
177 ) {
178 let f: &F = &*(f as *const F);
179 f(TrackElementAsset::from_glib_borrow(this).unsafe_cast_ref())
180 }
181 unsafe {
182 let f: Box_<F> = Box_::new(f);
183 connect_raw(
184 self.as_ptr() as *mut _,
185 b"notify::track-type\0".as_ptr() as *const _,
186 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
187 notify_track_type_trampoline::<Self, F> as *const (),
188 )),
189 Box_::into_raw(f),
190 )
191 }
192 }
193}
194
195impl<O: IsA<TrackElementAsset>> TrackElementAssetExt for O {}