1#![allow(deprecated)]
6
7use crate::{
8 PlayAudioInfo, PlayColorBalanceType, PlayMediaInfo, PlaySubtitleInfo, PlayVideoInfo,
9 PlayVideoRenderer, PlayVisualization, ffi,
10};
11use glib::{
12 prelude::*,
13 signal::{SignalHandlerId, connect_raw},
14 translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19 #[doc(alias = "GstPlay")]
145 pub struct Play(Object<ffi::GstPlay, ffi::GstPlayClass>) @extends gst::Object;
146
147 match fn {
148 type_ => || ffi::gst_play_get_type(),
149 }
150}
151
152impl Play {
153 #[doc(alias = "gst_play_new")]
168 pub fn new(video_renderer: Option<impl IsA<PlayVideoRenderer>>) -> Play {
169 assert_initialized_main_thread!();
170 unsafe {
171 from_glib_full(ffi::gst_play_new(
172 video_renderer.map(|p| p.upcast()).into_glib_ptr(),
173 ))
174 }
175 }
176
177 #[doc(alias = "gst_play_get_audio_video_offset")]
183 #[doc(alias = "get_audio_video_offset")]
184 #[doc(alias = "audio-video-offset")]
185 pub fn audio_video_offset(&self) -> i64 {
186 unsafe { ffi::gst_play_get_audio_video_offset(self.to_glib_none().0) }
187 }
188
189 #[doc(alias = "gst_play_get_color_balance")]
198 #[doc(alias = "get_color_balance")]
199 pub fn color_balance(&self, type_: PlayColorBalanceType) -> f64 {
200 unsafe { ffi::gst_play_get_color_balance(self.to_glib_none().0, type_.into_glib()) }
201 }
202
203 #[doc(alias = "gst_play_get_current_audio_track")]
211 #[doc(alias = "get_current_audio_track")]
212 #[doc(alias = "current-audio-track")]
213 pub fn current_audio_track(&self) -> Option<PlayAudioInfo> {
214 unsafe { from_glib_full(ffi::gst_play_get_current_audio_track(self.to_glib_none().0)) }
215 }
216
217 #[doc(alias = "gst_play_get_current_subtitle_track")]
225 #[doc(alias = "get_current_subtitle_track")]
226 #[doc(alias = "current-subtitle-track")]
227 pub fn current_subtitle_track(&self) -> Option<PlaySubtitleInfo> {
228 unsafe {
229 from_glib_full(ffi::gst_play_get_current_subtitle_track(
230 self.to_glib_none().0,
231 ))
232 }
233 }
234
235 #[doc(alias = "gst_play_get_current_video_track")]
243 #[doc(alias = "get_current_video_track")]
244 #[doc(alias = "current-video-track")]
245 pub fn current_video_track(&self) -> Option<PlayVideoInfo> {
246 unsafe { from_glib_full(ffi::gst_play_get_current_video_track(self.to_glib_none().0)) }
247 }
248
249 #[doc(alias = "gst_play_get_current_visualization")]
256 #[doc(alias = "get_current_visualization")]
257 pub fn current_visualization(&self) -> Option<glib::GString> {
258 unsafe {
259 from_glib_full(ffi::gst_play_get_current_visualization(
260 self.to_glib_none().0,
261 ))
262 }
263 }
264
265 #[doc(alias = "gst_play_get_duration")]
272 #[doc(alias = "get_duration")]
273 pub fn duration(&self) -> Option<gst::ClockTime> {
274 unsafe { from_glib(ffi::gst_play_get_duration(self.to_glib_none().0)) }
275 }
276
277 #[doc(alias = "gst_play_get_media_info")]
285 #[doc(alias = "get_media_info")]
286 #[doc(alias = "media-info")]
287 pub fn media_info(&self) -> Option<PlayMediaInfo> {
288 unsafe { from_glib_full(ffi::gst_play_get_media_info(self.to_glib_none().0)) }
289 }
290
291 #[doc(alias = "gst_play_get_message_bus")]
307 #[doc(alias = "get_message_bus")]
308 pub fn message_bus(&self) -> gst::Bus {
309 unsafe { from_glib_full(ffi::gst_play_get_message_bus(self.to_glib_none().0)) }
310 }
311
312 #[doc(alias = "gst_play_get_multiview_flags")]
318 #[doc(alias = "get_multiview_flags")]
319 pub fn multiview_flags(&self) -> gst_video::VideoMultiviewFlags {
320 unsafe { from_glib(ffi::gst_play_get_multiview_flags(self.to_glib_none().0)) }
321 }
322
323 #[doc(alias = "gst_play_get_multiview_mode")]
329 #[doc(alias = "get_multiview_mode")]
330 pub fn multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking {
331 unsafe { from_glib(ffi::gst_play_get_multiview_mode(self.to_glib_none().0)) }
332 }
333
334 #[doc(alias = "gst_play_get_mute")]
339 #[doc(alias = "get_mute")]
340 #[doc(alias = "mute")]
341 pub fn is_muted(&self) -> bool {
342 unsafe { from_glib(ffi::gst_play_get_mute(self.to_glib_none().0)) }
343 }
344
345 #[doc(alias = "gst_play_get_pipeline")]
352 #[doc(alias = "get_pipeline")]
353 pub fn pipeline(&self) -> gst::Element {
354 unsafe { from_glib_full(ffi::gst_play_get_pipeline(self.to_glib_none().0)) }
355 }
356
357 #[doc(alias = "gst_play_get_position")]
363 #[doc(alias = "get_position")]
364 pub fn position(&self) -> Option<gst::ClockTime> {
365 unsafe { from_glib(ffi::gst_play_get_position(self.to_glib_none().0)) }
366 }
367
368 #[doc(alias = "gst_play_get_rate")]
373 #[doc(alias = "get_rate")]
374 pub fn rate(&self) -> f64 {
375 unsafe { ffi::gst_play_get_rate(self.to_glib_none().0) }
376 }
377
378 #[doc(alias = "gst_play_get_subtitle_uri")]
385 #[doc(alias = "get_subtitle_uri")]
386 pub fn subtitle_uri(&self) -> Option<glib::GString> {
387 unsafe { from_glib_full(ffi::gst_play_get_subtitle_uri(self.to_glib_none().0)) }
388 }
389
390 #[doc(alias = "gst_play_get_subtitle_video_offset")]
396 #[doc(alias = "get_subtitle_video_offset")]
397 #[doc(alias = "subtitle-video-offset")]
398 pub fn subtitle_video_offset(&self) -> i64 {
399 unsafe { ffi::gst_play_get_subtitle_video_offset(self.to_glib_none().0) }
400 }
401
402 #[doc(alias = "gst_play_get_uri")]
409 #[doc(alias = "get_uri")]
410 pub fn uri(&self) -> Option<glib::GString> {
411 unsafe { from_glib_full(ffi::gst_play_get_uri(self.to_glib_none().0)) }
412 }
413
414 #[doc(alias = "gst_play_get_volume")]
420 #[doc(alias = "get_volume")]
421 pub fn volume(&self) -> f64 {
422 unsafe { ffi::gst_play_get_volume(self.to_glib_none().0) }
423 }
424
425 #[doc(alias = "gst_play_has_color_balance")]
432 pub fn has_color_balance(&self) -> bool {
433 unsafe { from_glib(ffi::gst_play_has_color_balance(self.to_glib_none().0)) }
434 }
435
436 #[doc(alias = "gst_play_pause")]
438 pub fn pause(&self) {
439 unsafe {
440 ffi::gst_play_pause(self.to_glib_none().0);
441 }
442 }
443
444 #[doc(alias = "gst_play_play")]
446 pub fn play(&self) {
447 unsafe {
448 ffi::gst_play_play(self.to_glib_none().0);
449 }
450 }
451
452 #[doc(alias = "gst_play_seek")]
457 pub fn seek(&self, position: gst::ClockTime) {
458 unsafe {
459 ffi::gst_play_seek(self.to_glib_none().0, position.into_glib());
460 }
461 }
462
463 #[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")]
476 #[allow(deprecated)]
477 #[doc(alias = "gst_play_set_audio_track")]
478 pub fn set_audio_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> {
479 unsafe {
480 glib::result_from_gboolean!(
481 ffi::gst_play_set_audio_track(self.to_glib_none().0, stream_index),
482 "Failed to set audio track"
483 )
484 }
485 }
486
487 #[doc(alias = "gst_play_set_audio_track_enabled")]
491 pub fn set_audio_track_enabled(&self, enabled: bool) {
492 unsafe {
493 ffi::gst_play_set_audio_track_enabled(self.to_glib_none().0, enabled.into_glib());
494 }
495 }
496
497 #[cfg(feature = "v1_26")]
506 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
507 #[doc(alias = "gst_play_set_audio_track_id")]
508 pub fn set_audio_track_id(
509 &self,
510 stream_id: Option<&str>,
511 ) -> Result<(), glib::error::BoolError> {
512 unsafe {
513 glib::result_from_gboolean!(
514 ffi::gst_play_set_audio_track_id(self.to_glib_none().0, stream_id.to_glib_none().0),
515 "Failed to set audio track"
516 )
517 }
518 }
519
520 #[doc(alias = "gst_play_set_audio_video_offset")]
524 #[doc(alias = "audio-video-offset")]
525 pub fn set_audio_video_offset(&self, offset: i64) {
526 unsafe {
527 ffi::gst_play_set_audio_video_offset(self.to_glib_none().0, offset);
528 }
529 }
530
531 #[doc(alias = "gst_play_set_color_balance")]
538 pub fn set_color_balance(&self, type_: PlayColorBalanceType, value: f64) {
539 unsafe {
540 ffi::gst_play_set_color_balance(self.to_glib_none().0, type_.into_glib(), value);
541 }
542 }
543
544 #[doc(alias = "gst_play_set_multiview_flags")]
549 pub fn set_multiview_flags(&self, flags: gst_video::VideoMultiviewFlags) {
550 unsafe {
551 ffi::gst_play_set_multiview_flags(self.to_glib_none().0, flags.into_glib());
552 }
553 }
554
555 #[doc(alias = "gst_play_set_multiview_mode")]
560 pub fn set_multiview_mode(&self, mode: gst_video::VideoMultiviewFramePacking) {
561 unsafe {
562 ffi::gst_play_set_multiview_mode(self.to_glib_none().0, mode.into_glib());
563 }
564 }
565
566 #[doc(alias = "gst_play_set_mute")]
570 #[doc(alias = "mute")]
571 pub fn set_mute(&self, val: bool) {
572 unsafe {
573 ffi::gst_play_set_mute(self.to_glib_none().0, val.into_glib());
574 }
575 }
576
577 #[doc(alias = "gst_play_set_rate")]
581 #[doc(alias = "rate")]
582 pub fn set_rate(&self, rate: f64) {
583 unsafe {
584 ffi::gst_play_set_rate(self.to_glib_none().0, rate);
585 }
586 }
587
588 #[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")]
601 #[allow(deprecated)]
602 #[doc(alias = "gst_play_set_subtitle_track")]
603 pub fn set_subtitle_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> {
604 unsafe {
605 glib::result_from_gboolean!(
606 ffi::gst_play_set_subtitle_track(self.to_glib_none().0, stream_index),
607 "Failed to set subtitle track"
608 )
609 }
610 }
611
612 #[doc(alias = "gst_play_set_subtitle_track_enabled")]
616 pub fn set_subtitle_track_enabled(&self, enabled: bool) {
617 unsafe {
618 ffi::gst_play_set_subtitle_track_enabled(self.to_glib_none().0, enabled.into_glib());
619 }
620 }
621
622 #[cfg(feature = "v1_26")]
631 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
632 #[doc(alias = "gst_play_set_subtitle_track_id")]
633 pub fn set_subtitle_track_id(
634 &self,
635 stream_id: Option<&str>,
636 ) -> Result<(), glib::error::BoolError> {
637 unsafe {
638 glib::result_from_gboolean!(
639 ffi::gst_play_set_subtitle_track_id(
640 self.to_glib_none().0,
641 stream_id.to_glib_none().0
642 ),
643 "Failed to set subtitle track"
644 )
645 }
646 }
647
648 #[doc(alias = "gst_play_set_subtitle_uri")]
654 pub fn set_subtitle_uri(&self, uri: Option<&str>) {
655 unsafe {
656 ffi::gst_play_set_subtitle_uri(self.to_glib_none().0, uri.to_glib_none().0);
657 }
658 }
659
660 #[doc(alias = "gst_play_set_subtitle_video_offset")]
664 #[doc(alias = "subtitle-video-offset")]
665 pub fn set_subtitle_video_offset(&self, offset: i64) {
666 unsafe {
667 ffi::gst_play_set_subtitle_video_offset(self.to_glib_none().0, offset);
668 }
669 }
670
671 #[cfg(feature = "v1_26")]
685 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
686 #[doc(alias = "gst_play_set_track_ids")]
687 pub fn set_track_ids(
688 &self,
689 audio_stream_id: Option<&str>,
690 video_stream_id: Option<&str>,
691 subtitle_stream_id: Option<&str>,
692 ) -> Result<(), glib::error::BoolError> {
693 unsafe {
694 glib::result_from_gboolean!(
695 ffi::gst_play_set_track_ids(
696 self.to_glib_none().0,
697 audio_stream_id.to_glib_none().0,
698 video_stream_id.to_glib_none().0,
699 subtitle_stream_id.to_glib_none().0
700 ),
701 "Failed to set tracks"
702 )
703 }
704 }
705
706 #[doc(alias = "gst_play_set_uri")]
710 #[doc(alias = "uri")]
711 pub fn set_uri(&self, uri: Option<&str>) {
712 unsafe {
713 ffi::gst_play_set_uri(self.to_glib_none().0, uri.to_glib_none().0);
714 }
715 }
716
717 #[cfg_attr(feature = "v1_26", deprecated = "Since 1.26")]
730 #[allow(deprecated)]
731 #[doc(alias = "gst_play_set_video_track")]
732 pub fn set_video_track(&self, stream_index: i32) -> Result<(), glib::error::BoolError> {
733 unsafe {
734 glib::result_from_gboolean!(
735 ffi::gst_play_set_video_track(self.to_glib_none().0, stream_index),
736 "Failed to set video track"
737 )
738 }
739 }
740
741 #[doc(alias = "gst_play_set_video_track_enabled")]
745 pub fn set_video_track_enabled(&self, enabled: bool) {
746 unsafe {
747 ffi::gst_play_set_video_track_enabled(self.to_glib_none().0, enabled.into_glib());
748 }
749 }
750
751 #[cfg(feature = "v1_26")]
760 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
761 #[doc(alias = "gst_play_set_video_track_id")]
762 pub fn set_video_track_id(
763 &self,
764 stream_id: Option<&str>,
765 ) -> Result<(), glib::error::BoolError> {
766 unsafe {
767 glib::result_from_gboolean!(
768 ffi::gst_play_set_video_track_id(self.to_glib_none().0, stream_id.to_glib_none().0),
769 "Failed to set video track"
770 )
771 }
772 }
773
774 #[doc(alias = "gst_play_set_visualization")]
783 pub fn set_visualization(&self, name: Option<&str>) -> Result<(), glib::error::BoolError> {
784 unsafe {
785 glib::result_from_gboolean!(
786 ffi::gst_play_set_visualization(self.to_glib_none().0, name.to_glib_none().0),
787 "Failed to set visualization"
788 )
789 }
790 }
791
792 #[doc(alias = "gst_play_set_visualization_enabled")]
796 pub fn set_visualization_enabled(&self, enabled: bool) {
797 unsafe {
798 ffi::gst_play_set_visualization_enabled(self.to_glib_none().0, enabled.into_glib());
799 }
800 }
801
802 #[doc(alias = "gst_play_set_volume")]
806 #[doc(alias = "volume")]
807 pub fn set_volume(&self, val: f64) {
808 unsafe {
809 ffi::gst_play_set_volume(self.to_glib_none().0, val);
810 }
811 }
812
813 #[doc(alias = "gst_play_stop")]
816 pub fn stop(&self) {
817 unsafe {
818 ffi::gst_play_stop(self.to_glib_none().0);
819 }
820 }
821
822 pub fn suburi(&self) -> Option<glib::GString> {
823 ObjectExt::property(self, "suburi")
824 }
825
826 pub fn set_suburi(&self, suburi: Option<&str>) {
827 ObjectExt::set_property(self, "suburi", suburi)
828 }
829
830 #[doc(alias = "video-multiview-flags")]
831 pub fn video_multiview_flags(&self) -> gst_video::VideoMultiviewFlags {
832 ObjectExt::property(self, "video-multiview-flags")
833 }
834
835 #[doc(alias = "video-multiview-flags")]
836 pub fn set_video_multiview_flags(&self, video_multiview_flags: gst_video::VideoMultiviewFlags) {
837 ObjectExt::set_property(self, "video-multiview-flags", video_multiview_flags)
838 }
839
840 #[doc(alias = "video-multiview-mode")]
841 pub fn video_multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking {
842 ObjectExt::property(self, "video-multiview-mode")
843 }
844
845 #[doc(alias = "video-multiview-mode")]
846 pub fn set_video_multiview_mode(
847 &self,
848 video_multiview_mode: gst_video::VideoMultiviewFramePacking,
849 ) {
850 ObjectExt::set_property(self, "video-multiview-mode", video_multiview_mode)
851 }
852
853 #[doc(alias = "video-renderer")]
854 pub fn video_renderer(&self) -> Option<PlayVideoRenderer> {
855 ObjectExt::property(self, "video-renderer")
856 }
857
858 #[doc(alias = "video-renderer")]
859 pub fn set_video_renderer<P: IsA<PlayVideoRenderer>>(&self, video_renderer: Option<&P>) {
860 ObjectExt::set_property(self, "video-renderer", video_renderer)
861 }
862
863 #[doc(alias = "gst_play_get_audio_streams")]
871 #[doc(alias = "get_audio_streams")]
872 pub fn audio_streams(info: &PlayMediaInfo) -> Vec<PlayAudioInfo> {
873 skip_assert_initialized!();
874 unsafe {
875 FromGlibPtrContainer::from_glib_none(ffi::gst_play_get_audio_streams(
876 info.to_glib_none().0,
877 ))
878 }
879 }
880
881 #[doc(alias = "gst_play_get_subtitle_streams")]
889 #[doc(alias = "get_subtitle_streams")]
890 pub fn subtitle_streams(info: &PlayMediaInfo) -> Vec<PlaySubtitleInfo> {
891 skip_assert_initialized!();
892 unsafe {
893 FromGlibPtrContainer::from_glib_none(ffi::gst_play_get_subtitle_streams(
894 info.to_glib_none().0,
895 ))
896 }
897 }
898
899 #[doc(alias = "gst_play_get_video_streams")]
907 #[doc(alias = "get_video_streams")]
908 pub fn video_streams(info: &PlayMediaInfo) -> Vec<PlayVideoInfo> {
909 skip_assert_initialized!();
910 unsafe {
911 FromGlibPtrContainer::from_glib_none(ffi::gst_play_get_video_streams(
912 info.to_glib_none().0,
913 ))
914 }
915 }
916
917 #[doc(alias = "gst_play_is_play_message")]
924 pub fn is_play_message(msg: &gst::Message) -> bool {
925 assert_initialized_main_thread!();
926 unsafe { from_glib(ffi::gst_play_is_play_message(msg.to_glib_none().0)) }
927 }
928
929 #[doc(alias = "gst_play_visualizations_get")]
937 pub fn visualizations_get() -> Vec<PlayVisualization> {
938 assert_initialized_main_thread!();
939 unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_play_visualizations_get()) }
940 }
941
942 #[doc(alias = "audio-video-offset")]
943 pub fn connect_audio_video_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
944 &self,
945 f: F,
946 ) -> SignalHandlerId {
947 unsafe extern "C" fn notify_audio_video_offset_trampoline<
948 F: Fn(&Play) + Send + Sync + 'static,
949 >(
950 this: *mut ffi::GstPlay,
951 _param_spec: glib::ffi::gpointer,
952 f: glib::ffi::gpointer,
953 ) {
954 unsafe {
955 let f: &F = &*(f as *const F);
956 f(&from_glib_borrow(this))
957 }
958 }
959 unsafe {
960 let f: Box_<F> = Box_::new(f);
961 connect_raw(
962 self.as_ptr() as *mut _,
963 c"notify::audio-video-offset".as_ptr(),
964 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
965 notify_audio_video_offset_trampoline::<F> as *const (),
966 )),
967 Box_::into_raw(f),
968 )
969 }
970 }
971
972 #[doc(alias = "current-audio-track")]
973 pub fn connect_current_audio_track_notify<F: Fn(&Self) + Send + Sync + 'static>(
974 &self,
975 f: F,
976 ) -> SignalHandlerId {
977 unsafe extern "C" fn notify_current_audio_track_trampoline<
978 F: Fn(&Play) + Send + Sync + 'static,
979 >(
980 this: *mut ffi::GstPlay,
981 _param_spec: glib::ffi::gpointer,
982 f: glib::ffi::gpointer,
983 ) {
984 unsafe {
985 let f: &F = &*(f as *const F);
986 f(&from_glib_borrow(this))
987 }
988 }
989 unsafe {
990 let f: Box_<F> = Box_::new(f);
991 connect_raw(
992 self.as_ptr() as *mut _,
993 c"notify::current-audio-track".as_ptr(),
994 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
995 notify_current_audio_track_trampoline::<F> as *const (),
996 )),
997 Box_::into_raw(f),
998 )
999 }
1000 }
1001
1002 #[doc(alias = "current-subtitle-track")]
1003 pub fn connect_current_subtitle_track_notify<F: Fn(&Self) + Send + Sync + 'static>(
1004 &self,
1005 f: F,
1006 ) -> SignalHandlerId {
1007 unsafe extern "C" fn notify_current_subtitle_track_trampoline<
1008 F: Fn(&Play) + Send + Sync + 'static,
1009 >(
1010 this: *mut ffi::GstPlay,
1011 _param_spec: glib::ffi::gpointer,
1012 f: glib::ffi::gpointer,
1013 ) {
1014 unsafe {
1015 let f: &F = &*(f as *const F);
1016 f(&from_glib_borrow(this))
1017 }
1018 }
1019 unsafe {
1020 let f: Box_<F> = Box_::new(f);
1021 connect_raw(
1022 self.as_ptr() as *mut _,
1023 c"notify::current-subtitle-track".as_ptr(),
1024 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1025 notify_current_subtitle_track_trampoline::<F> as *const (),
1026 )),
1027 Box_::into_raw(f),
1028 )
1029 }
1030 }
1031
1032 #[doc(alias = "current-video-track")]
1033 pub fn connect_current_video_track_notify<F: Fn(&Self) + Send + Sync + 'static>(
1034 &self,
1035 f: F,
1036 ) -> SignalHandlerId {
1037 unsafe extern "C" fn notify_current_video_track_trampoline<
1038 F: Fn(&Play) + Send + Sync + 'static,
1039 >(
1040 this: *mut ffi::GstPlay,
1041 _param_spec: glib::ffi::gpointer,
1042 f: glib::ffi::gpointer,
1043 ) {
1044 unsafe {
1045 let f: &F = &*(f as *const F);
1046 f(&from_glib_borrow(this))
1047 }
1048 }
1049 unsafe {
1050 let f: Box_<F> = Box_::new(f);
1051 connect_raw(
1052 self.as_ptr() as *mut _,
1053 c"notify::current-video-track".as_ptr(),
1054 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1055 notify_current_video_track_trampoline::<F> as *const (),
1056 )),
1057 Box_::into_raw(f),
1058 )
1059 }
1060 }
1061
1062 #[doc(alias = "duration")]
1063 pub fn connect_duration_notify<F: Fn(&Self) + Send + Sync + 'static>(
1064 &self,
1065 f: F,
1066 ) -> SignalHandlerId {
1067 unsafe extern "C" fn notify_duration_trampoline<F: Fn(&Play) + Send + Sync + 'static>(
1068 this: *mut ffi::GstPlay,
1069 _param_spec: glib::ffi::gpointer,
1070 f: glib::ffi::gpointer,
1071 ) {
1072 unsafe {
1073 let f: &F = &*(f as *const F);
1074 f(&from_glib_borrow(this))
1075 }
1076 }
1077 unsafe {
1078 let f: Box_<F> = Box_::new(f);
1079 connect_raw(
1080 self.as_ptr() as *mut _,
1081 c"notify::duration".as_ptr(),
1082 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1083 notify_duration_trampoline::<F> as *const (),
1084 )),
1085 Box_::into_raw(f),
1086 )
1087 }
1088 }
1089
1090 #[doc(alias = "media-info")]
1091 pub fn connect_media_info_notify<F: Fn(&Self) + Send + Sync + 'static>(
1092 &self,
1093 f: F,
1094 ) -> SignalHandlerId {
1095 unsafe extern "C" fn notify_media_info_trampoline<F: Fn(&Play) + Send + Sync + 'static>(
1096 this: *mut ffi::GstPlay,
1097 _param_spec: glib::ffi::gpointer,
1098 f: glib::ffi::gpointer,
1099 ) {
1100 unsafe {
1101 let f: &F = &*(f as *const F);
1102 f(&from_glib_borrow(this))
1103 }
1104 }
1105 unsafe {
1106 let f: Box_<F> = Box_::new(f);
1107 connect_raw(
1108 self.as_ptr() as *mut _,
1109 c"notify::media-info".as_ptr(),
1110 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1111 notify_media_info_trampoline::<F> as *const (),
1112 )),
1113 Box_::into_raw(f),
1114 )
1115 }
1116 }
1117
1118 #[doc(alias = "mute")]
1119 pub fn connect_mute_notify<F: Fn(&Self) + Send + Sync + 'static>(
1120 &self,
1121 f: F,
1122 ) -> SignalHandlerId {
1123 unsafe extern "C" fn notify_mute_trampoline<F: Fn(&Play) + Send + Sync + 'static>(
1124 this: *mut ffi::GstPlay,
1125 _param_spec: glib::ffi::gpointer,
1126 f: glib::ffi::gpointer,
1127 ) {
1128 unsafe {
1129 let f: &F = &*(f as *const F);
1130 f(&from_glib_borrow(this))
1131 }
1132 }
1133 unsafe {
1134 let f: Box_<F> = Box_::new(f);
1135 connect_raw(
1136 self.as_ptr() as *mut _,
1137 c"notify::mute".as_ptr(),
1138 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1139 notify_mute_trampoline::<F> as *const (),
1140 )),
1141 Box_::into_raw(f),
1142 )
1143 }
1144 }
1145
1146 #[doc(alias = "pipeline")]
1147 pub fn connect_pipeline_notify<F: Fn(&Self) + Send + Sync + 'static>(
1148 &self,
1149 f: F,
1150 ) -> SignalHandlerId {
1151 unsafe extern "C" fn notify_pipeline_trampoline<F: Fn(&Play) + Send + Sync + 'static>(
1152 this: *mut ffi::GstPlay,
1153 _param_spec: glib::ffi::gpointer,
1154 f: glib::ffi::gpointer,
1155 ) {
1156 unsafe {
1157 let f: &F = &*(f as *const F);
1158 f(&from_glib_borrow(this))
1159 }
1160 }
1161 unsafe {
1162 let f: Box_<F> = Box_::new(f);
1163 connect_raw(
1164 self.as_ptr() as *mut _,
1165 c"notify::pipeline".as_ptr(),
1166 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1167 notify_pipeline_trampoline::<F> as *const (),
1168 )),
1169 Box_::into_raw(f),
1170 )
1171 }
1172 }
1173
1174 #[doc(alias = "position")]
1175 pub fn connect_position_notify<F: Fn(&Self) + Send + Sync + 'static>(
1176 &self,
1177 f: F,
1178 ) -> SignalHandlerId {
1179 unsafe extern "C" fn notify_position_trampoline<F: Fn(&Play) + Send + Sync + 'static>(
1180 this: *mut ffi::GstPlay,
1181 _param_spec: glib::ffi::gpointer,
1182 f: glib::ffi::gpointer,
1183 ) {
1184 unsafe {
1185 let f: &F = &*(f as *const F);
1186 f(&from_glib_borrow(this))
1187 }
1188 }
1189 unsafe {
1190 let f: Box_<F> = Box_::new(f);
1191 connect_raw(
1192 self.as_ptr() as *mut _,
1193 c"notify::position".as_ptr(),
1194 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1195 notify_position_trampoline::<F> as *const (),
1196 )),
1197 Box_::into_raw(f),
1198 )
1199 }
1200 }
1201
1202 #[doc(alias = "rate")]
1203 pub fn connect_rate_notify<F: Fn(&Self) + Send + Sync + 'static>(
1204 &self,
1205 f: F,
1206 ) -> SignalHandlerId {
1207 unsafe extern "C" fn notify_rate_trampoline<F: Fn(&Play) + Send + Sync + 'static>(
1208 this: *mut ffi::GstPlay,
1209 _param_spec: glib::ffi::gpointer,
1210 f: glib::ffi::gpointer,
1211 ) {
1212 unsafe {
1213 let f: &F = &*(f as *const F);
1214 f(&from_glib_borrow(this))
1215 }
1216 }
1217 unsafe {
1218 let f: Box_<F> = Box_::new(f);
1219 connect_raw(
1220 self.as_ptr() as *mut _,
1221 c"notify::rate".as_ptr(),
1222 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1223 notify_rate_trampoline::<F> as *const (),
1224 )),
1225 Box_::into_raw(f),
1226 )
1227 }
1228 }
1229
1230 #[doc(alias = "subtitle-video-offset")]
1231 pub fn connect_subtitle_video_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
1232 &self,
1233 f: F,
1234 ) -> SignalHandlerId {
1235 unsafe extern "C" fn notify_subtitle_video_offset_trampoline<
1236 F: Fn(&Play) + Send + Sync + 'static,
1237 >(
1238 this: *mut ffi::GstPlay,
1239 _param_spec: glib::ffi::gpointer,
1240 f: glib::ffi::gpointer,
1241 ) {
1242 unsafe {
1243 let f: &F = &*(f as *const F);
1244 f(&from_glib_borrow(this))
1245 }
1246 }
1247 unsafe {
1248 let f: Box_<F> = Box_::new(f);
1249 connect_raw(
1250 self.as_ptr() as *mut _,
1251 c"notify::subtitle-video-offset".as_ptr(),
1252 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1253 notify_subtitle_video_offset_trampoline::<F> as *const (),
1254 )),
1255 Box_::into_raw(f),
1256 )
1257 }
1258 }
1259
1260 #[doc(alias = "suburi")]
1261 pub fn connect_suburi_notify<F: Fn(&Self) + Send + Sync + 'static>(
1262 &self,
1263 f: F,
1264 ) -> SignalHandlerId {
1265 unsafe extern "C" fn notify_suburi_trampoline<F: Fn(&Play) + Send + Sync + 'static>(
1266 this: *mut ffi::GstPlay,
1267 _param_spec: glib::ffi::gpointer,
1268 f: glib::ffi::gpointer,
1269 ) {
1270 unsafe {
1271 let f: &F = &*(f as *const F);
1272 f(&from_glib_borrow(this))
1273 }
1274 }
1275 unsafe {
1276 let f: Box_<F> = Box_::new(f);
1277 connect_raw(
1278 self.as_ptr() as *mut _,
1279 c"notify::suburi".as_ptr(),
1280 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1281 notify_suburi_trampoline::<F> as *const (),
1282 )),
1283 Box_::into_raw(f),
1284 )
1285 }
1286 }
1287
1288 #[doc(alias = "uri")]
1289 pub fn connect_uri_notify<F: Fn(&Self) + Send + Sync + 'static>(
1290 &self,
1291 f: F,
1292 ) -> SignalHandlerId {
1293 unsafe extern "C" fn notify_uri_trampoline<F: Fn(&Play) + Send + Sync + 'static>(
1294 this: *mut ffi::GstPlay,
1295 _param_spec: glib::ffi::gpointer,
1296 f: glib::ffi::gpointer,
1297 ) {
1298 unsafe {
1299 let f: &F = &*(f as *const F);
1300 f(&from_glib_borrow(this))
1301 }
1302 }
1303 unsafe {
1304 let f: Box_<F> = Box_::new(f);
1305 connect_raw(
1306 self.as_ptr() as *mut _,
1307 c"notify::uri".as_ptr(),
1308 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1309 notify_uri_trampoline::<F> as *const (),
1310 )),
1311 Box_::into_raw(f),
1312 )
1313 }
1314 }
1315
1316 #[doc(alias = "video-multiview-flags")]
1317 pub fn connect_video_multiview_flags_notify<F: Fn(&Self) + Send + Sync + 'static>(
1318 &self,
1319 f: F,
1320 ) -> SignalHandlerId {
1321 unsafe extern "C" fn notify_video_multiview_flags_trampoline<
1322 F: Fn(&Play) + Send + Sync + 'static,
1323 >(
1324 this: *mut ffi::GstPlay,
1325 _param_spec: glib::ffi::gpointer,
1326 f: glib::ffi::gpointer,
1327 ) {
1328 unsafe {
1329 let f: &F = &*(f as *const F);
1330 f(&from_glib_borrow(this))
1331 }
1332 }
1333 unsafe {
1334 let f: Box_<F> = Box_::new(f);
1335 connect_raw(
1336 self.as_ptr() as *mut _,
1337 c"notify::video-multiview-flags".as_ptr(),
1338 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1339 notify_video_multiview_flags_trampoline::<F> as *const (),
1340 )),
1341 Box_::into_raw(f),
1342 )
1343 }
1344 }
1345
1346 #[doc(alias = "video-multiview-mode")]
1347 pub fn connect_video_multiview_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(
1348 &self,
1349 f: F,
1350 ) -> SignalHandlerId {
1351 unsafe extern "C" fn notify_video_multiview_mode_trampoline<
1352 F: Fn(&Play) + Send + Sync + 'static,
1353 >(
1354 this: *mut ffi::GstPlay,
1355 _param_spec: glib::ffi::gpointer,
1356 f: glib::ffi::gpointer,
1357 ) {
1358 unsafe {
1359 let f: &F = &*(f as *const F);
1360 f(&from_glib_borrow(this))
1361 }
1362 }
1363 unsafe {
1364 let f: Box_<F> = Box_::new(f);
1365 connect_raw(
1366 self.as_ptr() as *mut _,
1367 c"notify::video-multiview-mode".as_ptr(),
1368 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1369 notify_video_multiview_mode_trampoline::<F> as *const (),
1370 )),
1371 Box_::into_raw(f),
1372 )
1373 }
1374 }
1375
1376 #[doc(alias = "video-renderer")]
1377 pub fn connect_video_renderer_notify<F: Fn(&Self) + Send + Sync + 'static>(
1378 &self,
1379 f: F,
1380 ) -> SignalHandlerId {
1381 unsafe extern "C" fn notify_video_renderer_trampoline<
1382 F: Fn(&Play) + Send + Sync + 'static,
1383 >(
1384 this: *mut ffi::GstPlay,
1385 _param_spec: glib::ffi::gpointer,
1386 f: glib::ffi::gpointer,
1387 ) {
1388 unsafe {
1389 let f: &F = &*(f as *const F);
1390 f(&from_glib_borrow(this))
1391 }
1392 }
1393 unsafe {
1394 let f: Box_<F> = Box_::new(f);
1395 connect_raw(
1396 self.as_ptr() as *mut _,
1397 c"notify::video-renderer".as_ptr(),
1398 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1399 notify_video_renderer_trampoline::<F> as *const (),
1400 )),
1401 Box_::into_raw(f),
1402 )
1403 }
1404 }
1405
1406 #[doc(alias = "volume")]
1407 pub fn connect_volume_notify<F: Fn(&Self) + Send + Sync + 'static>(
1408 &self,
1409 f: F,
1410 ) -> SignalHandlerId {
1411 unsafe extern "C" fn notify_volume_trampoline<F: Fn(&Play) + Send + Sync + 'static>(
1412 this: *mut ffi::GstPlay,
1413 _param_spec: glib::ffi::gpointer,
1414 f: glib::ffi::gpointer,
1415 ) {
1416 unsafe {
1417 let f: &F = &*(f as *const F);
1418 f(&from_glib_borrow(this))
1419 }
1420 }
1421 unsafe {
1422 let f: Box_<F> = Box_::new(f);
1423 connect_raw(
1424 self.as_ptr() as *mut _,
1425 c"notify::volume".as_ptr(),
1426 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1427 notify_volume_trampoline::<F> as *const (),
1428 )),
1429 Box_::into_raw(f),
1430 )
1431 }
1432 }
1433}
1434
1435unsafe impl Send for Play {}
1436unsafe impl Sync for Play {}