/**
* gst_ebml_write_flush_cache:
- * @ebml: a #GstEbmlWrite.
+ * @ebml: a #GstEbmlWrite.
+ * @timestamp: timestamp of the buffer.
*
* Flush the cache.
*/
void
-gst_ebml_write_flush_cache (GstEbmlWrite * ebml, gboolean is_keyframe)
+gst_ebml_write_flush_cache (GstEbmlWrite * ebml, gboolean is_keyframe,
+ GstClockTime timestamp)
{
GstBuffer *buffer;
ebml->cache = NULL;
GST_DEBUG ("Flushing cache of size %d", GST_BUFFER_SIZE (buffer));
gst_buffer_set_caps (buffer, ebml->caps);
+ GST_BUFFER_TIMESTAMP (buffer) = timestamp;
GST_BUFFER_OFFSET (buffer) = ebml->pos - GST_BUFFER_SIZE (buffer);
GST_BUFFER_OFFSET_END (buffer) = ebml->pos;
if (ebml->last_write_result == GST_FLOW_OK) {
return;
} else {
GST_LOG ("Seek outside cache range. Clearing...");
- gst_ebml_write_flush_cache (ebml, FALSE);
+ gst_ebml_write_flush_cache (ebml, FALSE, GST_CLOCK_TIME_NONE);
}
}
gst_ebml_write_uint (ebml, GST_EBML_ID_DOCTYPEVERSION, version);
gst_ebml_write_uint (ebml, GST_EBML_ID_DOCTYPEREADVERSION, version);
gst_ebml_write_master_finish (ebml, pos);
- gst_ebml_write_flush_cache (ebml, FALSE);
+ gst_ebml_write_flush_cache (ebml, FALSE, 0);
}
gst_ebml_write_master_finish (ebml, master);
/* lastly, flush the cache */
- gst_ebml_write_flush_cache (ebml, FALSE);
+ gst_ebml_write_flush_cache (ebml, FALSE, 0);
}
static void
}
gst_ebml_write_master_finish (ebml, master);
- gst_ebml_write_flush_cache (ebml, FALSE);
+ gst_ebml_write_flush_cache (ebml, FALSE, GST_CLOCK_TIME_NONE);
}
/* tags */
GST_LOG_OBJECT (mux, "cluster timestamp %" G_GUINT64_FORMAT,
gst_util_uint64_scale (GST_BUFFER_TIMESTAMP (buf), 1,
mux->time_scale));
- gst_ebml_write_flush_cache (ebml, TRUE);
+ gst_ebml_write_flush_cache (ebml, TRUE, GST_BUFFER_TIMESTAMP (buf));
mux->cluster_time = GST_BUFFER_TIMESTAMP (buf);
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_PREVSIZE,
mux->prev_cluster_size);
mux->cluster = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CLUSTER);
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CLUSTERTIMECODE,
gst_util_uint64_scale (GST_BUFFER_TIMESTAMP (buf), 1, mux->time_scale));
- gst_ebml_write_flush_cache (ebml, TRUE);
+ gst_ebml_write_flush_cache (ebml, TRUE, GST_BUFFER_TIMESTAMP (buf));
mux->cluster_time = GST_BUFFER_TIMESTAMP (buf);
}
gst_ebml_write_buffer_header (ebml, GST_MATROSKA_ID_SIMPLEBLOCK,
GST_BUFFER_SIZE (buf) + GST_BUFFER_SIZE (hdr));
gst_ebml_write_buffer (ebml, hdr);
- gst_ebml_write_flush_cache (ebml, FALSE);
+ gst_ebml_write_flush_cache (ebml, FALSE, GST_BUFFER_TIMESTAMP (buf));
gst_ebml_write_buffer (ebml, buf);
return gst_ebml_last_write_result (ebml);
GST_BUFFER_SIZE (buf) + GST_BUFFER_SIZE (hdr));
gst_ebml_write_buffer (ebml, hdr);
gst_ebml_write_master_finish_full (ebml, blockgroup, GST_BUFFER_SIZE (buf));
- gst_ebml_write_flush_cache (ebml, FALSE);
+ gst_ebml_write_flush_cache (ebml, FALSE, GST_BUFFER_TIMESTAMP (buf));
gst_ebml_write_buffer (ebml, buf);
+
return gst_ebml_last_write_result (ebml);
}
}