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    #[doc(alias = "GstVideoOrientation")]
11    pub struct VideoOrientation(Interface<ffi::GstVideoOrientation, ffi::GstVideoOrientationInterface>);
12
13    match fn {
14        type_ => || ffi::gst_video_orientation_get_type(),
15    }
16}
17
18impl VideoOrientation {
19    pub const NONE: Option<&'static VideoOrientation> = None;
20}
21
22unsafe impl Send for VideoOrientation {}
23unsafe impl Sync for VideoOrientation {}
24
25pub trait VideoOrientationExt: IsA<VideoOrientation> + 'static {
26    #[doc(alias = "gst_video_orientation_get_hcenter")]
27    #[doc(alias = "get_hcenter")]
28    fn hcenter(&self) -> Option<i32> {
29        unsafe {
30            let mut center = std::mem::MaybeUninit::uninit();
31            let ret = from_glib(ffi::gst_video_orientation_get_hcenter(
32                self.as_ref().to_glib_none().0,
33                center.as_mut_ptr(),
34            ));
35            if ret {
36                Some(center.assume_init())
37            } else {
38                None
39            }
40        }
41    }
42
43    #[doc(alias = "gst_video_orientation_get_hflip")]
44    #[doc(alias = "get_hflip")]
45    fn hflip(&self) -> Option<bool> {
46        unsafe {
47            let mut flip = std::mem::MaybeUninit::uninit();
48            let ret = from_glib(ffi::gst_video_orientation_get_hflip(
49                self.as_ref().to_glib_none().0,
50                flip.as_mut_ptr(),
51            ));
52            if ret {
53                Some(from_glib(flip.assume_init()))
54            } else {
55                None
56            }
57        }
58    }
59
60    #[doc(alias = "gst_video_orientation_get_vcenter")]
61    #[doc(alias = "get_vcenter")]
62    fn vcenter(&self) -> Option<i32> {
63        unsafe {
64            let mut center = std::mem::MaybeUninit::uninit();
65            let ret = from_glib(ffi::gst_video_orientation_get_vcenter(
66                self.as_ref().to_glib_none().0,
67                center.as_mut_ptr(),
68            ));
69            if ret {
70                Some(center.assume_init())
71            } else {
72                None
73            }
74        }
75    }
76
77    #[doc(alias = "gst_video_orientation_get_vflip")]
78    #[doc(alias = "get_vflip")]
79    fn vflip(&self) -> Option<bool> {
80        unsafe {
81            let mut flip = std::mem::MaybeUninit::uninit();
82            let ret = from_glib(ffi::gst_video_orientation_get_vflip(
83                self.as_ref().to_glib_none().0,
84                flip.as_mut_ptr(),
85            ));
86            if ret {
87                Some(from_glib(flip.assume_init()))
88            } else {
89                None
90            }
91        }
92    }
93
94    #[doc(alias = "gst_video_orientation_set_hcenter")]
95    fn set_hcenter(&self, center: i32) -> Result<(), glib::error::BoolError> {
96        unsafe {
97            glib::result_from_gboolean!(
98                ffi::gst_video_orientation_set_hcenter(self.as_ref().to_glib_none().0, center),
99                "Failed to set horizontal centering"
100            )
101        }
102    }
103
104    #[doc(alias = "gst_video_orientation_set_hflip")]
105    fn set_hflip(&self, flip: bool) -> Result<(), glib::error::BoolError> {
106        unsafe {
107            glib::result_from_gboolean!(
108                ffi::gst_video_orientation_set_hflip(
109                    self.as_ref().to_glib_none().0,
110                    flip.into_glib()
111                ),
112                "Failed to set horizontal flipping"
113            )
114        }
115    }
116
117    #[doc(alias = "gst_video_orientation_set_vcenter")]
118    fn set_vcenter(&self, center: i32) -> Result<(), glib::error::BoolError> {
119        unsafe {
120            glib::result_from_gboolean!(
121                ffi::gst_video_orientation_set_vcenter(self.as_ref().to_glib_none().0, center),
122                "Failed to set vertical centering"
123            )
124        }
125    }
126
127    #[doc(alias = "gst_video_orientation_set_vflip")]
128    fn set_vflip(&self, flip: bool) -> Result<(), glib::error::BoolError> {
129        unsafe {
130            glib::result_from_gboolean!(
131                ffi::gst_video_orientation_set_vflip(
132                    self.as_ref().to_glib_none().0,
133                    flip.into_glib()
134                ),
135                "Failed to set vertical flipping"
136            )
137        }
138    }
139}
140
141impl<O: IsA<VideoOrientation>> VideoOrientationExt for O {}