gstreamer_editing_services/auto/
title_source.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#![allow(deprecated)]
6
7use crate::{
8    ffi, Extractable, MetaContainer, Source, TextHAlign, TextVAlign, TimelineElement, TrackElement,
9    VideoSource,
10};
11use glib::{prelude::*, translate::*};
12
13glib::wrapper! {
14    /// [`TitleSource`][crate::TitleSource] is a GESTimelineElement that implements the notion
15    /// of titles in GES.
16    ///
17    /// # Implements
18    ///
19    /// [`TitleSourceExt`][trait@crate::prelude::TitleSourceExt], [`VideoSourceExt`][trait@crate::prelude::VideoSourceExt], [`SourceExt`][trait@crate::prelude::SourceExt], [`TrackElementExt`][trait@crate::prelude::TrackElementExt], [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
20    #[doc(alias = "GESTitleSource")]
21    pub struct TitleSource(Object<ffi::GESTitleSource, ffi::GESTitleSourceClass>) @extends VideoSource, Source, TrackElement, TimelineElement, @implements Extractable, MetaContainer;
22
23    match fn {
24        type_ => || ffi::ges_title_source_get_type(),
25    }
26}
27
28impl TitleSource {
29    pub const NONE: Option<&'static TitleSource> = None;
30}
31
32/// Trait containing all [`struct@TitleSource`] methods.
33///
34/// # Implementors
35///
36/// [`TitleSource`][struct@crate::TitleSource]
37pub trait TitleSourceExt: IsA<TitleSource> + 'static {
38    /// Get the background used by `self`.
39    ///
40    /// # Returns
41    ///
42    /// The background used by `self`.
43    #[doc(alias = "ges_title_source_get_background_color")]
44    #[doc(alias = "get_background_color")]
45    fn background_color(&self) -> u32 {
46        unsafe { ffi::ges_title_source_get_background_color(self.as_ref().to_glib_none().0) }
47    }
48
49    /// Get the pango font description used by `self`.
50    ///
51    /// # Deprecated since 1.16
52    ///
53    /// Use ges_timeline_element_get_child_property instead
54    /// (this actually returns a newly allocated string)
55    ///
56    /// # Returns
57    ///
58    /// The pango font description used by this
59    /// `self`.
60    #[cfg_attr(feature = "v1_16", deprecated = "Since 1.16")]
61    #[allow(deprecated)]
62    #[doc(alias = "ges_title_source_get_font_desc")]
63    #[doc(alias = "get_font_desc")]
64    fn font_desc(&self) -> Option<glib::GString> {
65        unsafe {
66            from_glib_full(ffi::ges_title_source_get_font_desc(
67                self.as_ref().to_glib_none().0,
68            ))
69        }
70    }
71
72    /// Get the horizontal aligment used by `self`.
73    ///
74    /// # Returns
75    ///
76    /// The horizontal aligment used by `self`.
77    #[doc(alias = "ges_title_source_get_halignment")]
78    #[doc(alias = "get_halignment")]
79    fn halignment(&self) -> TextHAlign {
80        unsafe {
81            from_glib(ffi::ges_title_source_get_halignment(
82                self.as_ref().to_glib_none().0,
83            ))
84        }
85    }
86
87    /// Get the text currently set on the `self`.
88    ///
89    /// # Deprecated since 1.16
90    ///
91    /// Use ges_timeline_element_get_child_property instead
92    /// (this actually returns a newly allocated string)
93    ///
94    /// # Returns
95    ///
96    /// The text currently set on the `self`.
97    #[cfg_attr(feature = "v1_16", deprecated = "Since 1.16")]
98    #[allow(deprecated)]
99    #[doc(alias = "ges_title_source_get_text")]
100    #[doc(alias = "get_text")]
101    fn text(&self) -> Option<glib::GString> {
102        unsafe {
103            from_glib_full(ffi::ges_title_source_get_text(
104                self.as_ref().to_glib_none().0,
105            ))
106        }
107    }
108
109    /// Get the color used by `self`.
110    ///
111    /// # Returns
112    ///
113    /// The color used by `self`.
114    #[doc(alias = "ges_title_source_get_text_color")]
115    #[doc(alias = "get_text_color")]
116    fn text_color(&self) -> u32 {
117        unsafe { ffi::ges_title_source_get_text_color(self.as_ref().to_glib_none().0) }
118    }
119
120    /// Get the vertical aligment used by `self`.
121    ///
122    /// # Returns
123    ///
124    /// The vertical aligment used by `self`.
125    #[doc(alias = "ges_title_source_get_valignment")]
126    #[doc(alias = "get_valignment")]
127    fn valignment(&self) -> TextVAlign {
128        unsafe {
129            from_glib(ffi::ges_title_source_get_valignment(
130                self.as_ref().to_glib_none().0,
131            ))
132        }
133    }
134
135    /// Get the horizontal position used by `self`.
136    ///
137    /// # Returns
138    ///
139    /// The horizontal position used by `self`.
140    #[doc(alias = "ges_title_source_get_xpos")]
141    #[doc(alias = "get_xpos")]
142    fn xpos(&self) -> f64 {
143        unsafe { ffi::ges_title_source_get_xpos(self.as_ref().to_glib_none().0) }
144    }
145
146    /// Get the vertical position used by `self`.
147    ///
148    /// # Returns
149    ///
150    /// The vertical position used by `self`.
151    #[doc(alias = "ges_title_source_get_ypos")]
152    #[doc(alias = "get_ypos")]
153    fn ypos(&self) -> f64 {
154        unsafe { ffi::ges_title_source_get_ypos(self.as_ref().to_glib_none().0) }
155    }
156
157    /// Sets the color of the background
158    /// ## `color`
159    /// the color `self` is being set to
160    #[doc(alias = "ges_title_source_set_background_color")]
161    fn set_background_color(&self, color: u32) {
162        unsafe {
163            ffi::ges_title_source_set_background_color(self.as_ref().to_glib_none().0, color);
164        }
165    }
166
167    /// Set the pango font description this source will use to render
168    /// the text.
169    /// ## `font_desc`
170    /// the pango font description
171    #[doc(alias = "ges_title_source_set_font_desc")]
172    fn set_font_desc(&self, font_desc: Option<&str>) {
173        unsafe {
174            ffi::ges_title_source_set_font_desc(
175                self.as_ref().to_glib_none().0,
176                font_desc.to_glib_none().0,
177            );
178        }
179    }
180
181    /// Sets the vertical aligment of the text.
182    /// ## `halign`
183    /// [`TextHAlign`][crate::TextHAlign]
184    #[doc(alias = "ges_title_source_set_halignment")]
185    fn set_halignment(&self, halign: TextHAlign) {
186        unsafe {
187            ffi::ges_title_source_set_halignment(
188                self.as_ref().to_glib_none().0,
189                halign.into_glib(),
190            );
191        }
192    }
193
194    /// Sets the text this track element will render.
195    ///
196    /// # Deprecated
197    ///
198    /// use ges_track_element_get/set_children_properties on the
199    /// GESTrackElement instead
200    /// ## `text`
201    /// the text to render. an internal copy of this text will be
202    /// made.
203    #[doc(alias = "ges_title_source_set_text")]
204    fn set_text(&self, text: Option<&str>) {
205        unsafe {
206            ffi::ges_title_source_set_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
207        }
208    }
209
210    /// Sets the color of the text.
211    /// ## `color`
212    /// the color `self` is being set to
213    #[doc(alias = "ges_title_source_set_text_color")]
214    fn set_text_color(&self, color: u32) {
215        unsafe {
216            ffi::ges_title_source_set_text_color(self.as_ref().to_glib_none().0, color);
217        }
218    }
219
220    /// Sets the vertical aligment of the text.
221    /// ## `valign`
222    /// [`TextVAlign`][crate::TextVAlign]
223    #[doc(alias = "ges_title_source_set_valignment")]
224    fn set_valignment(&self, valign: TextVAlign) {
225        unsafe {
226            ffi::ges_title_source_set_valignment(
227                self.as_ref().to_glib_none().0,
228                valign.into_glib(),
229            );
230        }
231    }
232
233    /// Sets the horizontal position of the text.
234    /// ## `position`
235    /// the horizontal position `self` is being set to
236    #[doc(alias = "ges_title_source_set_xpos")]
237    fn set_xpos(&self, position: f64) {
238        unsafe {
239            ffi::ges_title_source_set_xpos(self.as_ref().to_glib_none().0, position);
240        }
241    }
242
243    /// Sets the vertical position of the text.
244    /// ## `position`
245    /// the color `self` is being set to
246    #[doc(alias = "ges_title_source_set_ypos")]
247    fn set_ypos(&self, position: f64) {
248        unsafe {
249            ffi::ges_title_source_set_ypos(self.as_ref().to_glib_none().0, position);
250        }
251    }
252}
253
254impl<O: IsA<TitleSource>> TitleSourceExt for O {}