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
233mod sealed {
234 pub trait Sealed {}
235 impl<T: super::IsA<super::TextOverlayClip>> Sealed for T {}
236}
237
238/// Trait containing all [`struct@TextOverlayClip`] methods.
239///
240/// # Implementors
241///
242/// [`TextOverlayClip`][struct@crate::TextOverlayClip]
243pub trait TextOverlayClipExt: IsA<TextOverlayClip> + sealed::Sealed + 'static {
244 /// Get the color used by `source`.
245 ///
246 /// # Returns
247 ///
248 /// The color used by `source`.
249 #[doc(alias = "ges_text_overlay_clip_get_color")]
250 #[doc(alias = "get_color")]
251 fn color(&self) -> u32 {
252 unsafe { ffi::ges_text_overlay_clip_get_color(self.as_ref().to_glib_none().0) }
253 }
254
255 /// Get the pango font description used by `self`.
256 ///
257 /// # Returns
258 ///
259 /// The pango font description used by `self`.
260 #[doc(alias = "ges_text_overlay_clip_get_font_desc")]
261 #[doc(alias = "get_font_desc")]
262 #[doc(alias = "font-desc")]
263 fn font_desc(&self) -> Option<glib::GString> {
264 unsafe {
265 from_glib_none(ffi::ges_text_overlay_clip_get_font_desc(
266 self.as_ref().to_glib_none().0,
267 ))
268 }
269 }
270
271 /// Get the horizontal aligment used by `self`.
272 ///
273 /// # Returns
274 ///
275 /// The horizontal aligment used by `self`.
276 #[doc(alias = "ges_text_overlay_clip_get_halignment")]
277 #[doc(alias = "get_halignment")]
278 fn halignment(&self) -> TextHAlign {
279 unsafe {
280 from_glib(ffi::ges_text_overlay_clip_get_halignment(
281 self.as_ref().to_glib_none().0,
282 ))
283 }
284 }
285
286 /// Get the text currently set on `self`.
287 ///
288 /// # Returns
289 ///
290 /// The text currently set on `self`.
291 #[doc(alias = "ges_text_overlay_clip_get_text")]
292 #[doc(alias = "get_text")]
293 fn text(&self) -> Option<glib::GString> {
294 unsafe {
295 from_glib_none(ffi::ges_text_overlay_clip_get_text(
296 self.as_ref().to_glib_none().0,
297 ))
298 }
299 }
300
301 /// Get the vertical aligment used by `self`.
302 ///
303 /// # Returns
304 ///
305 /// The vertical aligment used by `self`.
306 #[doc(alias = "ges_text_overlay_clip_get_valignment")]
307 #[doc(alias = "get_valignment")]
308 fn valignment(&self) -> TextVAlign {
309 unsafe {
310 from_glib(ffi::ges_text_overlay_clip_get_valignment(
311 self.as_ref().to_glib_none().0,
312 ))
313 }
314 }
315
316 /// Get the horizontal position used by `source`.
317 ///
318 /// # Returns
319 ///
320 /// The horizontal position used by `source`.
321 #[doc(alias = "ges_text_overlay_clip_get_xpos")]
322 #[doc(alias = "get_xpos")]
323 fn xpos(&self) -> f64 {
324 unsafe { ffi::ges_text_overlay_clip_get_xpos(self.as_ref().to_glib_none().0) }
325 }
326
327 /// Get the vertical position used by `source`.
328 ///
329 /// # Returns
330 ///
331 /// The vertical position used by `source`.
332 #[doc(alias = "ges_text_overlay_clip_get_ypos")]
333 #[doc(alias = "get_ypos")]
334 fn ypos(&self) -> f64 {
335 unsafe { ffi::ges_text_overlay_clip_get_ypos(self.as_ref().to_glib_none().0) }
336 }
337
338 /// Sets the color of the text.
339 /// ## `color`
340 /// The color `self` is being set to
341 #[doc(alias = "ges_text_overlay_clip_set_color")]
342 #[doc(alias = "color")]
343 fn set_color(&self, color: u32) {
344 unsafe {
345 ffi::ges_text_overlay_clip_set_color(self.as_ref().to_glib_none().0, color);
346 }
347 }
348
349 /// Sets the pango font description of the text
350 /// ## `font_desc`
351 /// the pango font description
352 #[doc(alias = "ges_text_overlay_clip_set_font_desc")]
353 #[doc(alias = "font-desc")]
354 fn set_font_desc(&self, font_desc: Option<&str>) {
355 unsafe {
356 ffi::ges_text_overlay_clip_set_font_desc(
357 self.as_ref().to_glib_none().0,
358 font_desc.to_glib_none().0,
359 );
360 }
361 }
362
363 /// Sets the horizontal aligment of the text.
364 /// ## `halign`
365 /// [`TextHAlign`][crate::TextHAlign]
366 #[doc(alias = "ges_text_overlay_clip_set_halign")]
367 fn set_halign(&self, halign: TextHAlign) {
368 unsafe {
369 ffi::ges_text_overlay_clip_set_halign(
370 self.as_ref().to_glib_none().0,
371 halign.into_glib(),
372 );
373 }
374 }
375
376 /// Sets the text this clip will render.
377 /// ## `text`
378 /// the text to render. an internal copy of this text will be
379 /// made.
380 #[doc(alias = "ges_text_overlay_clip_set_text")]
381 #[doc(alias = "text")]
382 fn set_text(&self, text: Option<&str>) {
383 unsafe {
384 ffi::ges_text_overlay_clip_set_text(
385 self.as_ref().to_glib_none().0,
386 text.to_glib_none().0,
387 );
388 }
389 }
390
391 /// Sets the vertical aligment of the text.
392 /// ## `valign`
393 /// [`TextVAlign`][crate::TextVAlign]
394 #[doc(alias = "ges_text_overlay_clip_set_valign")]
395 fn set_valign(&self, valign: TextVAlign) {
396 unsafe {
397 ffi::ges_text_overlay_clip_set_valign(
398 self.as_ref().to_glib_none().0,
399 valign.into_glib(),
400 );
401 }
402 }
403
404 /// Sets the horizontal position of the text.
405 /// ## `position`
406 /// The horizontal position `self` is being set to
407 #[doc(alias = "ges_text_overlay_clip_set_xpos")]
408 #[doc(alias = "xpos")]
409 fn set_xpos(&self, position: f64) {
410 unsafe {
411 ffi::ges_text_overlay_clip_set_xpos(self.as_ref().to_glib_none().0, position);
412 }
413 }
414
415 /// Sets the vertical position of the text.
416 /// ## `position`
417 /// The vertical position `self` is being set to
418 #[doc(alias = "ges_text_overlay_clip_set_ypos")]
419 #[doc(alias = "ypos")]
420 fn set_ypos(&self, position: f64) {
421 unsafe {
422 ffi::ges_text_overlay_clip_set_ypos(self.as_ref().to_glib_none().0, position);
423 }
424 }
425
426 /// Horizontal alignment of the text
427 fn set_halignment(&self, halignment: TextHAlign) {
428 ObjectExt::set_property(self.as_ref(), "halignment", halignment)
429 }
430
431 /// Vertical alignent of the text
432 fn set_valignment(&self, valignment: TextVAlign) {
433 ObjectExt::set_property(self.as_ref(), "valignment", valignment)
434 }
435
436 #[doc(alias = "color")]
437 fn connect_color_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
438 unsafe extern "C" fn notify_color_trampoline<
439 P: IsA<TextOverlayClip>,
440 F: Fn(&P) + 'static,
441 >(
442 this: *mut ffi::GESTextOverlayClip,
443 _param_spec: glib::ffi::gpointer,
444 f: glib::ffi::gpointer,
445 ) {
446 let f: &F = &*(f as *const F);
447 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
448 }
449 unsafe {
450 let f: Box_<F> = Box_::new(f);
451 connect_raw(
452 self.as_ptr() as *mut _,
453 b"notify::color\0".as_ptr() as *const _,
454 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
455 notify_color_trampoline::<Self, F> as *const (),
456 )),
457 Box_::into_raw(f),
458 )
459 }
460 }
461
462 #[doc(alias = "font-desc")]
463 fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
464 unsafe extern "C" fn notify_font_desc_trampoline<
465 P: IsA<TextOverlayClip>,
466 F: Fn(&P) + 'static,
467 >(
468 this: *mut ffi::GESTextOverlayClip,
469 _param_spec: glib::ffi::gpointer,
470 f: glib::ffi::gpointer,
471 ) {
472 let f: &F = &*(f as *const F);
473 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
474 }
475 unsafe {
476 let f: Box_<F> = Box_::new(f);
477 connect_raw(
478 self.as_ptr() as *mut _,
479 b"notify::font-desc\0".as_ptr() as *const _,
480 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
481 notify_font_desc_trampoline::<Self, F> as *const (),
482 )),
483 Box_::into_raw(f),
484 )
485 }
486 }
487
488 #[doc(alias = "halignment")]
489 fn connect_halignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
490 unsafe extern "C" fn notify_halignment_trampoline<
491 P: IsA<TextOverlayClip>,
492 F: Fn(&P) + 'static,
493 >(
494 this: *mut ffi::GESTextOverlayClip,
495 _param_spec: glib::ffi::gpointer,
496 f: glib::ffi::gpointer,
497 ) {
498 let f: &F = &*(f as *const F);
499 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
500 }
501 unsafe {
502 let f: Box_<F> = Box_::new(f);
503 connect_raw(
504 self.as_ptr() as *mut _,
505 b"notify::halignment\0".as_ptr() as *const _,
506 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
507 notify_halignment_trampoline::<Self, F> as *const (),
508 )),
509 Box_::into_raw(f),
510 )
511 }
512 }
513
514 #[doc(alias = "text")]
515 fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
516 unsafe extern "C" fn notify_text_trampoline<
517 P: IsA<TextOverlayClip>,
518 F: Fn(&P) + 'static,
519 >(
520 this: *mut ffi::GESTextOverlayClip,
521 _param_spec: glib::ffi::gpointer,
522 f: glib::ffi::gpointer,
523 ) {
524 let f: &F = &*(f as *const F);
525 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
526 }
527 unsafe {
528 let f: Box_<F> = Box_::new(f);
529 connect_raw(
530 self.as_ptr() as *mut _,
531 b"notify::text\0".as_ptr() as *const _,
532 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
533 notify_text_trampoline::<Self, F> as *const (),
534 )),
535 Box_::into_raw(f),
536 )
537 }
538 }
539
540 #[doc(alias = "valignment")]
541 fn connect_valignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
542 unsafe extern "C" fn notify_valignment_trampoline<
543 P: IsA<TextOverlayClip>,
544 F: Fn(&P) + 'static,
545 >(
546 this: *mut ffi::GESTextOverlayClip,
547 _param_spec: glib::ffi::gpointer,
548 f: glib::ffi::gpointer,
549 ) {
550 let f: &F = &*(f as *const F);
551 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
552 }
553 unsafe {
554 let f: Box_<F> = Box_::new(f);
555 connect_raw(
556 self.as_ptr() as *mut _,
557 b"notify::valignment\0".as_ptr() as *const _,
558 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
559 notify_valignment_trampoline::<Self, F> as *const (),
560 )),
561 Box_::into_raw(f),
562 )
563 }
564 }
565
566 #[doc(alias = "xpos")]
567 fn connect_xpos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
568 unsafe extern "C" fn notify_xpos_trampoline<
569 P: IsA<TextOverlayClip>,
570 F: Fn(&P) + 'static,
571 >(
572 this: *mut ffi::GESTextOverlayClip,
573 _param_spec: glib::ffi::gpointer,
574 f: glib::ffi::gpointer,
575 ) {
576 let f: &F = &*(f as *const F);
577 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
578 }
579 unsafe {
580 let f: Box_<F> = Box_::new(f);
581 connect_raw(
582 self.as_ptr() as *mut _,
583 b"notify::xpos\0".as_ptr() as *const _,
584 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
585 notify_xpos_trampoline::<Self, F> as *const (),
586 )),
587 Box_::into_raw(f),
588 )
589 }
590 }
591
592 #[doc(alias = "ypos")]
593 fn connect_ypos_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
594 unsafe extern "C" fn notify_ypos_trampoline<
595 P: IsA<TextOverlayClip>,
596 F: Fn(&P) + 'static,
597 >(
598 this: *mut ffi::GESTextOverlayClip,
599 _param_spec: glib::ffi::gpointer,
600 f: glib::ffi::gpointer,
601 ) {
602 let f: &F = &*(f as *const F);
603 f(TextOverlayClip::from_glib_borrow(this).unsafe_cast_ref())
604 }
605 unsafe {
606 let f: Box_<F> = Box_::new(f);
607 connect_raw(
608 self.as_ptr() as *mut _,
609 b"notify::ypos\0".as_ptr() as *const _,
610 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
611 notify_ypos_trampoline::<Self, F> as *const (),
612 )),
613 Box_::into_raw(f),
614 )
615 }
616 }
617}
618
619impl<O: IsA<TextOverlayClip>> TextOverlayClipExt for O {}