Skip to main content

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::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// 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
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    #[doc(alias = "duration")]
677    fn connect_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
678        unsafe extern "C" fn notify_duration_trampoline<
679            P: IsA<MediaStream>,
680            F: Fn(&P) + 'static,
681        >(
682            this: *mut ffi::GtkMediaStream,
683            _param_spec: glib::ffi::gpointer,
684            f: glib::ffi::gpointer,
685        ) {
686            unsafe {
687                let f: &F = &*(f as *const F);
688                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
689            }
690        }
691        unsafe {
692            let f: Box_<F> = Box_::new(f);
693            connect_raw(
694                self.as_ptr() as *mut _,
695                c"notify::duration".as_ptr() as *const _,
696                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
697                    notify_duration_trampoline::<Self, F> as *const (),
698                )),
699                Box_::into_raw(f),
700            )
701        }
702    }
703
704    #[doc(alias = "ended")]
705    fn connect_ended_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
706        unsafe extern "C" fn notify_ended_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
707            this: *mut ffi::GtkMediaStream,
708            _param_spec: glib::ffi::gpointer,
709            f: glib::ffi::gpointer,
710        ) {
711            unsafe {
712                let f: &F = &*(f as *const F);
713                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
714            }
715        }
716        unsafe {
717            let f: Box_<F> = Box_::new(f);
718            connect_raw(
719                self.as_ptr() as *mut _,
720                c"notify::ended".as_ptr() as *const _,
721                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
722                    notify_ended_trampoline::<Self, F> as *const (),
723                )),
724                Box_::into_raw(f),
725            )
726        }
727    }
728
729    #[doc(alias = "error")]
730    fn connect_error_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
731        unsafe extern "C" fn notify_error_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
732            this: *mut ffi::GtkMediaStream,
733            _param_spec: glib::ffi::gpointer,
734            f: glib::ffi::gpointer,
735        ) {
736            unsafe {
737                let f: &F = &*(f as *const F);
738                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
739            }
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            unsafe {
765                let f: &F = &*(f as *const F);
766                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
767            }
768        }
769        unsafe {
770            let f: Box_<F> = Box_::new(f);
771            connect_raw(
772                self.as_ptr() as *mut _,
773                c"notify::has-audio".as_ptr() as *const _,
774                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
775                    notify_has_audio_trampoline::<Self, F> as *const (),
776                )),
777                Box_::into_raw(f),
778            )
779        }
780    }
781
782    #[doc(alias = "has-video")]
783    fn connect_has_video_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
784        unsafe extern "C" fn notify_has_video_trampoline<
785            P: IsA<MediaStream>,
786            F: Fn(&P) + 'static,
787        >(
788            this: *mut ffi::GtkMediaStream,
789            _param_spec: glib::ffi::gpointer,
790            f: glib::ffi::gpointer,
791        ) {
792            unsafe {
793                let f: &F = &*(f as *const F);
794                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
795            }
796        }
797        unsafe {
798            let f: Box_<F> = Box_::new(f);
799            connect_raw(
800                self.as_ptr() as *mut _,
801                c"notify::has-video".as_ptr() as *const _,
802                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
803                    notify_has_video_trampoline::<Self, F> as *const (),
804                )),
805                Box_::into_raw(f),
806            )
807        }
808    }
809
810    #[doc(alias = "loop")]
811    fn connect_loop_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
812        unsafe extern "C" fn notify_loop_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
813            this: *mut ffi::GtkMediaStream,
814            _param_spec: glib::ffi::gpointer,
815            f: glib::ffi::gpointer,
816        ) {
817            unsafe {
818                let f: &F = &*(f as *const F);
819                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
820            }
821        }
822        unsafe {
823            let f: Box_<F> = Box_::new(f);
824            connect_raw(
825                self.as_ptr() as *mut _,
826                c"notify::loop".as_ptr() as *const _,
827                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
828                    notify_loop_trampoline::<Self, F> as *const (),
829                )),
830                Box_::into_raw(f),
831            )
832        }
833    }
834
835    #[doc(alias = "muted")]
836    fn connect_muted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
837        unsafe extern "C" fn notify_muted_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
838            this: *mut ffi::GtkMediaStream,
839            _param_spec: glib::ffi::gpointer,
840            f: glib::ffi::gpointer,
841        ) {
842            unsafe {
843                let f: &F = &*(f as *const F);
844                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
845            }
846        }
847        unsafe {
848            let f: Box_<F> = Box_::new(f);
849            connect_raw(
850                self.as_ptr() as *mut _,
851                c"notify::muted".as_ptr() as *const _,
852                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
853                    notify_muted_trampoline::<Self, F> as *const (),
854                )),
855                Box_::into_raw(f),
856            )
857        }
858    }
859
860    #[doc(alias = "playing")]
861    fn connect_playing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
862        unsafe extern "C" fn notify_playing_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
863            this: *mut ffi::GtkMediaStream,
864            _param_spec: glib::ffi::gpointer,
865            f: glib::ffi::gpointer,
866        ) {
867            unsafe {
868                let f: &F = &*(f as *const F);
869                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
870            }
871        }
872        unsafe {
873            let f: Box_<F> = Box_::new(f);
874            connect_raw(
875                self.as_ptr() as *mut _,
876                c"notify::playing".as_ptr() as *const _,
877                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
878                    notify_playing_trampoline::<Self, F> as *const (),
879                )),
880                Box_::into_raw(f),
881            )
882        }
883    }
884
885    #[doc(alias = "prepared")]
886    fn connect_prepared_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
887        unsafe extern "C" fn notify_prepared_trampoline<
888            P: IsA<MediaStream>,
889            F: Fn(&P) + 'static,
890        >(
891            this: *mut ffi::GtkMediaStream,
892            _param_spec: glib::ffi::gpointer,
893            f: glib::ffi::gpointer,
894        ) {
895            unsafe {
896                let f: &F = &*(f as *const F);
897                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
898            }
899        }
900        unsafe {
901            let f: Box_<F> = Box_::new(f);
902            connect_raw(
903                self.as_ptr() as *mut _,
904                c"notify::prepared".as_ptr() as *const _,
905                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
906                    notify_prepared_trampoline::<Self, F> as *const (),
907                )),
908                Box_::into_raw(f),
909            )
910        }
911    }
912
913    #[doc(alias = "seekable")]
914    fn connect_seekable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
915        unsafe extern "C" fn notify_seekable_trampoline<
916            P: IsA<MediaStream>,
917            F: Fn(&P) + 'static,
918        >(
919            this: *mut ffi::GtkMediaStream,
920            _param_spec: glib::ffi::gpointer,
921            f: glib::ffi::gpointer,
922        ) {
923            unsafe {
924                let f: &F = &*(f as *const F);
925                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
926            }
927        }
928        unsafe {
929            let f: Box_<F> = Box_::new(f);
930            connect_raw(
931                self.as_ptr() as *mut _,
932                c"notify::seekable".as_ptr() as *const _,
933                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
934                    notify_seekable_trampoline::<Self, F> as *const (),
935                )),
936                Box_::into_raw(f),
937            )
938        }
939    }
940
941    #[doc(alias = "seeking")]
942    fn connect_seeking_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
943        unsafe extern "C" fn notify_seeking_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
944            this: *mut ffi::GtkMediaStream,
945            _param_spec: glib::ffi::gpointer,
946            f: glib::ffi::gpointer,
947        ) {
948            unsafe {
949                let f: &F = &*(f as *const F);
950                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
951            }
952        }
953        unsafe {
954            let f: Box_<F> = Box_::new(f);
955            connect_raw(
956                self.as_ptr() as *mut _,
957                c"notify::seeking".as_ptr() as *const _,
958                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
959                    notify_seeking_trampoline::<Self, F> as *const (),
960                )),
961                Box_::into_raw(f),
962            )
963        }
964    }
965
966    #[doc(alias = "timestamp")]
967    fn connect_timestamp_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
968        unsafe extern "C" fn notify_timestamp_trampoline<
969            P: IsA<MediaStream>,
970            F: Fn(&P) + 'static,
971        >(
972            this: *mut ffi::GtkMediaStream,
973            _param_spec: glib::ffi::gpointer,
974            f: glib::ffi::gpointer,
975        ) {
976            unsafe {
977                let f: &F = &*(f as *const F);
978                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
979            }
980        }
981        unsafe {
982            let f: Box_<F> = Box_::new(f);
983            connect_raw(
984                self.as_ptr() as *mut _,
985                c"notify::timestamp".as_ptr() as *const _,
986                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
987                    notify_timestamp_trampoline::<Self, F> as *const (),
988                )),
989                Box_::into_raw(f),
990            )
991        }
992    }
993
994    #[doc(alias = "volume")]
995    fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
996        unsafe extern "C" fn notify_volume_trampoline<P: IsA<MediaStream>, F: Fn(&P) + 'static>(
997            this: *mut ffi::GtkMediaStream,
998            _param_spec: glib::ffi::gpointer,
999            f: glib::ffi::gpointer,
1000        ) {
1001            unsafe {
1002                let f: &F = &*(f as *const F);
1003                f(MediaStream::from_glib_borrow(this).unsafe_cast_ref())
1004            }
1005        }
1006        unsafe {
1007            let f: Box_<F> = Box_::new(f);
1008            connect_raw(
1009                self.as_ptr() as *mut _,
1010                c"notify::volume".as_ptr() as *const _,
1011                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1012                    notify_volume_trampoline::<Self, F> as *const (),
1013                )),
1014                Box_::into_raw(f),
1015            )
1016        }
1017    }
1018}
1019
1020impl<O: IsA<MediaStream>> MediaStreamExt for O {}