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 glib::{ |
7 | prelude::*, |
8 | signal::{connect_raw, SignalHandlerId}, |
9 | translate::*, |
10 | }; |
11 | use std::{boxed::Box as Box_, mem::transmute}; |
12 | |
13 | glib::wrapper! { |
14 | #[doc (alias = "GstBaseTransform" )] |
15 | pub struct BaseTransform(Object<ffi::GstBaseTransform, ffi::GstBaseTransformClass>) @extends gst::Element, gst::Object; |
16 | |
17 | match fn { |
18 | type_ => || ffi::gst_base_transform_get_type(), |
19 | } |
20 | } |
21 | |
22 | impl BaseTransform { |
23 | pub const NONE: Option<&'static BaseTransform> = None; |
24 | } |
25 | |
26 | unsafe impl Send for BaseTransform {} |
27 | unsafe impl Sync for BaseTransform {} |
28 | |
29 | mod sealed { |
30 | pub trait Sealed {} |
31 | impl<T: super::IsA<super::BaseTransform>> Sealed for T {} |
32 | } |
33 | |
34 | pub trait BaseTransformExt: IsA<BaseTransform> + sealed::Sealed + 'static { |
35 | #[doc (alias = "gst_base_transform_get_buffer_pool" )] |
36 | #[doc (alias = "get_buffer_pool" )] |
37 | fn buffer_pool(&self) -> Option<gst::BufferPool> { |
38 | unsafe { |
39 | from_glib_full(ffi::gst_base_transform_get_buffer_pool( |
40 | self.as_ref().to_glib_none().0, |
41 | )) |
42 | } |
43 | } |
44 | |
45 | #[doc (alias = "gst_base_transform_is_in_place" )] |
46 | fn is_in_place(&self) -> bool { |
47 | unsafe { |
48 | from_glib(ffi::gst_base_transform_is_in_place( |
49 | self.as_ref().to_glib_none().0, |
50 | )) |
51 | } |
52 | } |
53 | |
54 | #[doc (alias = "gst_base_transform_is_passthrough" )] |
55 | fn is_passthrough(&self) -> bool { |
56 | unsafe { |
57 | from_glib(ffi::gst_base_transform_is_passthrough( |
58 | self.as_ref().to_glib_none().0, |
59 | )) |
60 | } |
61 | } |
62 | |
63 | #[cfg (feature = "v1_18" )] |
64 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_18" )))] |
65 | #[doc (alias = "gst_base_transform_reconfigure" )] |
66 | fn reconfigure(&self) -> bool { |
67 | unsafe { |
68 | from_glib(ffi::gst_base_transform_reconfigure( |
69 | self.as_ref().to_glib_none().0, |
70 | )) |
71 | } |
72 | } |
73 | |
74 | #[doc (alias = "gst_base_transform_reconfigure_sink" )] |
75 | fn reconfigure_sink(&self) { |
76 | unsafe { |
77 | ffi::gst_base_transform_reconfigure_sink(self.as_ref().to_glib_none().0); |
78 | } |
79 | } |
80 | |
81 | #[doc (alias = "gst_base_transform_reconfigure_src" )] |
82 | fn reconfigure_src(&self) { |
83 | unsafe { |
84 | ffi::gst_base_transform_reconfigure_src(self.as_ref().to_glib_none().0); |
85 | } |
86 | } |
87 | |
88 | #[doc (alias = "gst_base_transform_set_gap_aware" )] |
89 | fn set_gap_aware(&self, gap_aware: bool) { |
90 | unsafe { |
91 | ffi::gst_base_transform_set_gap_aware( |
92 | self.as_ref().to_glib_none().0, |
93 | gap_aware.into_glib(), |
94 | ); |
95 | } |
96 | } |
97 | |
98 | #[doc (alias = "gst_base_transform_set_in_place" )] |
99 | fn set_in_place(&self, in_place: bool) { |
100 | unsafe { |
101 | ffi::gst_base_transform_set_in_place( |
102 | self.as_ref().to_glib_none().0, |
103 | in_place.into_glib(), |
104 | ); |
105 | } |
106 | } |
107 | |
108 | #[doc (alias = "gst_base_transform_set_passthrough" )] |
109 | fn set_passthrough(&self, passthrough: bool) { |
110 | unsafe { |
111 | ffi::gst_base_transform_set_passthrough( |
112 | self.as_ref().to_glib_none().0, |
113 | passthrough.into_glib(), |
114 | ); |
115 | } |
116 | } |
117 | |
118 | #[doc (alias = "gst_base_transform_set_prefer_passthrough" )] |
119 | fn set_prefer_passthrough(&self, prefer_passthrough: bool) { |
120 | unsafe { |
121 | ffi::gst_base_transform_set_prefer_passthrough( |
122 | self.as_ref().to_glib_none().0, |
123 | prefer_passthrough.into_glib(), |
124 | ); |
125 | } |
126 | } |
127 | |
128 | #[doc (alias = "gst_base_transform_update_qos" )] |
129 | fn update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime) { |
130 | unsafe { |
131 | ffi::gst_base_transform_update_qos( |
132 | self.as_ref().to_glib_none().0, |
133 | proportion, |
134 | diff, |
135 | timestamp.into_glib(), |
136 | ); |
137 | } |
138 | } |
139 | |
140 | #[doc (alias = "gst_base_transform_update_src_caps" )] |
141 | fn update_src_caps(&self, updated_caps: &gst::Caps) -> Result<(), glib::error::BoolError> { |
142 | unsafe { |
143 | glib::result_from_gboolean!( |
144 | ffi::gst_base_transform_update_src_caps( |
145 | self.as_ref().to_glib_none().0, |
146 | updated_caps.to_glib_none().0 |
147 | ), |
148 | "Failed to update src caps" |
149 | ) |
150 | } |
151 | } |
152 | |
153 | fn is_qos(&self) -> bool { |
154 | ObjectExt::property(self.as_ref(), "qos" ) |
155 | } |
156 | |
157 | fn set_qos(&self, qos: bool) { |
158 | ObjectExt::set_property(self.as_ref(), "qos" , qos) |
159 | } |
160 | |
161 | #[doc (alias = "qos" )] |
162 | fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { |
163 | unsafe extern "C" fn notify_qos_trampoline< |
164 | P: IsA<BaseTransform>, |
165 | F: Fn(&P) + Send + Sync + 'static, |
166 | >( |
167 | this: *mut ffi::GstBaseTransform, |
168 | _param_spec: glib::ffi::gpointer, |
169 | f: glib::ffi::gpointer, |
170 | ) { |
171 | let f: &F = &*(f as *const F); |
172 | f(BaseTransform::from_glib_borrow(this).unsafe_cast_ref()) |
173 | } |
174 | unsafe { |
175 | let f: Box_<F> = Box_::new(f); |
176 | connect_raw( |
177 | self.as_ptr() as *mut _, |
178 | b"notify::qos \0" .as_ptr() as *const _, |
179 | Some(transmute::<_, unsafe extern "C" fn()>( |
180 | notify_qos_trampoline::<Self, F> as *const (), |
181 | )), |
182 | Box_::into_raw(f), |
183 | ) |
184 | } |
185 | } |
186 | } |
187 | |
188 | impl<O: IsA<BaseTransform>> BaseTransformExt for O {} |
189 | |