gstreamer_editing_services/auto/
text_overlay_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, OperationClip, OverlayClip, TextHAlign,
8    TextVAlign, TimelineElement,
9};
10use glib::{
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// Renders text onto the next lower priority stream using textrender.
19    ///
20    /// ## Properties
21    ///
22    ///
23    /// #### `color`
24    ///  The color of the text
25    ///
26    /// Readable | Writeable | Construct
27    ///
28    ///
29    /// #### `font-desc`
30    ///  Pango font description string
31    ///
32    /// Readable | Writeable | Construct
33    ///
34    ///
35    /// #### `halignment`
36    ///  Horizontal alignment of the text
37    ///
38    /// Readable | Writeable | Construct
39    ///
40    ///
41    /// #### `text`
42    ///  The text to diplay
43    ///
44    /// Readable | Writeable | Construct
45    ///
46    ///
47    /// #### `valignment`
48    ///  Vertical alignent of the text
49    ///
50    /// Readable | Writeable | Construct
51    ///
52    ///
53    /// #### `xpos`
54    ///  The horizontal position of the text
55    ///
56    /// Readable | Writeable | Construct
57    ///
58    ///
59    /// #### `ypos`
60    ///  The vertical position of the text
61    ///
62    /// Readable | Writeable | Construct
63    /// <details><summary><h4>Clip</h4></summary>
64    ///
65    ///
66    /// #### `duration-limit`
67    ///  The maximum [`duration`][struct@crate::TimelineElement#duration] that can be *currently* set
68    /// for the clip, taking into account the [`in-point`][struct@crate::TimelineElement#in-point],
69    /// [`max-duration`][struct@crate::TimelineElement#max-duration], [`active`][struct@crate::TrackElement#active], and
70    /// [`track`][struct@crate::TrackElement#track] properties of its children, as well as any
71    /// time effects. If there is no limit, this will be set to
72    /// `GST_CLOCK_TIME_NONE`.
73    ///
74    /// Note that whilst a clip has no children in any tracks, the limit will
75    /// be unknown, and similarly set to `GST_CLOCK_TIME_NONE`.
76    ///
77    /// If the duration-limit would ever go below the current
78    /// [`duration`][struct@crate::TimelineElement#duration] of the clip due to a change in the above
79    /// variables, its [`duration`][struct@crate::TimelineElement#duration] will be set to the new
80    /// limit.
81    ///
82    /// Readable
83    ///
84    ///
85    /// #### `layer`
86    ///  The layer this clip lies in.
87    ///
88    /// If you want to connect to this property's [`notify`][struct@crate::glib::Object#notify] signal,
89    /// you should connect to it with `g_signal_connect_after()` since the
90    /// signal emission may be stopped internally.
91    ///
92    /// Readable
93    ///
94    ///
95    /// #### `supported-formats`
96    ///  The [`TrackType`][crate::TrackType]-s that the clip supports, which it can create
97    /// [`TrackElement`][crate::TrackElement]-s for. Note that this can be a combination of
98    /// [`TrackType`][crate::TrackType] flags to indicate support for several
99    /// [`track-type`][struct@crate::TrackElement#track-type] elements.
100    ///
101    /// Readable | Writeable | Construct
102    /// </details>
103    /// <details><summary><h4>Container</h4></summary>
104    ///
105    ///
106    /// #### `height`
107    ///  The span of the container's children's [`priority`][struct@crate::TimelineElement#priority]
108    /// values, which is the number of integers that lie between (inclusive)
109    /// the minimum and maximum priorities found amongst the container's
110    /// children (maximum - minimum + 1).
111    ///
112    /// Readable
113    /// </details>
114    /// <details><summary><h4>TimelineElement</h4></summary>
115    ///
116    ///
117    /// #### `duration`
118    ///  The duration that the element is in effect for in the timeline (a
119    /// time difference in nanoseconds using the time coordinates of the
120    /// timeline). For example, for a source element, this would determine
121    /// for how long it should output its internal content for. For an
122    /// operation element, this would determine for how long its effect
123    /// should be applied to any source content.
124    ///
125    /// Readable | Writeable
126    ///
127    ///
128    /// #### `in-point`
129    ///  The initial offset to use internally when outputting content (in
130    /// nanoseconds, but in the time coordinates of the internal content).
131    ///
132    /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
133    /// file, the "internal content" is the media file data, and the
134    /// in-point would correspond to some timestamp in the media file.
135    /// When playing the timeline, and when the element is first reached at
136    /// timeline-time [`start`][struct@crate::TimelineElement#start], it will begin outputting the
137    /// data from the timestamp in-point **onwards**, until it reaches the
138    /// end of its [`duration`][struct@crate::TimelineElement#duration] in the timeline.
139    ///
140    /// For elements that have no internal content, this should be kept
141    /// as 0.
142    ///
143    /// Readable | Writeable
144    ///
145    ///
146    /// #### `max-duration`
147    ///  The full duration of internal content that is available (a time
148    /// difference in nanoseconds using the time coordinates of the internal
149    /// content).
150    ///
151    /// This will act as a cap on the [`in-point`][struct@crate::TimelineElement#in-point] of the
152    /// element (which is in the same time coordinates), and will sometimes
153    /// be used to limit the [`duration`][struct@crate::TimelineElement#duration] of the element in
154    /// the timeline.
155    ///
156    /// For example, for a [`VideoUriSource`][crate::VideoUriSource] that references some media
157    /// file, this would be the length of the media file.
158    ///
159    /// For elements that have no internal content, or whose content is
160    /// indefinite, this should be kept as `GST_CLOCK_TIME_NONE`.
161    ///
162    /// Readable | Writeable | Construct
163    ///
164    ///
165    /// #### `name`
166    ///  The name of the element. This should be unique within its timeline.
167    ///
168    /// Readable | Writeable | Construct
169    ///
170    ///
171    /// #### `parent`
172    ///  The parent container of the element.
173    ///
174    /// Readable | Writeable
175    ///
176    ///
177    /// #### `priority`
178    ///  The priority of the element.
179    ///
180    /// Readable | Writeable
181    ///
182    ///
183    /// #### `serialize`
184    ///  Whether the element should be serialized.
185    ///
186    /// Readable | Writeable
187    ///
188    ///
189    /// #### `start`
190    ///  The starting position of the element in the timeline (in nanoseconds
191    /// and in the time coordinates of the timeline). For example, for a
192    /// source element, this would determine the time at which it should
193    /// start outputting its internal content. For an operation element, this
194    /// would determine the time at which it should start applying its effect
195    /// to any source content.
196    ///
197    /// Readable | Writeable
198    ///
199    ///
200    /// #### `timeline`
201    ///  The timeline that the element lies within.
202    ///
203    /// Readable | Writeable
204    /// </details>
205    ///
206    /// # Implements
207    ///
208    /// [`TextOverlayClipExt`][trait@crate::prelude::TextOverlayClipExt], [`OverlayClipExt`][trait@crate::prelude::OverlayClipExt], [`OperationClipExt`][trait@crate::prelude::OperationClipExt], [`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]
209    #[doc(alias = "GESTextOverlayClip")]
210    pub struct TextOverlayClip(Object<ffi::GESTextOverlayClip, ffi::GESTextOverlayClipClass>) @extends OverlayClip, OperationClip, Clip, Container, TimelineElement, @implements Extractable, MetaContainer;
211
212    match fn {
213        type_ => || ffi::ges_text_overlay_clip_get_type(),
214    }
215}
216
217impl TextOverlayClip {
218    pub const NONE: Option<&'static TextOverlayClip> = None;
219
220    /// Creates a new [`TextOverlayClip`][crate::TextOverlayClip]
221    ///
222    /// # Returns
223    ///
224    /// The newly created
225    /// [`TextOverlayClip`][crate::TextOverlayClip], or [`None`] if there was an error.
226    #[doc(alias = "ges_text_overlay_clip_new")]
227    pub fn new() -> Option<TextOverlayClip> {
228        assert_initialized_main_thread!();
229        unsafe { from_glib_none(ffi::ges_text_overlay_clip_new()) }
230    }
231}
232
233/// Trait containing all [`struct@TextOverlayClip`] methods.
234///
235/// # Implementors
236///
237/// [`TextOverlayClip`][struct@crate::TextOverlayClip]
238pub trait TextOverlayClipExt: IsA<TextOverlayClip> + 'static {
239    /// Get the color used by `source`.
240    ///
241    /// # Returns
242    ///
243    /// The color used by `source`.
244    #[doc(alias = "ges_text_overlay_clip_get_color")]
245    #[doc(alias = "get_color")]
246    fn color(&self) -> u32 {
247        unsafe { ffi::ges_text_overlay_clip_get_color(self.as_ref().to_glib_none().0) }
248    }
249
250    /// Get the pango font description used by `self`.
251    ///
252    /// # Returns
253    ///
254    /// The pango font description used by `self`.
255    #[doc(alias = "ges_text_overlay_clip_get_font_desc")]
256    #[doc(alias = "get_font_desc")]
257    #[doc(alias = "font-desc")]
258    fn font_desc(&self) -> Option<glib::GString> {
259        unsafe {
260            from_glib_none(ffi::ges_text_overlay_clip_get_font_desc(
261                self.as_ref().to_glib_none().0,
262            ))
263        }
264    }
265
266    /// Get the horizontal aligment used by `self`.
267    ///
268    /// # Returns
269    ///
270    /// The horizontal aligment used by `self`.
271    #[doc(alias = "ges_text_overlay_clip_get_halignment")]
272    #[doc(alias = "get_halignment")]
273    fn halignment(&self) -> TextHAlign {
274        unsafe {
275            from_glib(ffi::ges_text_overlay_clip_get_halignment(
276                self.as_ref().to_glib_none().0,
277            ))
278        }
279    }
280
281    /// Get the text currently set on `self`.
282    ///
283    /// # Returns
284    ///
285    /// The text currently set on `self`.
286    #[doc(alias = "ges_text_overlay_clip_get_text")]
287    #[doc(alias = "get_text")]
288    fn text(&self) -> Option<glib::GString> {
289        unsafe {
290            from_glib_none(ffi::ges_text_overlay_clip_get_text(
291                self.as_ref().to_glib_none().0,
292            ))
293        }
294    }
295
296    /// Get the vertical aligment used by `self`.
297    ///
298    /// # Returns
299    ///
300    /// The vertical aligment used by `self`.
301    #[doc(alias = "ges_text_overlay_clip_get_valignment")]
302    #[doc(alias = "get_valignment")]
303    fn valignment(&self) -> TextVAlign {
304        unsafe {
305            from_glib(ffi::ges_text_overlay_clip_get_valignment(
306                self.as_ref().to_glib_none().0,
307            ))
308        }
309    }
310
311    /// Get the horizontal position used by `source`.
312    ///
313    /// # Returns
314    ///
315    /// The horizontal position used by `source`.
316    #[doc(alias = "ges_text_overlay_clip_get_xpos")]
317    #[doc(alias = "get_xpos")]
318    fn xpos(&self) -> f64 {
319        unsafe { ffi::ges_text_overlay_clip_get_xpos(self.as_ref().to_glib_none().0) }
320    }
321
322    /// Get the vertical position used by `source`.
323    ///
324    /// # Returns
325    ///
326    /// The vertical position used by `source`.
327    #[doc(alias = "ges_text_overlay_clip_get_ypos")]
328    #[doc(alias = "get_ypos")]
329    fn ypos(&self) -> f64 {
330        unsafe { ffi::ges_text_overlay_clip_get_ypos(self.as_ref().to_glib_none().0) }
331    }
332
333    /// Sets the color of the text.
334    /// ## `color`
335    /// The color `self` is being set to
336    #[doc(alias = "ges_text_overlay_clip_set_color")]
337    #[doc(alias = "color")]
338    fn set_color(&self, color: u32) {
339        unsafe {
340            ffi::ges_text_overlay_clip_set_color(self.as_ref().to_glib_none().0, color);
341        }
342    }
343
344    /// Sets the pango font description of the text
345    /// ## `font_desc`
346    /// the pango font description
347    #[doc(alias = "ges_text_overlay_clip_set_font_desc")]
348    #[doc(alias = "font-desc")]
349    fn set_font_desc(&self, font_desc: Option<&str>) {
350        unsafe {
351            ffi::ges_text_overlay_clip_set_font_desc(
352                self.as_ref().to_glib_none().0,
353                font_desc.to_glib_none().0,
354            );
355        }
356    }
357
358    /// Sets the horizontal aligment of the text.
359    /// ## `halign`
360    /// [`TextHAlign`][crate::TextHAlign]
361    #[doc(alias = "ges_text_overlay_clip_set_halign")]
362    fn set_halign(&self, halign: TextHAlign) {
363        unsafe {
364            ffi::ges_text_overlay_clip_set_halign(
365                self.as_ref().to_glib_none().0,
366                halign.into_glib(),
367            );
368        }
369    }
370
371    /// Sets the text this clip will render.
372    /// ## `text`
373    /// the text to render. an internal copy of this text will be
374    /// made.
375    #[doc(alias = "ges_text_overlay_clip_set_text")]
376    #[doc(alias = "text")]
377    fn set_text(&self, text: Option<&str>) {
378        unsafe {
379            ffi::ges_text_overlay_clip_set_text(
380                self.as_ref().to_glib_none().0,
381                text.to_glib_none().0,
382            );
383        }
384    }
385
386    /// Sets the vertical aligment of the text.
387    /// ## `valign`
388    /// [`TextVAlign`][crate::TextVAlign]
389    #[doc(alias = "ges_text_overlay_clip_set_valign")]
390    fn set_valign(&self, valign: TextVAlign) {
391        unsafe {
392            ffi::ges_text_overlay_clip_set_valign(
393                self.as_ref().to_glib_none().0,
394                valign.into_glib(),
395            );
396        }
397    }
398
399    /// Sets the horizontal position of the text.
400    /// ## `position`
401    /// The horizontal position `self` is being set to
402    #[doc(alias = "ges_text_overlay_clip_set_xpos")]
403    #[doc(alias = "xpos")]
404    fn set_xpos(&self, position: f64) {
405        unsafe {
406            ffi::ges_text_overlay_clip_set_xpos(self.as_ref().to_glib_none().0, position);
407        }
408    }
409
410    /// Sets the vertical position of the text.
411    /// ## `position`
412    /// The vertical position `self` is being set to
413    #[doc(alias = "ges_text_overlay_clip_set_ypos")]
414    #[doc(alias = "ypos")]
415    fn set_ypos(&self, position: f64) {
416        unsafe {
417            ffi::ges_text_overlay_clip_set_ypos(self.as_ref().to_glib_none().0, position);
418        }
419    }
420
421    /// Horizontal alignment of the text
422    fn set_halignment(&self, halignment: TextHAlign) {
423        ObjectExt::set_property(self.as_ref(), "halignment", halignment)
424    }
425
426    /// Vertical alignent of the text
427    fn set_valignment(&self, valignment: TextVAlign) {
428        ObjectExt::set_property(self.as_ref(), "valignment", valignment)
429    }
430
431    #[doc(alias = "color")]
432    fn connect_color_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
433        unsafe extern "C" fn notify_color_trampoline<
434            P: IsA<TextOverlayClip>,
435            F: Fn(&P) + 'static,
436        >(
437            this: *mut ffi::GESTextOverlayClip,
438            _param_spec: glib::ffi::gpointer,
439            f: glib::ffi::gpointer,
440        ) {
441            let f: &F = &*(f as *const F);
442            f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
443        }
444        unsafe {
445            let f: Box_<F> = Box_::new(f);
446            connect_raw(
447                self.as_ptr() as *mut _,
448                c"notify::color".as_ptr() as *const _,
449                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
450                    notify_color_trampoline::<Self, F> as *const (),
451                )),
452                Box_::into_raw(f),
453            )
454        }
455    }
456
457    #[doc(alias = "font-desc")]
458    fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
459        unsafe extern "C" fn notify_font_desc_trampoline<
460            P: IsA<TextOverlayClip>,
461            F: Fn(&P) + 'static,
462        >(
463            this: *mut ffi::GESTextOverlayClip,
464            _param_spec: glib::ffi::gpointer,
465            f: glib::ffi::gpointer,
466        ) {
467            let f: &F = &*(f as *const F);
468            f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
469        }
470        unsafe {
471            let f: Box_<F> = Box_::new(f);
472            connect_raw(
473                self.as_ptr() as *mut _,
474                c"notify::font-desc".as_ptr() as *const _,
475                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
476                    notify_font_desc_trampoline::<Self, F> as *const (),
477                )),
478                Box_::into_raw(f),
479            )
480        }
481    }
482
483    #[doc(alias = "halignment")]
484    fn connect_halignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
485        unsafe extern "C" fn notify_halignment_trampoline<
486            P: IsA<TextOverlayClip>,
487            F: Fn(&P) + 'static,
488        >(
489            this: *mut ffi::GESTextOverlayClip,
490            _param_spec: glib::ffi::gpointer,
491            f: glib::ffi::gpointer,
492        ) {
493            let f: &F = &*(f as *const F);
494            f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
495        }
496        unsafe {
497            let f: Box_<F> = Box_::new(f);
498            connect_raw(
499                self.as_ptr() as *mut _,
500                c"notify::halignment".as_ptr() as *const _,
501                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
502                    notify_halignment_trampoline::<Self, F> as *const (),
503                )),
504                Box_::into_raw(f),
505            )
506        }
507    }
508
509    #[doc(alias = "text")]
510    fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
511        unsafe extern "C" fn notify_text_trampoline<
512            P: IsA<TextOverlayClip>,
513            F: Fn(&P) + 'static,
514        >(
515            this: *mut ffi::GESTextOverlayClip,
516            _param_spec: glib::ffi::gpointer,
517            f: glib::ffi::gpointer,
518        ) {
519            let f: &F = &*(f as *const F);
520            f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
521        }
522        unsafe {
523            let f: Box_<F> = Box_::new(f);
524            connect_raw(
525                self.as_ptr() as *mut _,
526                c"notify::text".as_ptr() as *const _,
527                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
528                    notify_text_trampoline::<Self, F> as *const (),
529                )),
530                Box_::into_raw(f),
531            )
532        }
533    }
534
535    #[doc(alias = "valignment")]
536    fn connect_valignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
537        unsafe extern "C" fn notify_valignment_trampoline<
538            P: IsA<TextOverlayClip>,
539            F: Fn(&P) + 'static,
540        >(
541            this: *mut ffi::GESTextOverlayClip,
542            _param_spec: glib::ffi::gpointer,
543            f: glib::ffi::gpointer,
544        ) {
545            let f: &F = &*(f as *const F);
546            f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
547        }
548        unsafe {
549            let f: Box_<F> = Box_::new(f);
550            connect_raw(
551                self.as_ptr() as *mut _,
552                c"notify::valignment".as_ptr() as *const _,
553                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
554                    notify_valignment_trampoline::<Self, F> as *const (),
555                )),
556                Box_::into_raw(f),
557            )
558        }
559    }
560
561    #[doc(alias = "xpos")]
562    fn connect_xpos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
563        unsafe extern "C" fn notify_xpos_trampoline<
564            P: IsA<TextOverlayClip>,
565            F: Fn(&P) + 'static,
566        >(
567            this: *mut ffi::GESTextOverlayClip,
568            _param_spec: glib::ffi::gpointer,
569            f: glib::ffi::gpointer,
570        ) {
571            let f: &F = &*(f as *const F);
572            f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
573        }
574        unsafe {
575            let f: Box_<F> = Box_::new(f);
576            connect_raw(
577                self.as_ptr() as *mut _,
578                c"notify::xpos".as_ptr() as *const _,
579                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
580                    notify_xpos_trampoline::<Self, F> as *const (),
581                )),
582                Box_::into_raw(f),
583            )
584        }
585    }
586
587    #[doc(alias = "ypos")]
588    fn connect_ypos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
589        unsafe extern "C" fn notify_ypos_trampoline<
590            P: IsA<TextOverlayClip>,
591            F: Fn(&P) + 'static,
592        >(
593            this: *mut ffi::GESTextOverlayClip,
594            _param_spec: glib::ffi::gpointer,
595            f: glib::ffi::gpointer,
596        ) {
597            let f: &F = &*(f as *const F);
598            f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
599        }
600        unsafe {
601            let f: Box_<F> = Box_::new(f);
602            connect_raw(
603                self.as_ptr() as *mut _,
604                c"notify::ypos".as_ptr() as *const _,
605                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
606                    notify_ypos_trampoline::<Self, F> as *const (),
607                )),
608                Box_::into_raw(f),
609            )
610        }
611    }
612}
613
614impl<O: IsA<TextOverlayClip>> TextOverlayClipExt for O {}