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