gstreamer_editing_services/auto/
discoverer_manager.rs

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    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")]
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            let f: &F = &*(f as *const F);
105            f(
106                &from_glib_borrow(this),
107                &from_glib_borrow(info),
108                Option::<glib::Error>::from_glib_borrow(error)
109                    .as_ref()
110                    .as_ref(),
111            )
112        }
113        unsafe {
114            let f: Box_<F> = Box_::new(f);
115            connect_raw(
116                self.as_ptr() as *mut _,
117                c"discovered".as_ptr() as *const _,
118                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
119                    discovered_trampoline::<F> as *const (),
120                )),
121                Box_::into_raw(f),
122            )
123        }
124    }
125
126    #[cfg(feature = "v1_24")]
127    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
128    #[doc(alias = "load-serialized-info")]
129    pub fn connect_load_serialized_info<
130        F: Fn(&Self, &str) -> Option<gst_pbutils::DiscovererInfo> + 'static,
131    >(
132        &self,
133        f: F,
134    ) -> SignalHandlerId {
135        unsafe extern "C" fn load_serialized_info_trampoline<
136            F: Fn(&DiscovererManager, &str) -> Option<gst_pbutils::DiscovererInfo> + 'static,
137        >(
138            this: *mut ffi::GESDiscovererManager,
139            uri: *mut std::ffi::c_char,
140            f: glib::ffi::gpointer,
141        ) -> *mut gst_pbutils::ffi::GstDiscovererInfo {
142            let f: &F = &*(f as *const F);
143            f(
144                &from_glib_borrow(this),
145                &glib::GString::from_glib_borrow(uri),
146            )
147            .to_glib_full()
148        }
149        unsafe {
150            let f: Box_<F> = Box_::new(f);
151            connect_raw(
152                self.as_ptr() as *mut _,
153                c"load-serialized-info".as_ptr() as *const _,
154                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
155                    load_serialized_info_trampoline::<F> as *const (),
156                )),
157                Box_::into_raw(f),
158            )
159        }
160    }
161
162    #[cfg(feature = "v1_24")]
163    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
164    #[doc(alias = "source-setup")]
165    pub fn connect_source_setup<F: Fn(&Self, &gst::Element) + 'static>(
166        &self,
167        f: F,
168    ) -> SignalHandlerId {
169        unsafe extern "C" fn source_setup_trampoline<
170            F: Fn(&DiscovererManager, &gst::Element) + 'static,
171        >(
172            this: *mut ffi::GESDiscovererManager,
173            source: *mut gst::ffi::GstElement,
174            f: glib::ffi::gpointer,
175        ) {
176            let f: &F = &*(f as *const F);
177            f(&from_glib_borrow(this), &from_glib_borrow(source))
178        }
179        unsafe {
180            let f: Box_<F> = Box_::new(f);
181            connect_raw(
182                self.as_ptr() as *mut _,
183                c"source-setup".as_ptr() as *const _,
184                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
185                    source_setup_trampoline::<F> as *const (),
186                )),
187                Box_::into_raw(f),
188            )
189        }
190    }
191
192    #[cfg(feature = "v1_24")]
193    #[cfg_attr(docsrs, doc(cfg(feature = "v1_24")))]
194    #[doc(alias = "timeout")]
195    pub fn connect_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
196        unsafe extern "C" fn notify_timeout_trampoline<F: Fn(&DiscovererManager) + 'static>(
197            this: *mut ffi::GESDiscovererManager,
198            _param_spec: glib::ffi::gpointer,
199            f: glib::ffi::gpointer,
200        ) {
201            let f: &F = &*(f as *const F);
202            f(&from_glib_borrow(this))
203        }
204        unsafe {
205            let f: Box_<F> = Box_::new(f);
206            connect_raw(
207                self.as_ptr() as *mut _,
208                c"notify::timeout".as_ptr() as *const _,
209                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
210                    notify_timeout_trampoline::<F> as *const (),
211                )),
212                Box_::into_raw(f),
213            )
214        }
215    }
216
217    #[doc(alias = "use-cache")]
218    pub fn connect_use_cache_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
219        unsafe extern "C" fn notify_use_cache_trampoline<F: Fn(&DiscovererManager) + 'static>(
220            this: *mut ffi::GESDiscovererManager,
221            _param_spec: glib::ffi::gpointer,
222            f: glib::ffi::gpointer,
223        ) {
224            let f: &F = &*(f as *const F);
225            f(&from_glib_borrow(this))
226        }
227        unsafe {
228            let f: Box_<F> = Box_::new(f);
229            connect_raw(
230                self.as_ptr() as *mut _,
231                c"notify::use-cache".as_ptr() as *const _,
232                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
233                    notify_use_cache_trampoline::<F> as *const (),
234                )),
235                Box_::into_raw(f),
236            )
237        }
238    }
239}