+GstCaps *
+gst_ogg_demux_set_header_on_caps (GstOggDemux * ogg, GstCaps * caps,
+ GList * headers)
+{
+ GstStructure *structure;
+ GValue array = { 0 };
+
+ GST_LOG_OBJECT (ogg, "caps: %" GST_PTR_FORMAT, caps);
+
+ if (G_UNLIKELY (!caps))
+ return NULL;
+ if (G_UNLIKELY (!headers))
+ return NULL;
+
+ caps = gst_caps_make_writable (caps);
+ structure = gst_caps_get_structure (caps, 0);
+
+ g_value_init (&array, GST_TYPE_ARRAY);
+
+ while (headers) {
+ GValue value = { 0 };
+ GstBuffer *buffer;
+ ogg_packet *op = headers->data;
+ g_assert (op);
+ buffer = gst_buffer_new_and_alloc (op->bytes);
+ memcpy (GST_BUFFER_DATA (buffer), op->packet, op->bytes);
+ GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_IN_CAPS);
+ g_value_init (&value, GST_TYPE_BUFFER);
+ gst_value_take_buffer (&value, buffer);
+ gst_value_array_append_value (&array, &value);
+ g_value_unset (&value);
+ headers = headers->next;
+ }
+
+ gst_structure_set_value (structure, "streamheader", &array);
+ g_value_unset (&array);
+ GST_LOG_OBJECT (ogg, "here are the newly set caps: %" GST_PTR_FORMAT, caps);
+
+ return caps;
+}
+