gstreamer_editing_services/auto/test_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::{
7 ffi, Clip, Container, Extractable, MetaContainer, SourceClip, TimelineElement, VideoTestPattern,
8};
9use glib::{
10 prelude::*,
11 signal::{connect_raw, SignalHandlerId},
12 translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17 /// Useful for testing purposes.
18 ///
19 /// ## Asset
20 ///
21 /// The default asset ID is GESTestClip, but the framerate and video
22 /// size can be overridden using an ID of the form:
23 ///
24 /// ```text
25 /// framerate=60/1, width=1920, height=1080, max-duration=5.0
26 /// ```
27 /// Note: `max-duration` can be provided in seconds as float, or as GstClockTime
28 /// as guint64 or gint.
29 ///
30 /// ## Properties
31 ///
32 ///
33 /// #### `freq`
34 /// The frequency to generate for audio track elements.
35 ///
36 /// Readable | Writeable | Construct
37 ///
38 ///
39 /// #### `mute`
40 /// Whether the sound will be played or not.
41 ///
42 /// Readable | Writeable | Construct
43 ///
44 ///
45 /// #### `volume`
46 /// The volume for the audio track elements.
47 ///
48 /// Readable | Writeable | Construct
49 ///
50 ///
51 /// #### `vpattern`
52 /// Video pattern to display in video track elements.
53 ///
54 /// Readable | Writeable | Construct
55 /// <details><summary><h4>Clip</h4></summary>
56 ///
57 ///
58 /// #### `duration-limit`
59 /// The maximum [`duration`][struct@crate::TimelineElement#duration] that can be *currently* set
60 /// for the clip, taking into account the [`in-point`][struct@crate::TimelineElement#in-point],
61 /// [`max-duration`][struct@crate::TimelineElement#max-duration], [`active`][struct@crate::TrackElement#active], and
62 /// [`track`][struct@crate::TrackElement#track] properties of its children, as well as any
63 /// time effects. If there is no limit, this will be set to
64 /// `GST_CLOCK_TIME_NONE`.
65 ///
66 /// Note that whilst a clip has no children in any tracks, the limit will
67 /// be unknown, and similarly set to `GST_CLOCK_TIME_NONE`.
68 ///
69 /// If the duration-limit would ever go below the current
70 /// [`duration`][struct@crate::TimelineElement#duration] of the clip due to a change in the above
71 /// variables, its [`duration`][struct@crate::TimelineElement#duration] will be set to the new
72 /// limit.
73 ///
74 /// Readable
75 ///
76 ///
77 /// #### `layer`
78 /// The layer this clip lies in.
79 ///
80 /// If you want to connect to this property's [`notify`][struct@crate::glib::Object#notify] signal,
81 /// you should connect to it with `g_signal_connect_after()` since the
82 /// signal emission may be stopped internally.
83 ///
84 /// Readable
85 ///
86 ///
87 /// #### `supported-formats`
88 /// The [`TrackType`][crate::TrackType]-s that the clip supports, which it can create
89 /// [`TrackElement`][crate::TrackElement]-s for. Note that this can be a combination of
90 /// [`TrackType`][crate::TrackType] flags to indicate support for several
91 /// [`track-type`][struct@crate::TrackElement#track-type] elements.
92 ///
93 /// Readable | Writeable | Construct
94 /// </details>
95 /// <details><summary><h4>Container</h4></summary>
96 ///
97 ///
98 /// #### `height`
99 /// The span of the container's children's [`priority`][struct@crate::TimelineElement#priority]
100 /// values, which is the number of integers that lie between (inclusive)
101 /// the minimum and maximum priorities found amongst the container's
102 /// children (maximum - minimum + 1).
103 ///
104 /// Readable
105 /// </details>
106 /// <details><summary><h4>TimelineElement</h4></summary>
107 ///
108 ///
109 /// #### `duration`
110 /// The duration that the element is in effect for in the timeline (a
111 /// time difference in nanoseconds using the time coordinates of the
112 /// timeline). For example, for a source element, this would determine
113 /// for how long it should output its internal content for. For an
114 /// operation element, this would determine for how long its effect
115 /// should be applied to any source content.
116 ///
117 /// Readable | Writeable
118 ///
119 ///
120 /// #### `in-point`
121 /// The initial offset to use internally when outputting content (in
122 /// nanoseconds, but in the time coordinates of the internal content).
123 ///
124 /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
125 /// file, the "internal content" is the media file data, and the
126 /// in-point would correspond to some timestamp in the media file.
127 /// When playing the timeline, and when the element is first reached at
128 /// timeline-time [`start`][struct@crate::TimelineElement#start], it will begin outputting the
129 /// data from the timestamp in-point **onwards**, until it reaches the
130 /// end of its [`duration`][struct@crate::TimelineElement#duration] in the timeline.
131 ///
132 /// For elements that have no internal content, this should be kept
133 /// as 0.
134 ///
135 /// Readable | Writeable
136 ///
137 ///
138 /// #### `max-duration`
139 /// The full duration of internal content that is available (a time
140 /// difference in nanoseconds using the time coordinates of the internal
141 /// content).
142 ///
143 /// This will act as a cap on the [`in-point`][struct@crate::TimelineElement#in-point] of the
144 /// element (which is in the same time coordinates), and will sometimes
145 /// be used to limit the [`duration`][struct@crate::TimelineElement#duration] of the element in
146 /// the timeline.
147 ///
148 /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
149 /// file, this would be the length of the media file.
150 ///
151 /// For elements that have no internal content, or whose content is
152 /// indefinite, this should be kept as `GST_CLOCK_TIME_NONE`.
153 ///
154 /// Readable | Writeable | Construct
155 ///
156 ///
157 /// #### `name`
158 /// The name of the element. This should be unique within its timeline.
159 ///
160 /// Readable | Writeable | Construct
161 ///
162 ///
163 /// #### `parent`
164 /// The parent container of the element.
165 ///
166 /// Readable | Writeable
167 ///
168 ///
169 /// #### `priority`
170 /// The priority of the element.
171 ///
172 /// Readable | Writeable
173 ///
174 ///
175 /// #### `serialize`
176 /// Whether the element should be serialized.
177 ///
178 /// Readable | Writeable
179 ///
180 ///
181 /// #### `start`
182 /// The starting position of the element in the timeline (in nanoseconds
183 /// and in the time coordinates of the timeline). For example, for a
184 /// source element, this would determine the time at which it should
185 /// start outputting its internal content. For an operation element, this
186 /// would determine the time at which it should start applying its effect
187 /// to any source content.
188 ///
189 /// Readable | Writeable
190 ///
191 ///
192 /// #### `timeline`
193 /// The timeline that the element lies within.
194 ///
195 /// Readable | Writeable
196 /// </details>
197 ///
198 /// # Implements
199 ///
200 /// [`TestClipExt`][trait@crate::prelude::TestClipExt], [`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]
201 #[doc(alias = "GESTestClip")]
202 pub struct TestClip(Object<ffi::GESTestClip, ffi::GESTestClipClass>) @extends SourceClip, Clip, Container, TimelineElement, @implements Extractable, MetaContainer;
203
204 match fn {
205 type_ => || ffi::ges_test_clip_get_type(),
206 }
207}
208
209impl TestClip {
210 pub const NONE: Option<&'static TestClip> = None;
211
212 /// Creates a new [`TestClip`][crate::TestClip].
213 ///
214 /// # Returns
215 ///
216 /// The newly created [`TestClip`][crate::TestClip],
217 /// or [`None`] if there was an error.
218 #[doc(alias = "ges_test_clip_new")]
219 pub fn new() -> Option<TestClip> {
220 assert_initialized_main_thread!();
221 unsafe { from_glib_none(ffi::ges_test_clip_new()) }
222 }
223
224 /// Creates a new [`TestClip`][crate::TestClip] for the provided `nick`.
225 /// ## `nick`
226 /// the nickname for which to create the [`TestClip`][crate::TestClip]
227 ///
228 /// # Returns
229 ///
230 /// The newly created [`TestClip`][crate::TestClip],
231 /// or [`None`] if there was an error.
232 #[doc(alias = "ges_test_clip_new_for_nick")]
233 #[doc(alias = "new_for_nick")]
234 pub fn for_nick(nick: &str) -> Option<TestClip> {
235 assert_initialized_main_thread!();
236 unsafe { from_glib_none(ffi::ges_test_clip_new_for_nick(nick.to_glib_none().0)) }
237 }
238}
239
240/// Trait containing all [`struct@TestClip`] methods.
241///
242/// # Implementors
243///
244/// [`TestClip`][struct@crate::TestClip]
245pub trait TestClipExt: IsA<TestClip> + 'static {
246 /// Get the frequency `self` generates.
247 ///
248 /// # Returns
249 ///
250 /// The frequency `self` generates. See audiotestsrc element.
251 #[doc(alias = "ges_test_clip_get_frequency")]
252 #[doc(alias = "get_frequency")]
253 fn frequency(&self) -> f64 {
254 unsafe { ffi::ges_test_clip_get_frequency(self.as_ref().to_glib_none().0) }
255 }
256
257 /// Get the volume of the test audio signal applied on `self`.
258 ///
259 /// # Returns
260 ///
261 /// The volume of the test audio signal applied on `self`.
262 #[doc(alias = "ges_test_clip_get_volume")]
263 #[doc(alias = "get_volume")]
264 fn volume(&self) -> f64 {
265 unsafe { ffi::ges_test_clip_get_volume(self.as_ref().to_glib_none().0) }
266 }
267
268 /// Get the [`VideoTestPattern`][crate::VideoTestPattern] which is applied on `self`.
269 ///
270 /// # Returns
271 ///
272 /// The [`VideoTestPattern`][crate::VideoTestPattern] which is applied on `self`.
273 #[doc(alias = "ges_test_clip_get_vpattern")]
274 #[doc(alias = "get_vpattern")]
275 fn vpattern(&self) -> VideoTestPattern {
276 unsafe {
277 from_glib(ffi::ges_test_clip_get_vpattern(
278 self.as_ref().to_glib_none().0,
279 ))
280 }
281 }
282
283 /// Let you know if the audio track of `self` is muted or not.
284 ///
285 /// # Returns
286 ///
287 /// Whether the audio track of `self` is muted or not.
288 #[doc(alias = "ges_test_clip_is_muted")]
289 fn is_muted(&self) -> bool {
290 unsafe { from_glib(ffi::ges_test_clip_is_muted(self.as_ref().to_glib_none().0)) }
291 }
292
293 /// Sets the frequency to generate. See audiotestsrc element.
294 /// ## `freq`
295 /// the frequency you want to use on `self`
296 #[doc(alias = "ges_test_clip_set_frequency")]
297 fn set_frequency(&self, freq: f64) {
298 unsafe {
299 ffi::ges_test_clip_set_frequency(self.as_ref().to_glib_none().0, freq);
300 }
301 }
302
303 /// Sets whether the audio track of this clip is muted or not.
304 /// ## `mute`
305 /// [`true`] to mute the audio track, [`false`] to unmute it
306 #[doc(alias = "ges_test_clip_set_mute")]
307 #[doc(alias = "mute")]
308 fn set_mute(&self, mute: bool) {
309 unsafe {
310 ffi::ges_test_clip_set_mute(self.as_ref().to_glib_none().0, mute.into_glib());
311 }
312 }
313
314 /// Sets the volume of the test audio signal.
315 /// ## `volume`
316 /// the volume of the audio signal you want to use on `self`
317 #[doc(alias = "ges_test_clip_set_volume")]
318 #[doc(alias = "volume")]
319 fn set_volume(&self, volume: f64) {
320 unsafe {
321 ffi::ges_test_clip_set_volume(self.as_ref().to_glib_none().0, volume);
322 }
323 }
324
325 /// Sets which video pattern to display on `self`.
326 /// ## `vpattern`
327 /// the [`VideoTestPattern`][crate::VideoTestPattern] to use on `self`
328 #[doc(alias = "ges_test_clip_set_vpattern")]
329 #[doc(alias = "vpattern")]
330 fn set_vpattern(&self, vpattern: VideoTestPattern) {
331 unsafe {
332 ffi::ges_test_clip_set_vpattern(self.as_ref().to_glib_none().0, vpattern.into_glib());
333 }
334 }
335
336 /// The frequency to generate for audio track elements.
337 fn freq(&self) -> f64 {
338 ObjectExt::property(self.as_ref(), "freq")
339 }
340
341 /// The frequency to generate for audio track elements.
342 fn set_freq(&self, freq: f64) {
343 ObjectExt::set_property(self.as_ref(), "freq", freq)
344 }
345
346 #[doc(alias = "freq")]
347 fn connect_freq_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
348 unsafe extern "C" fn notify_freq_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
349 this: *mut ffi::GESTestClip,
350 _param_spec: glib::ffi::gpointer,
351 f: glib::ffi::gpointer,
352 ) {
353 let f: &F = &*(f as *const F);
354 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
355 }
356 unsafe {
357 let f: Box_<F> = Box_::new(f);
358 connect_raw(
359 self.as_ptr() as *mut _,
360 c"notify::freq".as_ptr() as *const _,
361 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
362 notify_freq_trampoline::<Self, F> as *const (),
363 )),
364 Box_::into_raw(f),
365 )
366 }
367 }
368
369 #[doc(alias = "mute")]
370 fn connect_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
371 unsafe extern "C" fn notify_mute_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
372 this: *mut ffi::GESTestClip,
373 _param_spec: glib::ffi::gpointer,
374 f: glib::ffi::gpointer,
375 ) {
376 let f: &F = &*(f as *const F);
377 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
378 }
379 unsafe {
380 let f: Box_<F> = Box_::new(f);
381 connect_raw(
382 self.as_ptr() as *mut _,
383 c"notify::mute".as_ptr() as *const _,
384 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
385 notify_mute_trampoline::<Self, F> as *const (),
386 )),
387 Box_::into_raw(f),
388 )
389 }
390 }
391
392 #[doc(alias = "volume")]
393 fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
394 unsafe extern "C" fn notify_volume_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
395 this: *mut ffi::GESTestClip,
396 _param_spec: glib::ffi::gpointer,
397 f: glib::ffi::gpointer,
398 ) {
399 let f: &F = &*(f as *const F);
400 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
401 }
402 unsafe {
403 let f: Box_<F> = Box_::new(f);
404 connect_raw(
405 self.as_ptr() as *mut _,
406 c"notify::volume".as_ptr() as *const _,
407 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
408 notify_volume_trampoline::<Self, F> as *const (),
409 )),
410 Box_::into_raw(f),
411 )
412 }
413 }
414
415 #[doc(alias = "vpattern")]
416 fn connect_vpattern_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
417 unsafe extern "C" fn notify_vpattern_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
418 this: *mut ffi::GESTestClip,
419 _param_spec: glib::ffi::gpointer,
420 f: glib::ffi::gpointer,
421 ) {
422 let f: &F = &*(f as *const F);
423 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
424 }
425 unsafe {
426 let f: Box_<F> = Box_::new(f);
427 connect_raw(
428 self.as_ptr() as *mut _,
429 c"notify::vpattern".as_ptr() as *const _,
430 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
431 notify_vpattern_trampoline::<Self, F> as *const (),
432 )),
433 Box_::into_raw(f),
434 )
435 }
436 }
437}
438
439impl<O: IsA<TestClip>> TestClipExt for O {}