{
g_list_foreach (stream->headers, (GFunc) gst_mini_object_unref, NULL);
g_list_foreach (stream->unknown_pages, (GFunc) gst_mini_object_unref, NULL);
+ g_list_foreach (stream->stored_buffers, (GFunc) gst_mini_object_unref, NULL);
g_free (stream);
}
static GstBuffer *
gst_ogg_parse_buffer_from_page (ogg_page * page,
- guint64 offset, gboolean keyframe, GstClockTime timestamp)
+ guint64 offset, GstClockTime timestamp)
{
int size = page->header_len + page->body_len;
GstBuffer *buf = gst_buffer_new_and_alloc (size);
GST_BUFFER_TIMESTAMP (buf) = timestamp;
GST_BUFFER_OFFSET (buf) = offset;
GST_BUFFER_OFFSET_END (buf) = offset + size;
- if (!keyframe) {
- GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
- }
return buf;
}
keyframe = TRUE;
}
pagebuffer = gst_ogg_parse_buffer_from_page (&page, startoffset,
- keyframe, buffertimestamp);
+ buffertimestamp);
/* We read out 'ret' bytes, so we set the next offset appropriately */
ogg->offset += ret;
g_list_free (stream->unknown_pages);
stream->unknown_pages = NULL;
}
+ }
- gst_buffer_set_caps (pagebuffer, caps);
-
- result = gst_pad_push (ogg->srcpad, GST_BUFFER (pagebuffer));
- if (result != GST_FLOW_OK)
- return result;
+ if (granule == -1) {
+ stream->stored_buffers = g_list_append (stream->stored_buffers,
+ pagebuffer);
} else {
- /* Normal data page, submit buffer */
+ if (stream->stored_buffers) {
+ int j;
+
+ for (j = 0; j < g_list_length (stream->stored_buffers); j++) {
+ GstBuffer *buf =
+ GST_BUFFER (g_list_nth_data (stream->stored_buffers, j));
+
+ gst_buffer_set_caps (buf, ogg->caps);
+ GST_BUFFER_TIMESTAMP (buf) = buffertimestamp;
+ if (!keyframe) {
+ GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
+ } else {
+ keyframe = FALSE;
+ }
+
+ result = gst_pad_push (ogg->srcpad, buf);
+ if (result != GST_FLOW_OK)
+ return result;
+ }
+ g_list_free (stream->stored_buffers);
+ stream->stored_buffers = NULL;
+ }
+
gst_buffer_set_caps (pagebuffer, ogg->caps);
+ if (!keyframe) {
+ GST_BUFFER_FLAG_SET (pagebuffer, GST_BUFFER_FLAG_DELTA_UNIT);
+ } else {
+ keyframe = FALSE;
+ }
+
result = gst_pad_push (ogg->srcpad, GST_BUFFER (pagebuffer));
if (result != GST_FLOW_OK)
return result;