gstreamer_video/auto/
video_orientation.rs
1use 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
31mod sealed {
32 pub trait Sealed {}
33 impl<T: super::IsA<super::VideoOrientation>> Sealed for T {}
34}
35
36pub trait VideoOrientationExt: IsA<VideoOrientation> + sealed::Sealed + 'static {
42 #[doc(alias = "gst_video_orientation_get_hcenter")]
51 #[doc(alias = "get_hcenter")]
52 fn hcenter(&self) -> Option<i32> {
53 unsafe {
54 let mut center = std::mem::MaybeUninit::uninit();
55 let ret = from_glib(ffi::gst_video_orientation_get_hcenter(
56 self.as_ref().to_glib_none().0,
57 center.as_mut_ptr(),
58 ));
59 if ret {
60 Some(center.assume_init())
61 } else {
62 None
63 }
64 }
65 }
66
67 #[doc(alias = "gst_video_orientation_get_hflip")]
76 #[doc(alias = "get_hflip")]
77 fn hflip(&self) -> Option<bool> {
78 unsafe {
79 let mut flip = std::mem::MaybeUninit::uninit();
80 let ret = from_glib(ffi::gst_video_orientation_get_hflip(
81 self.as_ref().to_glib_none().0,
82 flip.as_mut_ptr(),
83 ));
84 if ret {
85 Some(from_glib(flip.assume_init()))
86 } else {
87 None
88 }
89 }
90 }
91
92 #[doc(alias = "gst_video_orientation_get_vcenter")]
101 #[doc(alias = "get_vcenter")]
102 fn vcenter(&self) -> Option<i32> {
103 unsafe {
104 let mut center = std::mem::MaybeUninit::uninit();
105 let ret = from_glib(ffi::gst_video_orientation_get_vcenter(
106 self.as_ref().to_glib_none().0,
107 center.as_mut_ptr(),
108 ));
109 if ret {
110 Some(center.assume_init())
111 } else {
112 None
113 }
114 }
115 }
116
117 #[doc(alias = "gst_video_orientation_get_vflip")]
126 #[doc(alias = "get_vflip")]
127 fn vflip(&self) -> Option<bool> {
128 unsafe {
129 let mut flip = std::mem::MaybeUninit::uninit();
130 let ret = from_glib(ffi::gst_video_orientation_get_vflip(
131 self.as_ref().to_glib_none().0,
132 flip.as_mut_ptr(),
133 ));
134 if ret {
135 Some(from_glib(flip.assume_init()))
136 } else {
137 None
138 }
139 }
140 }
141
142 #[doc(alias = "gst_video_orientation_set_hcenter")]
150 fn set_hcenter(&self, center: i32) -> Result<(), glib::error::BoolError> {
151 unsafe {
152 glib::result_from_gboolean!(
153 ffi::gst_video_orientation_set_hcenter(self.as_ref().to_glib_none().0, center),
154 "Failed to set horizontal centering"
155 )
156 }
157 }
158
159 #[doc(alias = "gst_video_orientation_set_hflip")]
167 fn set_hflip(&self, flip: bool) -> Result<(), glib::error::BoolError> {
168 unsafe {
169 glib::result_from_gboolean!(
170 ffi::gst_video_orientation_set_hflip(
171 self.as_ref().to_glib_none().0,
172 flip.into_glib()
173 ),
174 "Failed to set horizontal flipping"
175 )
176 }
177 }
178
179 #[doc(alias = "gst_video_orientation_set_vcenter")]
187 fn set_vcenter(&self, center: i32) -> Result<(), glib::error::BoolError> {
188 unsafe {
189 glib::result_from_gboolean!(
190 ffi::gst_video_orientation_set_vcenter(self.as_ref().to_glib_none().0, center),
191 "Failed to set vertical centering"
192 )
193 }
194 }
195
196 #[doc(alias = "gst_video_orientation_set_vflip")]
204 fn set_vflip(&self, flip: bool) -> Result<(), glib::error::BoolError> {
205 unsafe {
206 glib::result_from_gboolean!(
207 ffi::gst_video_orientation_set_vflip(
208 self.as_ref().to_glib_none().0,
209 flip.into_glib()
210 ),
211 "Failed to set vertical flipping"
212 )
213 }
214 }
215}
216
217impl<O: IsA<VideoOrientation>> VideoOrientationExt for O {}