+ * gst_event_parse_caps:
+ * @event: The event to parse
+ * @caps: (out): A pointer to the caps
+ *
+ * Get the caps from @event. The caps remains valid as long as @event remains
+ * valid.
+ */
+void
+gst_event_parse_caps (GstEvent * event, GstCaps ** caps)
+{
+ GstStructure *structure;
+
+ g_return_if_fail (GST_IS_EVENT (event));
+ g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_CAPS);
+
+ structure = GST_EVENT_STRUCTURE (event);
+ if (G_LIKELY (caps))
+ *caps =
+ g_value_get_boxed (gst_structure_id_get_value (structure,
+ GST_QUARK (CAPS)));
+}
+
+/**
+ * gst_event_new_stream_config:
+ * @flags: the stream config flags
+ *
+ * Create a new STREAM CONFIG event. The stream config event travels
+ * downstream synchronized with the buffer flow and contains stream
+ * configuration information for the stream, such as stream-headers
+ * or setup-data. It is optional and should be sent after the CAPS
+ * event.
+ *
+ * Returns: (transfer full): the new STREAM CONFIG event.
+ */
+GstEvent *
+gst_event_new_stream_config (GstStreamConfigFlags flags)
+{
+ GstEvent *event;
+
+ GST_CAT_INFO (GST_CAT_EVENT, "creating stream info event, flags=0x%x", flags);
+
+ event = gst_event_new_custom (GST_EVENT_STREAM_CONFIG,
+ gst_structure_new_id (GST_QUARK (EVENT_STREAM_CONFIG),
+ GST_QUARK (FLAGS), GST_TYPE_STREAM_CONFIG_FLAGS, flags, NULL));
+
+ return event;
+}
+
+/**
+ * gst_event_parse_stream_config:
+ * @event: The event to parse
+ * @flags: (out): a pointer to a variable to store the stream config flags
+ *
+ * Get the stream config flags from @event.
+ */
+void
+gst_event_parse_stream_config (GstEvent * event, GstStreamConfigFlags * flags)
+{
+ GstStructure *structure;
+
+ g_return_if_fail (GST_IS_EVENT (event));
+ g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG);
+
+ structure = GST_EVENT_STRUCTURE (event);
+ if (G_LIKELY (flags != NULL)) {
+ *flags =
+ g_value_get_enum (gst_structure_id_get_value (structure,
+ GST_QUARK (FLAGS)));
+ }
+}
+
+/**
+ * gst_event_set_stream_config_setup_data:
+ * @event: a stream config event
+ * @buf: a #GstBuffer with setup data
+ *
+ * Set setup data on the stream info event to signal out of bound setup data
+ * to downstream elements. Unlike stream headers, setup data contains data
+ * that is required to interpret the data stream, but is not valid as-is
+ * inside the data stream and thus can't just be prepended to or inserted
+ * into the data stream.
+ */
+void
+gst_event_set_stream_config_setup_data (GstEvent * event, GstBuffer * buf)
+{
+ GstStructure *s;
+
+ g_return_if_fail (GST_IS_EVENT (event));
+ g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG);
+ g_return_if_fail (GST_IS_BUFFER (buf) && gst_buffer_get_size (buf) > 0);
+
+ s = GST_EVENT_STRUCTURE (event);
+ gst_structure_id_set (s, GST_QUARK (SETUP_DATA), GST_TYPE_BUFFER, buf, NULL);
+}
+
+/**
+ * gst_event_parse_stream_config_setup_data:
+ * @event: a stream config event
+ * @buf: (out) (transfer none): location where to store the #GstBuffer with setup data
+ *
+ * Extracts the setup data buffer from the stream info event. Will store
+ * %NULL in @buf if the event contains no setup data. The buffer returned
+ * will remain valid as long as @event remains valid. The caller should
+ * acquire a reference to to @buf if needed.
+ *
+ * Returns: TRUE if @event contained setup data and @buf has been set,
+ * otherwise FALSE.
+ */
+gboolean
+gst_event_parse_stream_config_setup_data (GstEvent * event, GstBuffer ** buf)
+{
+ const GValue *val;
+ GstStructure *s;
+
+ g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
+ g_return_val_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG,
+ FALSE);
+ g_return_val_if_fail (buf != NULL, FALSE);
+
+ s = GST_EVENT_STRUCTURE (event);
+ val = gst_structure_id_get_value (s, GST_QUARK (SETUP_DATA));
+ if (val != NULL)
+ *buf = g_value_get_boxed (val);
+ else
+ *buf = NULL;
+
+ return (*buf != NULL);
+}
+
+/**
+ * gst_event_add_stream_config_header:
+ * @event: a stream config event
+ * @buf: a #GstBuffer with stream header data
+ *
+ * Adds a stream header to the stream info event to signal stream headers to
+ * to downstream elements such as multifilesink, tcpserversink etc. Stream
+ * headers can be and should usually be prepended to the data stream at any
+ * point in the stream (which requires a streamable format), e.g. to a new
+ * client connecting, or when starting a new file segment. stream header
+ * buffers will all be used together in the order they were added to the
+ * stream config event. Stream headers are sent as buffers at the beginning
+ * of the data flow in addition to the stream config event. Elements that
+ * care about stream headers need to make sure that they don't insert or
+ * interpret these header buffers twice if they interpret them.