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
91/// Trait containing all [`struct@TrackElementAsset`] methods.
92///
93/// # Implementors
94///
95/// [`EffectAsset`][struct@crate::EffectAsset], [`TrackElementAsset`][struct@crate::TrackElementAsset], [`UriSourceAsset`][struct@crate::UriSourceAsset]
96pub trait TrackElementAssetExt: IsA<TrackElementAsset> + 'static {
97 /// Result: [`true`] if `self` has a natural framerate [`false`] otherwise
98 ///
99 /// # Returns
100 ///
101 ///
102 /// ## `framerate_n`
103 /// The framerate numerator
104 ///
105 /// ## `framerate_d`
106 /// The framerate denominator
107 #[cfg(feature = "v1_18")]
108 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
109 #[doc(alias = "ges_track_element_asset_get_natural_framerate")]
110 #[doc(alias = "get_natural_framerate")]
111 fn natural_framerate(&self) -> Option<(i32, i32)> {
112 unsafe {
113 let mut framerate_n = std::mem::MaybeUninit::uninit();
114 let mut framerate_d = std::mem::MaybeUninit::uninit();
115 let ret = from_glib(ffi::ges_track_element_asset_get_natural_framerate(
116 self.as_ref().to_glib_none().0,
117 framerate_n.as_mut_ptr(),
118 framerate_d.as_mut_ptr(),
119 ));
120 if ret {
121 Some((framerate_n.assume_init(), framerate_d.assume_init()))
122 } else {
123 None
124 }
125 }
126 }
127
128 /// Get the GESAssetTrackType the [`TrackElement`][crate::TrackElement] extracted from `self_`
129 /// should get into
130 ///
131 /// # Returns
132 ///
133 /// a [`TrackType`][crate::TrackType]
134 #[doc(alias = "ges_track_element_asset_get_track_type")]
135 #[doc(alias = "get_track_type")]
136 #[doc(alias = "track-type")]
137 fn track_type(&self) -> TrackType {
138 unsafe {
139 from_glib(ffi::ges_track_element_asset_get_track_type(
140 self.as_ref().to_glib_none().0,
141 ))
142 }
143 }
144
145 /// Set the [`TrackType`][crate::TrackType] the [`TrackElement`][crate::TrackElement] extracted from `self_`
146 /// should get into
147 /// ## `type_`
148 /// A [`TrackType`][crate::TrackType]
149 #[doc(alias = "ges_track_element_asset_set_track_type")]
150 #[doc(alias = "track-type")]
151 fn set_track_type(&self, type_: TrackType) {
152 unsafe {
153 ffi::ges_track_element_asset_set_track_type(
154 self.as_ref().to_glib_none().0,
155 type_.into_glib(),
156 );
157 }
158 }
159
160 #[doc(alias = "track-type")]
161 fn connect_track_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
162 &self,
163 f: F,
164 ) -> SignalHandlerId {
165 unsafe extern "C" fn notify_track_type_trampoline<
166 P: IsA<TrackElementAsset>,
167 F: Fn(&P) + Send + Sync + 'static,
168 >(
169 this: *mut ffi::GESTrackElementAsset,
170 _param_spec: glib::ffi::gpointer,
171 f: glib::ffi::gpointer,
172 ) {
173 let f: &F = &*(f as *const F);
174 f(TrackElementAsset::from_glib_borrow(this).unsafe_cast_ref())
175 }
176 unsafe {
177 let f: Box_<F> = Box_::new(f);
178 connect_raw(
179 self.as_ptr() as *mut _,
180 c"notify::track-type".as_ptr() as *const _,
181 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
182 notify_track_type_trampoline::<Self, F> as *const (),
183 )),
184 Box_::into_raw(f),
185 )
186 }
187 }
188}
189
190impl<O: IsA<TrackElementAsset>> TrackElementAssetExt for O {}