summaryrefslogtreecommitdiff
path: root/gst/gstevent.c
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2013-07-22 11:41:35 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-07-22 15:30:10 +0200
commit75d9454bf41c6637ab84cf7d151d8807bb30a96e (patch)
treed9b1e46ecbb08d6f5303552ad1a27600a6e7a678 /gst/gstevent.c
parente136416dcc8cb088afcfd24ed8646a8cbae7e73f (diff)
downloadgstreamer-75d9454bf41c6637ab84cf7d151d8807bb30a96e.tar.gz
gst: Add new group-id field to the stream-start event
All streams that have the same group id are supposed to be played together, i.e. all streams inside a container file should have the same group id but different stream ids. The group id should change each time the stream is started, resulting in different group ids each time a file is played for example.
Diffstat (limited to 'gst/gstevent.c')
-rw-r--r--gst/gstevent.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/gst/gstevent.c b/gst/gstevent.c
index 0874471986..f47c928f60 100644
--- a/gst/gstevent.c
+++ b/gst/gstevent.c
@@ -1474,6 +1474,57 @@ gst_event_parse_stream_flags (GstEvent * event, GstStreamFlags * flags)
}
/**
+ * gst_event_set_group_id:
+ * @event: a stream-start event
+ * @group_id: the group id to set
+ *
+ * All streams that have the same group id are supposed to be played
+ * together, i.e. all streams inside a container file should have the
+ * same group id but different stream ids. The group id should change
+ * each time the stream is started, resulting in different group ids
+ * each time a file is played for example.
+ *
+ * Use gst_util_group_id_next() to get a new group id.
+ *
+ * Since: 1.2
+ */
+void
+gst_event_set_group_id (GstEvent * event, guint group_id)
+{
+ g_return_if_fail (event != NULL);
+ g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START);
+ g_return_if_fail (gst_event_is_writable (event));
+
+ gst_structure_id_set (GST_EVENT_STRUCTURE (event),
+ GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL);
+}
+
+/**
+ * gst_event_parse_group_id:
+ * @event: a stream-start event
+ * @group_id: (out): address of variable where to store the group id
+ *
+ * Returns: %TRUE if a group id was set on the event and could be parsed,
+ * %FALSE otherwise.
+ *
+ * Since: 1.2
+ */
+gboolean
+gst_event_parse_group_id (GstEvent * event, guint * group_id)
+{
+ g_return_val_if_fail (event != NULL, FALSE);
+ g_return_val_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_START,
+ FALSE);
+
+ if (group_id) {
+ return gst_structure_id_get (GST_EVENT_STRUCTURE (event),
+ GST_QUARK (GROUP_ID), G_TYPE_UINT, group_id, NULL);
+ }
+
+ return TRUE;
+}
+
+/**
* gst_event_new_toc:
* @toc: (transfer none): #GstToc structure.
* @updated: whether @toc was updated or not.