gstreamer_editing_services/auto/
discoverer_manager.rs1use crate::ffi;
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{SignalHandlerId, connect_raw},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "GESDiscovererManager")]
54 pub struct DiscovererManager(Object<ffi::GESDiscovererManager, ffi::GESDiscovererManagerClass>);
55
56 match fn {
57 type_ => || ffi::ges_discoverer_manager_get_type(),
58 }
59}
60
61impl DiscovererManager {
62 #[doc(alias = "ges_discoverer_manager_get_timeout")]
67 #[doc(alias = "get_timeout")]
68 pub fn timeout(&self) -> Option<gst::ClockTime> {
69 unsafe {
70 from_glib(ffi::ges_discoverer_manager_get_timeout(
71 self.to_glib_none().0,
72 ))
73 }
74 }
75
76 #[doc(alias = "ges_discoverer_manager_get_use_cache")]
81 #[doc(alias = "get_use_cache")]
82 #[doc(alias = "use-cache")]
83 pub fn uses_cache(&self) -> bool {
84 unsafe {
85 from_glib(ffi::ges_discoverer_manager_get_use_cache(
86 self.to_glib_none().0,
87 ))
88 }
89 }
90
91 #[doc(alias = "ges_discoverer_manager_set_timeout")]
95 #[doc(alias = "timeout")]
96 pub fn set_timeout(&self, timeout: impl Into<Option<gst::ClockTime>>) {
97 unsafe {
98 ffi::ges_discoverer_manager_set_timeout(
99 self.to_glib_none().0,
100 timeout.into().into_glib(),
101 );
102 }
103 }
104
105 #[doc(alias = "ges_discoverer_manager_set_use_cache")]
109 #[doc(alias = "use-cache")]
110 pub fn set_use_cache(&self, use_cache: bool) {
111 unsafe {
112 ffi::ges_discoverer_manager_set_use_cache(self.to_glib_none().0, use_cache.into_glib());
113 }
114 }
115
116 #[cfg(not(feature = "v1_24"))]
117 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_24"))))]
118 #[doc(alias = "use-cache")]
119 pub fn uses_cache(&self) -> bool {
120 ObjectExt::property(self, "use-cache")
121 }
122
123 #[cfg(not(feature = "v1_24"))]
124 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_24"))))]
125 #[doc(alias = "use-cache")]
126 pub fn set_use_cache(&self, use_cache: bool) {
127 ObjectExt::set_property(self, "use-cache", use_cache)
128 }
129
130 #[doc(alias = "ges_discoverer_manager_get_default")]
135 #[doc(alias = "get_default")]
136 #[allow(clippy::should_implement_trait)]
137 pub fn default() -> DiscovererManager {
138 assert_initialized_main_thread!();
139 unsafe { from_glib_full(ffi::ges_discoverer_manager_get_default()) }
140 }
141
142 #[cfg(feature = "v1_24")]
147 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
148 #[doc(alias = "discovered")]
149 pub fn connect_discovered<
150 F: Fn(&Self, &gst_pbutils::DiscovererInfo, Option<&glib::Error>) + 'static,
151 >(
152 &self,
153 f: F,
154 ) -> SignalHandlerId {
155 unsafe extern "C" fn discovered_trampoline<
156 F: Fn(&DiscovererManager, &gst_pbutils::DiscovererInfo, Option<&glib::Error>) + 'static,
157 >(
158 this: *mut ffi::GESDiscovererManager,
159 info: *mut gst_pbutils::ffi::GstDiscovererInfo,
160 error: *mut glib::ffi::GError,
161 f: glib::ffi::gpointer,
162 ) {
163 unsafe {
164 let f: &F = &*(f as *const F);
165 f(
166 &from_glib_borrow(this),
167 &from_glib_borrow(info),
168 Option::<glib::Error>::from_glib_borrow(error)
169 .as_ref()
170 .as_ref(),
171 )
172 }
173 }
174 unsafe {
175 let f: Box_<F> = Box_::new(f);
176 connect_raw(
177 self.as_ptr() as *mut _,
178 c"discovered".as_ptr(),
179 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
180 discovered_trampoline::<F> as *const (),
181 )),
182 Box_::into_raw(f),
183 )
184 }
185 }
186
187 #[cfg(feature = "v1_24")]
198 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
199 #[doc(alias = "load-serialized-info")]
200 pub fn connect_load_serialized_info<
201 F: Fn(&Self, &str) -> Option<gst_pbutils::DiscovererInfo> + 'static,
202 >(
203 &self,
204 f: F,
205 ) -> SignalHandlerId {
206 unsafe extern "C" fn load_serialized_info_trampoline<
207 F: Fn(&DiscovererManager, &str) -> Option<gst_pbutils::DiscovererInfo> + 'static,
208 >(
209 this: *mut ffi::GESDiscovererManager,
210 uri: *mut std::ffi::c_char,
211 f: glib::ffi::gpointer,
212 ) -> *mut gst_pbutils::ffi::GstDiscovererInfo {
213 unsafe {
214 let f: &F = &*(f as *const F);
215 f(
216 &from_glib_borrow(this),
217 &glib::GString::from_glib_borrow(uri),
218 )
219 .to_glib_full()
220 }
221 }
222 unsafe {
223 let f: Box_<F> = Box_::new(f);
224 connect_raw(
225 self.as_ptr() as *mut _,
226 c"load-serialized-info".as_ptr(),
227 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
228 load_serialized_info_trampoline::<F> as *const (),
229 )),
230 Box_::into_raw(f),
231 )
232 }
233 }
234
235 #[cfg(feature = "v1_24")]
239 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
240 #[doc(alias = "source-setup")]
241 pub fn connect_source_setup<F: Fn(&Self, &gst::Element) + 'static>(
242 &self,
243 f: F,
244 ) -> SignalHandlerId {
245 unsafe extern "C" fn source_setup_trampoline<
246 F: Fn(&DiscovererManager, &gst::Element) + 'static,
247 >(
248 this: *mut ffi::GESDiscovererManager,
249 source: *mut gst::ffi::GstElement,
250 f: glib::ffi::gpointer,
251 ) {
252 unsafe {
253 let f: &F = &*(f as *const F);
254 f(&from_glib_borrow(this), &from_glib_borrow(source))
255 }
256 }
257 unsafe {
258 let f: Box_<F> = Box_::new(f);
259 connect_raw(
260 self.as_ptr() as *mut _,
261 c"source-setup".as_ptr(),
262 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
263 source_setup_trampoline::<F> as *const (),
264 )),
265 Box_::into_raw(f),
266 )
267 }
268 }
269
270 #[cfg(feature = "v1_24")]
271 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
272 #[doc(alias = "timeout")]
273 pub fn connect_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
274 unsafe extern "C" fn notify_timeout_trampoline<F: Fn(&DiscovererManager) + 'static>(
275 this: *mut ffi::GESDiscovererManager,
276 _param_spec: glib::ffi::gpointer,
277 f: glib::ffi::gpointer,
278 ) {
279 unsafe {
280 let f: &F = &*(f as *const F);
281 f(&from_glib_borrow(this))
282 }
283 }
284 unsafe {
285 let f: Box_<F> = Box_::new(f);
286 connect_raw(
287 self.as_ptr() as *mut _,
288 c"notify::timeout".as_ptr(),
289 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
290 notify_timeout_trampoline::<F> as *const (),
291 )),
292 Box_::into_raw(f),
293 )
294 }
295 }
296
297 #[doc(alias = "use-cache")]
298 pub fn connect_use_cache_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
299 unsafe extern "C" fn notify_use_cache_trampoline<F: Fn(&DiscovererManager) + 'static>(
300 this: *mut ffi::GESDiscovererManager,
301 _param_spec: glib::ffi::gpointer,
302 f: glib::ffi::gpointer,
303 ) {
304 unsafe {
305 let f: &F = &*(f as *const F);
306 f(&from_glib_borrow(this))
307 }
308 }
309 unsafe {
310 let f: Box_<F> = Box_::new(f);
311 connect_raw(
312 self.as_ptr() as *mut _,
313 c"notify::use-cache".as_ptr(),
314 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
315 notify_use_cache_trampoline::<F> as *const (),
316 )),
317 Box_::into_raw(f),
318 )
319 }
320 }
321}