summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--gst/matroska/matroska-mux.c62
-rw-r--r--gst/matroska/matroska-mux.h4
3 files changed, 11 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog
index 9beba234..ed5cf867 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2008-06-15 Sebastian Dröge <slomo@circular-chaos.org>
+ * gst/matroska/matroska-mux.c: (gst_matroska_mux_reset),
+ (gst_matroska_mux_start), (gst_matroska_mux_finish),
+ (gst_matroska_mux_write_data):
+ * gst/matroska/matroska-mux.h:
+ Don't write another SeekHead which indexes all Clusters to the end of
+ the file. This isn't useful for anything and just increases filesize.
+
+2008-06-15 Sebastian Dröge <slomo@circular-chaos.org>
+
* gst/matroska/ebml-read.c: (_ext2dbl), (gst_ebml_read_float):
Prevent unaligned memory access when reading floats.
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c
index 58d42ae9..9b5ba255 100644
--- a/gst/matroska/matroska-mux.c
+++ b/gst/matroska/matroska-mux.c
@@ -419,11 +419,6 @@ gst_matroska_mux_reset (GstElement * element)
mux->cluster_time = 0;
mux->cluster_pos = 0;
- /* reset meta-seek index */
- mux->num_meta_indexes = 0;
- g_free (mux->meta_index);
- mux->meta_index = NULL;
-
/* reset tags */
if (mux->tags) {
gst_tag_list_free (mux->tags);
@@ -1386,7 +1381,6 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
guint32 seekhead_id[] = { GST_MATROSKA_ID_SEGMENTINFO,
GST_MATROSKA_ID_TRACKS,
GST_MATROSKA_ID_CUES,
- GST_MATROSKA_ID_SEEKHEAD,
GST_MATROSKA_ID_TAGS,
0
};
@@ -1621,29 +1615,6 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
gst_ebml_write_flush_cache (ebml);
}
- if (mux->meta_index != NULL) {
- guint n;
-
- guint64 master, seekentry_master;
-
- mux->meta_pos = ebml->pos;
- gst_ebml_write_set_cache (ebml, 12 + 28 * mux->num_meta_indexes);
- master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_SEEKHEAD);
-
- for (n = 0; n < mux->num_meta_indexes; n++) {
- GstMatroskaMetaSeekIndex *idx = &mux->meta_index[n];
-
- seekentry_master = gst_ebml_write_master_start (ebml,
- GST_MATROSKA_ID_SEEKENTRY);
- gst_ebml_write_uint (ebml, GST_MATROSKA_ID_SEEKID, idx->id);
- gst_ebml_write_uint (ebml, GST_MATROSKA_ID_SEEKPOSITION,
- idx->pos - mux->segment_master);
- gst_ebml_write_master_finish (ebml, seekentry_master);
- }
- gst_ebml_write_master_finish (ebml, master);
- }
- gst_ebml_write_flush_cache (ebml);
-
/* tags */
tags = gst_tag_list_merge (gst_tag_setter_get_tag_list (GST_TAG_SETTER (mux)),
mux->tags, GST_TAG_MERGE_APPEND);
@@ -1686,25 +1657,14 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 26);
gst_ebml_write_seek (ebml, my_pos);
}
- if (mux->meta_index != NULL) {
- gst_ebml_replace_uint (ebml, mux->seekhead_pos + 116,
- mux->meta_pos - mux->segment_master);
- } else {
- /* void'ify */
- guint64 my_pos = ebml->pos;
-
- gst_ebml_write_seek (ebml, mux->seekhead_pos + 96);
- gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 26);
- gst_ebml_write_seek (ebml, my_pos);
- }
if (tags != NULL) {
- gst_ebml_replace_uint (ebml, mux->seekhead_pos + 144,
+ gst_ebml_replace_uint (ebml, mux->seekhead_pos + 116,
mux->tags_pos - mux->segment_master);
} else {
/* void'ify */
guint64 my_pos = ebml->pos;
- gst_ebml_write_seek (ebml, mux->seekhead_pos + 124);
+ gst_ebml_write_seek (ebml, mux->seekhead_pos + 96);
gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 26);
gst_ebml_write_seek (ebml, my_pos);
}
@@ -1902,7 +1862,6 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
/* start a new cluster every two seconds or at keyframe */
if (mux->cluster_time + GST_SECOND * 2 < GST_BUFFER_TIMESTAMP (buf)
|| is_video_keyframe) {
- GstMatroskaMetaSeekIndex *idx;
gst_ebml_write_master_finish (ebml, mux->cluster);
mux->cluster_pos = ebml->pos;
@@ -1911,32 +1870,15 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CLUSTERTIMECODE,
GST_BUFFER_TIMESTAMP (buf) / mux->time_scale);
mux->cluster_time = GST_BUFFER_TIMESTAMP (buf);
-
- if (mux->num_meta_indexes % 32 == 0) {
- mux->meta_index = g_renew (GstMatroskaMetaSeekIndex, mux->meta_index,
- mux->num_meta_indexes + 32);
- }
- idx = &mux->meta_index[mux->num_meta_indexes++];
- idx->id = GST_MATROSKA_ID_CLUSTER;
- idx->pos = mux->cluster_pos;
}
} else {
/* first cluster */
- GstMatroskaMetaSeekIndex *idx;
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);
-
- if (mux->num_meta_indexes % 32 == 0) {
- mux->meta_index = g_renew (GstMatroskaMetaSeekIndex, mux->meta_index,
- mux->num_meta_indexes + 32);
- }
- idx = &mux->meta_index[mux->num_meta_indexes++];
- idx->id = GST_MATROSKA_ID_CLUSTER;
- idx->pos = mux->cluster_pos;
}
cluster = mux->cluster;
diff --git a/gst/matroska/matroska-mux.h b/gst/matroska/matroska-mux.h
index 85d92550..867cf086 100644
--- a/gst/matroska/matroska-mux.h
+++ b/gst/matroska/matroska-mux.h
@@ -129,10 +129,6 @@ typedef struct _GstMatroskaMux {
cluster_time,
cluster_pos;
- /* meta-seek info */
- GstMatroskaMetaSeekIndex *meta_index;
- guint num_meta_indexes;
-
/* tags */
GstTagList *tags;
} GstMatroskaMux;