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
240mod sealed {
241    pub trait Sealed {}
242    impl<T: super::IsA<super::TestClip>> Sealed for T {}
243}
244
245/// Trait containing all [`struct@TestClip`] methods.
246///
247/// # Implementors
248///
249/// [`TestClip`][struct@crate::TestClip]
250pub trait TestClipExt: IsA<TestClip> + sealed::Sealed + 'static {
251    /// Get the frequency `self` generates.
252    ///
253    /// # Returns
254    ///
255    /// The frequency `self` generates. See audiotestsrc element.
256    #[doc(alias = "ges_test_clip_get_frequency")]
257    #[doc(alias = "get_frequency")]
258    fn frequency(&self) -> f64 {
259        unsafe { ffi::ges_test_clip_get_frequency(self.as_ref().to_glib_none().0) }
260    }
261
262    /// Get the volume of the test audio signal applied on `self`.
263    ///
264    /// # Returns
265    ///
266    /// The volume of the test audio signal applied on `self`.
267    #[doc(alias = "ges_test_clip_get_volume")]
268    #[doc(alias = "get_volume")]
269    fn volume(&self) -> f64 {
270        unsafe { ffi::ges_test_clip_get_volume(self.as_ref().to_glib_none().0) }
271    }
272
273    /// Get the [`VideoTestPattern`][crate::VideoTestPattern] which is applied on `self`.
274    ///
275    /// # Returns
276    ///
277    /// The [`VideoTestPattern`][crate::VideoTestPattern] which is applied on `self`.
278    #[doc(alias = "ges_test_clip_get_vpattern")]
279    #[doc(alias = "get_vpattern")]
280    fn vpattern(&self) -> VideoTestPattern {
281        unsafe {
282            from_glib(ffi::ges_test_clip_get_vpattern(
283                self.as_ref().to_glib_none().0,
284            ))
285        }
286    }
287
288    /// Let you know if the audio track of `self` is muted or not.
289    ///
290    /// # Returns
291    ///
292    /// Whether the audio track of `self` is muted or not.
293    #[doc(alias = "ges_test_clip_is_muted")]
294    fn is_muted(&self) -> bool {
295        unsafe { from_glib(ffi::ges_test_clip_is_muted(self.as_ref().to_glib_none().0)) }
296    }
297
298    /// Sets the frequency to generate. See audiotestsrc element.
299    /// ## `freq`
300    /// the frequency you want to use on `self`
301    #[doc(alias = "ges_test_clip_set_frequency")]
302    fn set_frequency(&self, freq: f64) {
303        unsafe {
304            ffi::ges_test_clip_set_frequency(self.as_ref().to_glib_none().0, freq);
305        }
306    }
307
308    /// Sets whether the audio track of this clip is muted or not.
309    /// ## `mute`
310    /// [`true`] to mute the audio track, [`false`] to unmute it
311    #[doc(alias = "ges_test_clip_set_mute")]
312    #[doc(alias = "mute")]
313    fn set_mute(&self, mute: bool) {
314        unsafe {
315            ffi::ges_test_clip_set_mute(self.as_ref().to_glib_none().0, mute.into_glib());
316        }
317    }
318
319    /// Sets the volume of the test audio signal.
320    /// ## `volume`
321    /// the volume of the audio signal you want to use on `self`
322    #[doc(alias = "ges_test_clip_set_volume")]
323    #[doc(alias = "volume")]
324    fn set_volume(&self, volume: f64) {
325        unsafe {
326            ffi::ges_test_clip_set_volume(self.as_ref().to_glib_none().0, volume);
327        }
328    }
329
330    /// Sets which video pattern to display on `self`.
331    /// ## `vpattern`
332    /// the [`VideoTestPattern`][crate::VideoTestPattern] to use on `self`
333    #[doc(alias = "ges_test_clip_set_vpattern")]
334    #[doc(alias = "vpattern")]
335    fn set_vpattern(&self, vpattern: VideoTestPattern) {
336        unsafe {
337            ffi::ges_test_clip_set_vpattern(self.as_ref().to_glib_none().0, vpattern.into_glib());
338        }
339    }
340
341    /// The frequency to generate for audio track elements.
342    fn freq(&self) -> f64 {
343        ObjectExt::property(self.as_ref(), "freq")
344    }
345
346    /// The frequency to generate for audio track elements.
347    fn set_freq(&self, freq: f64) {
348        ObjectExt::set_property(self.as_ref(), "freq", freq)
349    }
350
351    #[doc(alias = "freq")]
352    fn connect_freq_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
353        unsafe extern "C" fn notify_freq_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
354            this: *mut ffi::GESTestClip,
355            _param_spec: glib::ffi::gpointer,
356            f: glib::ffi::gpointer,
357        ) {
358            let f: &F = &*(f as *const F);
359            f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
360        }
361        unsafe {
362            let f: Box_<F> = Box_::new(f);
363            connect_raw(
364                self.as_ptr() as *mut _,
365                b"notify::freq\0".as_ptr() as *const _,
366                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
367                    notify_freq_trampoline::<Self, F> as *const (),
368                )),
369                Box_::into_raw(f),
370            )
371        }
372    }
373
374    #[doc(alias = "mute")]
375    fn connect_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
376        unsafe extern "C" fn notify_mute_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
377            this: *mut ffi::GESTestClip,
378            _param_spec: glib::ffi::gpointer,
379            f: glib::ffi::gpointer,
380        ) {
381            let f: &F = &*(f as *const F);
382            f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
383        }
384        unsafe {
385            let f: Box_<F> = Box_::new(f);
386            connect_raw(
387                self.as_ptr() as *mut _,
388                b"notify::mute\0".as_ptr() as *const _,
389                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
390                    notify_mute_trampoline::<Self, F> as *const (),
391                )),
392                Box_::into_raw(f),
393            )
394        }
395    }
396
397    #[doc(alias = "volume")]
398    fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
399        unsafe extern "C" fn notify_volume_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
400            this: *mut ffi::GESTestClip,
401            _param_spec: glib::ffi::gpointer,
402            f: glib::ffi::gpointer,
403        ) {
404            let f: &F = &*(f as *const F);
405            f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
406        }
407        unsafe {
408            let f: Box_<F> = Box_::new(f);
409            connect_raw(
410                self.as_ptr() as *mut _,
411                b"notify::volume\0".as_ptr() as *const _,
412                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
413                    notify_volume_trampoline::<Self, F> as *const (),
414                )),
415                Box_::into_raw(f),
416            )
417        }
418    }
419
420    #[doc(alias = "vpattern")]
421    fn connect_vpattern_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
422        unsafe extern "C" fn notify_vpattern_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
423            this: *mut ffi::GESTestClip,
424            _param_spec: glib::ffi::gpointer,
425            f: glib::ffi::gpointer,
426        ) {
427            let f: &F = &*(f as *const F);
428            f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
429        }
430        unsafe {
431            let f: Box_<F> = Box_::new(f);
432            connect_raw(
433                self.as_ptr() as *mut _,
434                b"notify::vpattern\0".as_ptr() as *const _,
435                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
436                    notify_vpattern_trampoline::<Self, F> as *const (),
437                )),
438                Box_::into_raw(f),
439            )
440        }
441    }
442}
443
444impl<O: IsA<TestClip>> TestClipExt for O {}