#GstMediaSource is the entry point into the W3C Media Source API. It offers
functionality similar to #GstAppSrc for client-side web or JavaScript
applications decoupling the source of media from its processing and playback.
To interact with a Media Source, connect it to a #GstMseSrc that is in some
#GstPipeline using gst_media_source_attach(). Then create at least one
#GstSourceBuffer using gst_media_source_add_source_buffer(). Finally, feed
some media data to the Source Buffer(s) using
gst_source_buffer_append_buffer() and play the pipeline.
Creates a new #GstMediaSource instance. The instance is in the
%GST_MEDIA_SOURCE_READY_STATE_CLOSED state and is not associated with any
media player.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-constructor)
a new #GstMediaSource instance
Determines whether the current Media Source configuration can process media
of the supplied @type.
`TRUE` when supported, `FALSE` otherwise
A MIME type value
Add a #GstSourceBuffer to this #GstMediaSource of the specified media type.
The Media Source must be in the #GstMediaSourceReadyState %GST_MEDIA_SOURCE_READY_STATE_OPEN.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-addsourcebuffer)
a new #GstSourceBuffer instance on success, otherwise `NULL`
#GstMediaSource instance
A MIME type describing the format of the incoming media
Associates @self with @element.
Normally, the Element will be part of a #GstPipeline that plays back the data
submitted to the Media Source's Source Buffers.
#GstMseSrc is a special source element that is designed to consume media from
a #GstMediaSource.
[Specification](https://www.w3.org/TR/media-source-2/#dfn-attaching-to-a-media-element)
#GstMediaSource instance
#GstMseSrc source Element
Clear the live seekable range for @self. This will inform the component
playing this Media Source that there is no seekable time range.
If the ready state is not %GST_MEDIA_SOURCE_READY_STATE_OPEN, it will fail
and set an error.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-clearliveseekablerange)
`TRUE` on success, `FALSE` otherwise
#GstMediaSource instance
Detaches @self from any #GstMseSrc element that it may be associated with.
#GstMediaSource instance
Mark @self as reaching the end of stream, disallowing new data inputs.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-endofstream)
`TRUE` on success, `FALSE` otherwise
#GstMediaSource instance
The error type, if any
Gets a #GstSourceBufferList containing all the Source Buffers currently
associated with this Media Source that are considered "active."
For a Source Buffer to be considered active, either its video track is
selected, its audio track is enabled, or its text track is visible or hidden.
This object will reflect any future changes to the parent Media Source as
well.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-activesourcebuffers)
a new #GstSourceBufferList instance
#GstMediaSource instance
Gets the current duration of @self.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-duration)
the current duration as a #GstClockTime
#GstMediaSource instance
Get the live seekable range of @self. Will fill in the supplied @range with
the current live seekable range.
#GstMediaSource instance
time range
Gets the current playback position of the Media Source.
the current playback position as a #GstClockTime
#GstMediaSource instance
Gets the current Ready State of the Media Source.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-readystate)
the current #GstMediaSourceReadyState value
#GstMediaSource instance
Gets a #GstSourceBufferList containing all the Source Buffers currently
associated with this Media Source. This object will reflect any future
changes to the parent Media Source as well.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-sourcebuffers)
a #GstSourceBufferList instance
#GstMediaSource instance
Remove @buffer from @self.
@buffer must have been created as a child of @self and @self must be in the
#GstMediaSourceReadyState %GST_MEDIA_SOURCE_READY_STATE_OPEN.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-removesourcebuffer)
`TRUE` on success, `FALSE` otherwise
#GstMediaSource instance
#GstSourceBuffer instance
Sets the duration of @self.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-duration)
`TRUE` on success, `FALSE` otherwise
#GstMediaSource instance
The new duration to apply to @self.
Set the live seekable range for @self. This range informs the component
playing this Media Source what it can allow the user to seek through.
If the ready state is not %GST_MEDIA_SOURCE_READY_STATE_OPEN, or the supplied
@start time is later than @end it will fail and set an error.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-setliveseekablerange)
`TRUE` on success, `FALSE` otherwise
#GstMediaSource instance
The earliest point in the stream considered seekable
The latest point in the stream considered seekable
A #GstSourceBufferList of every #GstSourceBuffer in this Media Source that
is considered active
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-activesourcebuffers)
The Duration of the Media Source as a #GstClockTime
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-duration)
The position of the player consuming from the Media Source
The Ready State of the Media Source
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-readystate)
A #GstSourceBufferList of every #GstSourceBuffer in this Media Source
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-sourcebuffers)
Emitted when @self has ended, normally through
gst_media_source_end_of_stream().
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-onsourceended)
Emitted when @self has been opened.
[Specification](https://www.w3.org/TR/media-source-2/#dom-mediasource-onsourceopen)
Reasons for ending a #GstMediaSource using gst_media_source_end_of_stream().
[Specification](https://www.w3.org/TR/media-source-2/#dom-endofstreamerror)
End the stream successfully
End the stream due to a networking error
End the stream due to a decoding error
Any error that can occur within #GstMediaSource or #GstSourceBuffer APIs.
These values correspond directly to those in the Web IDL specification.
[Specification](https://webidl.spec.whatwg.org/#idl-DOMException-error-names)
Any error type that can be reported by the Media Source API.
A structure describing a simplified version of the TimeRanges concept in the
HTML specification, only representing a single @start and @end time.
[Specification](https://html.spec.whatwg.org/multipage/media.html#timeranges)
The start of this range.
The end of this range.
Describes the possible states of the Media Source.
[Specification](https://www.w3.org/TR/media-source-2/#dom-readystate)
The #GstMediaSource is not connected to
any playback element.
The #GstMediaSource is connected to a
playback element and ready to append data to its #GstSourceBuffer (s).
gst_media_source_end_of_stream() has
been called on the current #GstMediaSource
#GstMseSrc is a source Element that interacts with a #GstMediaSource to
consume #GstSample<!-- -->s processed by the Media Source and supplies them
to the containing #GstPipeline. In the perspective of the Media Source API,
this element fulfills the basis of the Media Element's role relating to
working with a Media Source. The remaining responsibilities are meant to be
fulfilled by the application and #GstPlay can be used to satisfy many of
them.
Once added to a Pipeline, this element should be attached to a Media Source
using gst_media_source_attach().
Gets the duration of @self.
[Specification](https://html.spec.whatwg.org/multipage/media.html#dom-media-duration)
The duration of this stream as a #GstClockTime
#GstMseSrc instance
the number of audio tracks available from this source
#GstMseSrc instance
the number of text tracks available from this source
#GstMseSrc instance
the number of video tracks available from this source
#GstMseSrc instance
Gets the current playback position of @self.
[Specification](https://html.spec.whatwg.org/multipage/media.html#current-playback-position)
The playback position of this Element as a #GstClockTime
#GstMseSrc instance
The Ready State of @self, describing to what level it can supply content for
the current #GstMseSrc:position. This is a separate concept from
#GstMediaSource:ready-state: and corresponds to the HTML Media Element's
Ready State.
[Specification](https://html.spec.whatwg.org/multipage/media.html#ready-states)
the current #GstMseSrcReadyState
#GstMseSrc instance
The duration of the stream as a #GstClockTime
[Specification](https://html.spec.whatwg.org/multipage/media.html#dom-media-duration)
The number of audio tracks in the Media Source
The number of text tracks in the Media Source
The number of video tracks in the Media Source
The playback position as a #GstClockTime
[Specification](https://html.spec.whatwg.org/multipage/media.html#current-playback-position)
The Ready State of this element, describing to what level it can supply
content for the current #GstMseSrc:position. This is a separate concept
from #GstMediaSource:ready-state: and corresponds to the HTML Media
Element's Ready State.
[Specification](https://html.spec.whatwg.org/multipage/media.html#ready-states)
Describes how much information a #GstMseSrc has about the media it is playing
back at the current playback #GstMseSrc:position. This type corresponds
directly to the ready state of a HTML Media Element and is a separate concept
from #GstMediaSourceReadyState.
[Specification](https://html.spec.whatwg.org/multipage/media.html#ready-states)
No information is available about the
stream
The duration is available and video
dimensions are available if the stream contains video
The current playback position can
be presented but future information is not available
There is data for the current
position and some amount in the future and any text tracks are ready.
Either there is enough data to
play the stream through at the current playback and input rate or the input
buffer is full.
The Source Buffer is the primary means of data flow between an application
and the Media Source API. It represents a single timeline of media,
containing some combination of audio, video, and text tracks.
An application is responsible for feeding raw data into the Source Buffer
using gst_source_buffer_append_buffer() and the Source Buffer will
asynchronously process the data into tracks of time-coded multimedia samples.
The application as well as the associated playback component can then select
to play media from any subset of tracks across all Source Buffers of a Media
Source.
A few control points are also provided to customize the behavior.
- #GstSourceBuffer:append-mode controls how timestamps of processed samples are
interpreted. They are either inserted in the timeline directly where the
decoded media states they should, or inserted directly after the previously
encountered sample.
- #GstSourceBuffer:append-window-start / #GstSourceBuffer:append-window-end
control the planned time window where media from appended data can be added
to the current timeline. Any samples outside that range may be ignored.
- #GstSourceBuffer:timestamp-offset is added to the start time of any sample
processed.
Attempts to end any processing of the currently pending data and reset the
media parser.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-abort)
`TRUE` on success, `FALSE` otherwise
#GstSourceBuffer instance
Schedules the bytes inside @buf to be processed by @self. When it is possible
to accept the supplied data, it will be processed asynchronously and fill in
the track buffers for playback purposes.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendbuffer)
`TRUE` on success, `FALSE` otherwise
#GstSourceBuffer instance
The media data to append
Attempts to change the content type of @self to @type. Any new data appended
to the Source Buffer must be of the supplied @type afterward.
`TRUE` on success, `FALSE` otherwise
#GstSourceBuffer instance
the desired content type
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-mode)
The current #GstSourceBufferAppendMode
#GstSourceBuffer instance
Returns the current append window end time. Any segment processed that starts
after this value will be ignored.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowend)
The current Append Window end time as a #GstClockTime
#GstSourceBuffer instance
Returns the current append window start time. Any segment processed that ends
earlier than this value will be ignored.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowstart)
The current Append Window start time as a #GstClockTime
#GstSourceBuffer instance
Returns a sequence of #GstMediaSourceRange values representing which segments
of @self are buffered in memory.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-buffered)
a #GArray of #GstMediaSourceRange values.
#GstSourceBuffer instance
Returns the current content type of @self.
a string representing the content type
#GstSourceBuffer instance
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-timestampoffset)
The current timestamp offset as a #GstClockTime
#GstSourceBuffer instance
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-updating)
Whether @self is currently adding or removing media content.
#GstSourceBuffer instance
Attempts to remove any parsed data between @start and @end from @self.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-remove)
`TRUE` on success, `FALSE` otherwise
#GstSourceBuffer instance
The beginning timestamp of data to remove
The end timestamp of data to remove
Changes the Append Mode of @self. This influences what timestamps will be
assigned to media processed by this Source Buffer. In Segment mode, the
timestamps in each segment determine the position of each sample after it
is processed. In Sequence mode, the timestamp of each processed sample is
generated based on the end of the most recently processed segment.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-mode)
`TRUE` on success, `FALSE` otherwise
#GstSourceBuffer instance
#GstSourceBufferAppendMode the desired Append Mode
Modifies the current append window end of @self. If successful, samples
processed after setting this value that start after this point will be
ignored.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowend)
`TRUE` on success, `FALSE` otherwise
#GstSourceBuffer instance
the append window end
Modifies the current append window start of @self. If successful, samples
processed after setting this value that end before this point will be
ignored.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowstart)
`TRUE` on success, `FALSE` otherwise
#GstSourceBuffer instance
the append window end
Attempt to set the timestamp offset of @self. Any media processed after this
value is set will have this value added to its start time.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-timestampoffset)
`TRUE` on success, `FALSE` otherwise
#GstSourceBuffer instance
The new timestamp offset
Affects how timestamps of processed media segments are interpreted.
In %GST_SOURCE_BUFFER_APPEND_MODE_SEGMENTS, the start timestamp of a
processed media segment is used directly along with
#GstSourceBuffer:timestamp-offset .
In %GST_SOURCE_BUFFER_APPEND_MODE_SEQUENCE, the timestamp of a
processed media segment is ignored and replaced with the end time of the
most recently appended segment.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-mode)
Any segments processed which have a start time greater than this value will
be ignored by this Source Buffer.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowend)
Any segments processed which end before this value will be ignored by this
Source Buffer.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-appendwindowstart)
The set of Time Intervals that have been loaded into the current Source
Buffer
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-buffered)
The MIME content-type of the data stream
The next media segment appended to the current Source Buffer will have its
start timestamp increased by this amount.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-timestampoffset)
Whether the current source buffer is still asynchronously processing
previously issued commands.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-updating)
Emitted when @self was aborted after a call to gst_source_buffer_abort().
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-onabort)
Emitted when @self has encountered an error after a call to
gst_source_buffer_append_buffer().
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-onerror)
Emitted when @self has successfully processed data after a call to
gst_source_buffer_append_buffer().
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-onupdate)
Emitted when @self is no longer in the updating state after a call to
gst_source_buffer_append_buffer(). This can happen after a successful or
unsuccessful append.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-onupdateend)
Emitted when @self has begun to process data after a call to
gst_source_buffer_append_buffer().
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebuffer-onupdatestart)
[Specification](https://www.w3.org/TR/media-source-2/#dom-appendmode)
The Source Buffer List is a list of #GstSourceBuffer<!-- -->s that can be
indexed numerically and monitored for changes. The list itself cannot be
modified through this interface, though the Source Buffers it holds can be
modified after retrieval.
It is used by #GstMediaSource to provide direct access to its child
#GstSourceBuffer<!-- -->s through #GstMediaSource:source-buffers as well as
informing clients which of the Source Buffers are active through
#GstMediaSource:active-source-buffers.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebufferlist-length)
The number of #GstSourceBuffer objects in the list
#GstSourceBufferList instance
Retrieves the #GstSourceBuffer at @index from @self. If @index is greater than
the highest index in the list, it will return `NULL`.
[Specification](https://www.w3.org/TR/media-source-2/#dfn-sourcebufferlist-getter)
The requested #GstSourceBuffer or `NULL`
#GstSourceBufferList instance
index of requested Source Buffer
The number of #GstSourceBuffer<!-- -->s contained by this structure
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebufferlist-length)
Emitted when a #GstSourceBuffer has been added to this list.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebufferlist-onaddsourcebuffer)
Emitted when a #GstSourceBuffer has been removed from this list.
[Specification](https://www.w3.org/TR/media-source-2/#dom-sourcebufferlist-onremovesourcebuffer)
Any error type that can be reported by the Media Source API.