gstreamer_video/auto/
video_orientation.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::ffi;
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    /// The interface allows unified access to control flipping and autocenter
11    /// operation of video-sources or operators.
12    ///
13    /// # Implements
14    ///
15    /// [`VideoOrientationExt`][trait@crate::prelude::VideoOrientationExt]
16    #[doc(alias = "GstVideoOrientation")]
17    pub struct VideoOrientation(Interface<ffi::GstVideoOrientation, ffi::GstVideoOrientationInterface>);
18
19    match fn {
20        type_ => || ffi::gst_video_orientation_get_type(),
21    }
22}
23
24impl VideoOrientation {
25    pub const NONE: Option<&'static VideoOrientation> = None;
26}
27
28unsafe impl Send for VideoOrientation {}
29unsafe impl Sync for VideoOrientation {}
30
31/// Trait containing all [`struct@VideoOrientation`] methods.
32///
33/// # Implementors
34///
35/// [`VideoOrientation`][struct@crate::VideoOrientation]
36pub trait VideoOrientationExt: IsA<VideoOrientation> + 'static {
37    /// Get the horizontal centering offset from the given object.
38    ///
39    /// # Returns
40    ///
41    /// [`true`] in case the element supports centering
42    ///
43    /// ## `center`
44    /// return location for the result
45    #[doc(alias = "gst_video_orientation_get_hcenter")]
46    #[doc(alias = "get_hcenter")]
47    fn hcenter(&self) -> Option<i32> {
48        unsafe {
49            let mut center = std::mem::MaybeUninit::uninit();
50            let ret = from_glib(ffi::gst_video_orientation_get_hcenter(
51                self.as_ref().to_glib_none().0,
52                center.as_mut_ptr(),
53            ));
54            if ret {
55                Some(center.assume_init())
56            } else {
57                None
58            }
59        }
60    }
61
62    /// Get the horizontal flipping state ([`true`] for flipped) from the given object.
63    ///
64    /// # Returns
65    ///
66    /// [`true`] in case the element supports flipping
67    ///
68    /// ## `flip`
69    /// return location for the result
70    #[doc(alias = "gst_video_orientation_get_hflip")]
71    #[doc(alias = "get_hflip")]
72    fn hflip(&self) -> Option<bool> {
73        unsafe {
74            let mut flip = std::mem::MaybeUninit::uninit();
75            let ret = from_glib(ffi::gst_video_orientation_get_hflip(
76                self.as_ref().to_glib_none().0,
77                flip.as_mut_ptr(),
78            ));
79            if ret {
80                Some(from_glib(flip.assume_init()))
81            } else {
82                None
83            }
84        }
85    }
86
87    /// Get the vertical centering offset from the given object.
88    ///
89    /// # Returns
90    ///
91    /// [`true`] in case the element supports centering
92    ///
93    /// ## `center`
94    /// return location for the result
95    #[doc(alias = "gst_video_orientation_get_vcenter")]
96    #[doc(alias = "get_vcenter")]
97    fn vcenter(&self) -> Option<i32> {
98        unsafe {
99            let mut center = std::mem::MaybeUninit::uninit();
100            let ret = from_glib(ffi::gst_video_orientation_get_vcenter(
101                self.as_ref().to_glib_none().0,
102                center.as_mut_ptr(),
103            ));
104            if ret {
105                Some(center.assume_init())
106            } else {
107                None
108            }
109        }
110    }
111
112    /// Get the vertical flipping state ([`true`] for flipped) from the given object.
113    ///
114    /// # Returns
115    ///
116    /// [`true`] in case the element supports flipping
117    ///
118    /// ## `flip`
119    /// return location for the result
120    #[doc(alias = "gst_video_orientation_get_vflip")]
121    #[doc(alias = "get_vflip")]
122    fn vflip(&self) -> Option<bool> {
123        unsafe {
124            let mut flip = std::mem::MaybeUninit::uninit();
125            let ret = from_glib(ffi::gst_video_orientation_get_vflip(
126                self.as_ref().to_glib_none().0,
127                flip.as_mut_ptr(),
128            ));
129            if ret {
130                Some(from_glib(flip.assume_init()))
131            } else {
132                None
133            }
134        }
135    }
136
137    /// Set the horizontal centering offset for the given object.
138    /// ## `center`
139    /// centering offset
140    ///
141    /// # Returns
142    ///
143    /// [`true`] in case the element supports centering
144    #[doc(alias = "gst_video_orientation_set_hcenter")]
145    fn set_hcenter(&self, center: i32) -> Result<(), glib::error::BoolError> {
146        unsafe {
147            glib::result_from_gboolean!(
148                ffi::gst_video_orientation_set_hcenter(self.as_ref().to_glib_none().0, center),
149                "Failed to set horizontal centering"
150            )
151        }
152    }
153
154    /// Set the horizontal flipping state ([`true`] for flipped) for the given object.
155    /// ## `flip`
156    /// use flipping
157    ///
158    /// # Returns
159    ///
160    /// [`true`] in case the element supports flipping
161    #[doc(alias = "gst_video_orientation_set_hflip")]
162    fn set_hflip(&self, flip: bool) -> Result<(), glib::error::BoolError> {
163        unsafe {
164            glib::result_from_gboolean!(
165                ffi::gst_video_orientation_set_hflip(
166                    self.as_ref().to_glib_none().0,
167                    flip.into_glib()
168                ),
169                "Failed to set horizontal flipping"
170            )
171        }
172    }
173
174    /// Set the vertical centering offset for the given object.
175    /// ## `center`
176    /// centering offset
177    ///
178    /// # Returns
179    ///
180    /// [`true`] in case the element supports centering
181    #[doc(alias = "gst_video_orientation_set_vcenter")]
182    fn set_vcenter(&self, center: i32) -> Result<(), glib::error::BoolError> {
183        unsafe {
184            glib::result_from_gboolean!(
185                ffi::gst_video_orientation_set_vcenter(self.as_ref().to_glib_none().0, center),
186                "Failed to set vertical centering"
187            )
188        }
189    }
190
191    /// Set the vertical flipping state ([`true`] for flipped) for the given object.
192    /// ## `flip`
193    /// use flipping
194    ///
195    /// # Returns
196    ///
197    /// [`true`] in case the element supports flipping
198    #[doc(alias = "gst_video_orientation_set_vflip")]
199    fn set_vflip(&self, flip: bool) -> Result<(), glib::error::BoolError> {
200        unsafe {
201            glib::result_from_gboolean!(
202                ffi::gst_video_orientation_set_vflip(
203                    self.as_ref().to_glib_none().0,
204                    flip.into_glib()
205                ),
206                "Failed to set vertical flipping"
207            )
208        }
209    }
210}
211
212impl<O: IsA<VideoOrientation>> VideoOrientationExt for O {}