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