MediaFile

gtk.media_file.MediaFile implements gtk.media_stream.MediaStream for files.

This provides a simple way to play back video files with GTK.

GTK provides a GIO extension point for gtk.media_file.MediaFile implementations to allow for external implementations using various media frameworks.

GTK itself includes an implementation using GStreamer.

Constructors

this
this()

Creates a new empty media file.

Members

Functions

clear
void clear()

Resets the media file to be empty.

getFile
gio.file.File getFile()

Returns the file that self is currently playing from.

getInputStream
gio.input_stream.InputStream getInputStream()

Returns the stream that self is currently playing from.

setFile
void setFile(gio.file.File file)

Sets the gtk.media_file.MediaFile to play the given file.

setFilename
void setFilename(string filename)

Sets the `GtkMediaFile to play the given file.

setInputStream
void setInputStream(gio.input_stream.InputStream stream)

Sets the gtk.media_file.MediaFile to play the given stream.

setResource
void setResource(string resourcePath)

Sets the `GtkMediaFile to play the given resource.

Static functions

newForFile
gtk.media_file.MediaFile newForFile(gio.file.File file)

Creates a new media file to play file.

newForFilename
gtk.media_file.MediaFile newForFilename(string filename)

Creates a new media file for the given filename.

newForInputStream
gtk.media_file.MediaFile newForInputStream(gio.input_stream.InputStream stream)

Creates a new media file to play stream.

newForResource
gtk.media_file.MediaFile newForResource(string resourcePath)

Creates a new new media file for the given resource.

Inherited Members

From MediaStream

gerror
void gerror(glib.error.ErrorG error)

Sets self into an error state.

getDuration
long getDuration()

Gets the duration of the stream.

getEnded
bool getEnded()

Returns whether the streams playback is finished.

getError
glib.error.ErrorG getError()

If the stream is in an error state, returns the glib.error.ErrorG explaining that state.

getLoop
bool getLoop()

Returns whether the stream is set to loop.

getMuted
bool getMuted()

Returns whether the audio for the stream is muted.

getPlaying
bool getPlaying()

Return whether the stream is currently playing.

getTimestamp
long getTimestamp()

Returns the current presentation timestamp in microseconds.

getVolume
double getVolume()

Returns the volume of the audio for the stream.

hasAudio
bool hasAudio()

Returns whether the stream has audio.

hasVideo
bool hasVideo()

Returns whether the stream has video.

isPrepared
bool isPrepared()

Returns whether the stream has finished initializing.

isSeekable
bool isSeekable()

Checks if a stream may be seekable.

isSeeking
bool isSeeking()

Checks if there is currently a seek operation going on.

pause
void pause()

Pauses playback of the stream.

play
void play()

Starts playing the stream.

realize
void realize(gdk.surface.Surface surface)

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

seek
void seek(long timestamp)

Start a seek operation on self to timestamp.

seekFailed
void seekFailed()

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

seekSuccess
void seekSuccess()

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

setLoop
void setLoop(bool loop)

Sets whether the stream should loop.

setMuted
void setMuted(bool muted)

Sets whether the audio stream should be muted.

setPlaying
void setPlaying(bool playing)

Starts or pauses playback of the stream.

setVolume
void setVolume(double volume)

Sets the volume of the audio stream.

streamEnded
void streamEnded()

Pauses the media stream and marks it as ended.

streamPrepared
void streamPrepared(bool hasAudio, bool hasVideo, bool seekable, long duration)

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

streamUnprepared
void streamUnprepared()

Resets a given media stream implementation.

unrealize
void unrealize(gdk.surface.Surface surface)

Undoes a previous call to gtk.media_stream.MediaStream.realize.

update
void update(long timestamp)

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