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    /// [`MediaStream`][crate::MediaStream] is the integration point for media playback inside GTK.
16    ///
17    /// GTK provides an implementation of the [`MediaStream`][crate::MediaStream] interface that
18    /// is called [`MediaFile`][crate::MediaFile].
19    ///
20    /// Apart from application-facing API for stream playback, [`MediaStream`][crate::MediaStream]
21    /// has a number of APIs that are only useful for implementations and should
22    /// not be used in applications:
23    /// [`MediaStreamExt::prepared()`][crate::prelude::MediaStreamExt::prepared()],
24    /// [`MediaStreamExt::unprepared()`][crate::prelude::MediaStreamExt::unprepared()],
25    /// [`MediaStreamExt::update()`][crate::prelude::MediaStreamExt::update()],
26    /// [`MediaStreamExt::ended()`][crate::prelude::MediaStreamExt::ended()],
27    /// [`MediaStreamExt::seek_success()`][crate::prelude::MediaStreamExt::seek_success()],
28    /// [`MediaStreamExt::seek_failed()`][crate::prelude::MediaStreamExt::seek_failed()],
29    /// [`MediaStreamExtManual::set_error()`][crate::prelude::MediaStreamExtManual::set_error()],
30    /// `Gtk::MediaStream::error()`,
31    /// `Gtk::MediaStream::error_valist()`.
32    ///
33    /// This is an Abstract Base Class, you cannot instantiate it.
34    ///
35    /// ## Properties
36    ///
37    ///
38    /// #### `duration`
39    ///  The stream's duration in microseconds or 0 if unknown.
40    ///
41    /// Readable
42    ///
43    ///
44    /// #### `ended`
45    ///  Set when playback has finished.
46    ///
47    /// Readable
48    ///
49    ///
50    /// #### `error`
51    ///  [`None`] for a properly working stream or the `GError`
52    /// that the stream is in.
53    ///
54    /// Readable
55    ///
56    ///
57    /// #### `has-audio`
58    ///  Whether the stream contains audio.
59    ///
60    /// Readable
61    ///
62    ///
63    /// #### `has-video`
64    ///  Whether the stream contains video.
65    ///
66    /// Readable
67    ///
68    ///
69    /// #### `loop`
70    ///  Try to restart the media from the beginning once it ended.
71    ///
72    /// Readable | Writeable
73    ///
74    ///
75    /// #### `muted`
76    ///  Whether the audio stream should be muted.
77    ///
78    /// Readable | Writeable
79    ///
80    ///
81    /// #### `playing`
82    ///  Whether the stream is currently playing.
83    ///
84    /// Readable | Writeable
85    ///
86    ///
87    /// #### `prepared`
88    ///  Whether the stream has finished initializing and existence of
89    /// audio and video is known.
90    ///
91    /// Readable | Writeable
92    ///
93    ///
94    /// #### `seekable`
95    ///  Set unless the stream is known to not support seeking.
96    ///
97    /// Readable
98    ///
99    ///
100    /// #### `seeking`
101    ///  Set while a seek is in progress.
102    ///
103    /// Readable
104    ///
105    ///
106    /// #### `timestamp`
107    ///  The current presentation timestamp in microseconds.
108    ///
109    /// Readable
110    ///
111    ///
112    /// #### `volume`
113    ///  Volume of the audio stream.
114    ///
115    /// Readable | Writeable
116    ///
117    /// # Implements
118    ///
119    /// [`MediaStreamExt`][trait@crate::prelude::MediaStreamExt], [`trait@glib::ObjectExt`], [`trait@gdk::prelude::PaintableExt`], [`MediaStreamExtManual`][trait@crate::prelude::MediaStreamExtManual]
120    #[doc(alias = "GtkMediaStream")]
121    pub struct MediaStream(Object<ffi::GtkMediaStream, ffi::GtkMediaStreamClass>) @implements gdk::Paintable;
122
123    match fn {
124        type_ => || ffi::gtk_media_stream_get_type(),
125    }
126}
127
128impl MediaStream {
129    pub const NONE: Option<&'static MediaStream> = None;
130}
131
132/// Trait containing all [`struct@MediaStream`] methods.
133///
134/// # Implementors
135///
136/// [`MediaFile`][struct@crate::MediaFile], [`MediaStream`][struct@crate::MediaStream]
137pub trait MediaStreamExt: IsA<MediaStream> + 'static {
138    /// Pauses the media stream and marks it as ended.
139    ///
140    /// This is a hint only, calls to [`play()`][Self::play()]
141    /// may still happen.
142    ///
143    /// The media stream must be prepared when this function is called.
144    ///
145    /// # Deprecated since 4.4
146    ///
147    /// Use [`stream_ended()`][Self::stream_ended()] instead
148    #[cfg_attr(feature = "v4_4", deprecated = "Since 4.4")]
149    #[allow(deprecated)]
150    #[doc(alias = "gtk_media_stream_ended")]
151    fn ended(&self) {
152        unsafe {
153            ffi::gtk_media_stream_ended(self.as_ref().to_glib_none().0);
154        }
155    }
156
157    /// Gets the duration of the stream.
158    ///
159    /// If the duration is not known, 0 will be returned.
160    ///
161    /// # Returns
162    ///
163    /// the duration of the stream or 0 if not known.
164    #[doc(alias = "gtk_media_stream_get_duration")]
165    #[doc(alias = "get_duration")]
166    fn duration(&self) -> i64 {
167        unsafe { ffi::gtk_media_stream_get_duration(self.as_ref().to_glib_none().0) }
168    }
169
170    /// Returns whether the streams playback is finished.
171    ///
172    /// # Returns
173    ///
174    /// [`true`] if playback is finished
175    #[doc(alias = "gtk_media_stream_get_ended")]
176    #[doc(alias = "get_ended")]
177    #[doc(alias = "ended")]
178    fn is_ended(&self) -> bool {
179        unsafe {
180            from_glib(ffi::gtk_media_stream_get_ended(
181                self.as_ref().to_glib_none().0,
182            ))
183        }
184    }
185
186    /// If the stream is in an error state, returns the `GError`
187    /// explaining that state.
188    ///
189    /// Any type of error can be reported here depending on the
190    /// implementation of the media stream.
191    ///
192    /// A media stream in an error cannot be operated on, calls
193    /// like [`play()`][Self::play()] or
194    /// [`seek()`][Self::seek()] will not have any effect.
195    ///
196    /// [`MediaStream`][crate::MediaStream] itself does not provide a way to unset
197    /// an error, but implementations may provide options. For example,
198    /// a [`MediaFile`][crate::MediaFile] will unset errors when a new source is
199    /// set, e.g. with [`MediaFileExt::set_file()`][crate::prelude::MediaFileExt::set_file()].
200    ///
201    /// # Returns
202    ///
203    /// [`None`] if not in an
204    ///   error state or the `GError` of the stream
205    #[doc(alias = "gtk_media_stream_get_error")]
206    #[doc(alias = "get_error")]
207    fn error(&self) -> Option<glib::Error> {
208        unsafe {
209            from_glib_none(ffi::gtk_media_stream_get_error(
210                self.as_ref().to_glib_none().0,
211            ))
212        }
213    }
214
215    /// Returns whether the stream is set to loop.
216    ///
217    /// See [`set_loop()`][Self::set_loop()] for details.
218    ///
219    /// # Returns
220    ///
221    /// [`true`] if the stream should loop
222    #[doc(alias = "gtk_media_stream_get_loop")]
223    #[doc(alias = "get_loop")]
224    #[doc(alias = "loop")]
225    fn is_loop(&self) -> bool {
226        unsafe {
227            from_glib(ffi::gtk_media_stream_get_loop(
228                self.as_ref().to_glib_none().0,
229            ))
230        }
231    }
232
233    /// Returns whether the audio for the stream is muted.
234    ///
235    /// See [`set_muted()`][Self::set_muted()] for details.
236    ///
237    /// # Returns
238    ///
239    /// [`true`] if the stream is muted
240    #[doc(alias = "gtk_media_stream_get_muted")]
241    #[doc(alias = "get_muted")]
242    #[doc(alias = "muted")]
243    fn is_muted(&self) -> bool {
244        unsafe {
245            from_glib(ffi::gtk_media_stream_get_muted(
246                self.as_ref().to_glib_none().0,
247            ))
248        }
249    }
250
251    /// Return whether the stream is currently playing.
252    ///
253    /// # Returns
254    ///
255    /// [`true`] if the stream is playing
256    #[doc(alias = "gtk_media_stream_get_playing")]
257    #[doc(alias = "get_playing")]
258    #[doc(alias = "playing")]
259    fn is_playing(&self) -> bool {
260        unsafe {
261            from_glib(ffi::gtk_media_stream_get_playing(
262                self.as_ref().to_glib_none().0,
263            ))
264        }
265    }
266
267    /// Returns the current presentation timestamp in microseconds.
268    ///
269    /// # Returns
270    ///
271    /// the timestamp in microseconds
272    #[doc(alias = "gtk_media_stream_get_timestamp")]
273    #[doc(alias = "get_timestamp")]
274    fn timestamp(&self) -> i64 {
275        unsafe { ffi::gtk_media_stream_get_timestamp(self.as_ref().to_glib_none().0) }
276    }
277
278    /// Returns the volume of the audio for the stream.
279    ///
280    /// See [`set_volume()`][Self::set_volume()] for details.
281    ///
282    /// # Returns
283    ///
284    /// volume of the stream from 0.0 to 1.0
285    #[doc(alias = "gtk_media_stream_get_volume")]
286    #[doc(alias = "get_volume")]
287    fn volume(&self) -> f64 {
288        unsafe { ffi::gtk_media_stream_get_volume(self.as_ref().to_glib_none().0) }
289    }
290
291    /// Returns whether the stream has audio.
292    ///
293    /// # Returns
294    ///
295    /// [`true`] if the stream has audio
296    #[doc(alias = "gtk_media_stream_has_audio")]
297    #[doc(alias = "has-audio")]
298    fn has_audio(&self) -> bool {
299        unsafe {
300            from_glib(ffi::gtk_media_stream_has_audio(
301                self.as_ref().to_glib_none().0,
302            ))
303        }
304    }
305
306    /// Returns whether the stream has video.
307    ///
308    /// # Returns
309    ///
310    /// [`true`] if the stream has video
311    #[doc(alias = "gtk_media_stream_has_video")]
312    #[doc(alias = "has-video")]
313    fn has_video(&self) -> bool {
314        unsafe {
315            from_glib(ffi::gtk_media_stream_has_video(
316                self.as_ref().to_glib_none().0,
317            ))
318        }
319    }
320
321    /// Returns whether the stream has finished initializing.
322    ///
323    /// At this point the existence of audio and video is known.
324    ///
325    /// # Returns
326    ///
327    /// [`true`] if the stream is prepared
328    #[doc(alias = "gtk_media_stream_is_prepared")]
329    #[doc(alias = "prepared")]
330    fn is_prepared(&self) -> bool {
331        unsafe {
332            from_glib(ffi::gtk_media_stream_is_prepared(
333                self.as_ref().to_glib_none().0,
334            ))
335        }
336    }
337
338    /// Checks if a stream may be seekable.
339    ///
340    /// This is meant to be a hint. Streams may not allow seeking even if
341    /// this function returns [`true`]. However, if this function returns
342    /// [`false`], streams are guaranteed to not be seekable and user interfaces
343    /// may hide controls that allow seeking.
344    ///
345    /// It is allowed to call [`seek()`][Self::seek()] on a non-seekable
346    /// stream, though it will not do anything.
347    ///
348    /// # Returns
349    ///
350    /// [`true`] if the stream may support seeking
351    #[doc(alias = "gtk_media_stream_is_seekable")]
352    #[doc(alias = "seekable")]
353    fn is_seekable(&self) -> bool {
354        unsafe {
355            from_glib(ffi::gtk_media_stream_is_seekable(
356                self.as_ref().to_glib_none().0,
357            ))
358        }
359    }
360
361    /// Checks if there is currently a seek operation going on.
362    ///
363    /// # Returns
364    ///
365    /// [`true`] if a seek operation is ongoing.
366    #[doc(alias = "gtk_media_stream_is_seeking")]
367    #[doc(alias = "seeking")]
368    fn is_seeking(&self) -> bool {
369        unsafe {
370            from_glib(ffi::gtk_media_stream_is_seeking(
371                self.as_ref().to_glib_none().0,
372            ))
373        }
374    }
375
376    /// Pauses playback of the stream.
377    ///
378    /// If the stream is not playing, do nothing.
379    #[doc(alias = "gtk_media_stream_pause")]
380    fn pause(&self) {
381        unsafe {
382            ffi::gtk_media_stream_pause(self.as_ref().to_glib_none().0);
383        }
384    }
385
386    /// Starts playing the stream.
387    ///
388    /// If the stream is in error or already playing, do nothing.
389    #[doc(alias = "gtk_media_stream_play")]
390    fn play(&self) {
391        unsafe {
392            ffi::gtk_media_stream_play(self.as_ref().to_glib_none().0);
393        }
394    }
395
396    /// Same as gtk_media_stream_stream_prepared().
397    ///
398    /// # Deprecated since 4.4
399    ///
400    /// Use [`stream_prepared()`][Self::stream_prepared()] instead.
401    /// ## `has_audio`
402    /// [`true`] if the stream should advertise audio support
403    /// ## `has_video`
404    /// [`true`] if the stream should advertise video support
405    /// ## `seekable`
406    /// [`true`] if the stream should advertise seekability
407    /// ## `duration`
408    /// The duration of the stream or 0 if unknown
409    #[cfg_attr(feature = "v4_4", deprecated = "Since 4.4")]
410    #[allow(deprecated)]
411    #[doc(alias = "gtk_media_stream_prepared")]
412    fn prepared(&self, has_audio: bool, has_video: bool, seekable: bool, duration: i64) {
413        unsafe {
414            ffi::gtk_media_stream_prepared(
415                self.as_ref().to_glib_none().0,
416                has_audio.into_glib(),
417                has_video.into_glib(),
418                seekable.into_glib(),
419                duration,
420            );
421        }
422    }
423
424    /// Called by users to attach the media stream to a [`gdk::Surface`][crate::gdk::Surface] they manage.
425    ///
426    /// The stream can then access the resources of @surface for its
427    /// rendering purposes. In particular, media streams might want to
428    /// create a [`gdk::GLContext`][crate::gdk::GLContext] or sync to the [`gdk::FrameClock`][crate::gdk::FrameClock].
429    ///
430    /// Whoever calls this function is responsible for calling
431    /// [`unrealize()`][Self::unrealize()] before either the stream
432    /// or @surface get destroyed.
433    ///
434    /// Multiple calls to this function may happen from different
435    /// users of the video, even with the same @surface. Each of these
436    /// calls must be followed by its own call to
437    /// [`unrealize()`][Self::unrealize()].
438    ///
439    /// It is not required to call this function to make a media stream work.
440    /// ## `surface`
441    /// a [`gdk::Surface`][crate::gdk::Surface]
442    #[doc(alias = "gtk_media_stream_realize")]
443    fn realize(&self, surface: &impl IsA<gdk::Surface>) {
444        unsafe {
445            ffi::gtk_media_stream_realize(
446                self.as_ref().to_glib_none().0,
447                surface.as_ref().to_glib_none().0,
448            );
449        }
450    }
451
452    /// Start a seek operation on @self to @timestamp.
453    ///
454    /// If @timestamp is out of range, it will be clamped.
455    ///
456    /// Seek operations may not finish instantly. While a
457    /// seek operation is in process, the [`seeking`][struct@crate::MediaStream#seeking]
458    /// property will be set.
459    ///
460    /// When calling gtk_media_stream_seek() during an
461    /// ongoing seek operation, the new seek will override
462    /// any pending seek.
463    /// ## `timestamp`
464    /// timestamp to seek to.
465    #[doc(alias = "gtk_media_stream_seek")]
466    fn seek(&self, timestamp: i64) {
467        unsafe {
468            ffi::gtk_media_stream_seek(self.as_ref().to_glib_none().0, timestamp);
469        }
470    }
471
472    /// Ends a seek operation started via GtkMediaStream.seek() as a failure.
473    ///
474    /// This will not cause an error on the stream and will assume that
475    /// playback continues as if no seek had happened.
476    ///
477    /// See [`seek_success()`][Self::seek_success()] for the other way of
478    /// ending a seek.
479    #[doc(alias = "gtk_media_stream_seek_failed")]
480    fn seek_failed(&self) {
481        unsafe {
482            ffi::gtk_media_stream_seek_failed(self.as_ref().to_glib_none().0);
483        }
484    }
485
486    /// Ends a seek operation started via GtkMediaStream.seek() successfully.
487    ///
488    /// This function will unset the GtkMediaStream:ended property
489    /// if it was set.
490    ///
491    /// See [`seek_failed()`][Self::seek_failed()] for the other way of
492    /// ending a seek.
493    #[doc(alias = "gtk_media_stream_seek_success")]
494    fn seek_success(&self) {
495        unsafe {
496            ffi::gtk_media_stream_seek_success(self.as_ref().to_glib_none().0);
497        }
498    }
499
500    /// Sets whether the stream should loop.
501    ///
502    /// In this case, it will attempt to restart playback
503    /// from the beginning instead of stopping at the end.
504    ///
505    /// Not all streams may support looping, in particular
506    /// non-seekable streams. Those streams will ignore the
507    /// loop setting and just end.
508    /// ## `loop_`
509    /// [`true`] if the stream should loop
510    #[doc(alias = "gtk_media_stream_set_loop")]
511    #[doc(alias = "loop")]
512    fn set_loop(&self, loop_: bool) {
513        unsafe {
514            ffi::gtk_media_stream_set_loop(self.as_ref().to_glib_none().0, loop_.into_glib());
515        }
516    }
517
518    /// Sets whether the audio stream should be muted.
519    ///
520    /// Muting a stream will cause no audio to be played, but it
521    /// does not modify the volume. This means that muting and
522    /// then unmuting the stream will restore the volume settings.
523    ///
524    /// If the stream has no audio, calling this function will
525    /// still work but it will not have an audible effect.
526    /// ## `muted`
527    /// [`true`] if the stream should be muted
528    #[doc(alias = "gtk_media_stream_set_muted")]
529    #[doc(alias = "muted")]
530    fn set_muted(&self, muted: bool) {
531        unsafe {
532            ffi::gtk_media_stream_set_muted(self.as_ref().to_glib_none().0, muted.into_glib());
533        }
534    }
535
536    /// Starts or pauses playback of the stream.
537    /// ## `playing`
538    /// whether to start or pause playback
539    #[doc(alias = "gtk_media_stream_set_playing")]
540    #[doc(alias = "playing")]
541    fn set_playing(&self, playing: bool) {
542        unsafe {
543            ffi::gtk_media_stream_set_playing(self.as_ref().to_glib_none().0, playing.into_glib());
544        }
545    }
546
547    /// Sets the volume of the audio stream.
548    ///
549    /// This function call will work even if the stream is muted.
550    ///
551    /// The given @volume should range from 0.0 for silence to 1.0
552    /// for as loud as possible. Values outside of this range will
553    /// be clamped to the nearest value.
554    ///
555    /// If the stream has no audio or is muted, calling this function
556    /// will still work but it will not have an immediate audible effect.
557    /// When the stream is unmuted, the new volume setting will take effect.
558    /// ## `volume`
559    /// New volume of the stream from 0.0 to 1.0
560    #[doc(alias = "gtk_media_stream_set_volume")]
561    #[doc(alias = "volume")]
562    fn set_volume(&self, volume: f64) {
563        unsafe {
564            ffi::gtk_media_stream_set_volume(self.as_ref().to_glib_none().0, volume);
565        }
566    }
567
568    /// Pauses the media stream and marks it as ended.
569    ///
570    /// This is a hint only, calls to [`play()`][Self::play()]
571    /// may still happen.
572    ///
573    /// The media stream must be prepared when this function is called.
574    #[cfg(feature = "v4_4")]
575    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
576    #[doc(alias = "gtk_media_stream_stream_ended")]
577    fn stream_ended(&self) {
578        unsafe {
579            ffi::gtk_media_stream_stream_ended(self.as_ref().to_glib_none().0);
580        }
581    }
582
583    /// Called by [`MediaStream`][crate::MediaStream] implementations to advertise the stream
584    /// being ready to play and providing details about the stream.
585    ///
586    /// Note that the arguments are hints. If the stream implementation
587    /// cannot determine the correct values, it is better to err on the
588    /// side of caution and return [`true`]. User interfaces will use those
589    /// values to determine what controls to show.
590    ///
591    /// This function may not be called again until the stream has been
592    /// reset via [`stream_unprepared()`][Self::stream_unprepared()].
593    /// ## `has_audio`
594    /// [`true`] if the stream should advertise audio support
595    /// ## `has_video`
596    /// [`true`] if the stream should advertise video support
597    /// ## `seekable`
598    /// [`true`] if the stream should advertise seekability
599    /// ## `duration`
600    /// The duration of the stream or 0 if unknown
601    #[cfg(feature = "v4_4")]
602    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
603    #[doc(alias = "gtk_media_stream_stream_prepared")]
604    fn stream_prepared(&self, has_audio: bool, has_video: bool, seekable: bool, duration: i64) {
605        unsafe {
606            ffi::gtk_media_stream_stream_prepared(
607                self.as_ref().to_glib_none().0,
608                has_audio.into_glib(),
609                has_video.into_glib(),
610                seekable.into_glib(),
611                duration,
612            );
613        }
614    }
615
616    /// Resets a given media stream implementation.
617    ///
618    /// [`stream_prepared()`][Self::stream_prepared()] can then be called again.
619    ///
620    /// This function will also reset any error state the stream was in.
621    #[cfg(feature = "v4_4")]
622    #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))]
623    #[doc(alias = "gtk_media_stream_stream_unprepared")]
624    fn stream_unprepared(&self) {
625        unsafe {
626            ffi::gtk_media_stream_stream_unprepared(self.as_ref().to_glib_none().0);
627        }
628    }
629
630    /// Same as gtk_media_stream_stream_unprepared().
631    ///
632    /// # Deprecated since 4.4
633    ///
634    /// Use [`stream_unprepared()`][Self::stream_unprepared()] instead.
635    #[cfg_attr(feature = "v4_4", deprecated = "Since 4.4")]
636    #[allow(deprecated)]
637    #[doc(alias = "gtk_media_stream_unprepared")]
638    fn unprepared(&self) {
639        unsafe {
640            ffi::gtk_media_stream_unprepared(self.as_ref().to_glib_none().0);
641        }
642    }
643
644    /// Undoes a previous call to gtk_media_stream_realize().
645    ///
646    /// This causes the stream to release all resources it had
647    /// allocated from @surface.
648    /// ## `surface`
649    /// the [`gdk::Surface`][crate::gdk::Surface] the stream was realized with
650    #[doc(alias = "gtk_media_stream_unrealize")]
651    fn unrealize(&self, surface: &impl IsA<gdk::Surface>) {
652        unsafe {
653            ffi::gtk_media_stream_unrealize(
654                self.as_ref().to_glib_none().0,
655                surface.as_ref().to_glib_none().0,
656            );
657        }
658    }
659
660    /// Media stream implementations should regularly call this
661    /// function to update the timestamp reported by the stream.
662    ///
663    /// It is up to implementations to call this at the frequency
664    /// they deem appropriate.
665    ///
666    /// The media stream must be prepared when this function is called.
667    /// ## `timestamp`
668    /// the new timestamp
669    #[doc(alias = "gtk_media_stream_update")]
670    fn update(&self, timestamp: i64) {
671        unsafe {
672            ffi::gtk_media_stream_update(self.as_ref().to_glib_none().0, timestamp);
673        }
674    }
675
676    /// Whether the stream has finished initializing and existence of
677    /// audio and video is known.
678    fn set_prepared(&self, prepared: bool) {
679        ObjectExt::set_property(self.as_ref(), "prepared", prepared)
680    }
681
682    #[doc(alias = "duration")]
683    fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
684        unsafe extern "C" fn notify_duration_trampoline<
685            P: IsA<MediaStream>,
686            F: Fn(&P) + 'static,
687        >(
688            this: *mut ffi::GtkMediaStream,
689            _param_spec: glib::ffi::gpointer,
690            f: glib::ffi::gpointer,
691        ) {
692            let f: &F = &*(f as *const F);
693            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
694        }
695        unsafe {
696            let f: Box_<F> = Box_::new(f);
697            connect_raw(
698                self.as_ptr() as *mut _,
699                c"notify::duration".as_ptr() as *const _,
700                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
701                    notify_duration_trampoline::<Self, F> as *const (),
702                )),
703                Box_::into_raw(f),
704            )
705        }
706    }
707
708    #[doc(alias = "ended")]
709    fn connect_ended_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
710        unsafe extern "C" fn notify_ended_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
711            this: *mut ffi::GtkMediaStream,
712            _param_spec: glib::ffi::gpointer,
713            f: glib::ffi::gpointer,
714        ) {
715            let f: &F = &*(f as *const F);
716            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
717        }
718        unsafe {
719            let f: Box_<F> = Box_::new(f);
720            connect_raw(
721                self.as_ptr() as *mut _,
722                c"notify::ended".as_ptr() as *const _,
723                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
724                    notify_ended_trampoline::<Self, F> as *const (),
725                )),
726                Box_::into_raw(f),
727            )
728        }
729    }
730
731    #[doc(alias = "error")]
732    fn connect_error_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
733        unsafe extern "C" fn notify_error_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
734            this: *mut ffi::GtkMediaStream,
735            _param_spec: glib::ffi::gpointer,
736            f: glib::ffi::gpointer,
737        ) {
738            let f: &F = &*(f as *const F);
739            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
740        }
741        unsafe {
742            let f: Box_<F> = Box_::new(f);
743            connect_raw(
744                self.as_ptr() as *mut _,
745                c"notify::error".as_ptr() as *const _,
746                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
747                    notify_error_trampoline::<Self, F> as *const (),
748                )),
749                Box_::into_raw(f),
750            )
751        }
752    }
753
754    #[doc(alias = "has-audio")]
755    fn connect_has_audio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
756        unsafe extern "C" fn notify_has_audio_trampoline<
757            P: IsA<MediaStream>,
758            F: Fn(&P) + 'static,
759        >(
760            this: *mut ffi::GtkMediaStream,
761            _param_spec: glib::ffi::gpointer,
762            f: glib::ffi::gpointer,
763        ) {
764            let f: &F = &*(f as *const F);
765            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
766        }
767        unsafe {
768            let f: Box_<F> = Box_::new(f);
769            connect_raw(
770                self.as_ptr() as *mut _,
771                c"notify::has-audio".as_ptr() as *const _,
772                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
773                    notify_has_audio_trampoline::<Self, F> as *const (),
774                )),
775                Box_::into_raw(f),
776            )
777        }
778    }
779
780    #[doc(alias = "has-video")]
781    fn connect_has_video_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
782        unsafe extern "C" fn notify_has_video_trampoline<
783            P: IsA<MediaStream>,
784            F: Fn(&P) + 'static,
785        >(
786            this: *mut ffi::GtkMediaStream,
787            _param_spec: glib::ffi::gpointer,
788            f: glib::ffi::gpointer,
789        ) {
790            let f: &F = &*(f as *const F);
791            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
792        }
793        unsafe {
794            let f: Box_<F> = Box_::new(f);
795            connect_raw(
796                self.as_ptr() as *mut _,
797                c"notify::has-video".as_ptr() as *const _,
798                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
799                    notify_has_video_trampoline::<Self, F> as *const (),
800                )),
801                Box_::into_raw(f),
802            )
803        }
804    }
805
806    #[doc(alias = "loop")]
807    fn connect_loop_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
808        unsafe extern "C" fn notify_loop_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
809            this: *mut ffi::GtkMediaStream,
810            _param_spec: glib::ffi::gpointer,
811            f: glib::ffi::gpointer,
812        ) {
813            let f: &F = &*(f as *const F);
814            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
815        }
816        unsafe {
817            let f: Box_<F> = Box_::new(f);
818            connect_raw(
819                self.as_ptr() as *mut _,
820                c"notify::loop".as_ptr() as *const _,
821                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
822                    notify_loop_trampoline::<Self, F> as *const (),
823                )),
824                Box_::into_raw(f),
825            )
826        }
827    }
828
829    #[doc(alias = "muted")]
830    fn connect_muted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
831        unsafe extern "C" fn notify_muted_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
832            this: *mut ffi::GtkMediaStream,
833            _param_spec: glib::ffi::gpointer,
834            f: glib::ffi::gpointer,
835        ) {
836            let f: &F = &*(f as *const F);
837            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
838        }
839        unsafe {
840            let f: Box_<F> = Box_::new(f);
841            connect_raw(
842                self.as_ptr() as *mut _,
843                c"notify::muted".as_ptr() as *const _,
844                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
845                    notify_muted_trampoline::<Self, F> as *const (),
846                )),
847                Box_::into_raw(f),
848            )
849        }
850    }
851
852    #[doc(alias = "playing")]
853    fn connect_playing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
854        unsafe extern "C" fn notify_playing_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
855            this: *mut ffi::GtkMediaStream,
856            _param_spec: glib::ffi::gpointer,
857            f: glib::ffi::gpointer,
858        ) {
859            let f: &F = &*(f as *const F);
860            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
861        }
862        unsafe {
863            let f: Box_<F> = Box_::new(f);
864            connect_raw(
865                self.as_ptr() as *mut _,
866                c"notify::playing".as_ptr() as *const _,
867                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
868                    notify_playing_trampoline::<Self, F> as *const (),
869                )),
870                Box_::into_raw(f),
871            )
872        }
873    }
874
875    #[doc(alias = "prepared")]
876    fn connect_prepared_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
877        unsafe extern "C" fn notify_prepared_trampoline<
878            P: IsA<MediaStream>,
879            F: Fn(&P) + 'static,
880        >(
881            this: *mut ffi::GtkMediaStream,
882            _param_spec: glib::ffi::gpointer,
883            f: glib::ffi::gpointer,
884        ) {
885            let f: &F = &*(f as *const F);
886            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
887        }
888        unsafe {
889            let f: Box_<F> = Box_::new(f);
890            connect_raw(
891                self.as_ptr() as *mut _,
892                c"notify::prepared".as_ptr() as *const _,
893                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
894                    notify_prepared_trampoline::<Self, F> as *const (),
895                )),
896                Box_::into_raw(f),
897            )
898        }
899    }
900
901    #[doc(alias = "seekable")]
902    fn connect_seekable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
903        unsafe extern "C" fn notify_seekable_trampoline<
904            P: IsA<MediaStream>,
905            F: Fn(&P) + 'static,
906        >(
907            this: *mut ffi::GtkMediaStream,
908            _param_spec: glib::ffi::gpointer,
909            f: glib::ffi::gpointer,
910        ) {
911            let f: &F = &*(f as *const F);
912            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
913        }
914        unsafe {
915            let f: Box_<F> = Box_::new(f);
916            connect_raw(
917                self.as_ptr() as *mut _,
918                c"notify::seekable".as_ptr() as *const _,
919                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
920                    notify_seekable_trampoline::<Self, F> as *const (),
921                )),
922                Box_::into_raw(f),
923            )
924        }
925    }
926
927    #[doc(alias = "seeking")]
928    fn connect_seeking_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
929        unsafe extern "C" fn notify_seeking_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
930            this: *mut ffi::GtkMediaStream,
931            _param_spec: glib::ffi::gpointer,
932            f: glib::ffi::gpointer,
933        ) {
934            let f: &F = &*(f as *const F);
935            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
936        }
937        unsafe {
938            let f: Box_<F> = Box_::new(f);
939            connect_raw(
940                self.as_ptr() as *mut _,
941                c"notify::seeking".as_ptr() as *const _,
942                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
943                    notify_seeking_trampoline::<Self, F> as *const (),
944                )),
945                Box_::into_raw(f),
946            )
947        }
948    }
949
950    #[doc(alias = "timestamp")]
951    fn connect_timestamp_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
952        unsafe extern "C" fn notify_timestamp_trampoline<
953            P: IsA<MediaStream>,
954            F: Fn(&P) + 'static,
955        >(
956            this: *mut ffi::GtkMediaStream,
957            _param_spec: glib::ffi::gpointer,
958            f: glib::ffi::gpointer,
959        ) {
960            let f: &F = &*(f as *const F);
961            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
962        }
963        unsafe {
964            let f: Box_<F> = Box_::new(f);
965            connect_raw(
966                self.as_ptr() as *mut _,
967                c"notify::timestamp".as_ptr() as *const _,
968                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
969                    notify_timestamp_trampoline::<Self, F> as *const (),
970                )),
971                Box_::into_raw(f),
972            )
973        }
974    }
975
976    #[doc(alias = "volume")]
977    fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
978        unsafe extern "C" fn notify_volume_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
979            this: *mut ffi::GtkMediaStream,
980            _param_spec: glib::ffi::gpointer,
981            f: glib::ffi::gpointer,
982        ) {
983            let f: &F = &*(f as *const F);
984            f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
985        }
986        unsafe {
987            let f: Box_<F> = Box_::new(f);
988            connect_raw(
989                self.as_ptr() as *mut _,
990                c"notify::volume".as_ptr() as *const _,
991                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
992                    notify_volume_trampoline::<Self, F> as *const (),
993                )),
994                Box_::into_raw(f),
995            )
996        }
997    }
998}
999
1000impl<O: IsA<MediaStream>> MediaStreamExt for O {}