GstSourceBuffer
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.
-
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.
-
append-window-start / 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.
-
timestamp-offset is added to the start time of any sample processed.
GstSourceBuffer
GObject ╰──GInitiallyUnowned ╰──GstObject ╰──GstSourceBuffer
Since : 1.24
Class structure
Methods
gst_source_buffer_abort
gboolean gst_source_buffer_abort (GstSourceBuffer * self, GError ** error)
Attempts to end any processing of the currently pending data and reset the media parser.
Parameters:
self
–
GstSourceBuffer instance
error
(
[out][optional][nullable][transfer: full])
–
the resulting error or NULL
TRUE
on success, FALSE
otherwise
Since : 1.24
gst_source_buffer_append_buffer
gboolean gst_source_buffer_append_buffer (GstSourceBuffer * self, GstBuffer * buf, GError ** error)
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.
Parameters:
self
–
GstSourceBuffer instance
buf
–
(transfer full):The media data to append
error
(
[out][optional][nullable][transfer: full])
–
the resulting error or NULL
TRUE
on success, FALSE
otherwise
Since : 1.24
gst_source_buffer_change_content_type
gboolean gst_source_buffer_change_content_type (GstSourceBuffer * self, const gchar * type, GError ** error)
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.
Parameters:
self
–
GstSourceBuffer instance
type
(
[transfer: none])
–
the desired content type
error
(
[out][optional][nullable][transfer: full])
–
the resulting error or NULL
TRUE
on success, FALSE
otherwise
Since : 1.24
gst_source_buffer_get_append_mode
GstSourceBufferAppendMode gst_source_buffer_get_append_mode (GstSourceBuffer * self)
Parameters:
self
–
GstSourceBuffer instance
The current GstSourceBufferAppendMode
Since : 1.24
gst_source_buffer_get_append_window_end
GstClockTime gst_source_buffer_get_append_window_end (GstSourceBuffer * self)
Returns the current append window end time. Any segment processed that starts after this value will be ignored.
Parameters:
self
–
GstSourceBuffer instance
The current Append Window end time as a GstClockTime
Since : 1.24
gst_source_buffer_get_append_window_start
GstClockTime gst_source_buffer_get_append_window_start (GstSourceBuffer * self)
Returns the current append window start time. Any segment processed that ends earlier than this value will be ignored.
Parameters:
self
–
GstSourceBuffer instance
The current Append Window start time as a GstClockTime
Since : 1.24
gst_source_buffer_get_buffered
GArray * gst_source_buffer_get_buffered (GstSourceBuffer * self, GError ** error)
Returns a sequence of GstMediaSourceRange values representing which segments of self are buffered in memory.
Parameters:
self
–
GstSourceBuffer instance
error
(
[out][optional][nullable][transfer: full])
–
the resulting error or NULL
a GArray of GstMediaSourceRange values.
Since : 1.24
gst_source_buffer_get_content_type
gchar * gst_source_buffer_get_content_type (GstSourceBuffer * self)
Returns the current content type of self.
Parameters:
self
–
GstSourceBuffer instance
a string representing the content type
Since : 1.24
gst_source_buffer_get_timestamp_offset
GstClockTime gst_source_buffer_get_timestamp_offset (GstSourceBuffer * self)
Parameters:
self
–
GstSourceBuffer instance
The current timestamp offset as a GstClockTime
Since : 1.24
gst_source_buffer_get_updating
gboolean gst_source_buffer_get_updating (GstSourceBuffer * self)
Parameters:
self
–
GstSourceBuffer instance
Whether self is currently adding or removing media content.
Since : 1.24
gst_source_buffer_remove
gboolean gst_source_buffer_remove (GstSourceBuffer * self, GstClockTime start, GstClockTime end, GError ** error)
Attempts to remove any parsed data between start and end from self.
Parameters:
self
–
GstSourceBuffer instance
start
–
The beginning timestamp of data to remove
end
–
The end timestamp of data to remove
error
(
[out][optional][nullable][transfer: full])
–
the resulting error or NULL
TRUE
on success, FALSE
otherwise
Since : 1.24
gst_source_buffer_set_append_mode
gboolean gst_source_buffer_set_append_mode (GstSourceBuffer * self, GstSourceBufferAppendMode mode, GError ** error)
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.
Parameters:
self
–
GstSourceBuffer instance
mode
–
GstSourceBufferAppendMode the desired Append Mode
error
(
[out][optional][nullable][transfer: full])
–
the resulting error or NULL
TRUE
on success, FALSE
otherwise
Since : 1.24
gst_source_buffer_set_append_window_end
gboolean gst_source_buffer_set_append_window_end (GstSourceBuffer * self, GstClockTime end, GError ** error)
Modifies the current append window end of self. If successful, samples processed after setting this value that start after this point will be ignored.
Parameters:
self
–
GstSourceBuffer instance
end
–
the append window end
error
(
[out][optional][nullable][transfer: full])
–
the resulting error or NULL
TRUE
on success, FALSE
otherwise
Since : 1.24
gst_source_buffer_set_append_window_start
gboolean gst_source_buffer_set_append_window_start (GstSourceBuffer * self, GstClockTime start, GError ** error)
Modifies the current append window start of self. If successful, samples processed after setting this value that end before this point will be ignored.
Parameters:
self
–
GstSourceBuffer instance
start
–
the append window start
error
(
[out][optional][nullable][transfer: full])
–
the resulting error or NULL
TRUE
on success, FALSE
otherwise
Since : 1.24
gst_source_buffer_set_timestamp_offset
gboolean gst_source_buffer_set_timestamp_offset (GstSourceBuffer * self, GstClockTime offset, GError ** error)
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.
Parameters:
self
–
GstSourceBuffer instance
offset
–
The new timestamp offset
error
(
[out][optional][nullable][transfer: full])
–
the resulting error or NULL
TRUE
on success, FALSE
otherwise
Since : 1.24
Signals
on-abort
on_abort_callback (GstSourceBuffer * self, gpointer user_data)
Emitted when self was aborted after a call to gst_source_buffer_abort.
Flags: Run Last
Since : 1.24
on-error
on_error_callback (GstSourceBuffer * self, gpointer user_data)
Emitted when self has encountered an error after a call to gst_source_buffer_append_buffer.
Parameters:
self
–
The GstSourceBuffer that has encountered an error
user_data
–
Flags: Run Last
Since : 1.24
on-update
on_update_callback (GstSourceBuffer * self, gpointer user_data)
Emitted when self has successfully processed data after a call to gst_source_buffer_append_buffer.
Flags: Run Last
Since : 1.24
on-update-end
on_update_end_callback (GstSourceBuffer * self, gpointer user_data)
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.
Parameters:
self
–
The GstSourceBuffer that is no longer updating
user_data
–
Flags: Run Last
Since : 1.24
on-update-start
on_update_start_callback (GstSourceBuffer * self, gpointer user_data)
Emitted when self has begun to process data after a call to gst_source_buffer_append_buffer.
Parameters:
self
–
The GstSourceBuffer that has just started updating
user_data
–
Flags: Run Last
Since : 1.24
Properties
append-mode
“append-mode” GstSourceBufferAppendMode *
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 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.
Flags : Read / Write
Since : 1.24
append-window-end
“append-window-end” guint64
Any segments processed which have a start time greater than this value will be ignored by this Source Buffer.
Flags : Read
Since : 1.24
append-window-start
“append-window-start” guint64
Any segments processed which end before this value will be ignored by this Source Buffer.
Flags : Read
Since : 1.24
buffered
“buffered” gpointer *
The set of Time Intervals that have been loaded into the current Source Buffer
Flags : Read
Since : 1.24
content-type
“content-type” gchar *
The MIME content-type of the data stream
Flags : Read / Write / Construct
Since : 1.24
timestamp-offset
“timestamp-offset” gint64
The next media segment appended to the current Source Buffer will have its start timestamp increased by this amount.
Flags : Read / Write
Since : 1.24
updating
“updating” gboolean
Whether the current source buffer is still asynchronously processing previously issued commands.
Flags : Read
Since : 1.24
GstSourceBufferInterval
Members
start
(GstClockTime)
–
end
(GstClockTime)
–
Since : 1.24
Enumerations
The results of the search are