gtkmm: Gtk::MediaStream Class Reference

gtkmm 4.23.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::MediaStream Class Reference

Display media in GTK. More...

`#include <gtkmm/mediastream.h>`

Inheritance diagram for Gtk::MediaStream:
[legend]

## Public Member Functions
| MediaStream (MediaStream && src) noexcept
MediaStream & | operator= (MediaStream && src) noexcept
| ~MediaStream () noexcept override
GtkMediaStream * | gobj ()
| Provides access to the underlying C GObject.
const GtkMediaStream * | gobj () const
| Provides access to the underlying C GObject.
GtkMediaStream * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool | is_prepared () const
| Returns whether the stream has finished initializing.
Glib::Error | get_error () const
| If the stream is in an error state, returns the Glib::Error explaining that state.
bool | has_audio () const
| Returns whether the stream has audio.
bool | has_video () const
| Returns whether the stream has video.
void | play ()
| Starts playing the stream.
void | pause ()
| Pauses playback of the stream.
bool | get_playing () const
| Return whether the stream is currently playing.
void | set_playing (bool playing=true)
| Starts or pauses playback of the stream.
bool | get_ended () const
| Returns whether the streams playback is finished.
gint64 | get_timestamp () const
| Returns the current presentation timestamp in microseconds.
gint64 | get_duration () const
| Gets the duration of the stream.
bool | is_seekable () const
| Checks if a stream may be seekable.
bool | is_seeking () const
| Checks if there is currently a seek operation going on.
void | seek (gint64 timestamp)
| Start a seek operation on self to timestamp.
bool | get_loop () const
| Returns whether the stream is set to loop.
void | set_loop (bool loop=true)
| Sets whether the stream should loop.
bool | get_muted () const
| Returns whether the audio for the stream is muted.
void | set_muted (bool muted=true)
| Sets whether the audio stream should be muted.
double | get_volume () const
| Returns the volume of the audio for the stream.
void | set_volume (double volume)
| Sets the volume of the audio stream.
void | realize (const Glib::RefPtr< Gdk::Surface > & surface)
| Called by users to attach the media stream to a Gdk::Surface they manage.
void | unrealize (const Glib::RefPtr< Gdk::Surface > & surface)
| Undoes a previous call to realize().
void | prepared (bool has_audio, bool has_video, bool seekable, gint64 duration)
| Same as stream_prepared().
void | unprepared ()
| Same as stream_unprepared().
void | stream_prepared (bool has_audio, bool has_video, bool seekable, gint64 duration)
| Called by Gtk::MediaStream implementations to advertise the stream being ready to play and providing details about the stream.
void | stream_unprepared ()
| Resets a given media stream implementation.
void | update (gint64 timestamp)
| Media stream implementations should regularly call this function to update the timestamp reported by the stream.
void | ended ()
| Pauses the media stream and marks it as ended.
void | stream_ended ()
| Pauses the media stream and marks it as ended.
void | seek_success ()
| Ends a seek operation started via GtkMediaStream.seek() successfully.
void | seek_failed ()
| Ends a seek operation started via GtkMediaStream.seek() as a failure.
void | set_error (const Glib::Error & error)
| Sets self into an error state.
Glib::PropertyProxy_ReadOnly< bool > | property_prepared () const
| Whether the stream has finished initializing and existence of audio and video is known.
Glib::PropertyProxy_ReadOnly< Glib::Error > | property_error () const
| nullptr for a properly working stream or the Glib::Error that the stream is in.
Glib::PropertyProxy_ReadOnly< bool > | property_has_audio () const
| Whether the stream contains audio.
Glib::PropertyProxy_ReadOnly< bool > | property_has_video () const
| Whether the stream contains video.
Glib::PropertyProxy< bool > | property_playing ()
| Whether the stream is currently playing.
Glib::PropertyProxy_ReadOnly< bool > | property_playing () const
| Whether the stream is currently playing.
Glib::PropertyProxy_ReadOnly< bool > | property_ended () const
| Set when playback has finished.
Glib::PropertyProxy_ReadOnly< gint64 > | property_timestamp () const
| The current presentation timestamp in microseconds.
Glib::PropertyProxy_ReadOnly< gint64 > | property_duration () const
| The stream's duration in microseconds or 0 if unknown.
Glib::PropertyProxy_ReadOnly< bool > | property_seekable () const
| Set unless the stream is known to not support seeking.
Glib::PropertyProxy_ReadOnly< bool > | property_seeking () const
| Set while a seek is in progress.
Glib::PropertyProxy< bool > | property_loop ()
| Try to restart the media from the beginning once it ended.
Glib::PropertyProxy_ReadOnly< bool > | property_loop () const
| Try to restart the media from the beginning once it ended.
Glib::PropertyProxy< bool > | property_muted ()
| Whether the audio stream should be muted.
Glib::PropertyProxy_ReadOnly< bool > | property_muted () const
| Whether the audio stream should be muted.
Glib::PropertyProxy< double > | property_volume ()
| Volume of the audio stream.
Glib::PropertyProxy_ReadOnly< double > | property_volume () const
| Volume of the audio stream.
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data_with_c_callback (const Quark &key, void *data, GDestroyNotify notify)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const
Public Member Functions inherited from Gdk::Paintable
| Paintable (Paintable && src) noexcept
Paintable & | operator= (Paintable && src) noexcept
| ~Paintable () noexcept override
GdkPaintable * | gobj ()
| Provides access to the underlying C GObject.
const GdkPaintable * | gobj () const
| Provides access to the underlying C GObject.
void | snapshot (const Glib::RefPtr< Gdk::Snapshot > & snapshot, double width, double height)
| Snapshots the given paintable with the given width and height.
Glib::RefPtr< const Paintable > | get_current_image () const
| Gets an immutable paintable for the current contents displayed by paintable.
Flags | get_flags () const
| Get flags for the paintable.
int | get_intrinsic_width () const
| Gets the preferred width the paintable would like to be displayed at.
int | get_intrinsic_height () const
| Gets the preferred height the paintable would like to be displayed at.
double | get_intrinsic_aspect_ratio () const
| Gets the preferred aspect ratio the paintable would like to be displayed at.
void | compute_concrete_size (double specified_width, double specified_height, double default_width, double default_height, double & concrete_width, double & concrete_height) const
| Compute a concrete size for the Gdk::Paintable.
void | invalidate_contents ()
| Called by implementations of Gdk::Paintable to invalidate their contents.
void | invalidate_size ()
| Called by implementations of Gdk::Paintable to invalidate their size.
Glib::SignalProxy< void()> | signal_invalidate_contents ()
Glib::SignalProxy< void()> | signal_invalidate_size ()
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
Static Public Member Functions inherited from Gdk::Paintable
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Member Functions
virtual bool | play_vfunc ()
virtual void | pause_vfunc ()
virtual void | seek_vfunc (gint64 timestamp)
virtual void | update_audio_vfunc (bool muted, double volume)
virtual void | realize_vfunc (const Glib::RefPtr< Gdk::Surface > & surface)
virtual void | unrealize_vfunc (const Glib::RefPtr< Gdk::Surface > & surface)
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
Protected Member Functions inherited from Gdk::Paintable
| Paintable ()
| You should derive from this class to use it.
virtual void | snapshot_vfunc (const Glib::RefPtr< Gdk::Snapshot > &snapshot, double width, double height)
virtual Glib::RefPtr< Paintable > | get_current_image_vfunc () const
virtual Flags | get_flags_vfunc () const
virtual int | get_intrinsic_width_vfunc () const
virtual int | get_intrinsic_height_vfunc () const
virtual double | get_intrinsic_aspect_ratio_vfunc () const

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gtk::MediaStream > | wrap (GtkMediaStream * object, bool take_copy=false)
| A Glib::wrap() method for this object.
Related Symbols inherited from Gdk::Paintable
Glib::RefPtr< Gdk::Paintable > | wrap (GdkPaintable * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from Gdk::Paintable
enum class | Flags { Flags::STATIC_SIZE = 1 << 0 , Flags::STATIC_CONTENTS = 1 << 1 }
| Flags about a paintable object. More...

## Detailed Description

Display media in GTK.

MediaStream is the integration point for media playback inside GTK.

Apart from application-facing API for stream playback, MediaStream has a number of APIs that are only useful for implementations and should not be used in applications: prepared(), unprepared(), update(), ended(), seek_success(), seek_failed(), set_error().

See also
  Gdk::Paintable

Since gtkmm 3.94

## Constructor & Destructor Documentation

## ◆ MediaStream()

Gtk::MediaStream::MediaStream | ( | MediaStream && | src | ) |
| noexcept

## ◆ ~MediaStream()

Gtk::MediaStream::~MediaStream | ( |  | ) |
| overridenoexcept

## Member Function Documentation

## ◆ ended()

void Gtk::MediaStream::ended | ( |  | ) |

Pauses the media stream and marks it as ended.

This is a hint only, calls to play() may still happen.

The media stream must be prepared when this function is called.

Deprecated: 4.4: Use stream_ended() instead

Deprecated
  Use stream_ended() instead.

## ◆ get_duration()

gint64 Gtk::MediaStream::get_duration | ( |  | ) | const

Gets the duration of the stream.

If the duration is not known, 0 will be returned.

Returns
  The duration of the stream or 0 if not known.

## ◆ get_ended()

bool Gtk::MediaStream::get_ended | ( |  | ) | const

Returns whether the streams playback is finished.

Returns
  true if playback is finished.

## ◆ get_error()

Glib::Error Gtk::MediaStream::get_error | ( |  | ) | const

If the stream is in an error state, returns the Glib::Error explaining that state.

Any type of error can be reported here depending on the implementation of the media stream.

A media stream in an error cannot be operated on, calls like play() or seek() will not have any effect.

Gtk::MediaStream itself does not provide a way to unset an error, but implementations may provide options. For example, a Gtk::MediaFile will unset errors when a new source is set, e.g. with Gtk::MediaFile::set_file().

Returns
  nullptr if not in an error state or the Glib::Error of the stream.

## ◆ get_loop()

bool Gtk::MediaStream::get_loop | ( |  | ) | const

Returns whether the stream is set to loop.

See set_loop() for details.

Returns
  true if the stream should loop.

## ◆ get_muted()

bool Gtk::MediaStream::get_muted | ( |  | ) | const

Returns whether the audio for the stream is muted.

See set_muted() for details.

Returns
  true if the stream is muted.

## ◆ get_playing()

bool Gtk::MediaStream::get_playing | ( |  | ) | const

Return whether the stream is currently playing.

Returns
  true if the stream is playing.

## ◆ get_timestamp()

gint64 Gtk::MediaStream::get_timestamp | ( |  | ) | const

Returns the current presentation timestamp in microseconds.

Returns
  The timestamp in microseconds.

## ◆ get_type()

GType Gtk::MediaStream::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_volume()

double Gtk::MediaStream::get_volume | ( |  | ) | const

Returns the volume of the audio for the stream.

See set_volume() for details.

Returns
  Volume of the stream from 0.0 to 1.0.

## ◆ gobj() [1/2]

GtkMediaStream * Gtk::MediaStream::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkMediaStream * Gtk::MediaStream::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkMediaStream * Gtk::MediaStream::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ has_audio()

bool Gtk::MediaStream::has_audio | ( |  | ) | const

Returns whether the stream has audio.

Returns
  true if the stream has audio.

## ◆ has_video()

bool Gtk::MediaStream::has_video | ( |  | ) | const

Returns whether the stream has video.

Returns
  true if the stream has video.

## ◆ is_prepared()

bool Gtk::MediaStream::is_prepared | ( |  | ) | const

Returns whether the stream has finished initializing.

At this point the existence of audio and video is known.

Returns
  true if the stream is prepared.

## ◆ is_seekable()

bool Gtk::MediaStream::is_seekable | ( |  | ) | const

Checks if a stream may be seekable.

This is meant to be a hint. Streams may not allow seeking even if this function returns true. However, if this function returns false, streams are guaranteed to not be seekable and user interfaces may hide controls that allow seeking.

It is allowed to call seek() on a non-seekable stream, though it will not do anything.

Returns
  true if the stream may support seeking.

## ◆ is_seeking()

bool Gtk::MediaStream::is_seeking | ( |  | ) | const

Checks if there is currently a seek operation going on.

Returns
  true if a seek operation is ongoing.

## ◆ operator=()

MediaStream & Gtk::MediaStream::operator= | ( | MediaStream && | src | ) |
| noexcept

## ◆ pause()

void Gtk::MediaStream::pause | ( |  | ) |

Pauses playback of the stream.

If the stream is not playing, do nothing.

## ◆ pause_vfunc()

virtual void Gtk::MediaStream::pause_vfunc | ( |  | ) |
| protectedvirtual

## ◆ play()

void Gtk::MediaStream::play | ( |  | ) |

Starts playing the stream.

If the stream is in error or already playing, do nothing.

## ◆ play_vfunc()

virtual bool Gtk::MediaStream::play_vfunc | ( |  | ) |
| protectedvirtual

## ◆ prepared()

void Gtk::MediaStream::prepared | ( | bool | has_audio,
|  | bool | has_video,
|  | bool | seekable,
|  | gint64 | duration )

Same as stream_prepared().

Deprecated: 4.4: Use stream_prepared() instead.

Deprecated
  Use stream_prepared() instead.

Parameters

  has_audio | true if the stream should advertise audio support.
  has_video | true if the stream should advertise video support.
  seekable | true if the stream should advertise seekability.
  duration | The duration of the stream or 0 if unknown.

## ◆ property_duration()

Glib::PropertyProxy_ReadOnly< gint64 > Gtk::MediaStream::property_duration | ( |  | ) | const

The stream's duration in microseconds or 0 if unknown.

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_ended()

Glib::PropertyProxy_ReadOnly< bool > Gtk::MediaStream::property_ended | ( |  | ) | const

Set when playback has finished.

Default value: false

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_error()

Glib::PropertyProxy_ReadOnly< Glib::Error > Gtk::MediaStream::property_error | ( |  | ) | const

nullptr for a properly working stream or the Glib::Error that the stream is in.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_has_audio()

Glib::PropertyProxy_ReadOnly< bool > Gtk::MediaStream::property_has_audio | ( |  | ) | const

Whether the stream contains audio.

Default value: false

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_has_video()

Glib::PropertyProxy_ReadOnly< bool > Gtk::MediaStream::property_has_video | ( |  | ) | const

Whether the stream contains video.

Default value: false

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_loop() [1/2]

Glib::PropertyProxy< bool > Gtk::MediaStream::property_loop | ( |  | ) |

Try to restart the media from the beginning once it ended.

Default value: false

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_loop() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::MediaStream::property_loop | ( |  | ) | const

Try to restart the media from the beginning once it ended.

Default value: false

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_muted() [1/2]

Glib::PropertyProxy< bool > Gtk::MediaStream::property_muted | ( |  | ) |

Whether the audio stream should be muted.

Default value: false

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_muted() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::MediaStream::property_muted | ( |  | ) | const

Whether the audio stream should be muted.

Default value: false

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_playing() [1/2]

Glib::PropertyProxy< bool > Gtk::MediaStream::property_playing | ( |  | ) |

Whether the stream is currently playing.

Default value: false

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_playing() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::MediaStream::property_playing | ( |  | ) | const

Whether the stream is currently playing.

Default value: false

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_prepared()

Glib::PropertyProxy_ReadOnly< bool > Gtk::MediaStream::property_prepared | ( |  | ) | const

Whether the stream has finished initializing and existence of audio and video is known.

Default value: false

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_seekable()

Glib::PropertyProxy_ReadOnly< bool > Gtk::MediaStream::property_seekable | ( |  | ) | const

Set unless the stream is known to not support seeking.

Default value: true

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_seeking()

Glib::PropertyProxy_ReadOnly< bool > Gtk::MediaStream::property_seeking | ( |  | ) | const

Set while a seek is in progress.

Default value: false

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_timestamp()

Glib::PropertyProxy_ReadOnly< gint64 > Gtk::MediaStream::property_timestamp | ( |  | ) | const

The current presentation timestamp in microseconds.

Default value: 0

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_volume() [1/2]

Glib::PropertyProxy< double > Gtk::MediaStream::property_volume | ( |  | ) |

Volume of the audio stream.

Default value: 1.000000

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_volume() [2/2]

Glib::PropertyProxy_ReadOnly< double > Gtk::MediaStream::property_volume | ( |  | ) | const

Volume of the audio stream.

Default value: 1.000000

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ realize()

void Gtk::MediaStream::realize | ( | const Glib::RefPtr< Gdk::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 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 unrealize().

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

Parameters

  surface | A Gdk::Surface.

## ◆ realize_vfunc()

virtual void Gtk::MediaStream::realize_vfunc | ( | const Glib::RefPtr< Gdk::Surface > & | surface | ) |
| protectedvirtual

## ◆ seek()

void Gtk::MediaStream::seek | ( | gint64 | timestamp | ) |

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 property_seeking() property will be set.

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

Parameters

  timestamp | Timestamp to seek to.

## ◆ seek_failed()

void Gtk::MediaStream::seek_failed | ( |  | ) |

Ends a seek operation started via GtkMediaStream.seek() as a failure.

This will not cause an error on the stream and will assume that playback continues as if no seek had happened.

See seek_success() for the other way of ending a seek.

## ◆ seek_success()

void Gtk::MediaStream::seek_success | ( |  | ) |

Ends a seek operation started via GtkMediaStream.seek() successfully.

This function will unset the GtkMediaStream:ended property if it was set.

See seek_failed() for the other way of ending a seek.

## ◆ seek_vfunc()

virtual void Gtk::MediaStream::seek_vfunc | ( | gint64 | timestamp | ) |
| protectedvirtual

## ◆ set_error()

void Gtk::MediaStream::set_error | ( | const Glib::Error & | error | ) |

Sets self into an error state.

This will pause the stream (you can check for an error via get_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 unprepared().

Parameters

  error | The Glib::Error to set.

## ◆ set_loop()

void Gtk::MediaStream::set_loop | ( | bool | loop = true | ) |

Sets whether the stream should loop.

In this case, it will attempt to restart playback from the beginning instead of stopping at the end.

Not all streams may support looping, in particular non-seekable streams. Those streams will ignore the loop setting and just end.

Parameters

  loop | true if the stream should loop.

## ◆ set_muted()

void Gtk::MediaStream::set_muted | ( | bool | muted = true | ) |

Sets whether the audio stream should be muted.

Muting a stream will cause no audio to be played, but it does not modify the volume. This means that muting and then unmuting the stream will restore the volume settings.

If the stream has no audio, calling this function will still work but it will not have an audible effect.

Parameters

  muted | true if the stream should be muted.

## ◆ set_playing()

void Gtk::MediaStream::set_playing | ( | bool | playing = true | ) |

Starts or pauses playback of the stream.

Parameters

  playing | Whether to start or pause playback.

## ◆ set_volume()

void Gtk::MediaStream::set_volume | ( | double | volume | ) |

Sets the volume of the audio stream.

This function call will work even if the stream is muted.

The given volume should range from 0.0 for silence to 1.0 for as loud as possible. Values outside of this range will be clamped to the nearest value.

If the stream has no audio or is muted, calling this function will still work but it will not have an immediate audible effect. When the stream is unmuted, the new volume setting will take effect.

Parameters

  volume | New volume of the stream from 0.0 to 1.0.

## ◆ stream_ended()

void Gtk::MediaStream::stream_ended | ( |  | ) |

Pauses the media stream and marks it as ended.

This is a hint only, calls to play() may still happen.

The media stream must be prepared when this function is called.

Since gtkmm 4.4

## ◆ stream_prepared()

void Gtk::MediaStream::stream_prepared | ( | bool | has_audio,
|  | bool | has_video,
|  | bool | seekable,
|  | gint64 | duration )

Called by Gtk::MediaStream implementations to advertise the stream being ready to play and providing details about the stream.

Note that the arguments are hints. If the stream implementation cannot determine the correct values, it is better to err on the side of caution and return true. User interfaces will use those values to determine what controls to show.

This function may not be called again until the stream has been reset via stream_unprepared().

Since gtkmm 4.4

Parameters

  has_audio | true if the stream should advertise audio support.
  has_video | true if the stream should advertise video support.
  seekable | true if the stream should advertise seekability.
  duration | The duration of the stream or 0 if unknown.

## ◆ stream_unprepared()

void Gtk::MediaStream::stream_unprepared | ( |  | ) |

Resets a given media stream implementation.

stream_prepared() can then be called again.

This function will also reset any error state the stream was in.

Since gtkmm 4.4

## ◆ unprepared()

void Gtk::MediaStream::unprepared | ( |  | ) |

Same as stream_unprepared().

Deprecated: 4.4: Use stream_unprepared() instead.

Deprecated
  Use stream_unprepared() instead.

## ◆ unrealize()

void Gtk::MediaStream::unrealize | ( | const Glib::RefPtr< Gdk::Surface > & | surface | ) |

Undoes a previous call to realize().

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

Parameters

  surface | The Gdk::Surface the stream was realized with.

## ◆ unrealize_vfunc()

virtual void Gtk::MediaStream::unrealize_vfunc | ( | const Glib::RefPtr< Gdk::Surface > & | surface | ) |
| protectedvirtual

## ◆ update()

void Gtk::MediaStream::update | ( | gint64 | timestamp | ) |

Media stream implementations should regularly call this function to update the timestamp reported by the stream.

It is up to implementations to call this at the frequency they deem appropriate.

The media stream must be prepared when this function is called.

Parameters

  timestamp | The new timestamp.

## ◆ update_audio_vfunc()

virtual void Gtk::MediaStream::update_audio_vfunc | ( | bool | muted,
|  | double | volume )
| protectedvirtual

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::MediaStream > wrap | ( | GtkMediaStream * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.