gstreamer_video/auto/
video_orientation.rs1use crate::ffi;
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[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
31pub trait VideoOrientationExt: IsA<VideoOrientation> + 'static {
37    #[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    #[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    #[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    #[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    #[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    #[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    #[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    #[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 {}