gstreamer_editing_services/auto/
discoverer_manager.rs
1use crate::ffi;
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
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 let f: &F = &*(f as *const F);
164 f(
165 &from_glib_borrow(this),
166 &from_glib_borrow(info),
167 Option::<glib::Error>::from_glib_borrow(error)
168 .as_ref()
169 .as_ref(),
170 )
171 }
172 unsafe {
173 let f: Box_<F> = Box_::new(f);
174 connect_raw(
175 self.as_ptr() as *mut _,
176 c"discovered".as_ptr() as *const _,
177 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
178 discovered_trampoline::<F> as *const (),
179 )),
180 Box_::into_raw(f),
181 )
182 }
183 }
184
185 #[cfg(feature = "v1_24")]
196 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
197 #[doc(alias = "load-serialized-info")]
198 pub fn connect_load_serialized_info<
199 F: Fn(&Self, &str) -> Option<gst_pbutils::DiscovererInfo> + 'static,
200 >(
201 &self,
202 f: F,
203 ) -> SignalHandlerId {
204 unsafe extern "C" fn load_serialized_info_trampoline<
205 F: Fn(&DiscovererManager, &str) -> Option<gst_pbutils::DiscovererInfo> + 'static,
206 >(
207 this: *mut ffi::GESDiscovererManager,
208 uri: *mut std::ffi::c_char,
209 f: glib::ffi::gpointer,
210 ) -> *mut gst_pbutils::ffi::GstDiscovererInfo {
211 let f: &F = &*(f as *const F);
212 f(
213 &from_glib_borrow(this),
214 &glib::GString::from_glib_borrow(uri),
215 )
216 .to_glib_full()
217 }
218 unsafe {
219 let f: Box_<F> = Box_::new(f);
220 connect_raw(
221 self.as_ptr() as *mut _,
222 c"load-serialized-info".as_ptr() as *const _,
223 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
224 load_serialized_info_trampoline::<F> as *const (),
225 )),
226 Box_::into_raw(f),
227 )
228 }
229 }
230
231 #[cfg(feature = "v1_24")]
235 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
236 #[doc(alias = "source-setup")]
237 pub fn connect_source_setup<F: Fn(&Self, &gst::Element) + 'static>(
238 &self,
239 f: F,
240 ) -> SignalHandlerId {
241 unsafe extern "C" fn source_setup_trampoline<
242 F: Fn(&DiscovererManager, &gst::Element) + 'static,
243 >(
244 this: *mut ffi::GESDiscovererManager,
245 source: *mut gst::ffi::GstElement,
246 f: glib::ffi::gpointer,
247 ) {
248 let f: &F = &*(f as *const F);
249 f(&from_glib_borrow(this), &from_glib_borrow(source))
250 }
251 unsafe {
252 let f: Box_<F> = Box_::new(f);
253 connect_raw(
254 self.as_ptr() as *mut _,
255 c"source-setup".as_ptr() as *const _,
256 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
257 source_setup_trampoline::<F> as *const (),
258 )),
259 Box_::into_raw(f),
260 )
261 }
262 }
263
264 #[cfg(feature = "v1_24")]
265 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
266 #[doc(alias = "timeout")]
267 pub fn connect_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
268 unsafe extern "C" fn notify_timeout_trampoline<F: Fn(&DiscovererManager) + 'static>(
269 this: *mut ffi::GESDiscovererManager,
270 _param_spec: glib::ffi::gpointer,
271 f: glib::ffi::gpointer,
272 ) {
273 let f: &F = &*(f as *const F);
274 f(&from_glib_borrow(this))
275 }
276 unsafe {
277 let f: Box_<F> = Box_::new(f);
278 connect_raw(
279 self.as_ptr() as *mut _,
280 c"notify::timeout".as_ptr() as *const _,
281 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
282 notify_timeout_trampoline::<F> as *const (),
283 )),
284 Box_::into_raw(f),
285 )
286 }
287 }
288
289 #[doc(alias = "use-cache")]
290 pub fn connect_use_cache_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
291 unsafe extern "C" fn notify_use_cache_trampoline<F: Fn(&DiscovererManager) + 'static>(
292 this: *mut ffi::GESDiscovererManager,
293 _param_spec: glib::ffi::gpointer,
294 f: glib::ffi::gpointer,
295 ) {
296 let f: &F = &*(f as *const F);
297 f(&from_glib_borrow(this))
298 }
299 unsafe {
300 let f: Box_<F> = Box_::new(f);
301 connect_raw(
302 self.as_ptr() as *mut _,
303 c"notify::use-cache".as_ptr() as *const _,
304 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
305 notify_use_cache_trampoline::<F> as *const (),
306 )),
307 Box_::into_raw(f),
308 )
309 }
310 }
311}