gstreamer_play/auto/
play_signal_adapter.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, Play, PlayMediaInfo, PlayState};
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 = "GstPlaySignalAdapter")]
17    pub struct PlaySignalAdapter(Object<ffi::GstPlaySignalAdapter, ffi::GstPlaySignalAdapterClass>);
18
19    match fn {
20        type_ => || ffi::gst_play_signal_adapter_get_type(),
21    }
22}
23
24impl PlaySignalAdapter {
25    #[doc(alias = "gst_play_signal_adapter_new")]
26    pub fn new(play: &Play) -> PlaySignalAdapter {
27        skip_assert_initialized!();
28        unsafe { from_glib_full(ffi::gst_play_signal_adapter_new(play.to_glib_none().0)) }
29    }
30
31    #[doc(alias = "gst_play_signal_adapter_new_sync_emit")]
32    pub fn new_sync_emit(play: &Play) -> PlaySignalAdapter {
33        skip_assert_initialized!();
34        unsafe {
35            from_glib_full(ffi::gst_play_signal_adapter_new_sync_emit(
36                play.to_glib_none().0,
37            ))
38        }
39    }
40
41    #[doc(alias = "gst_play_signal_adapter_new_with_main_context")]
42    #[doc(alias = "new_with_main_context")]
43    pub fn with_main_context(play: &Play, context: &glib::MainContext) -> PlaySignalAdapter {
44        skip_assert_initialized!();
45        unsafe {
46            from_glib_full(ffi::gst_play_signal_adapter_new_with_main_context(
47                play.to_glib_none().0,
48                context.to_glib_none().0,
49            ))
50        }
51    }
52
53    #[doc(alias = "gst_play_signal_adapter_get_play")]
54    #[doc(alias = "get_play")]
55    pub fn play(&self) -> Play {
56        unsafe { from_glib_none(ffi::gst_play_signal_adapter_get_play(self.to_glib_none().0)) }
57    }
58
59    #[doc(alias = "buffering")]
60    pub fn connect_buffering<F: Fn(&Self, i32) + Send + 'static>(&self, f: F) -> SignalHandlerId {
61        unsafe extern "C" fn buffering_trampoline<
62            F: Fn(&PlaySignalAdapter, i32) + Send + 'static,
63        >(
64            this: *mut ffi::GstPlaySignalAdapter,
65            object: std::ffi::c_int,
66            f: glib::ffi::gpointer,
67        ) {
68            let f: &F = &*(f as *const F);
69            f(&from_glib_borrow(this), object)
70        }
71        unsafe {
72            let f: Box_<F> = Box_::new(f);
73            connect_raw(
74                self.as_ptr() as *mut _,
75                b"buffering\0".as_ptr() as *const _,
76                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
77                    buffering_trampoline::<F> as *const (),
78                )),
79                Box_::into_raw(f),
80            )
81        }
82    }
83
84    #[doc(alias = "end-of-stream")]
85    pub fn connect_end_of_stream<F: Fn(&Self) + Send + 'static>(&self, f: F) -> SignalHandlerId {
86        unsafe extern "C" fn end_of_stream_trampoline<
87            F: Fn(&PlaySignalAdapter) + Send + 'static,
88        >(
89            this: *mut ffi::GstPlaySignalAdapter,
90            f: glib::ffi::gpointer,
91        ) {
92            let f: &F = &*(f as *const F);
93            f(&from_glib_borrow(this))
94        }
95        unsafe {
96            let f: Box_<F> = Box_::new(f);
97            connect_raw(
98                self.as_ptr() as *mut _,
99                b"end-of-stream\0".as_ptr() as *const _,
100                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
101                    end_of_stream_trampoline::<F> as *const (),
102                )),
103                Box_::into_raw(f),
104            )
105        }
106    }
107
108    #[doc(alias = "error")]
109    pub fn connect_error<F: Fn(&Self, &glib::Error, Option<&gst::Structure>) + Send + 'static>(
110        &self,
111        f: F,
112    ) -> SignalHandlerId {
113        unsafe extern "C" fn error_trampoline<
114            F: Fn(&PlaySignalAdapter, &glib::Error, Option<&gst::Structure>) + Send + 'static,
115        >(
116            this: *mut ffi::GstPlaySignalAdapter,
117            error: *mut glib::ffi::GError,
118            details: *mut gst::ffi::GstStructure,
119            f: glib::ffi::gpointer,
120        ) {
121            let f: &F = &*(f as *const F);
122            f(
123                &from_glib_borrow(this),
124                &from_glib_borrow(error),
125                Option::<gst::Structure>::from_glib_borrow(details)
126                    .as_ref()
127                    .as_ref(),
128            )
129        }
130        unsafe {
131            let f: Box_<F> = Box_::new(f);
132            connect_raw(
133                self.as_ptr() as *mut _,
134                b"error\0".as_ptr() as *const _,
135                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
136                    error_trampoline::<F> as *const (),
137                )),
138                Box_::into_raw(f),
139            )
140        }
141    }
142
143    #[doc(alias = "media-info-updated")]
144    pub fn connect_media_info_updated<F: Fn(&Self, &PlayMediaInfo) + Send + 'static>(
145        &self,
146        f: F,
147    ) -> SignalHandlerId {
148        unsafe extern "C" fn media_info_updated_trampoline<
149            F: Fn(&PlaySignalAdapter, &PlayMediaInfo) + Send + 'static,
150        >(
151            this: *mut ffi::GstPlaySignalAdapter,
152            object: *mut ffi::GstPlayMediaInfo,
153            f: glib::ffi::gpointer,
154        ) {
155            let f: &F = &*(f as *const F);
156            f(&from_glib_borrow(this), &from_glib_borrow(object))
157        }
158        unsafe {
159            let f: Box_<F> = Box_::new(f);
160            connect_raw(
161                self.as_ptr() as *mut _,
162                b"media-info-updated\0".as_ptr() as *const _,
163                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
164                    media_info_updated_trampoline::<F> as *const (),
165                )),
166                Box_::into_raw(f),
167            )
168        }
169    }
170
171    #[doc(alias = "mute-changed")]
172    pub fn connect_mute_changed<F: Fn(&Self, bool) + Send + 'static>(
173        &self,
174        f: F,
175    ) -> SignalHandlerId {
176        unsafe extern "C" fn mute_changed_trampoline<
177            F: Fn(&PlaySignalAdapter, bool) + Send + 'static,
178        >(
179            this: *mut ffi::GstPlaySignalAdapter,
180            object: glib::ffi::gboolean,
181            f: glib::ffi::gpointer,
182        ) {
183            let f: &F = &*(f as *const F);
184            f(&from_glib_borrow(this), from_glib(object))
185        }
186        unsafe {
187            let f: Box_<F> = Box_::new(f);
188            connect_raw(
189                self.as_ptr() as *mut _,
190                b"mute-changed\0".as_ptr() as *const _,
191                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
192                    mute_changed_trampoline::<F> as *const (),
193                )),
194                Box_::into_raw(f),
195            )
196        }
197    }
198
199    #[doc(alias = "state-changed")]
200    pub fn connect_state_changed<F: Fn(&Self, PlayState) + Send + 'static>(
201        &self,
202        f: F,
203    ) -> SignalHandlerId {
204        unsafe extern "C" fn state_changed_trampoline<
205            F: Fn(&PlaySignalAdapter, PlayState) + Send + 'static,
206        >(
207            this: *mut ffi::GstPlaySignalAdapter,
208            object: ffi::GstPlayState,
209            f: glib::ffi::gpointer,
210        ) {
211            let f: &F = &*(f as *const F);
212            f(&from_glib_borrow(this), from_glib(object))
213        }
214        unsafe {
215            let f: Box_<F> = Box_::new(f);
216            connect_raw(
217                self.as_ptr() as *mut _,
218                b"state-changed\0".as_ptr() as *const _,
219                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
220                    state_changed_trampoline::<F> as *const (),
221                )),
222                Box_::into_raw(f),
223            )
224        }
225    }
226
227    #[doc(alias = "uri-loaded")]
228    pub fn connect_uri_loaded<F: Fn(&Self, &str) + Send + 'static>(&self, f: F) -> SignalHandlerId {
229        unsafe extern "C" fn uri_loaded_trampoline<
230            F: Fn(&PlaySignalAdapter, &str) + Send + 'static,
231        >(
232            this: *mut ffi::GstPlaySignalAdapter,
233            object: *mut std::ffi::c_char,
234            f: glib::ffi::gpointer,
235        ) {
236            let f: &F = &*(f as *const F);
237            f(
238                &from_glib_borrow(this),
239                &glib::GString::from_glib_borrow(object),
240            )
241        }
242        unsafe {
243            let f: Box_<F> = Box_::new(f);
244            connect_raw(
245                self.as_ptr() as *mut _,
246                b"uri-loaded\0".as_ptr() as *const _,
247                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
248                    uri_loaded_trampoline::<F> as *const (),
249                )),
250                Box_::into_raw(f),
251            )
252        }
253    }
254
255    #[doc(alias = "video-dimensions-changed")]
256    pub fn connect_video_dimensions_changed<F: Fn(&Self, u32, u32) + Send + 'static>(
257        &self,
258        f: F,
259    ) -> SignalHandlerId {
260        unsafe extern "C" fn video_dimensions_changed_trampoline<
261            F: Fn(&PlaySignalAdapter, u32, u32) + Send + 'static,
262        >(
263            this: *mut ffi::GstPlaySignalAdapter,
264            object: std::ffi::c_uint,
265            p0: std::ffi::c_uint,
266            f: glib::ffi::gpointer,
267        ) {
268            let f: &F = &*(f as *const F);
269            f(&from_glib_borrow(this), object, p0)
270        }
271        unsafe {
272            let f: Box_<F> = Box_::new(f);
273            connect_raw(
274                self.as_ptr() as *mut _,
275                b"video-dimensions-changed\0".as_ptr() as *const _,
276                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
277                    video_dimensions_changed_trampoline::<F> as *const (),
278                )),
279                Box_::into_raw(f),
280            )
281        }
282    }
283
284    #[doc(alias = "volume-changed")]
285    pub fn connect_volume_changed<F: Fn(&Self, f64) + Send + 'static>(
286        &self,
287        f: F,
288    ) -> SignalHandlerId {
289        unsafe extern "C" fn volume_changed_trampoline<
290            F: Fn(&PlaySignalAdapter, f64) + Send + 'static,
291        >(
292            this: *mut ffi::GstPlaySignalAdapter,
293            object: std::ffi::c_double,
294            f: glib::ffi::gpointer,
295        ) {
296            let f: &F = &*(f as *const F);
297            f(&from_glib_borrow(this), object)
298        }
299        unsafe {
300            let f: Box_<F> = Box_::new(f);
301            connect_raw(
302                self.as_ptr() as *mut _,
303                b"volume-changed\0".as_ptr() as *const _,
304                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
305                    volume_changed_trampoline::<F> as *const (),
306                )),
307                Box_::into_raw(f),
308            )
309        }
310    }
311
312    #[doc(alias = "warning")]
313    pub fn connect_warning<F: Fn(&Self, &glib::Error, Option<&gst::Structure>) + Send + 'static>(
314        &self,
315        f: F,
316    ) -> SignalHandlerId {
317        unsafe extern "C" fn warning_trampoline<
318            F: Fn(&PlaySignalAdapter, &glib::Error, Option<&gst::Structure>) + Send + 'static,
319        >(
320            this: *mut ffi::GstPlaySignalAdapter,
321            error: *mut glib::ffi::GError,
322            details: *mut gst::ffi::GstStructure,
323            f: glib::ffi::gpointer,
324        ) {
325            let f: &F = &*(f as *const F);
326            f(
327                &from_glib_borrow(this),
328                &from_glib_borrow(error),
329                Option::<gst::Structure>::from_glib_borrow(details)
330                    .as_ref()
331                    .as_ref(),
332            )
333        }
334        unsafe {
335            let f: Box_<F> = Box_::new(f);
336            connect_raw(
337                self.as_ptr() as *mut _,
338                b"warning\0".as_ptr() as *const _,
339                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
340                    warning_trampoline::<F> as *const (),
341                )),
342                Box_::into_raw(f),
343            )
344        }
345    }
346
347    #[doc(alias = "play")]
348    pub fn connect_play_notify<F: Fn(&Self) + Send + Sync + 'static>(
349        &self,
350        f: F,
351    ) -> SignalHandlerId {
352        unsafe extern "C" fn notify_play_trampoline<
353            F: Fn(&PlaySignalAdapter) + Send + Sync + 'static,
354        >(
355            this: *mut ffi::GstPlaySignalAdapter,
356            _param_spec: glib::ffi::gpointer,
357            f: glib::ffi::gpointer,
358        ) {
359            let f: &F = &*(f as *const F);
360            f(&from_glib_borrow(this))
361        }
362        unsafe {
363            let f: Box_<F> = Box_::new(f);
364            connect_raw(
365                self.as_ptr() as *mut _,
366                b"notify::play\0".as_ptr() as *const _,
367                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
368                    notify_play_trampoline::<F> as *const (),
369                )),
370                Box_::into_raw(f),
371            )
372        }
373    }
374}
375
376unsafe impl Send for PlaySignalAdapter {}
377unsafe impl Sync for PlaySignalAdapter {}