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")]
17 pub struct DiscovererManager(Object<ffi::GESDiscovererManager, ffi::GESDiscovererManagerClass>);
18
19 match fn {
20 type_ => || ffi::ges_discoverer_manager_get_type(),
21 }
22}
23
24impl DiscovererManager {
25 #[doc(alias = "ges_discoverer_manager_get_timeout")]
26 #[doc(alias = "get_timeout")]
27 pub fn timeout(&self) -> Option<gst::ClockTime> {
28 unsafe {
29 from_glib(ffi::ges_discoverer_manager_get_timeout(
30 self.to_glib_none().0,
31 ))
32 }
33 }
34
35 #[doc(alias = "ges_discoverer_manager_get_use_cache")]
36 #[doc(alias = "get_use_cache")]
37 #[doc(alias = "use-cache")]
38 pub fn uses_cache(&self) -> bool {
39 unsafe {
40 from_glib(ffi::ges_discoverer_manager_get_use_cache(
41 self.to_glib_none().0,
42 ))
43 }
44 }
45
46 #[doc(alias = "ges_discoverer_manager_set_timeout")]
47 #[doc(alias = "timeout")]
48 pub fn set_timeout(&self, timeout: impl Into<Option<gst::ClockTime>>) {
49 unsafe {
50 ffi::ges_discoverer_manager_set_timeout(
51 self.to_glib_none().0,
52 timeout.into().into_glib(),
53 );
54 }
55 }
56
57 #[doc(alias = "ges_discoverer_manager_set_use_cache")]
58 #[doc(alias = "use-cache")]
59 pub fn set_use_cache(&self, use_cache: bool) {
60 unsafe {
61 ffi::ges_discoverer_manager_set_use_cache(self.to_glib_none().0, use_cache.into_glib());
62 }
63 }
64
65 #[cfg(not(feature = "v1_24"))]
66 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_24"))))]
67 #[doc(alias = "use-cache")]
68 pub fn uses_cache(&self) -> bool {
69 ObjectExt::property(self, "use-cache")
70 }
71
72 #[cfg(not(feature = "v1_24"))]
73 #[cfg_attr(docsrs, doc(cfg(not(feature = "v1_24"))))]
74 #[doc(alias = "use-cache")]
75 pub fn set_use_cache(&self, use_cache: bool) {
76 ObjectExt::set_property(self, "use-cache", use_cache)
77 }
78
79 #[doc(alias = "ges_discoverer_manager_get_default")]
80 #[doc(alias = "get_default")]
81 #[allow(clippy::should_implement_trait)]
82 pub fn default() -> DiscovererManager {
83 assert_initialized_main_thread!();
84 unsafe { from_glib_full(ffi::ges_discoverer_manager_get_default()) }
85 }
86
87 #[cfg(feature = "v1_24")]
88 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
89 #[doc(alias = "discovered")]
90 pub fn connect_discovered<
91 F: Fn(&Self, &gst_pbutils::DiscovererInfo, Option<&glib::Error>) + 'static,
92 >(
93 &self,
94 f: F,
95 ) -> SignalHandlerId {
96 unsafe extern "C" fn discovered_trampoline<
97 F: Fn(&DiscovererManager, &gst_pbutils::DiscovererInfo, Option<&glib::Error>) + 'static,
98 >(
99 this: *mut ffi::GESDiscovererManager,
100 info: *mut gst_pbutils::ffi::GstDiscovererInfo,
101 error: *mut glib::ffi::GError,
102 f: glib::ffi::gpointer,
103 ) {
104 unsafe {
105 let f: &F = &*(f as *const F);
106 f(
107 &from_glib_borrow(this),
108 &from_glib_borrow(info),
109 Option::<glib::Error>::from_glib_borrow(error)
110 .as_ref()
111 .as_ref(),
112 )
113 }
114 }
115 unsafe {
116 let f: Box_<F> = Box_::new(f);
117 connect_raw(
118 self.as_ptr() as *mut _,
119 c"discovered".as_ptr(),
120 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
121 discovered_trampoline::<F> as *const (),
122 )),
123 Box_::into_raw(f),
124 )
125 }
126 }
127
128 #[cfg(feature = "v1_24")]
129 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
130 #[doc(alias = "load-serialized-info")]
131 pub fn connect_load_serialized_info<
132 F: Fn(&Self, &str) -> Option<gst_pbutils::DiscovererInfo> + 'static,
133 >(
134 &self,
135 f: F,
136 ) -> SignalHandlerId {
137 unsafe extern "C" fn load_serialized_info_trampoline<
138 F: Fn(&DiscovererManager, &str) -> Option<gst_pbutils::DiscovererInfo> + 'static,
139 >(
140 this: *mut ffi::GESDiscovererManager,
141 uri: *mut std::ffi::c_char,
142 f: glib::ffi::gpointer,
143 ) -> *mut gst_pbutils::ffi::GstDiscovererInfo {
144 unsafe {
145 let f: &F = &*(f as *const F);
146 f(
147 &from_glib_borrow(this),
148 &glib::GString::from_glib_borrow(uri),
149 )
150 .to_glib_full()
151 }
152 }
153 unsafe {
154 let f: Box_<F> = Box_::new(f);
155 connect_raw(
156 self.as_ptr() as *mut _,
157 c"load-serialized-info".as_ptr(),
158 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
159 load_serialized_info_trampoline::<F> as *const (),
160 )),
161 Box_::into_raw(f),
162 )
163 }
164 }
165
166 #[cfg(feature = "v1_24")]
167 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
168 #[doc(alias = "source-setup")]
169 pub fn connect_source_setup<F: Fn(&Self, &gst::Element) + 'static>(
170 &self,
171 f: F,
172 ) -> SignalHandlerId {
173 unsafe extern "C" fn source_setup_trampoline<
174 F: Fn(&DiscovererManager, &gst::Element) + 'static,
175 >(
176 this: *mut ffi::GESDiscovererManager,
177 source: *mut gst::ffi::GstElement,
178 f: glib::ffi::gpointer,
179 ) {
180 unsafe {
181 let f: &F = &*(f as *const F);
182 f(&from_glib_borrow(this), &from_glib_borrow(source))
183 }
184 }
185 unsafe {
186 let f: Box_<F> = Box_::new(f);
187 connect_raw(
188 self.as_ptr() as *mut _,
189 c"source-setup".as_ptr(),
190 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
191 source_setup_trampoline::<F> as *const (),
192 )),
193 Box_::into_raw(f),
194 )
195 }
196 }
197
198 #[cfg(feature = "v1_24")]
199 #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
200 #[doc(alias = "timeout")]
201 pub fn connect_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
202 unsafe extern "C" fn notify_timeout_trampoline<F: Fn(&DiscovererManager) + 'static>(
203 this: *mut ffi::GESDiscovererManager,
204 _param_spec: glib::ffi::gpointer,
205 f: glib::ffi::gpointer,
206 ) {
207 unsafe {
208 let f: &F = &*(f as *const F);
209 f(&from_glib_borrow(this))
210 }
211 }
212 unsafe {
213 let f: Box_<F> = Box_::new(f);
214 connect_raw(
215 self.as_ptr() as *mut _,
216 c"notify::timeout".as_ptr(),
217 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
218 notify_timeout_trampoline::<F> as *const (),
219 )),
220 Box_::into_raw(f),
221 )
222 }
223 }
224
225 #[doc(alias = "use-cache")]
226 pub fn connect_use_cache_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
227 unsafe extern "C" fn notify_use_cache_trampoline<F: Fn(&DiscovererManager) + 'static>(
228 this: *mut ffi::GESDiscovererManager,
229 _param_spec: glib::ffi::gpointer,
230 f: glib::ffi::gpointer,
231 ) {
232 unsafe {
233 let f: &F = &*(f as *const F);
234 f(&from_glib_borrow(this))
235 }
236 }
237 unsafe {
238 let f: Box_<F> = Box_::new(f);
239 connect_raw(
240 self.as_ptr() as *mut _,
241 c"notify::use-cache".as_ptr(),
242 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
243 notify_use_cache_trampoline::<F> as *const (),
244 )),
245 Box_::into_raw(f),
246 )
247 }
248 }
249}