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