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 Clip, Container, Extractable, MetaContainer, OperationClip, OverlayClip, TextHAlign,
8 TextVAlign, TimelineElement, ffi,
9};
10use glib::{
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
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 unsafe {
442 let f: &F = &*(f as *const F);
443 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
444 }
445 }
446 unsafe {
447 let f: Box_<F> = Box_::new(f);
448 connect_raw(
449 self.as_ptr() as *mut _,
450 c"notify::color".as_ptr(),
451 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
452 notify_color_trampoline::<Self, F> as *const (),
453 )),
454 Box_::into_raw(f),
455 )
456 }
457 }
458
459 #[doc(alias = "font-desc")]
460 fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
461 unsafe extern "C" fn notify_font_desc_trampoline<
462 P: IsA<TextOverlayClip>,
463 F: Fn(&P) + 'static,
464 >(
465 this: *mut ffi::GESTextOverlayClip,
466 _param_spec: glib::ffi::gpointer,
467 f: glib::ffi::gpointer,
468 ) {
469 unsafe {
470 let f: &F = &*(f as *const F);
471 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
472 }
473 }
474 unsafe {
475 let f: Box_<F> = Box_::new(f);
476 connect_raw(
477 self.as_ptr() as *mut _,
478 c"notify::font-desc".as_ptr(),
479 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
480 notify_font_desc_trampoline::<Self, F> as *const (),
481 )),
482 Box_::into_raw(f),
483 )
484 }
485 }
486
487 #[doc(alias = "halignment")]
488 fn connect_halignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
489 unsafe extern "C" fn notify_halignment_trampoline<
490 P: IsA<TextOverlayClip>,
491 F: Fn(&P) + 'static,
492 >(
493 this: *mut ffi::GESTextOverlayClip,
494 _param_spec: glib::ffi::gpointer,
495 f: glib::ffi::gpointer,
496 ) {
497 unsafe {
498 let f: &F = &*(f as *const F);
499 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
500 }
501 }
502 unsafe {
503 let f: Box_<F> = Box_::new(f);
504 connect_raw(
505 self.as_ptr() as *mut _,
506 c"notify::halignment".as_ptr(),
507 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
508 notify_halignment_trampoline::<Self, F> as *const (),
509 )),
510 Box_::into_raw(f),
511 )
512 }
513 }
514
515 #[doc(alias = "text")]
516 fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
517 unsafe extern "C" fn notify_text_trampoline<
518 P: IsA<TextOverlayClip>,
519 F: Fn(&P) + 'static,
520 >(
521 this: *mut ffi::GESTextOverlayClip,
522 _param_spec: glib::ffi::gpointer,
523 f: glib::ffi::gpointer,
524 ) {
525 unsafe {
526 let f: &F = &*(f as *const F);
527 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
528 }
529 }
530 unsafe {
531 let f: Box_<F> = Box_::new(f);
532 connect_raw(
533 self.as_ptr() as *mut _,
534 c"notify::text".as_ptr(),
535 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
536 notify_text_trampoline::<Self, F> as *const (),
537 )),
538 Box_::into_raw(f),
539 )
540 }
541 }
542
543 #[doc(alias = "valignment")]
544 fn connect_valignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
545 unsafe extern "C" fn notify_valignment_trampoline<
546 P: IsA<TextOverlayClip>,
547 F: Fn(&P) + 'static,
548 >(
549 this: *mut ffi::GESTextOverlayClip,
550 _param_spec: glib::ffi::gpointer,
551 f: glib::ffi::gpointer,
552 ) {
553 unsafe {
554 let f: &F = &*(f as *const F);
555 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
556 }
557 }
558 unsafe {
559 let f: Box_<F> = Box_::new(f);
560 connect_raw(
561 self.as_ptr() as *mut _,
562 c"notify::valignment".as_ptr(),
563 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
564 notify_valignment_trampoline::<Self, F> as *const (),
565 )),
566 Box_::into_raw(f),
567 )
568 }
569 }
570
571 #[doc(alias = "xpos")]
572 fn connect_xpos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
573 unsafe extern "C" fn notify_xpos_trampoline<
574 P: IsA<TextOverlayClip>,
575 F: Fn(&P) + 'static,
576 >(
577 this: *mut ffi::GESTextOverlayClip,
578 _param_spec: glib::ffi::gpointer,
579 f: glib::ffi::gpointer,
580 ) {
581 unsafe {
582 let f: &F = &*(f as *const F);
583 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
584 }
585 }
586 unsafe {
587 let f: Box_<F> = Box_::new(f);
588 connect_raw(
589 self.as_ptr() as *mut _,
590 c"notify::xpos".as_ptr(),
591 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
592 notify_xpos_trampoline::<Self, F> as *const (),
593 )),
594 Box_::into_raw(f),
595 )
596 }
597 }
598
599 #[doc(alias = "ypos")]
600 fn connect_ypos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
601 unsafe extern "C" fn notify_ypos_trampoline<
602 P: IsA<TextOverlayClip>,
603 F: Fn(&P) + 'static,
604 >(
605 this: *mut ffi::GESTextOverlayClip,
606 _param_spec: glib::ffi::gpointer,
607 f: glib::ffi::gpointer,
608 ) {
609 unsafe {
610 let f: &F = &*(f as *const F);
611 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
612 }
613 }
614 unsafe {
615 let f: Box_<F> = Box_::new(f);
616 connect_raw(
617 self.as_ptr() as *mut _,
618 c"notify::ypos".as_ptr(),
619 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
620 notify_ypos_trampoline::<Self, F> as *const (),
621 )),
622 Box_::into_raw(f),
623 )
624 }
625 }
626}
627
628impl<O: IsA<TextOverlayClip>> TextOverlayClipExt for O {}