[go: up one dir, main page]

gtk4/auto/
media_stream.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// DO NOT EDIT
4#![allow(deprecated)]
5
6use crate::ffi;
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GtkMediaStream")]
16    pub struct MediaStream(Object<ffi::GtkMediaStream, ffi::GtkMediaStreamClass>) @implements gdk::Paintable;
17
18    match fn {
19        type_ => || ffi::gtk_media_stream_get_type(),
20    }
21}
22
23impl MediaStream {
24    pub const NONE: Option<&'static MediaStream> = None;
25}
26
27pub trait MediaStreamExt: IsA<MediaStream> + 'static {
28    #[cfg_attr(feature = "v4_4", deprecated = "Since 4.4")]
29    #[allow(deprecated)]
30    #[doc(alias = "gtk_media_stream_ended")]
31    fn ended(&self) {
32        unsafe {
33            ffi::gtk_media_stream_ended(self.as_ref().to_glib_none().0);
34        }
35    }
36
37    #[doc(alias = "gtk_media_stream_get_duration")]
38    #[doc(alias = "get_duration")]
39    fn duration(&self) -> i64 {
40        unsafe { ffi::gtk_media_stream_get_duration(self.as_ref().to_glib_none().0) }
41    }
42
43    #[doc(alias = "gtk_media_stream_get_ended")]
44    #[doc(alias = "get_ended")]
45    #[doc(alias = "ended")]
46    fn is_ended(&self) -> bool {
47        unsafe {
48            from_glib(ffi::gtk_media_stream_get_ended(
49                self.as_ref().to_glib_none().0,
50            ))
51        }
52    }
53
54    #[doc(alias = "gtk_media_stream_get_error")]
55    #[doc(alias = "get_error")]
56    fn error(&self) -> Option<glib::Error> {
57        unsafe {
58            from_glib_none(ffi::gtk_media_stream_get_error(
59                self.as_ref().to_glib_none().0,
60            ))
61        }
62    }
63
64    #[doc(alias = "gtk_media_stream_get_loop")]
65    #[doc(alias = "get_loop")]
66    #[doc(alias = "loop")]
67    fn is_loop(&self) -> bool {
68        unsafe {
69            from_glib(ffi::gtk_media_stream_get_loop(
70                self.as_ref().to_glib_none().0,
71            ))
72        }
73    }
74
75    #[doc(alias = "gtk_media_stream_get_muted")]
76    #[doc(alias = "get_muted")]
77    #[doc(alias = "muted")]
78    fn is_muted(&self) -> bool {
79        unsafe {
80            from_glib(ffi::gtk_media_stream_get_muted(
81                self.as_ref().to_glib_none().0,
82            ))
83        }
84    }
85
86    #[doc(alias = "gtk_media_stream_get_playing")]
87    #[doc(alias = "get_playing")]
88    #[doc(alias = "playing")]
89    fn is_playing(&self) -> bool {
90        unsafe {
91            from_glib(ffi::gtk_media_stream_get_playing(
92                self.as_ref().to_glib_none().0,
93            ))
94        }
95    }
96
97    #[doc(alias = "gtk_media_stream_get_timestamp")]
98    #[doc(alias = "get_timestamp")]
99    fn timestamp(&self) -> i64 {
100        unsafe { ffi::gtk_media_stream_get_timestamp(self.as_ref().to_glib_none().0) }
101    }
102
103    #[doc(alias = "gtk_media_stream_get_volume")]
104    #[doc(alias = "get_volume")]
105    fn volume(&self) -> f64 {
106        unsafe { ffi::gtk_media_stream_get_volume(self.as_ref().to_glib_none().0) }
107    }
108
109    #[doc(alias = "gtk_media_stream_has_audio")]
110    #[doc(alias = "has-audio")]
111    fn has_audio(&self) -> bool {
112        unsafe {
113            from_glib(ffi::gtk_media_stream_has_audio(
114                self.as_ref().to_glib_none().0,
115            ))
116        }
117    }
118
119    #[doc(alias = "gtk_media_stream_has_video")]
120    #[doc(alias = "has-video")]
121    fn has_video(&self) -> bool {
122        unsafe {
123            from_glib(ffi::gtk_media_stream_has_video(
124                self.as_ref().to_glib_none().0,
125            ))
126        }
127    }
128
129    #[doc(alias = "gtk_media_stream_is_prepared")]
130    #[doc(alias = "prepared")]
131    fn is_prepared(&self) -> bool {
132        unsafe {
133            from_glib(ffi::gtk_media_stream_is_prepared(
134                self.as_ref().to_glib_none().0,
135            ))
136        }
137    }
138
139    #[doc(alias = "gtk_media_stream_is_seekable")]
140    #[doc(alias = "seekable")]
141    fn is_seekable(&self) -> bool {
142        unsafe {
143            from_glib(ffi::gtk_media_stream_is_seekable(
144                self.as_ref().to_glib_none().0,
145            ))
146        }
147    }
148
149    #[doc(alias = "gtk_media_stream_is_seeking")]
150    #[doc(alias = "seeking")]
151    fn is_seeking(&self) -> bool {
152        unsafe {
153            from_glib(ffi::gtk_media_stream_is_seeking(
154                self.as_ref().to_glib_none().0,
155            ))
156        }
157    }
158
159    #[doc(alias = "gtk_media_stream_pause")]
160    fn pause(&self) {
161        unsafe {
162            ffi::gtk_media_stream_pause(self.as_ref().to_glib_none().0);
163        }
164    }
165
166    #[doc(alias = "gtk_media_stream_play")]
167    fn play(&self) {
168        unsafe {
169            ffi::gtk_media_stream_play(self.as_ref().to_glib_none().0);
170        }
171    }
172
173    #[cfg_attr(feature = "v4_4", deprecated = "Since 4.4")]
174    #[allow(deprecated)]
175    #[doc(alias = "gtk_media_stream_prepared")]
176    fn prepared(&self, has_audio: bool, has_video: bool, seekable: bool, duration: i64) {
177        unsafe {
178            ffi::gtk_media_stream_prepared(
179                self.as_ref().to_glib_none().0,
180                has_audio.into_glib(),
181                has_video.into_glib(),
182                seekable.into_glib(),
183                duration,
184            );
185        }
186    }
187
188    #[doc(alias = "gtk_media_stream_realize")]
189    fn realize(&self, surface: &impl IsA<gdk::Surface>) {
190        unsafe {
191            ffi::gtk_media_stream_realize(
192                self.as_ref().to_glib_none().0,
193                surface.as_ref().to_glib_none().0,
194            );
195        }
196    }
197
198    #[doc(alias = "gtk_media_stream_seek")]
199    fn seek(&self, timestamp: i64) {
200        unsafe {
201            ffi::gtk_media_stream_seek(self.as_ref().to_glib_none().0, timestamp);
202        }
203    }
204
205    #[doc(alias = "gtk_media_stream_seek_failed")]
206    fn seek_failed(&self) {
207        unsafe {
208            ffi::gtk_media_stream_seek_failed(self.as_ref().to_glib_none().0);
209        }
210    }
211
212    #[doc(alias = "gtk_media_stream_seek_success")]
213    fn seek_success(&self) {
214        unsafe {
215            ffi::gtk_media_stream_seek_success(self.as_ref().to_glib_none().0);
216        }
217    }
218
219    #[doc(alias = "gtk_media_stream_set_loop")]
220    #[doc(alias = "loop")]
221    fn set_loop(&self, loop_: bool) {
222        unsafe {
223            ffi::gtk_media_stream_set_loop(self.as_ref().to_glib_none().0, loop_.into_glib());
224        }
225    }
226
227    #[doc(alias = "gtk_media_stream_set_muted")]
228    #[doc(alias = "muted")]
229    fn set_muted(&self, muted: bool) {
230        unsafe {
231            ffi::gtk_media_stream_set_muted(self.as_ref().to_glib_none().0, muted.into_glib());
232        }
233    }
234
235    #[doc(alias = "gtk_media_stream_set_playing")]
236    #[doc(alias = "playing")]
237    fn set_playing(&self, playing: bool) {
238        unsafe {
239            ffi::gtk_media_stream_set_playing(self.as_ref().to_glib_none().0, playing.into_glib());
240        }
241    }
242
243    #[doc(alias = "gtk_media_stream_set_volume")]
244    #[doc(alias = "volume")]
245    fn set_volume(&self, volume: f64) {
246        unsafe {
247            ffi::gtk_media_stream_set_volume(self.as_ref().to_glib_none().0, volume);
248        }
249    }
250
251    #[cfg(feature = "v4_4")]
252    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
253    #[doc(alias = "gtk_media_stream_stream_ended")]
254    fn stream_ended(&self) {
255        unsafe {
256            ffi::gtk_media_stream_stream_ended(self.as_ref().to_glib_none().0);
257        }
258    }
259
260    #[cfg(feature = "v4_4")]
261    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
262    #[doc(alias = "gtk_media_stream_stream_prepared")]
263    fn stream_prepared(&self, has_audio: bool, has_video: bool, seekable: bool, duration: i64) {
264        unsafe {
265            ffi::gtk_media_stream_stream_prepared(
266                self.as_ref().to_glib_none().0,
267                has_audio.into_glib(),
268                has_video.into_glib(),
269                seekable.into_glib(),
270                duration,
271            );
272        }
273    }
274
275    #[cfg(feature = "v4_4")]
276    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
277    #[doc(alias = "gtk_media_stream_stream_unprepared")]
278    fn stream_unprepared(&self) {
279        unsafe {
280            ffi::gtk_media_stream_stream_unprepared(self.as_ref().to_glib_none().0);
281        }
282    }
283
284    #[cfg_attr(feature = "v4_4", deprecated = "Since 4.4")]
285    #[allow(deprecated)]
286    #[doc(alias = "gtk_media_stream_unprepared")]
287    fn unprepared(&self) {
288        unsafe {
289            ffi::gtk_media_stream_unprepared(self.as_ref().to_glib_none().0);
290        }
291    }
292
293    #[doc(alias = "gtk_media_stream_unrealize")]
294    fn unrealize(&self, surface: &impl IsA<gdk::Surface>) {
295        unsafe {
296            ffi::gtk_media_stream_unrealize(
297                self.as_ref().to_glib_none().0,
298                surface.as_ref().to_glib_none().0,
299            );
300        }
301    }
302
303    #[doc(alias = "gtk_media_stream_update")]
304    fn update(&self, timestamp: i64) {
305        unsafe {
306            ffi::gtk_media_stream_update(self.as_ref().to_glib_none().0, timestamp);
307        }
308    }
309
310    #[doc(alias = "duration")]
311    fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
312        unsafe extern "C" fn notify_duration_trampoline<
313            P: IsA<MediaStream>,
314            F: Fn(&P) + 'static,
315        >(
316            this: *mut ffi::GtkMediaStream,
317            _param_spec: glib::ffi::gpointer,
318            f: glib::ffi::gpointer,
319        ) {
320            let f: &F = &*(f as *const F);
321            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
322        }
323        unsafe {
324            let f: Box_<F> = Box_::new(f);
325            connect_raw(
326                self.as_ptr() as *mut _,
327                c"notify::duration".as_ptr() as *const _,
328                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
329                    notify_duration_trampoline::<Self, F> as *const (),
330                )),
331                Box_::into_raw(f),
332            )
333        }
334    }
335
336    #[doc(alias = "ended")]
337    fn connect_ended_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
338        unsafe extern "C" fn notify_ended_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
339            this: *mut ffi::GtkMediaStream,
340            _param_spec: glib::ffi::gpointer,
341            f: glib::ffi::gpointer,
342        ) {
343            let f: &F = &*(f as *const F);
344            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
345        }
346        unsafe {
347            let f: Box_<F> = Box_::new(f);
348            connect_raw(
349                self.as_ptr() as *mut _,
350                c"notify::ended".as_ptr() as *const _,
351                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
352                    notify_ended_trampoline::<Self, F> as *const (),
353                )),
354                Box_::into_raw(f),
355            )
356        }
357    }
358
359    #[doc(alias = "error")]
360    fn connect_error_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
361        unsafe extern "C" fn notify_error_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
362            this: *mut ffi::GtkMediaStream,
363            _param_spec: glib::ffi::gpointer,
364            f: glib::ffi::gpointer,
365        ) {
366            let f: &F = &*(f as *const F);
367            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
368        }
369        unsafe {
370            let f: Box_<F> = Box_::new(f);
371            connect_raw(
372                self.as_ptr() as *mut _,
373                c"notify::error".as_ptr() as *const _,
374                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
375                    notify_error_trampoline::<Self, F> as *const (),
376                )),
377                Box_::into_raw(f),
378            )
379        }
380    }
381
382    #[doc(alias = "has-audio")]
383    fn connect_has_audio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
384        unsafe extern "C" fn notify_has_audio_trampoline<
385            P: IsA<MediaStream>,
386            F: Fn(&P) + 'static,
387        >(
388            this: *mut ffi::GtkMediaStream,
389            _param_spec: glib::ffi::gpointer,
390            f: glib::ffi::gpointer,
391        ) {
392            let f: &F = &*(f as *const F);
393            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
394        }
395        unsafe {
396            let f: Box_<F> = Box_::new(f);
397            connect_raw(
398                self.as_ptr() as *mut _,
399                c"notify::has-audio".as_ptr() as *const _,
400                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
401                    notify_has_audio_trampoline::<Self, F> as *const (),
402                )),
403                Box_::into_raw(f),
404            )
405        }
406    }
407
408    #[doc(alias = "has-video")]
409    fn connect_has_video_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
410        unsafe extern "C" fn notify_has_video_trampoline<
411            P: IsA<MediaStream>,
412            F: Fn(&P) + 'static,
413        >(
414            this: *mut ffi::GtkMediaStream,
415            _param_spec: glib::ffi::gpointer,
416            f: glib::ffi::gpointer,
417        ) {
418            let f: &F = &*(f as *const F);
419            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
420        }
421        unsafe {
422            let f: Box_<F> = Box_::new(f);
423            connect_raw(
424                self.as_ptr() as *mut _,
425                c"notify::has-video".as_ptr() as *const _,
426                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
427                    notify_has_video_trampoline::<Self, F> as *const (),
428                )),
429                Box_::into_raw(f),
430            )
431        }
432    }
433
434    #[doc(alias = "loop")]
435    fn connect_loop_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
436        unsafe extern "C" fn notify_loop_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
437            this: *mut ffi::GtkMediaStream,
438            _param_spec: glib::ffi::gpointer,
439            f: glib::ffi::gpointer,
440        ) {
441            let f: &F = &*(f as *const F);
442            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
443        }
444        unsafe {
445            let f: Box_<F> = Box_::new(f);
446            connect_raw(
447                self.as_ptr() as *mut _,
448                c"notify::loop".as_ptr() as *const _,
449                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
450                    notify_loop_trampoline::<Self, F> as *const (),
451                )),
452                Box_::into_raw(f),
453            )
454        }
455    }
456
457    #[doc(alias = "muted")]
458    fn connect_muted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
459        unsafe extern "C" fn notify_muted_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
460            this: *mut ffi::GtkMediaStream,
461            _param_spec: glib::ffi::gpointer,
462            f: glib::ffi::gpointer,
463        ) {
464            let f: &F = &*(f as *const F);
465            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
466        }
467        unsafe {
468            let f: Box_<F> = Box_::new(f);
469            connect_raw(
470                self.as_ptr() as *mut _,
471                c"notify::muted".as_ptr() as *const _,
472                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
473                    notify_muted_trampoline::<Self, F> as *const (),
474                )),
475                Box_::into_raw(f),
476            )
477        }
478    }
479
480    #[doc(alias = "playing")]
481    fn connect_playing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
482        unsafe extern "C" fn notify_playing_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
483            this: *mut ffi::GtkMediaStream,
484            _param_spec: glib::ffi::gpointer,
485            f: glib::ffi::gpointer,
486        ) {
487            let f: &F = &*(f as *const F);
488            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
489        }
490        unsafe {
491            let f: Box_<F> = Box_::new(f);
492            connect_raw(
493                self.as_ptr() as *mut _,
494                c"notify::playing".as_ptr() as *const _,
495                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
496                    notify_playing_trampoline::<Self, F> as *const (),
497                )),
498                Box_::into_raw(f),
499            )
500        }
501    }
502
503    #[doc(alias = "prepared")]
504    fn connect_prepared_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
505        unsafe extern "C" fn notify_prepared_trampoline<
506            P: IsA<MediaStream>,
507            F: Fn(&P) + 'static,
508        >(
509            this: *mut ffi::GtkMediaStream,
510            _param_spec: glib::ffi::gpointer,
511            f: glib::ffi::gpointer,
512        ) {
513            let f: &F = &*(f as *const F);
514            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
515        }
516        unsafe {
517            let f: Box_<F> = Box_::new(f);
518            connect_raw(
519                self.as_ptr() as *mut _,
520                c"notify::prepared".as_ptr() as *const _,
521                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
522                    notify_prepared_trampoline::<Self, F> as *const (),
523                )),
524                Box_::into_raw(f),
525            )
526        }
527    }
528
529    #[doc(alias = "seekable")]
530    fn connect_seekable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
531        unsafe extern "C" fn notify_seekable_trampoline<
532            P: IsA<MediaStream>,
533            F: Fn(&P) + 'static,
534        >(
535            this: *mut ffi::GtkMediaStream,
536            _param_spec: glib::ffi::gpointer,
537            f: glib::ffi::gpointer,
538        ) {
539            let f: &F = &*(f as *const F);
540            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
541        }
542        unsafe {
543            let f: Box_<F> = Box_::new(f);
544            connect_raw(
545                self.as_ptr() as *mut _,
546                c"notify::seekable".as_ptr() as *const _,
547                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
548                    notify_seekable_trampoline::<Self, F> as *const (),
549                )),
550                Box_::into_raw(f),
551            )
552        }
553    }
554
555    #[doc(alias = "seeking")]
556    fn connect_seeking_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
557        unsafe extern "C" fn notify_seeking_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
558            this: *mut ffi::GtkMediaStream,
559            _param_spec: glib::ffi::gpointer,
560            f: glib::ffi::gpointer,
561        ) {
562            let f: &F = &*(f as *const F);
563            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
564        }
565        unsafe {
566            let f: Box_<F> = Box_::new(f);
567            connect_raw(
568                self.as_ptr() as *mut _,
569                c"notify::seeking".as_ptr() as *const _,
570                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
571                    notify_seeking_trampoline::<Self, F> as *const (),
572                )),
573                Box_::into_raw(f),
574            )
575        }
576    }
577
578    #[doc(alias = "timestamp")]
579    fn connect_timestamp_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
580        unsafe extern "C" fn notify_timestamp_trampoline<
581            P: IsA<MediaStream>,
582            F: Fn(&P) + 'static,
583        >(
584            this: *mut ffi::GtkMediaStream,
585            _param_spec: glib::ffi::gpointer,
586            f: glib::ffi::gpointer,
587        ) {
588            let f: &F = &*(f as *const F);
589            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
590        }
591        unsafe {
592            let f: Box_<F> = Box_::new(f);
593            connect_raw(
594                self.as_ptr() as *mut _,
595                c"notify::timestamp".as_ptr() as *const _,
596                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
597                    notify_timestamp_trampoline::<Self, F> as *const (),
598                )),
599                Box_::into_raw(f),
600            )
601        }
602    }
603
604    #[doc(alias = "volume")]
605    fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
606        unsafe extern "C" fn notify_volume_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
607            this: *mut ffi::GtkMediaStream,
608            _param_spec: glib::ffi::gpointer,
609            f: glib::ffi::gpointer,
610        ) {
611            let f: &F = &*(f as *const F);
612            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
613        }
614        unsafe {
615            let f: Box_<F> = Box_::new(f);
616            connect_raw(
617                self.as_ptr() as *mut _,
618                c"notify::volume".as_ptr() as *const _,
619                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
620                    notify_volume_trampoline::<Self, F> as *const (),
621                )),
622                Box_::into_raw(f),
623            )
624        }
625    }
626}
627
628impl<O: IsA<MediaStream>> MediaStreamExt for O {}