It derives from <GObject>.
The integration point for media playback inside GTK.
GTK provides an implementation of the
<GtkMediaStream> interface that is called
<GtkMediaFile>.
Apart from application-facing API for stream playback,
<GtkMediaStream> has a number of APIs that are
only useful for implementations and should not be used in applications:
Gtk.MediaStream.prepared, Gtk.MediaStream.unprepared,
media-stream:update,
Gtk.MediaStream.ended, media-stream:seek-success, media-stream:seek-failed, media-stream:gerror, Gtk.MediaStream.error,
Gtk.MediaStream.error_valist.
parent-instanceThe stream’s duration in microseconds or 0 if unknown.
Its value is a 64-bit integer.
It is read only.
Set when playback has finished.
Its value is a boolean.
It is read only.
#f for a properly working stream or the
<GError> that the stream is in.
Its value is a <GError>, or #f.
It is read only.
Whether the stream contains audio.
Its value is a boolean.
It is read only.
Whether the stream contains video.
Its value is a boolean.
It is read only.
Try to restart the media from the beginning once it ended.
Its value is a boolean.
Set it with (set! (media-stream:loop self) value).
Whether the audio stream should be muted.
Its value is a boolean.
Set it with (set! (media-stream:muted self) value).
Whether the stream is currently playing.
Its value is a boolean.
Set it with (set! (media-stream:playing self) value).
Whether the stream has finished initializing and existence of audio and video is known.
Its value is a boolean.
It is read only.
Set unless the stream is known to not support seeking.
Its value is a boolean.
It is read only.
Set while a seek is in progress.
Its value is a boolean.
It is read only.
The current presentation timestamp in microseconds.
Its value is a 64-bit integer.
It is read only.
Volume of the audio stream.
Its value is a real number.
Set it with (set! (media-stream:volume self) value).
Sets self into an error state.
This will pause the stream (you can check for an error via
media-stream: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
Gtk.MediaStream.unprepared.
Passed: a <GtkMediaStream>.
Passed: a <GError>.
the <GError> to set
Gets the duration of the stream.
If the duration is not known, 0 will be returned.
Passed: a <GtkMediaStream>.
Returned: a 64-bit integer.
the duration of the stream or 0 if not known.
Returns whether the streams playback is finished.
Passed: a <GtkMediaStream>.
Returned: a boolean.
#t if playback is finished
If the stream is in an error state, returns the
<GError> 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
media-stream:play or
media-stream:seek will not have any
effect.
<GtkMediaStream> itself does not provide a way
to unset an error, but implementations may provide options. For
example, a <GtkMediaFile> will unset errors when
a new source is set, e.g. with media-file:set-file.
Passed: a <GtkMediaStream>.
Returned: a <GError>, or #f.
#f if not in an error state or the
<GError> of the stream
Returns whether the stream is set to loop.
See media-stream:set-loop for
details.
Passed: a <GtkMediaStream>.
Returned: a boolean.
#t if the stream should loop
Returns whether the audio for the stream is muted.
See media-stream:set-muted for
details.
Passed: a <GtkMediaStream>.
Returned: a boolean.
#t if the stream is muted
Return whether the stream is currently playing.
Passed: a <GtkMediaStream>.
Returned: a boolean.
#t if the stream is playing
Returns the current presentation timestamp in microseconds.
Passed: a <GtkMediaStream>.
Returned: a 64-bit integer.
the timestamp in microseconds
Returns the volume of the audio for the stream.
See media-stream:set-volume for
details.
Passed: a <GtkMediaStream>.
Returned: a real number.
volume of the stream from 0.0 to 1.0
Returns whether the stream has audio.
Passed: a <GtkMediaStream>.
Returned: a boolean.
#t if the stream has audio
Returns whether the stream has video.
Passed: a <GtkMediaStream>.
Returned: a boolean.
#t if the stream has video
Returns whether the stream has finished initializing.
At this point the existence of audio and video is known.
Passed: a <GtkMediaStream>.
Returned: a boolean.
#t if the stream is prepared
Checks if a stream may be seekable.
This is meant to be a hint. Streams may not allow seeking even if this
function returns #t. However, if this function returns
#f, streams are guaranteed to not be seekable and user interfaces
may hide controls that allow seeking.
It is allowed to call media-stream:seek
on a non-seekable stream, though it will not do anything.
Passed: a <GtkMediaStream>.
Returned: a boolean.
#t if the stream may support seeking
Checks if there is currently a seek operation going on.
Passed: a <GtkMediaStream>.
Returned: a boolean.
#t if a seek operation is ongoing.
Pauses playback of the stream.
If the stream is not playing, do nothing.
Passed: a <GtkMediaStream>.
Starts playing the stream.
If the stream is in error or already playing, do nothing.
Passed: a <GtkMediaStream>.
Called by users to attach the media stream to a
<GdkSurface> they manage.
The stream can then access the resources of surface for its
rendering purposes. In particular, media streams might want to create a
<GdkGLContext> or sync to the
<GdkFrameClock>.
Whoever calls this function is responsible for calling
media-stream: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 media-stream:unrealize.
It is not required to call this function to make a media stream work.
Passed: a <GtkMediaStream>.
Passed: a <GdkSurface>.
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 media-stream:seeking property will be set.
When calling media-stream:seek during an
ongoing seek operation, the new seek will override any pending seek.
Passed: a <GtkMediaStream>.
Passed: a 64-bit integer.
timestamp to seek to.
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 media-stream:seek-success for
the other way of ending a seek.
Passed: a <GtkMediaStream>.
Ends a seek operation started via GtkMediaStream.seek()
successfully.
This function will unset the GtkMediaStream:ended property if it was set.
See media-stream:seek-failed for
the other way of ending a seek.
Passed: a <GtkMediaStream>.
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.
Passed: a <GtkMediaStream>.
Passed: a boolean.
#t if the stream should loop
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.
Passed: a <GtkMediaStream>.
Passed: a boolean.
#t if the stream should be muted
Starts or pauses playback of the stream.
Passed: a <GtkMediaStream>.
Passed: a boolean.
whether to start or pause playback
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.
Passed: a <GtkMediaStream>.
Passed: a real number.
New volume of the stream from 0.0 to 1.0
Pauses the media stream and marks it as ended.
This is a hint only, calls to media-stream:play may still happen.
The media stream must be prepared when this function is called.
Passed: a <GtkMediaStream>.
Called by <GtkMediaStream> 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 #t. 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 media-stream:stream-unprepared.
Passed: a <GtkMediaStream>.
Passed: a boolean.
#t if the stream should advertise audio support
Passed: a boolean.
#t if the stream should advertise video support
Passed: a boolean.
#t if the stream should advertise seekability
Passed: a 64-bit integer.
The duration of the stream or 0 if unknown
Resets a given media stream implementation.
media-stream:stream-prepared
can then be called again.
This function will also reset any error state the stream was in.
Passed: a <GtkMediaStream>.
Undoes a previous call to media-stream:realize.
This causes the stream to release all resources it had allocated from surface.
Passed: a <GtkMediaStream>.
a <GtkMediaStream> previously realized
Passed: a <GdkSurface>.
the <GdkSurface> the stream was realized with
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.
Passed: a <GtkMediaStream>.
Passed: a 64-bit integer.
the new timestamp
Pauses playback of the stream.
If the stream is not playing, do nothing.
To override it in a new class, give register-type #:vfuncs
`((pause . ,procedure)). The procedure is called as (procedure
self).
Passed: the class whose implementation to call:
<GtkMediaStream>, or a class that derives from
it, or its GType number.
Passed: a <GtkMediaStream>.
To override it in a new class, give register-type #:vfuncs
`((play . ,procedure)). The procedure is called as (procedure
self) ⇒ %return.
Passed: the class whose implementation to call:
<GtkMediaStream>, or a class that derives from
it, or its GType number.
Passed: a <GtkMediaStream>.
Returned: a boolean.
Called by users to attach the media stream to a
<GdkSurface> they manage.
The stream can then access the resources of surface for its
rendering purposes. In particular, media streams might want to create a
<GdkGLContext> or sync to the
<GdkFrameClock>.
Whoever calls this function is responsible for calling
media-stream: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 media-stream:unrealize.
It is not required to call this function to make a media stream work.
To override it in a new class, give register-type #:vfuncs
`((realize . ,procedure)). The procedure is called as
(procedure self surface).
Passed: the class whose implementation to call:
<GtkMediaStream>, or a class that derives from
it, or its GType number.
Passed: a <GtkMediaStream>.
Passed: a <GdkSurface>.
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 media-stream:seeking property will be set.
When calling media-stream:seek during an
ongoing seek operation, the new seek will override any pending seek.
To override it in a new class, give register-type #:vfuncs
`((seek . ,procedure)). The procedure is called as (procedure
self timestamp).
Passed: the class whose implementation to call:
<GtkMediaStream>, or a class that derives from
it, or its GType number.
Passed: a <GtkMediaStream>.
Passed: a 64-bit integer.
timestamp to seek to.
Undoes a previous call to media-stream:realize.
This causes the stream to release all resources it had allocated from surface.
To override it in a new class, give register-type #:vfuncs
`((unrealize . ,procedure)). The procedure is called as
(procedure self surface).
Passed: the class whose implementation to call:
<GtkMediaStream>, or a class that derives from
it, or its GType number.
Passed: a <GtkMediaStream>.
a <GtkMediaStream> previously realized
Passed: a <GdkSurface>.
the <GdkSurface> the stream was realized with
To override it in a new class, give register-type #:vfuncs
`((update-audio . ,procedure)). The procedure is called as
(procedure self muted volume).
Passed: the class whose implementation to call:
<GtkMediaStream>, or a class that derives from
it, or its GType number.
Passed: a <GtkMediaStream>.
Passed: a boolean.
Passed: a real number.