1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, MediaStream};
use glib::translate::*;

pub trait MediaStreamExtManual: 'static {
    /// Sets @self into an error state.
    ///
    /// This will pause the stream (you can check for an error
    /// via [`MediaStreamExt::error()`][crate::prelude::MediaStreamExt::error()] in your
    /// GtkMediaStream.pause() implementation), abort pending
    /// seeks and mark the stream as prepared.
    ///
    /// if the stream is already in an error state, this call
    /// will be ignored and the existing error will be retained.
    ///
    /// To unset an error, the stream must be reset via a call to
    /// [`MediaStreamExt::unprepared()`][crate::prelude::MediaStreamExt::unprepared()].
    /// ## `error`
    /// the `GError` to set
    #[doc(alias = "gtk_media_stream_gerror")]
    #[doc(alias = "gtk_media_stream_error")]
    #[doc(alias = "gerror")]
    fn set_error(&self, error: glib::Error);
}

impl<O: IsA<MediaStream>> MediaStreamExtManual for O {
    fn set_error(&self, error: glib::Error) {
        unsafe {
            ffi::gtk_media_stream_gerror(
                self.as_ref().to_glib_none().0,
                mut_override(error.into_glib_ptr()),
            );
        }
    }
}