summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-05-01 14:20:59 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-05-01 14:20:59 +0200
commitad1c01661fcebe45c39aa51b55ad59be3213aa07 (patch)
tree3d4fb69a376e83dddcbb238b211a602483b9cb2d
parent1e1cf5df7042cc3cc989a0ad24d65b0cfda2e3cc (diff)
matroskamux: Write previous cluster's size
This is useful for backwards playback, which should be implemented in matroskademux at some point.
-rw-r--r--gst/matroska/matroska-mux.c4
-rw-r--r--gst/matroska/matroska-mux.h3
2 files changed, 6 insertions, 1 deletions
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c
index beda47134..b40d165cb 100644
--- a/gst/matroska/matroska-mux.c
+++ b/gst/matroska/matroska-mux.c
@@ -538,6 +538,7 @@ gst_matroska_mux_reset (GstElement * element)
mux->cluster = 0;
mux->cluster_time = 0;
mux->cluster_pos = 0;
+ mux->prev_cluster_size = 0;
/* reset tags */
gst_tag_setter_reset_tags (GST_TAG_SETTER (mux));
@@ -2509,12 +2510,15 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
|| is_video_keyframe) {
gst_ebml_write_master_finish (ebml, mux->cluster);
+ mux->prev_cluster_size = ebml->pos - mux->cluster_pos;
mux->cluster_pos = ebml->pos;
mux->cluster =
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CLUSTER);
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CLUSTERTIMECODE,
GST_BUFFER_TIMESTAMP (buf) / mux->time_scale);
mux->cluster_time = GST_BUFFER_TIMESTAMP (buf);
+ gst_ebml_write_uint (ebml, GST_MATROSKA_ID_PREVSIZE,
+ mux->prev_cluster_size);
}
} else {
/* first cluster */
diff --git a/gst/matroska/matroska-mux.h b/gst/matroska/matroska-mux.h
index 201df0cda..08b07baf4 100644
--- a/gst/matroska/matroska-mux.h
+++ b/gst/matroska/matroska-mux.h
@@ -116,7 +116,8 @@ typedef struct _GstMatroskaMux {
/* current cluster */
guint64 cluster,
cluster_time,
- cluster_pos;
+ cluster_pos,
+ prev_cluster_size;
} GstMatroskaMux;