gstreamer_player/auto/
player.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::{
7    ffi, PlayerAudioInfo, PlayerColorBalanceType, PlayerMediaInfo, PlayerSignalDispatcher,
8    PlayerState, PlayerSubtitleInfo, PlayerVideoInfo, PlayerVideoRenderer, PlayerVisualization,
9};
10use glib::{
11    object::ObjectType as _,
12    prelude::*,
13    signal::{connect_raw, SignalHandlerId},
14    translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19    #[doc(alias = "GstPlayer")]
20    pub struct Player(Object<ffi::GstPlayer, ffi::GstPlayerClass>) @extends gst::Object;
21
22    match fn {
23        type_ => || ffi::gst_player_get_type(),
24    }
25}
26
27impl Player {
28    #[doc(alias = "gst_player_new")]
29    pub fn new(
30        video_renderer: Option<impl IsA<PlayerVideoRenderer>>,
31        signal_dispatcher: Option<impl IsA<PlayerSignalDispatcher>>,
32    ) -> Player {
33        assert_initialized_main_thread!();
34        unsafe {
35            from_glib_full(ffi::gst_player_new(
36                video_renderer.map(|p| p.upcast()).into_glib_ptr(),
37                signal_dispatcher.map(|p| p.upcast()).into_glib_ptr(),
38            ))
39        }
40    }
41
42    #[doc(alias = "gst_player_get_audio_video_offset")]
43    #[doc(alias = "get_audio_video_offset")]
44    #[doc(alias = "audio-video-offset")]
45    pub fn audio_video_offset(&self) -> i64 {
46        unsafe { ffi::gst_player_get_audio_video_offset(self.to_glib_none().0) }
47    }
48
49    #[doc(alias = "gst_player_get_color_balance")]
50    #[doc(alias = "get_color_balance")]
51    pub fn color_balance(&self, type_: PlayerColorBalanceType) -> f64 {
52        unsafe { ffi::gst_player_get_color_balance(self.to_glib_none().0, type_.into_glib()) }
53    }
54
55    #[doc(alias = "gst_player_get_current_audio_track")]
56    #[doc(alias = "get_current_audio_track")]
57    #[doc(alias = "current-audio-track")]
58    pub fn current_audio_track(&self) -> Option<PlayerAudioInfo> {
59        unsafe {
60            from_glib_full(ffi::gst_player_get_current_audio_track(
61                self.to_glib_none().0,
62            ))
63        }
64    }
65
66    #[doc(alias = "gst_player_get_current_subtitle_track")]
67    #[doc(alias = "get_current_subtitle_track")]
68    #[doc(alias = "current-subtitle-track")]
69    pub fn current_subtitle_track(&self) -> Option<PlayerSubtitleInfo> {
70        unsafe {
71            from_glib_full(ffi::gst_player_get_current_subtitle_track(
72                self.to_glib_none().0,
73            ))
74        }
75    }
76
77    #[doc(alias = "gst_player_get_current_video_track")]
78    #[doc(alias = "get_current_video_track")]
79    #[doc(alias = "current-video-track")]
80    pub fn current_video_track(&self) -> Option<PlayerVideoInfo> {
81        unsafe {
82            from_glib_full(ffi::gst_player_get_current_video_track(
83                self.to_glib_none().0,
84            ))
85        }
86    }
87
88    #[doc(alias = "gst_player_get_current_visualization")]
89    #[doc(alias = "get_current_visualization")]
90    pub fn current_visualization(&self) -> Option<glib::GString> {
91        unsafe {
92            from_glib_full(ffi::gst_player_get_current_visualization(
93                self.to_glib_none().0,
94            ))
95        }
96    }
97
98    #[doc(alias = "gst_player_get_duration")]
99    #[doc(alias = "get_duration")]
100    pub fn duration(&self) -> Option<gst::ClockTime> {
101        unsafe { from_glib(ffi::gst_player_get_duration(self.to_glib_none().0)) }
102    }
103
104    #[doc(alias = "gst_player_get_media_info")]
105    #[doc(alias = "get_media_info")]
106    #[doc(alias = "media-info")]
107    pub fn media_info(&self) -> Option<PlayerMediaInfo> {
108        unsafe { from_glib_full(ffi::gst_player_get_media_info(self.to_glib_none().0)) }
109    }
110
111    #[doc(alias = "gst_player_get_multiview_flags")]
112    #[doc(alias = "get_multiview_flags")]
113    pub fn multiview_flags(&self) -> gst_video::VideoMultiviewFlags {
114        unsafe { from_glib(ffi::gst_player_get_multiview_flags(self.to_glib_none().0)) }
115    }
116
117    #[doc(alias = "gst_player_get_multiview_mode")]
118    #[doc(alias = "get_multiview_mode")]
119    pub fn multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking {
120        unsafe { from_glib(ffi::gst_player_get_multiview_mode(self.to_glib_none().0)) }
121    }
122
123    #[doc(alias = "gst_player_get_mute")]
124    #[doc(alias = "get_mute")]
125    #[doc(alias = "mute")]
126    pub fn is_muted(&self) -> bool {
127        unsafe { from_glib(ffi::gst_player_get_mute(self.to_glib_none().0)) }
128    }
129
130    #[doc(alias = "gst_player_get_pipeline")]
131    #[doc(alias = "get_pipeline")]
132    pub fn pipeline(&self) -> gst::Element {
133        unsafe { from_glib_full(ffi::gst_player_get_pipeline(self.to_glib_none().0)) }
134    }
135
136    #[doc(alias = "gst_player_get_position")]
137    #[doc(alias = "get_position")]
138    pub fn position(&self) -> Option<gst::ClockTime> {
139        unsafe { from_glib(ffi::gst_player_get_position(self.to_glib_none().0)) }
140    }
141
142    #[doc(alias = "gst_player_get_rate")]
143    #[doc(alias = "get_rate")]
144    pub fn rate(&self) -> f64 {
145        unsafe { ffi::gst_player_get_rate(self.to_glib_none().0) }
146    }
147
148    #[doc(alias = "gst_player_get_subtitle_uri")]
149    #[doc(alias = "get_subtitle_uri")]
150    pub fn subtitle_uri(&self) -> Option<glib::GString> {
151        unsafe { from_glib_full(ffi::gst_player_get_subtitle_uri(self.to_glib_none().0)) }
152    }
153
154    #[cfg(feature = "v1_16")]
155    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
156    #[doc(alias = "gst_player_get_subtitle_video_offset")]
157    #[doc(alias = "get_subtitle_video_offset")]
158    #[doc(alias = "subtitle-video-offset")]
159    pub fn subtitle_video_offset(&self) -> i64 {
160        unsafe { ffi::gst_player_get_subtitle_video_offset(self.to_glib_none().0) }
161    }
162
163    #[doc(alias = "gst_player_get_uri")]
164    #[doc(alias = "get_uri")]
165    pub fn uri(&self) -> Option<glib::GString> {
166        unsafe { from_glib_full(ffi::gst_player_get_uri(self.to_glib_none().0)) }
167    }
168
169    #[doc(alias = "gst_player_get_volume")]
170    #[doc(alias = "get_volume")]
171    pub fn volume(&self) -> f64 {
172        unsafe { ffi::gst_player_get_volume(self.to_glib_none().0) }
173    }
174
175    #[doc(alias = "gst_player_has_color_balance")]
176    pub fn has_color_balance(&self) -> bool {
177        unsafe { from_glib(ffi::gst_player_has_color_balance(self.to_glib_none().0)) }
178    }
179
180    #[doc(alias = "gst_player_pause")]
181    pub fn pause(&self) {
182        unsafe {
183            ffi::gst_player_pause(self.to_glib_none().0);
184        }
185    }
186
187    #[doc(alias = "gst_player_play")]
188    pub fn play(&self) {
189        unsafe {
190            ffi::gst_player_play(self.to_glib_none().0);
191        }
192    }
193
194    #[doc(alias = "gst_player_seek")]
195    pub fn seek(&self, position: gst::ClockTime) {
196        unsafe {
197            ffi::gst_player_seek(self.to_glib_none().0, position.into_glib());
198        }
199    }
200
201    #[doc(alias = "gst_player_set_audio_track")]
202    pub fn set_audio_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> {
203        unsafe {
204            glib::result_from_gboolean!(
205                ffi::gst_player_set_audio_track(self.to_glib_none().0, stream_index),
206                "Failed to set audio track"
207            )
208        }
209    }
210
211    #[doc(alias = "gst_player_set_audio_track_enabled")]
212    pub fn set_audio_track_enabled(&self, enabled: bool) {
213        unsafe {
214            ffi::gst_player_set_audio_track_enabled(self.to_glib_none().0, enabled.into_glib());
215        }
216    }
217
218    #[doc(alias = "gst_player_set_audio_video_offset")]
219    #[doc(alias = "audio-video-offset")]
220    pub fn set_audio_video_offset(&self, offset: i64) {
221        unsafe {
222            ffi::gst_player_set_audio_video_offset(self.to_glib_none().0, offset);
223        }
224    }
225
226    #[doc(alias = "gst_player_set_color_balance")]
227    pub fn set_color_balance(&self, type_: PlayerColorBalanceType, value: f64) {
228        unsafe {
229            ffi::gst_player_set_color_balance(self.to_glib_none().0, type_.into_glib(), value);
230        }
231    }
232
233    #[doc(alias = "gst_player_set_multiview_flags")]
234    pub fn set_multiview_flags(&self, flags: gst_video::VideoMultiviewFlags) {
235        unsafe {
236            ffi::gst_player_set_multiview_flags(self.to_glib_none().0, flags.into_glib());
237        }
238    }
239
240    #[doc(alias = "gst_player_set_multiview_mode")]
241    pub fn set_multiview_mode(&self, mode: gst_video::VideoMultiviewFramePacking) {
242        unsafe {
243            ffi::gst_player_set_multiview_mode(self.to_glib_none().0, mode.into_glib());
244        }
245    }
246
247    #[doc(alias = "gst_player_set_mute")]
248    #[doc(alias = "mute")]
249    pub fn set_mute(&self, val: bool) {
250        unsafe {
251            ffi::gst_player_set_mute(self.to_glib_none().0, val.into_glib());
252        }
253    }
254
255    #[doc(alias = "gst_player_set_rate")]
256    #[doc(alias = "rate")]
257    pub fn set_rate(&self, rate: f64) {
258        unsafe {
259            ffi::gst_player_set_rate(self.to_glib_none().0, rate);
260        }
261    }
262
263    #[doc(alias = "gst_player_set_subtitle_track")]
264    pub fn set_subtitle_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> {
265        unsafe {
266            glib::result_from_gboolean!(
267                ffi::gst_player_set_subtitle_track(self.to_glib_none().0, stream_index),
268                "Failed to set subtitle track"
269            )
270        }
271    }
272
273    #[doc(alias = "gst_player_set_subtitle_track_enabled")]
274    pub fn set_subtitle_track_enabled(&self, enabled: bool) {
275        unsafe {
276            ffi::gst_player_set_subtitle_track_enabled(self.to_glib_none().0, enabled.into_glib());
277        }
278    }
279
280    #[doc(alias = "gst_player_set_subtitle_uri")]
281    pub fn set_subtitle_uri(&self, uri: Option<&str>) {
282        unsafe {
283            ffi::gst_player_set_subtitle_uri(self.to_glib_none().0, uri.to_glib_none().0);
284        }
285    }
286
287    #[cfg(feature = "v1_16")]
288    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
289    #[doc(alias = "gst_player_set_subtitle_video_offset")]
290    #[doc(alias = "subtitle-video-offset")]
291    pub fn set_subtitle_video_offset(&self, offset: i64) {
292        unsafe {
293            ffi::gst_player_set_subtitle_video_offset(self.to_glib_none().0, offset);
294        }
295    }
296
297    #[doc(alias = "gst_player_set_uri")]
298    #[doc(alias = "uri")]
299    pub fn set_uri(&self, uri: Option<&str>) {
300        unsafe {
301            ffi::gst_player_set_uri(self.to_glib_none().0, uri.to_glib_none().0);
302        }
303    }
304
305    #[doc(alias = "gst_player_set_video_track")]
306    pub fn set_video_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> {
307        unsafe {
308            glib::result_from_gboolean!(
309                ffi::gst_player_set_video_track(self.to_glib_none().0, stream_index),
310                "Failed to set video track"
311            )
312        }
313    }
314
315    #[doc(alias = "gst_player_set_video_track_enabled")]
316    pub fn set_video_track_enabled(&self, enabled: bool) {
317        unsafe {
318            ffi::gst_player_set_video_track_enabled(self.to_glib_none().0, enabled.into_glib());
319        }
320    }
321
322    #[doc(alias = "gst_player_set_visualization")]
323    pub fn set_visualization(&self, name: Option<&str>) -> Result<(), glib::error::BoolError> {
324        unsafe {
325            glib::result_from_gboolean!(
326                ffi::gst_player_set_visualization(self.to_glib_none().0, name.to_glib_none().0),
327                "Failed to set visualization"
328            )
329        }
330    }
331
332    #[doc(alias = "gst_player_set_visualization_enabled")]
333    pub fn set_visualization_enabled(&self, enabled: bool) {
334        unsafe {
335            ffi::gst_player_set_visualization_enabled(self.to_glib_none().0, enabled.into_glib());
336        }
337    }
338
339    #[doc(alias = "gst_player_set_volume")]
340    #[doc(alias = "volume")]
341    pub fn set_volume(&self, val: f64) {
342        unsafe {
343            ffi::gst_player_set_volume(self.to_glib_none().0, val);
344        }
345    }
346
347    #[doc(alias = "gst_player_stop")]
348    pub fn stop(&self) {
349        unsafe {
350            ffi::gst_player_stop(self.to_glib_none().0);
351        }
352    }
353
354    pub fn suburi(&self) -> Option<glib::GString> {
355        ObjectExt::property(self, "suburi")
356    }
357
358    pub fn set_suburi(&self, suburi: Option<&str>) {
359        ObjectExt::set_property(self, "suburi", suburi)
360    }
361
362    #[doc(alias = "video-multiview-flags")]
363    pub fn video_multiview_flags(&self) -> gst_video::VideoMultiviewFlags {
364        ObjectExt::property(self, "video-multiview-flags")
365    }
366
367    #[doc(alias = "video-multiview-flags")]
368    pub fn set_video_multiview_flags(&self, video_multiview_flags: gst_video::VideoMultiviewFlags) {
369        ObjectExt::set_property(self, "video-multiview-flags", video_multiview_flags)
370    }
371
372    #[doc(alias = "video-multiview-mode")]
373    pub fn video_multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking {
374        ObjectExt::property(self, "video-multiview-mode")
375    }
376
377    #[doc(alias = "video-multiview-mode")]
378    pub fn set_video_multiview_mode(
379        &self,
380        video_multiview_mode: gst_video::VideoMultiviewFramePacking,
381    ) {
382        ObjectExt::set_property(self, "video-multiview-mode", video_multiview_mode)
383    }
384
385    #[doc(alias = "video-renderer")]
386    pub fn video_renderer(&self) -> Option<PlayerVideoRenderer> {
387        ObjectExt::property(self, "video-renderer")
388    }
389
390    #[doc(alias = "gst_player_get_audio_streams")]
391    #[doc(alias = "get_audio_streams")]
392    pub fn audio_streams(info: &PlayerMediaInfo) -> Vec<PlayerAudioInfo> {
393        skip_assert_initialized!();
394        unsafe {
395            FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_audio_streams(
396                info.to_glib_none().0,
397            ))
398        }
399    }
400
401    #[doc(alias = "gst_player_get_subtitle_streams")]
402    #[doc(alias = "get_subtitle_streams")]
403    pub fn subtitle_streams(info: &PlayerMediaInfo) -> Vec<PlayerSubtitleInfo> {
404        skip_assert_initialized!();
405        unsafe {
406            FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_subtitle_streams(
407                info.to_glib_none().0,
408            ))
409        }
410    }
411
412    #[doc(alias = "gst_player_get_video_streams")]
413    #[doc(alias = "get_video_streams")]
414    pub fn video_streams(info: &PlayerMediaInfo) -> Vec<PlayerVideoInfo> {
415        skip_assert_initialized!();
416        unsafe {
417            FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_video_streams(
418                info.to_glib_none().0,
419            ))
420        }
421    }
422
423    #[doc(alias = "gst_player_visualizations_get")]
424    pub fn visualizations_get() -> Vec<PlayerVisualization> {
425        assert_initialized_main_thread!();
426        unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_player_visualizations_get()) }
427    }
428
429    #[doc(alias = "buffering")]
430    pub fn connect_buffering<F: Fn(&Self, i32) + Send + 'static>(&self, f: F) -> SignalHandlerId {
431        unsafe extern "C" fn buffering_trampoline<F: Fn(&Player, i32) + Send + 'static>(
432            this: *mut ffi::GstPlayer,
433            object: std::ffi::c_int,
434            f: glib::ffi::gpointer,
435        ) {
436            let f: &F = &*(f as *const F);
437            f(&from_glib_borrow(this), object)
438        }
439        unsafe {
440            let f: Box_<F> = Box_::new(f);
441            connect_raw(
442                self.as_ptr() as *mut _,
443                c"buffering".as_ptr() as *const _,
444                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
445                    buffering_trampoline::<F> as *const (),
446                )),
447                Box_::into_raw(f),
448            )
449        }
450    }
451
452    #[doc(alias = "end-of-stream")]
453    pub fn connect_end_of_stream<F: Fn(&Self) + Send + 'static>(&self, f: F) -> SignalHandlerId {
454        unsafe extern "C" fn end_of_stream_trampoline<F: Fn(&Player) + Send + 'static>(
455            this: *mut ffi::GstPlayer,
456            f: glib::ffi::gpointer,
457        ) {
458            let f: &F = &*(f as *const F);
459            f(&from_glib_borrow(this))
460        }
461        unsafe {
462            let f: Box_<F> = Box_::new(f);
463            connect_raw(
464                self.as_ptr() as *mut _,
465                c"end-of-stream".as_ptr() as *const _,
466                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
467                    end_of_stream_trampoline::<F> as *const (),
468                )),
469                Box_::into_raw(f),
470            )
471        }
472    }
473
474    #[doc(alias = "error")]
475    pub fn connect_error<F: Fn(&Self, &glib::Error) + Send + 'static>(
476        &self,
477        f: F,
478    ) -> SignalHandlerId {
479        unsafe extern "C" fn error_trampoline<F: Fn(&Player, &glib::Error) + Send + 'static>(
480            this: *mut ffi::GstPlayer,
481            object: *mut glib::ffi::GError,
482            f: glib::ffi::gpointer,
483        ) {
484            let f: &F = &*(f as *const F);
485            f(&from_glib_borrow(this), &from_glib_borrow(object))
486        }
487        unsafe {
488            let f: Box_<F> = Box_::new(f);
489            connect_raw(
490                self.as_ptr() as *mut _,
491                c"error".as_ptr() as *const _,
492                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
493                    error_trampoline::<F> as *const (),
494                )),
495                Box_::into_raw(f),
496            )
497        }
498    }
499
500    #[doc(alias = "media-info-updated")]
501    pub fn connect_media_info_updated<F: Fn(&Self, &PlayerMediaInfo) + Send + 'static>(
502        &self,
503        f: F,
504    ) -> SignalHandlerId {
505        unsafe extern "C" fn media_info_updated_trampoline<
506            F: Fn(&Player, &PlayerMediaInfo) + Send + 'static,
507        >(
508            this: *mut ffi::GstPlayer,
509            object: *mut ffi::GstPlayerMediaInfo,
510            f: glib::ffi::gpointer,
511        ) {
512            let f: &F = &*(f as *const F);
513            f(&from_glib_borrow(this), &from_glib_borrow(object))
514        }
515        unsafe {
516            let f: Box_<F> = Box_::new(f);
517            connect_raw(
518                self.as_ptr() as *mut _,
519                c"media-info-updated".as_ptr() as *const _,
520                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
521                    media_info_updated_trampoline::<F> as *const (),
522                )),
523                Box_::into_raw(f),
524            )
525        }
526    }
527
528    #[doc(alias = "mute-changed")]
529    pub fn connect_mute_changed<F: Fn(&Self) + Send + 'static>(&self, f: F) -> SignalHandlerId {
530        unsafe extern "C" fn mute_changed_trampoline<F: Fn(&Player) + Send + 'static>(
531            this: *mut ffi::GstPlayer,
532            f: glib::ffi::gpointer,
533        ) {
534            let f: &F = &*(f as *const F);
535            f(&from_glib_borrow(this))
536        }
537        unsafe {
538            let f: Box_<F> = Box_::new(f);
539            connect_raw(
540                self.as_ptr() as *mut _,
541                c"mute-changed".as_ptr() as *const _,
542                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
543                    mute_changed_trampoline::<F> as *const (),
544                )),
545                Box_::into_raw(f),
546            )
547        }
548    }
549
550    #[doc(alias = "state-changed")]
551    pub fn connect_state_changed<F: Fn(&Self, PlayerState) + Send + 'static>(
552        &self,
553        f: F,
554    ) -> SignalHandlerId {
555        unsafe extern "C" fn state_changed_trampoline<
556            F: Fn(&Player, PlayerState) + Send + 'static,
557        >(
558            this: *mut ffi::GstPlayer,
559            object: ffi::GstPlayerState,
560            f: glib::ffi::gpointer,
561        ) {
562            let f: &F = &*(f as *const F);
563            f(&from_glib_borrow(this), from_glib(object))
564        }
565        unsafe {
566            let f: Box_<F> = Box_::new(f);
567            connect_raw(
568                self.as_ptr() as *mut _,
569                c"state-changed".as_ptr() as *const _,
570                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
571                    state_changed_trampoline::<F> as *const (),
572                )),
573                Box_::into_raw(f),
574            )
575        }
576    }
577
578    #[doc(alias = "uri-loaded")]
579    pub fn connect_uri_loaded<F: Fn(&Self, &str) + Send + 'static>(&self, f: F) -> SignalHandlerId {
580        unsafe extern "C" fn uri_loaded_trampoline<F: Fn(&Player, &str) + Send + 'static>(
581            this: *mut ffi::GstPlayer,
582            object: *mut std::ffi::c_char,
583            f: glib::ffi::gpointer,
584        ) {
585            let f: &F = &*(f as *const F);
586            f(
587                &from_glib_borrow(this),
588                &glib::GString::from_glib_borrow(object),
589            )
590        }
591        unsafe {
592            let f: Box_<F> = Box_::new(f);
593            connect_raw(
594                self.as_ptr() as *mut _,
595                c"uri-loaded".as_ptr() as *const _,
596                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
597                    uri_loaded_trampoline::<F> as *const (),
598                )),
599                Box_::into_raw(f),
600            )
601        }
602    }
603
604    #[doc(alias = "video-dimensions-changed")]
605    pub fn connect_video_dimensions_changed<F: Fn(&Self, i32, i32) + Send + 'static>(
606        &self,
607        f: F,
608    ) -> SignalHandlerId {
609        unsafe extern "C" fn video_dimensions_changed_trampoline<
610            F: Fn(&Player, i32, i32) + Send + 'static,
611        >(
612            this: *mut ffi::GstPlayer,
613            object: std::ffi::c_int,
614            p0: std::ffi::c_int,
615            f: glib::ffi::gpointer,
616        ) {
617            let f: &F = &*(f as *const F);
618            f(&from_glib_borrow(this), object, p0)
619        }
620        unsafe {
621            let f: Box_<F> = Box_::new(f);
622            connect_raw(
623                self.as_ptr() as *mut _,
624                c"video-dimensions-changed".as_ptr() as *const _,
625                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
626                    video_dimensions_changed_trampoline::<F> as *const (),
627                )),
628                Box_::into_raw(f),
629            )
630        }
631    }
632
633    #[doc(alias = "volume-changed")]
634    pub fn connect_volume_changed<F: Fn(&Self) + Send + 'static>(&self, f: F) -> SignalHandlerId {
635        unsafe extern "C" fn volume_changed_trampoline<F: Fn(&Player) + Send + 'static>(
636            this: *mut ffi::GstPlayer,
637            f: glib::ffi::gpointer,
638        ) {
639            let f: &F = &*(f as *const F);
640            f(&from_glib_borrow(this))
641        }
642        unsafe {
643            let f: Box_<F> = Box_::new(f);
644            connect_raw(
645                self.as_ptr() as *mut _,
646                c"volume-changed".as_ptr() as *const _,
647                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
648                    volume_changed_trampoline::<F> as *const (),
649                )),
650                Box_::into_raw(f),
651            )
652        }
653    }
654
655    #[doc(alias = "warning")]
656    pub fn connect_warning<F: Fn(&Self, &glib::Error) + Send + 'static>(
657        &self,
658        f: F,
659    ) -> SignalHandlerId {
660        unsafe extern "C" fn warning_trampoline<F: Fn(&Player, &glib::Error) + Send + 'static>(
661            this: *mut ffi::GstPlayer,
662            object: *mut glib::ffi::GError,
663            f: glib::ffi::gpointer,
664        ) {
665            let f: &F = &*(f as *const F);
666            f(&from_glib_borrow(this), &from_glib_borrow(object))
667        }
668        unsafe {
669            let f: Box_<F> = Box_::new(f);
670            connect_raw(
671                self.as_ptr() as *mut _,
672                c"warning".as_ptr() as *const _,
673                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
674                    warning_trampoline::<F> as *const (),
675                )),
676                Box_::into_raw(f),
677            )
678        }
679    }
680
681    #[doc(alias = "audio-video-offset")]
682    pub fn connect_audio_video_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
683        &self,
684        f: F,
685    ) -> SignalHandlerId {
686        unsafe extern "C" fn notify_audio_video_offset_trampoline<
687            F: Fn(&Player) + Send + Sync + 'static,
688        >(
689            this: *mut ffi::GstPlayer,
690            _param_spec: glib::ffi::gpointer,
691            f: glib::ffi::gpointer,
692        ) {
693            let f: &F = &*(f as *const F);
694            f(&from_glib_borrow(this))
695        }
696        unsafe {
697            let f: Box_<F> = Box_::new(f);
698            connect_raw(
699                self.as_ptr() as *mut _,
700                c"notify::audio-video-offset".as_ptr() as *const _,
701                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
702                    notify_audio_video_offset_trampoline::<F> as *const (),
703                )),
704                Box_::into_raw(f),
705            )
706        }
707    }
708
709    #[doc(alias = "current-audio-track")]
710    pub fn connect_current_audio_track_notify<F: Fn(&Self) + Send + Sync + 'static>(
711        &self,
712        f: F,
713    ) -> SignalHandlerId {
714        unsafe extern "C" fn notify_current_audio_track_trampoline<
715            F: Fn(&Player) + Send + Sync + 'static,
716        >(
717            this: *mut ffi::GstPlayer,
718            _param_spec: glib::ffi::gpointer,
719            f: glib::ffi::gpointer,
720        ) {
721            let f: &F = &*(f as *const F);
722            f(&from_glib_borrow(this))
723        }
724        unsafe {
725            let f: Box_<F> = Box_::new(f);
726            connect_raw(
727                self.as_ptr() as *mut _,
728                c"notify::current-audio-track".as_ptr() as *const _,
729                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
730                    notify_current_audio_track_trampoline::<F> as *const (),
731                )),
732                Box_::into_raw(f),
733            )
734        }
735    }
736
737    #[doc(alias = "current-subtitle-track")]
738    pub fn connect_current_subtitle_track_notify<F: Fn(&Self) + Send + Sync + 'static>(
739        &self,
740        f: F,
741    ) -> SignalHandlerId {
742        unsafe extern "C" fn notify_current_subtitle_track_trampoline<
743            F: Fn(&Player) + Send + Sync + 'static,
744        >(
745            this: *mut ffi::GstPlayer,
746            _param_spec: glib::ffi::gpointer,
747            f: glib::ffi::gpointer,
748        ) {
749            let f: &F = &*(f as *const F);
750            f(&from_glib_borrow(this))
751        }
752        unsafe {
753            let f: Box_<F> = Box_::new(f);
754            connect_raw(
755                self.as_ptr() as *mut _,
756                c"notify::current-subtitle-track".as_ptr() as *const _,
757                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
758                    notify_current_subtitle_track_trampoline::<F> as *const (),
759                )),
760                Box_::into_raw(f),
761            )
762        }
763    }
764
765    #[doc(alias = "current-video-track")]
766    pub fn connect_current_video_track_notify<F: Fn(&Self) + Send + Sync + 'static>(
767        &self,
768        f: F,
769    ) -> SignalHandlerId {
770        unsafe extern "C" fn notify_current_video_track_trampoline<
771            F: Fn(&Player) + Send + Sync + 'static,
772        >(
773            this: *mut ffi::GstPlayer,
774            _param_spec: glib::ffi::gpointer,
775            f: glib::ffi::gpointer,
776        ) {
777            let f: &F = &*(f as *const F);
778            f(&from_glib_borrow(this))
779        }
780        unsafe {
781            let f: Box_<F> = Box_::new(f);
782            connect_raw(
783                self.as_ptr() as *mut _,
784                c"notify::current-video-track".as_ptr() as *const _,
785                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
786                    notify_current_video_track_trampoline::<F> as *const (),
787                )),
788                Box_::into_raw(f),
789            )
790        }
791    }
792
793    #[doc(alias = "duration")]
794    pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
795        &self,
796        f: F,
797    ) -> SignalHandlerId {
798        unsafe extern "C" fn notify_duration_trampoline<F: Fn(&Player) + Send + Sync + 'static>(
799            this: *mut ffi::GstPlayer,
800            _param_spec: glib::ffi::gpointer,
801            f: glib::ffi::gpointer,
802        ) {
803            let f: &F = &*(f as *const F);
804            f(&from_glib_borrow(this))
805        }
806        unsafe {
807            let f: Box_<F> = Box_::new(f);
808            connect_raw(
809                self.as_ptr() as *mut _,
810                c"notify::duration".as_ptr() as *const _,
811                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
812                    notify_duration_trampoline::<F> as *const (),
813                )),
814                Box_::into_raw(f),
815            )
816        }
817    }
818
819    #[doc(alias = "media-info")]
820    pub fn connect_media_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
821        &self,
822        f: F,
823    ) -> SignalHandlerId {
824        unsafe extern "C" fn notify_media_info_trampoline<
825            F: Fn(&Player) + Send + Sync + 'static,
826        >(
827            this: *mut ffi::GstPlayer,
828            _param_spec: glib::ffi::gpointer,
829            f: glib::ffi::gpointer,
830        ) {
831            let f: &F = &*(f as *const F);
832            f(&from_glib_borrow(this))
833        }
834        unsafe {
835            let f: Box_<F> = Box_::new(f);
836            connect_raw(
837                self.as_ptr() as *mut _,
838                c"notify::media-info".as_ptr() as *const _,
839                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
840                    notify_media_info_trampoline::<F> as *const (),
841                )),
842                Box_::into_raw(f),
843            )
844        }
845    }
846
847    #[doc(alias = "mute")]
848    pub fn connect_mute_notify<F: Fn(&Self) + Send + Sync + 'static>(
849        &self,
850        f: F,
851    ) -> SignalHandlerId {
852        unsafe extern "C" fn notify_mute_trampoline<F: Fn(&Player) + Send + Sync + 'static>(
853            this: *mut ffi::GstPlayer,
854            _param_spec: glib::ffi::gpointer,
855            f: glib::ffi::gpointer,
856        ) {
857            let f: &F = &*(f as *const F);
858            f(&from_glib_borrow(this))
859        }
860        unsafe {
861            let f: Box_<F> = Box_::new(f);
862            connect_raw(
863                self.as_ptr() as *mut _,
864                c"notify::mute".as_ptr() as *const _,
865                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
866                    notify_mute_trampoline::<F> as *const (),
867                )),
868                Box_::into_raw(f),
869            )
870        }
871    }
872
873    #[doc(alias = "pipeline")]
874    pub fn connect_pipeline_notify<F: Fn(&Self) + Send + Sync + 'static>(
875        &self,
876        f: F,
877    ) -> SignalHandlerId {
878        unsafe extern "C" fn notify_pipeline_trampoline<F: Fn(&Player) + Send + Sync + 'static>(
879            this: *mut ffi::GstPlayer,
880            _param_spec: glib::ffi::gpointer,
881            f: glib::ffi::gpointer,
882        ) {
883            let f: &F = &*(f as *const F);
884            f(&from_glib_borrow(this))
885        }
886        unsafe {
887            let f: Box_<F> = Box_::new(f);
888            connect_raw(
889                self.as_ptr() as *mut _,
890                c"notify::pipeline".as_ptr() as *const _,
891                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
892                    notify_pipeline_trampoline::<F> as *const (),
893                )),
894                Box_::into_raw(f),
895            )
896        }
897    }
898
899    #[doc(alias = "position")]
900    pub fn connect_position_notify<F: Fn(&Self) + Send + Sync + 'static>(
901        &self,
902        f: F,
903    ) -> SignalHandlerId {
904        unsafe extern "C" fn notify_position_trampoline<F: Fn(&Player) + Send + Sync + 'static>(
905            this: *mut ffi::GstPlayer,
906            _param_spec: glib::ffi::gpointer,
907            f: glib::ffi::gpointer,
908        ) {
909            let f: &F = &*(f as *const F);
910            f(&from_glib_borrow(this))
911        }
912        unsafe {
913            let f: Box_<F> = Box_::new(f);
914            connect_raw(
915                self.as_ptr() as *mut _,
916                c"notify::position".as_ptr() as *const _,
917                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
918                    notify_position_trampoline::<F> as *const (),
919                )),
920                Box_::into_raw(f),
921            )
922        }
923    }
924
925    #[doc(alias = "rate")]
926    pub fn connect_rate_notify<F: Fn(&Self) + Send + Sync + 'static>(
927        &self,
928        f: F,
929    ) -> SignalHandlerId {
930        unsafe extern "C" fn notify_rate_trampoline<F: Fn(&Player) + Send + Sync + 'static>(
931            this: *mut ffi::GstPlayer,
932            _param_spec: glib::ffi::gpointer,
933            f: glib::ffi::gpointer,
934        ) {
935            let f: &F = &*(f as *const F);
936            f(&from_glib_borrow(this))
937        }
938        unsafe {
939            let f: Box_<F> = Box_::new(f);
940            connect_raw(
941                self.as_ptr() as *mut _,
942                c"notify::rate".as_ptr() as *const _,
943                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
944                    notify_rate_trampoline::<F> as *const (),
945                )),
946                Box_::into_raw(f),
947            )
948        }
949    }
950
951    #[cfg(feature = "v1_16")]
952    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
953    #[doc(alias = "subtitle-video-offset")]
954    pub fn connect_subtitle_video_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
955        &self,
956        f: F,
957    ) -> SignalHandlerId {
958        unsafe extern "C" fn notify_subtitle_video_offset_trampoline<
959            F: Fn(&Player) + Send + Sync + 'static,
960        >(
961            this: *mut ffi::GstPlayer,
962            _param_spec: glib::ffi::gpointer,
963            f: glib::ffi::gpointer,
964        ) {
965            let f: &F = &*(f as *const F);
966            f(&from_glib_borrow(this))
967        }
968        unsafe {
969            let f: Box_<F> = Box_::new(f);
970            connect_raw(
971                self.as_ptr() as *mut _,
972                c"notify::subtitle-video-offset".as_ptr() as *const _,
973                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
974                    notify_subtitle_video_offset_trampoline::<F> as *const (),
975                )),
976                Box_::into_raw(f),
977            )
978        }
979    }
980
981    #[doc(alias = "suburi")]
982    pub fn connect_suburi_notify<F: Fn(&Self) + Send + Sync + 'static>(
983        &self,
984        f: F,
985    ) -> SignalHandlerId {
986        unsafe extern "C" fn notify_suburi_trampoline<F: Fn(&Player) + Send + Sync + 'static>(
987            this: *mut ffi::GstPlayer,
988            _param_spec: glib::ffi::gpointer,
989            f: glib::ffi::gpointer,
990        ) {
991            let f: &F = &*(f as *const F);
992            f(&from_glib_borrow(this))
993        }
994        unsafe {
995            let f: Box_<F> = Box_::new(f);
996            connect_raw(
997                self.as_ptr() as *mut _,
998                c"notify::suburi".as_ptr() as *const _,
999                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1000                    notify_suburi_trampoline::<F> as *const (),
1001                )),
1002                Box_::into_raw(f),
1003            )
1004        }
1005    }
1006
1007    #[doc(alias = "uri")]
1008    pub fn connect_uri_notify<F: Fn(&Self) + Send + Sync + 'static>(
1009        &self,
1010        f: F,
1011    ) -> SignalHandlerId {
1012        unsafe extern "C" fn notify_uri_trampoline<F: Fn(&Player) + Send + Sync + 'static>(
1013            this: *mut ffi::GstPlayer,
1014            _param_spec: glib::ffi::gpointer,
1015            f: glib::ffi::gpointer,
1016        ) {
1017            let f: &F = &*(f as *const F);
1018            f(&from_glib_borrow(this))
1019        }
1020        unsafe {
1021            let f: Box_<F> = Box_::new(f);
1022            connect_raw(
1023                self.as_ptr() as *mut _,
1024                c"notify::uri".as_ptr() as *const _,
1025                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1026                    notify_uri_trampoline::<F> as *const (),
1027                )),
1028                Box_::into_raw(f),
1029            )
1030        }
1031    }
1032
1033    #[doc(alias = "video-multiview-flags")]
1034    pub fn connect_video_multiview_flags_notify<F: Fn(&Self) + Send + Sync + 'static>(
1035        &self,
1036        f: F,
1037    ) -> SignalHandlerId {
1038        unsafe extern "C" fn notify_video_multiview_flags_trampoline<
1039            F: Fn(&Player) + Send + Sync + 'static,
1040        >(
1041            this: *mut ffi::GstPlayer,
1042            _param_spec: glib::ffi::gpointer,
1043            f: glib::ffi::gpointer,
1044        ) {
1045            let f: &F = &*(f as *const F);
1046            f(&from_glib_borrow(this))
1047        }
1048        unsafe {
1049            let f: Box_<F> = Box_::new(f);
1050            connect_raw(
1051                self.as_ptr() as *mut _,
1052                c"notify::video-multiview-flags".as_ptr() as *const _,
1053                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1054                    notify_video_multiview_flags_trampoline::<F> as *const (),
1055                )),
1056                Box_::into_raw(f),
1057            )
1058        }
1059    }
1060
1061    #[doc(alias = "video-multiview-mode")]
1062    pub fn connect_video_multiview_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(
1063        &self,
1064        f: F,
1065    ) -> SignalHandlerId {
1066        unsafe extern "C" fn notify_video_multiview_mode_trampoline<
1067            F: Fn(&Player) + Send + Sync + 'static,
1068        >(
1069            this: *mut ffi::GstPlayer,
1070            _param_spec: glib::ffi::gpointer,
1071            f: glib::ffi::gpointer,
1072        ) {
1073            let f: &F = &*(f as *const F);
1074            f(&from_glib_borrow(this))
1075        }
1076        unsafe {
1077            let f: Box_<F> = Box_::new(f);
1078            connect_raw(
1079                self.as_ptr() as *mut _,
1080                c"notify::video-multiview-mode".as_ptr() as *const _,
1081                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1082                    notify_video_multiview_mode_trampoline::<F> as *const (),
1083                )),
1084                Box_::into_raw(f),
1085            )
1086        }
1087    }
1088
1089    #[doc(alias = "volume")]
1090    pub fn connect_volume_notify<F: Fn(&Self) + Send + Sync + 'static>(
1091        &self,
1092        f: F,
1093    ) -> SignalHandlerId {
1094        unsafe extern "C" fn notify_volume_trampoline<F: Fn(&Player) + Send + Sync + 'static>(
1095            this: *mut ffi::GstPlayer,
1096            _param_spec: glib::ffi::gpointer,
1097            f: glib::ffi::gpointer,
1098        ) {
1099            let f: &F = &*(f as *const F);
1100            f(&from_glib_borrow(this))
1101        }
1102        unsafe {
1103            let f: Box_<F> = Box_::new(f);
1104            connect_raw(
1105                self.as_ptr() as *mut _,
1106                c"notify::volume".as_ptr() as *const _,
1107                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1108                    notify_volume_trampoline::<F> as *const (),
1109                )),
1110                Box_::into_raw(f),
1111            )
1112        }
1113    }
1114}
1115
1116unsafe impl Send for Player {}
1117unsafe impl Sync for Player {}