gtk4::subclass::media_stream

Trait MediaStreamImpl

Source
pub trait MediaStreamImpl: MediaStreamImplExt + ObjectImpl {
    // Provided methods
    fn pause(&self) { ... }
    fn play(&self) -> bool { ... }
    fn realize(&self, surface: Surface) { ... }
    fn seek(&self, timestamp: i64) { ... }
    fn unrealize(&self, surface: Surface) { ... }
    fn update_audio(&self, muted: bool, volume: f64) { ... }
}

Provided Methods§

Source

fn pause(&self)

Pauses playback of the stream.

If the stream is not playing, do nothing.

Source

fn play(&self) -> bool

Source

fn realize(&self, surface: Surface)

Called by users to attach the media stream to a gdk::Surface they manage.

The stream can then access the resources of @surface for its rendering purposes. In particular, media streams might want to create a gdk::GLContext or sync to the gdk::FrameClock.

Whoever calls this function is responsible for calling MediaStreamExt::unrealize() before either the stream or @surface get destroyed.

Multiple calls to this function may happen from different users of the video, even with the same @surface. Each of these calls must be followed by its own call to MediaStreamExt::unrealize().

It is not required to call this function to make a media stream work.

§surface

a gdk::Surface

Source

fn seek(&self, timestamp: i64)

Start a seek operation on @self to @timestamp.

If @timestamp is out of range, it will be clamped.

Seek operations may not finish instantly. While a seek operation is in process, the seeking property will be set.

When calling gtk_media_stream_seek() during an ongoing seek operation, the new seek will override any pending seek.

§timestamp

timestamp to seek to.

Source

fn unrealize(&self, surface: Surface)

Undoes a previous call to gtk_media_stream_realize().

This causes the stream to release all resources it had allocated from @surface.

§surface

the gdk::Surface the stream was realized with

Source

fn update_audio(&self, muted: bool, volume: f64)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§