| 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, GLContext, GLStereoDownmix}; |
| 7 | use glib::{ |
| 8 | prelude::*, |
| 9 | signal::{connect_raw, SignalHandlerId}, |
| 10 | translate::*, |
| 11 | }; |
| 12 | use std::boxed::Box as Box_; |
| 13 | |
| 14 | glib::wrapper! { |
| 15 | #[doc (alias = "GstGLViewConvert" )] |
| 16 | pub struct GLViewConvert(Object<ffi::GstGLViewConvert, ffi::GstGLViewConvertClass>) @extends gst::Object; |
| 17 | |
| 18 | match fn { |
| 19 | type_ => || ffi::gst_gl_view_convert_get_type(), |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | impl GLViewConvert { |
| 24 | #[doc (alias = "gst_gl_view_convert_new" )] |
| 25 | pub fn new() -> GLViewConvert { |
| 26 | assert_initialized_main_thread!(); |
| 27 | unsafe { from_glib_full(ffi::gst_gl_view_convert_new()) } |
| 28 | } |
| 29 | |
| 30 | #[doc (alias = "gst_gl_view_convert_perform" )] |
| 31 | pub fn perform(&self, inbuf: &gst::Buffer) -> Option<gst::Buffer> { |
| 32 | unsafe { |
| 33 | from_glib_full(ffi::gst_gl_view_convert_perform( |
| 34 | self.to_glib_none().0, |
| 35 | inbuf.to_glib_none().0, |
| 36 | )) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | #[doc (alias = "gst_gl_view_convert_reset" )] |
| 41 | pub fn reset(&self) { |
| 42 | unsafe { |
| 43 | ffi::gst_gl_view_convert_reset(self.to_glib_none().0); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | #[doc (alias = "gst_gl_view_convert_set_caps" )] |
| 48 | pub fn set_caps( |
| 49 | &self, |
| 50 | in_caps: &gst::Caps, |
| 51 | out_caps: &gst::Caps, |
| 52 | ) -> Result<(), glib::error::BoolError> { |
| 53 | unsafe { |
| 54 | glib::result_from_gboolean!( |
| 55 | ffi::gst_gl_view_convert_set_caps( |
| 56 | self.to_glib_none().0, |
| 57 | in_caps.to_glib_none().0, |
| 58 | out_caps.to_glib_none().0 |
| 59 | ), |
| 60 | "Failed to set caps" |
| 61 | ) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | #[doc (alias = "gst_gl_view_convert_set_context" )] |
| 66 | pub fn set_context(&self, context: &impl IsA<GLContext>) { |
| 67 | unsafe { |
| 68 | ffi::gst_gl_view_convert_set_context( |
| 69 | self.to_glib_none().0, |
| 70 | context.as_ref().to_glib_none().0, |
| 71 | ); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | #[doc (alias = "gst_gl_view_convert_transform_caps" )] |
| 76 | pub fn transform_caps( |
| 77 | &self, |
| 78 | direction: gst::PadDirection, |
| 79 | caps: &gst::Caps, |
| 80 | filter: &gst::Caps, |
| 81 | ) -> gst::Caps { |
| 82 | unsafe { |
| 83 | from_glib_full(ffi::gst_gl_view_convert_transform_caps( |
| 84 | self.to_glib_none().0, |
| 85 | direction.into_glib(), |
| 86 | caps.to_glib_none().0, |
| 87 | filter.to_glib_none().0, |
| 88 | )) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | #[doc (alias = "downmix-mode" )] |
| 93 | pub fn downmix_mode(&self) -> GLStereoDownmix { |
| 94 | ObjectExt::property(self, "downmix-mode" ) |
| 95 | } |
| 96 | |
| 97 | #[doc (alias = "downmix-mode" )] |
| 98 | pub fn set_downmix_mode(&self, downmix_mode: GLStereoDownmix) { |
| 99 | ObjectExt::set_property(self, "downmix-mode" , downmix_mode) |
| 100 | } |
| 101 | |
| 102 | #[doc (alias = "input-flags-override" )] |
| 103 | pub fn input_flags_override(&self) -> gst_video::VideoMultiviewFlags { |
| 104 | ObjectExt::property(self, "input-flags-override" ) |
| 105 | } |
| 106 | |
| 107 | #[doc (alias = "input-flags-override" )] |
| 108 | pub fn set_input_flags_override(&self, input_flags_override: gst_video::VideoMultiviewFlags) { |
| 109 | ObjectExt::set_property(self, "input-flags-override" , input_flags_override) |
| 110 | } |
| 111 | |
| 112 | #[doc (alias = "input-mode-override" )] |
| 113 | pub fn input_mode_override(&self) -> gst_video::VideoMultiviewMode { |
| 114 | ObjectExt::property(self, "input-mode-override" ) |
| 115 | } |
| 116 | |
| 117 | #[doc (alias = "input-mode-override" )] |
| 118 | pub fn set_input_mode_override(&self, input_mode_override: gst_video::VideoMultiviewMode) { |
| 119 | ObjectExt::set_property(self, "input-mode-override" , input_mode_override) |
| 120 | } |
| 121 | |
| 122 | #[doc (alias = "output-flags-override" )] |
| 123 | pub fn output_flags_override(&self) -> gst_video::VideoMultiviewFlags { |
| 124 | ObjectExt::property(self, "output-flags-override" ) |
| 125 | } |
| 126 | |
| 127 | #[doc (alias = "output-flags-override" )] |
| 128 | pub fn set_output_flags_override(&self, output_flags_override: gst_video::VideoMultiviewFlags) { |
| 129 | ObjectExt::set_property(self, "output-flags-override" , output_flags_override) |
| 130 | } |
| 131 | |
| 132 | #[doc (alias = "output-mode-override" )] |
| 133 | pub fn output_mode_override(&self) -> gst_video::VideoMultiviewMode { |
| 134 | ObjectExt::property(self, "output-mode-override" ) |
| 135 | } |
| 136 | |
| 137 | #[doc (alias = "output-mode-override" )] |
| 138 | pub fn set_output_mode_override(&self, output_mode_override: gst_video::VideoMultiviewMode) { |
| 139 | ObjectExt::set_property(self, "output-mode-override" , output_mode_override) |
| 140 | } |
| 141 | |
| 142 | #[doc (alias = "downmix-mode" )] |
| 143 | pub fn connect_downmix_mode_notify<F: Fn(&Self) + Send + Sync + 'static>( |
| 144 | &self, |
| 145 | f: F, |
| 146 | ) -> SignalHandlerId { |
| 147 | unsafe extern "C" fn notify_downmix_mode_trampoline< |
| 148 | F: Fn(&GLViewConvert) + Send + Sync + 'static, |
| 149 | >( |
| 150 | this: *mut ffi::GstGLViewConvert, |
| 151 | _param_spec: glib::ffi::gpointer, |
| 152 | f: glib::ffi::gpointer, |
| 153 | ) { |
| 154 | let f: &F = &*(f as *const F); |
| 155 | f(&from_glib_borrow(this)) |
| 156 | } |
| 157 | unsafe { |
| 158 | let f: Box_<F> = Box_::new(f); |
| 159 | connect_raw( |
| 160 | self.as_ptr() as *mut _, |
| 161 | b"notify::downmix-mode \0" .as_ptr() as *const _, |
| 162 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 163 | notify_downmix_mode_trampoline::<F> as *const (), |
| 164 | )), |
| 165 | Box_::into_raw(f), |
| 166 | ) |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | #[doc (alias = "input-flags-override" )] |
| 171 | pub fn connect_input_flags_override_notify<F: Fn(&Self) + Send + Sync + 'static>( |
| 172 | &self, |
| 173 | f: F, |
| 174 | ) -> SignalHandlerId { |
| 175 | unsafe extern "C" fn notify_input_flags_override_trampoline< |
| 176 | F: Fn(&GLViewConvert) + Send + Sync + 'static, |
| 177 | >( |
| 178 | this: *mut ffi::GstGLViewConvert, |
| 179 | _param_spec: glib::ffi::gpointer, |
| 180 | f: glib::ffi::gpointer, |
| 181 | ) { |
| 182 | let f: &F = &*(f as *const F); |
| 183 | f(&from_glib_borrow(this)) |
| 184 | } |
| 185 | unsafe { |
| 186 | let f: Box_<F> = Box_::new(f); |
| 187 | connect_raw( |
| 188 | self.as_ptr() as *mut _, |
| 189 | b"notify::input-flags-override \0" .as_ptr() as *const _, |
| 190 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 191 | notify_input_flags_override_trampoline::<F> as *const (), |
| 192 | )), |
| 193 | Box_::into_raw(f), |
| 194 | ) |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | #[doc (alias = "input-mode-override" )] |
| 199 | pub fn connect_input_mode_override_notify<F: Fn(&Self) + Send + Sync + 'static>( |
| 200 | &self, |
| 201 | f: F, |
| 202 | ) -> SignalHandlerId { |
| 203 | unsafe extern "C" fn notify_input_mode_override_trampoline< |
| 204 | F: Fn(&GLViewConvert) + Send + Sync + 'static, |
| 205 | >( |
| 206 | this: *mut ffi::GstGLViewConvert, |
| 207 | _param_spec: glib::ffi::gpointer, |
| 208 | f: glib::ffi::gpointer, |
| 209 | ) { |
| 210 | let f: &F = &*(f as *const F); |
| 211 | f(&from_glib_borrow(this)) |
| 212 | } |
| 213 | unsafe { |
| 214 | let f: Box_<F> = Box_::new(f); |
| 215 | connect_raw( |
| 216 | self.as_ptr() as *mut _, |
| 217 | b"notify::input-mode-override \0" .as_ptr() as *const _, |
| 218 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 219 | notify_input_mode_override_trampoline::<F> as *const (), |
| 220 | )), |
| 221 | Box_::into_raw(f), |
| 222 | ) |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | #[doc (alias = "output-flags-override" )] |
| 227 | pub fn connect_output_flags_override_notify<F: Fn(&Self) + Send + Sync + 'static>( |
| 228 | &self, |
| 229 | f: F, |
| 230 | ) -> SignalHandlerId { |
| 231 | unsafe extern "C" fn notify_output_flags_override_trampoline< |
| 232 | F: Fn(&GLViewConvert) + Send + Sync + 'static, |
| 233 | >( |
| 234 | this: *mut ffi::GstGLViewConvert, |
| 235 | _param_spec: glib::ffi::gpointer, |
| 236 | f: glib::ffi::gpointer, |
| 237 | ) { |
| 238 | let f: &F = &*(f as *const F); |
| 239 | f(&from_glib_borrow(this)) |
| 240 | } |
| 241 | unsafe { |
| 242 | let f: Box_<F> = Box_::new(f); |
| 243 | connect_raw( |
| 244 | self.as_ptr() as *mut _, |
| 245 | b"notify::output-flags-override \0" .as_ptr() as *const _, |
| 246 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 247 | notify_output_flags_override_trampoline::<F> as *const (), |
| 248 | )), |
| 249 | Box_::into_raw(f), |
| 250 | ) |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | #[doc (alias = "output-mode-override" )] |
| 255 | pub fn connect_output_mode_override_notify<F: Fn(&Self) + Send + Sync + 'static>( |
| 256 | &self, |
| 257 | f: F, |
| 258 | ) -> SignalHandlerId { |
| 259 | unsafe extern "C" fn notify_output_mode_override_trampoline< |
| 260 | F: Fn(&GLViewConvert) + Send + Sync + 'static, |
| 261 | >( |
| 262 | this: *mut ffi::GstGLViewConvert, |
| 263 | _param_spec: glib::ffi::gpointer, |
| 264 | f: glib::ffi::gpointer, |
| 265 | ) { |
| 266 | let f: &F = &*(f as *const F); |
| 267 | f(&from_glib_borrow(this)) |
| 268 | } |
| 269 | unsafe { |
| 270 | let f: Box_<F> = Box_::new(f); |
| 271 | connect_raw( |
| 272 | self.as_ptr() as *mut _, |
| 273 | b"notify::output-mode-override \0" .as_ptr() as *const _, |
| 274 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 275 | notify_output_mode_override_trampoline::<F> as *const (), |
| 276 | )), |
| 277 | Box_::into_raw(f), |
| 278 | ) |
| 279 | } |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | impl Default for GLViewConvert { |
| 284 | fn default() -> Self { |
| 285 | Self::new() |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | unsafe impl Send for GLViewConvert {} |
| 290 | unsafe impl Sync for GLViewConvert {} |
| 291 | |