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