gtkmm 4.14.0
|
Open media files for use in GTK. More...
#include <gtkmm/mediafile.h>
Public Member Functions | |
MediaFile (MediaFile &&src) noexcept | |
MediaFile & | operator= (MediaFile &&src) noexcept |
~MediaFile () noexcept override | |
GtkMediaFile * | gobj () |
Provides access to the underlying C GObject. | |
const GtkMediaFile * | gobj () const |
Provides access to the underlying C GObject. | |
GtkMediaFile * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
void | clear () |
Resets the media file to be empty. | |
void | set_filename (const std::string &filename) |
Sets the `GtkMediaFile to play the given file. | |
void | set_resource (const std::string &resource_path) |
Sets the `GtkMediaFile to play the given resource. | |
void | set_file (const Glib::RefPtr< Gio::File > &file) |
Sets the Gtk::MediaFile to play the given file. | |
Glib::RefPtr< Gio::File > | get_file () |
Returns the file that self is currently playing from. | |
Glib::RefPtr< const Gio::File > | get_file () const |
Returns the file that self is currently playing from. | |
void | set_input_stream (const Glib::RefPtr< Gio::InputStream > &stream) |
Sets the Gtk::MediaFile to play the given stream. | |
Glib::RefPtr< Gio::InputStream > | get_input_stream () |
Returns the stream that self is currently playing from. | |
Glib::RefPtr< const Gio::InputStream > | get_input_stream () const |
Returns the stream that self is currently playing from. | |
Glib::PropertyProxy< Glib::RefPtr< Gio::File > > | property_file () |
The file being played back or nullptr if not playing a file. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > | property_file () const |
The file being played back or nullptr if not playing a file. | |
Glib::PropertyProxy< Glib::RefPtr< Gio::InputStream > > | property_input_stream () |
The stream being played back or nullptr if not playing a stream. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::InputStream > > | property_input_stream () const |
The stream being played back or nullptr if not playing a stream. | |
![]() | |
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 GError 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< bool > | property_prepared () |
Whether the stream has finished initializing and existence of audio and video is known. | |
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 GError 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. | |
![]() | |
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 () |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
static Glib::RefPtr< MediaFile > | create () |
Creates a new empty media file. | |
static Glib::RefPtr< MediaFile > | create_for_filename (const std::string &filename) |
Creates a new media file for the given filename. | |
static Glib::RefPtr< MediaFile > | create_for_resource (const std::string &resource_path) |
Creates a new new media file for the given resource. | |
static Glib::RefPtr< MediaFile > | create (const Glib::RefPtr< Gio::File > &file) |
Creates a new media file to play file. | |
static Glib::RefPtr< MediaFile > | create (const Glib::RefPtr< Gio::InputStream > &stream) |
Creates a new media file to play stream. | |
![]() | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
![]() | |
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 | |
MediaFile () | |
virtual void | open_vfunc () |
virtual void | close_vfunc () |
![]() | |
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) |
![]() | |
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::MediaFile > | wrap (GtkMediaFile *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
![]() | |
Glib::RefPtr< Gtk::MediaStream > | wrap (GtkMediaStream *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
![]() | |
Glib::RefPtr< Gdk::Paintable > | wrap (GdkPaintable * object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Additional Inherited Members | |
![]() | |
enum class | Flags { Flags::STATIC_SIZE = 1 << 0 , Flags::STATIC_CONTENTS = 1 << 1 } |
Flags about a paintable object. More... | |
Open media files for use in GTK.
MediaFile is the implementation for media file usage with MediaStream.
This provides a simple way to play back video files with GTK.
GTK+ provides a GIO extension point for Gtk::MediaFile implementations to allow for external implementations using various media frameworks. GTK+ itself includes implementations using GStreamer and ffmpeg.
|
noexcept |
|
overridenoexcept |
|
protected |
void Gtk::MediaFile::clear | ( | ) |
Resets the media file to be empty.
Creates a new empty media file.
Gtk::MediaFile
.
|
static |
Creates a new media file to play file.
file | The file to play. |
Gtk::MediaFile
playing file.
|
static |
Creates a new media file to play stream.
If you want the resulting media to be seekable, the stream should implement the Gio::Seekable
interface.
stream | The stream to play. |
Gtk::MediaFile
.
|
static |
Creates a new media file for the given filename.
This is a utility function that converts the given filename to a Gio::File
and calls new_for_file().
filename | Filename to open. |
Gtk::MediaFile
playing filename.
|
static |
Creates a new new media file for the given resource.
This is a utility function that converts the given resource to a Gio::File
and calls new_for_file().
resource_path | Resource path to open. |
Gtk::MediaFile
playing resource_path. Glib::RefPtr< Gio::File > Gtk::MediaFile::get_file | ( | ) |
Returns the file that self is currently playing from.
When self is not playing or not playing from a file, nullptr
is returned.
Glib::RefPtr< const Gio::File > Gtk::MediaFile::get_file | ( | ) | const |
Returns the file that self is currently playing from.
When self is not playing or not playing from a file, nullptr
is returned.
Glib::RefPtr< Gio::InputStream > Gtk::MediaFile::get_input_stream | ( | ) |
Returns the stream that self is currently playing from.
When self is not playing or not playing from a stream, nullptr
is returned.
Glib::RefPtr< const Gio::InputStream > Gtk::MediaFile::get_input_stream | ( | ) | const |
Returns the stream that self is currently playing from.
When self is not playing or not playing from a stream, nullptr
is returned.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GtkMediaFile * Gtk::MediaFile::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::PropertyProxy< Glib::RefPtr< Gio::File > > Gtk::MediaFile::property_file | ( | ) |
The file being played back or nullptr
if not playing a file.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > Gtk::MediaFile::property_file | ( | ) | const |
The file being played back or nullptr
if not playing a file.
Glib::PropertyProxy< Glib::RefPtr< Gio::InputStream > > Gtk::MediaFile::property_input_stream | ( | ) |
The stream being played back or nullptr
if not playing a stream.
This is nullptr
when playing a file.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::InputStream > > Gtk::MediaFile::property_input_stream | ( | ) | const |
The stream being played back or nullptr
if not playing a stream.
This is nullptr
when playing a file.
Sets the Gtk::MediaFile
to play the given file.
If any file is still playing, stop playing it.
file | The file to play. |
Sets the `GtkMediaFile to play the given file.
This is a utility function that converts the given filename to a Gio::File
and calls set_file().
filename | Name of file to play. |
Sets the Gtk::MediaFile
to play the given stream.
If anything is still playing, stop playing it.
Full control about the stream is assumed for the duration of playback. The stream will not be closed.
stream | The stream to play from. |
Sets the `GtkMediaFile to play the given resource.
This is a utility function that converts the given resource_path to a Gio::File
and calls set_file().
resource_path | Path to resource to play. |
|
related |
A Glib::wrap() method for this object.
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. |