gstreamer_editing_services/auto/uri_clip.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::{Clip, Container, Extractable, MetaContainer, SourceClip, TimelineElement, ffi};
7use glib::{
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 /// Represents all the output streams from a particular uri. It is assumed that
16 /// the URI points to a file of some type.
17 ///
18 /// ## Properties
19 ///
20 ///
21 /// #### `is-image`
22 /// Whether this uri clip represents a still image or not. This must be set
23 /// before create_track_elements is called.
24 ///
25 /// Readable | Writable | Construct
26 ///
27 ///
28 /// #### `mute`
29 /// Whether the sound will be played or not.
30 ///
31 /// Readable | Writable | Construct
32 ///
33 ///
34 /// #### `supported-formats`
35 /// Readable | Writable | Construct
36 ///
37 ///
38 /// #### `uri`
39 /// The location of the file/resource to use.
40 ///
41 /// Readable | Writable | Construct Only
42 /// <details><summary><h4>Clip</h4></summary>
43 ///
44 ///
45 /// #### `duration-limit`
46 /// The maximum [`duration`][struct@crate::TimelineElement#duration] that can be *currently* set
47 /// for the clip, taking into account the [`in-point`][struct@crate::TimelineElement#in-point],
48 /// [`max-duration`][struct@crate::TimelineElement#max-duration], [`active`][struct@crate::TrackElement#active], and
49 /// [`track`][struct@crate::TrackElement#track] properties of its children, as well as any
50 /// time effects. If there is no limit, this will be set to
51 /// `GST_CLOCK_TIME_NONE`.
52 ///
53 /// Note that whilst a clip has no children in any tracks, the limit will
54 /// be unknown, and similarly set to `GST_CLOCK_TIME_NONE`.
55 ///
56 /// If the duration-limit would ever go below the current
57 /// [`duration`][struct@crate::TimelineElement#duration] of the clip due to a change in the above
58 /// variables, its [`duration`][struct@crate::TimelineElement#duration] will be set to the new
59 /// limit.
60 ///
61 /// Readable
62 ///
63 ///
64 /// #### `layer`
65 /// The layer this clip lies in.
66 ///
67 /// If you want to connect to this property's [`notify`][struct@crate::glib::Object#notify] signal,
68 /// you should connect to it with `g_signal_connect_after()` since the
69 /// signal emission may be stopped internally.
70 ///
71 /// Readable
72 ///
73 ///
74 /// #### `supported-formats`
75 /// The [`TrackType`][crate::TrackType]-s that the clip supports, which it can create
76 /// [`TrackElement`][crate::TrackElement]-s for. Note that this can be a combination of
77 /// [`TrackType`][crate::TrackType] flags to indicate support for several
78 /// [`track-type`][struct@crate::TrackElement#track-type] elements.
79 ///
80 /// Readable | Writable | Construct
81 /// </details>
82 /// <details><summary><h4>Container</h4></summary>
83 ///
84 ///
85 /// #### `height`
86 /// The span of the container's children's [`priority`][struct@crate::TimelineElement#priority]
87 /// values, which is the number of integers that lie between (inclusive)
88 /// the minimum and maximum priorities found amongst the container's
89 /// children (maximum - minimum + 1).
90 ///
91 /// Readable
92 /// </details>
93 /// <details><summary><h4>TimelineElement</h4></summary>
94 ///
95 ///
96 /// #### `duration`
97 /// The duration that the element is in effect for in the timeline (a
98 /// time difference in nanoseconds using the time coordinates of the
99 /// timeline). For example, for a source element, this would determine
100 /// for how long it should output its internal content for. For an
101 /// operation element, this would determine for how long its effect
102 /// should be applied to any source content.
103 ///
104 /// Readable | Writable
105 ///
106 ///
107 /// #### `in-point`
108 /// The initial offset to use internally when outputting content (in
109 /// nanoseconds, but in the time coordinates of the internal content).
110 ///
111 /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
112 /// file, the "internal content" is the media file data, and the
113 /// in-point would correspond to some timestamp in the media file.
114 /// When playing the timeline, and when the element is first reached at
115 /// timeline-time [`start`][struct@crate::TimelineElement#start], it will begin outputting the
116 /// data from the timestamp in-point **onwards**, until it reaches the
117 /// end of its [`duration`][struct@crate::TimelineElement#duration] in the timeline.
118 ///
119 /// For elements that have no internal content, this should be kept
120 /// as 0.
121 ///
122 /// Readable | Writable
123 ///
124 ///
125 /// #### `max-duration`
126 /// The full duration of internal content that is available (a time
127 /// difference in nanoseconds using the time coordinates of the internal
128 /// content).
129 ///
130 /// This will act as a cap on the [`in-point`][struct@crate::TimelineElement#in-point] of the
131 /// element (which is in the same time coordinates), and will sometimes
132 /// be used to limit the [`duration`][struct@crate::TimelineElement#duration] of the element in
133 /// the timeline.
134 ///
135 /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
136 /// file, this would be the length of the media file.
137 ///
138 /// For elements that have no internal content, or whose content is
139 /// indefinite, this should be kept as `GST_CLOCK_TIME_NONE`.
140 ///
141 /// Readable | Writable | Construct
142 ///
143 ///
144 /// #### `name`
145 /// The name of the element. This should be unique within its timeline.
146 ///
147 /// Readable | Writable | Construct
148 ///
149 ///
150 /// #### `parent`
151 /// The parent container of the element.
152 ///
153 /// Readable | Writable
154 ///
155 ///
156 /// #### `priority`
157 /// The priority of the element.
158 ///
159 /// Readable | Writable
160 ///
161 ///
162 /// #### `serialize`
163 /// Whether the element should be serialized.
164 ///
165 /// Readable | Writable
166 ///
167 ///
168 /// #### `start`
169 /// The starting position of the element in the timeline (in nanoseconds
170 /// and in the time coordinates of the timeline). For example, for a
171 /// source element, this would determine the time at which it should
172 /// start outputting its internal content. For an operation element, this
173 /// would determine the time at which it should start applying its effect
174 /// to any source content.
175 ///
176 /// Readable | Writable
177 ///
178 ///
179 /// #### `timeline`
180 /// The timeline that the element lies within.
181 ///
182 /// Readable | Writable
183 /// </details>
184 ///
185 /// # Implements
186 ///
187 /// [`UriClipExt`][trait@crate::prelude::UriClipExt], [`SourceClipExt`][trait@crate::prelude::SourceClipExt], [`ClipExt`][trait@crate::prelude::ClipExt], [`GESContainerExt`][trait@crate::prelude::GESContainerExt], [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
188 #[doc(alias = "GESUriClip")]
189 pub struct UriClip(Object<ffi::GESUriClip, ffi::GESUriClipClass>) @extends SourceClip, Clip, Container, TimelineElement, @implements Extractable, MetaContainer;
190
191 match fn {
192 type_ => || ffi::ges_uri_clip_get_type(),
193 }
194}
195
196impl UriClip {
197 pub const NONE: Option<&'static UriClip> = None;
198
199 /// to make that operation happen **asynchronously**.
200 /// ## `uri`
201 /// the URI the source should control
202 ///
203 /// # Returns
204 ///
205 /// The newly created [`UriClip`][crate::UriClip], or
206 /// [`None`] if there was an error.
207 #[doc(alias = "ges_uri_clip_new")]
208 pub fn new(uri: &str) -> Result<UriClip, glib::BoolError> {
209 assert_initialized_main_thread!();
210 unsafe {
211 Option::<_>::from_glib_none(ffi::ges_uri_clip_new(uri.to_glib_none().0))
212 .ok_or_else(|| glib::bool_error!("Failed to create Uri clip from Uri"))
213 }
214 }
215}
216
217/// Trait containing all [`struct@UriClip`] methods.
218///
219/// # Implementors
220///
221/// [`UriClip`][struct@crate::UriClip]
222pub trait UriClipExt: IsA<UriClip> + 'static {
223 /// Get the location of the resource.
224 ///
225 /// # Returns
226 ///
227 /// The location of the resource.
228 #[doc(alias = "ges_uri_clip_get_uri")]
229 #[doc(alias = "get_uri")]
230 fn uri(&self) -> glib::GString {
231 unsafe { from_glib_none(ffi::ges_uri_clip_get_uri(self.as_ref().to_glib_none().0)) }
232 }
233
234 /// Lets you know if `self` is an image or not.
235 ///
236 /// # Returns
237 ///
238 /// [`true`] if `self` is a still image [`false`] otherwise.
239 #[doc(alias = "ges_uri_clip_is_image")]
240 fn is_image(&self) -> bool {
241 unsafe { from_glib(ffi::ges_uri_clip_is_image(self.as_ref().to_glib_none().0)) }
242 }
243
244 /// Lets you know if the audio track of `self` is muted or not.
245 ///
246 /// # Returns
247 ///
248 /// [`true`] if the audio track of `self` is muted, [`false`] otherwise.
249 #[doc(alias = "ges_uri_clip_is_muted")]
250 fn is_muted(&self) -> bool {
251 unsafe { from_glib(ffi::ges_uri_clip_is_muted(self.as_ref().to_glib_none().0)) }
252 }
253
254 /// Sets whether the clip is a still image or not.
255 /// ## `is_image`
256 /// [`true`] if `self` is a still image, [`false`] otherwise
257 #[doc(alias = "ges_uri_clip_set_is_image")]
258 #[doc(alias = "is-image")]
259 fn set_is_image(&self, is_image: bool) {
260 unsafe {
261 ffi::ges_uri_clip_set_is_image(self.as_ref().to_glib_none().0, is_image.into_glib());
262 }
263 }
264
265 /// Sets whether the audio track of this clip is muted or not.
266 /// ## `mute`
267 /// [`true`] to mute `self` audio track, [`false`] to unmute it
268 #[doc(alias = "ges_uri_clip_set_mute")]
269 #[doc(alias = "mute")]
270 fn set_mute(&self, mute: bool) {
271 unsafe {
272 ffi::ges_uri_clip_set_mute(self.as_ref().to_glib_none().0, mute.into_glib());
273 }
274 }
275
276 #[doc(alias = "is-image")]
277 fn connect_is_image_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
278 unsafe extern "C" fn notify_is_image_trampoline<P: IsA<UriClip>, F: Fn(&P) + 'static>(
279 this: *mut ffi::GESUriClip,
280 _param_spec: glib::ffi::gpointer,
281 f: glib::ffi::gpointer,
282 ) {
283 unsafe {
284 let f: &F = &*(f as *const F);
285 f(UriClip::from_glib_borrow(this).unsafe_cast_ref())
286 }
287 }
288 unsafe {
289 let f: Box_<F> = Box_::new(f);
290 connect_raw(
291 self.as_ptr() as *mut _,
292 c"notify::is-image".as_ptr(),
293 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
294 notify_is_image_trampoline::<Self, F> as *const (),
295 )),
296 Box_::into_raw(f),
297 )
298 }
299 }
300
301 #[doc(alias = "mute")]
302 fn connect_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
303 unsafe extern "C" fn notify_mute_trampoline<P: IsA<UriClip>, F: Fn(&P) + 'static>(
304 this: *mut ffi::GESUriClip,
305 _param_spec: glib::ffi::gpointer,
306 f: glib::ffi::gpointer,
307 ) {
308 unsafe {
309 let f: &F = &*(f as *const F);
310 f(UriClip::from_glib_borrow(this).unsafe_cast_ref())
311 }
312 }
313 unsafe {
314 let f: Box_<F> = Box_::new(f);
315 connect_raw(
316 self.as_ptr() as *mut _,
317 c"notify::mute".as_ptr(),
318 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
319 notify_mute_trampoline::<Self, F> as *const (),
320 )),
321 Box_::into_raw(f),
322 )
323 }
324 }
325}
326
327impl<O: IsA<UriClip>> UriClipExt for O {}