Do not create a SeekHeader, Cues, .. when doing live

This commit is contained in:
Xavier Queralt 2010-05-21 01:59:53 +02:00 committed by Zaheer Abbas Merali
parent 032d9b90ff
commit 40eda471a1

View File

@ -2020,6 +2020,10 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_SEGMENT);
mux->segment_master = ebml->pos;
/* the rest of the header is cached */
gst_ebml_write_set_cache (ebml, 0x1000);
if (!mux->is_live) {
/* seekhead (table of contents) - we set the positions later */
mux->seekhead_pos = ebml->pos;
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_SEEKHEAD);
@ -2030,6 +2034,7 @@ gst_matroska_mux_start (GstMatroskaMux * mux)
gst_ebml_write_master_finish (ebml, child);
}
gst_ebml_write_master_finish (ebml, master);
}
/* segment info */
mux->info_pos = ebml->pos;
@ -2182,7 +2187,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
}
/* cues */
if (mux->index != NULL) {
if (mux->index != NULL && !mux->is_live) {
guint n;
guint64 master, pointentry_master, trackpos_master;
@ -2213,7 +2218,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
/* tags */
tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (mux));
if (tags != NULL && !gst_tag_list_is_empty (tags)) {
if (tags != NULL && !gst_tag_list_is_empty (tags) && !mux->is_live) {
guint64 master_tags, master_tag;
GST_DEBUG ("Writing tags");
@ -2237,6 +2242,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
* length pointer starts at 20.
* - all entries are local to the segment (so pos - segment_master).
* - so each entry is at 12 + 20 + num * 28. */
if (!mux->is_live) {
gst_ebml_replace_uint (ebml, mux->seekhead_pos + 32,
mux->info_pos - mux->segment_master);
gst_ebml_replace_uint (ebml, mux->seekhead_pos + 60,
@ -2275,7 +2281,8 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
collect_pad = (GstMatroskaPad *) collected->data;
GST_DEBUG_OBJECT (mux, "Pad %" GST_PTR_FORMAT " start ts %" GST_TIME_FORMAT
GST_DEBUG_OBJECT (mux,
"Pad %" GST_PTR_FORMAT " start ts %" GST_TIME_FORMAT
" end ts %" GST_TIME_FORMAT, collect_pad,
GST_TIME_ARGS (collect_pad->start_ts),
GST_TIME_ARGS (collect_pad->end_ts));
@ -2286,7 +2293,8 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
GST_CLOCK_DIFF (collect_pad->start_ts, collect_pad->end_ts);
if (collect_pad->duration < min_duration)
collect_pad->duration = min_duration;
GST_DEBUG_OBJECT (collect_pad, "final track duration: %" GST_TIME_FORMAT,
GST_DEBUG_OBJECT (collect_pad,
"final track duration: %" GST_TIME_FORMAT,
GST_TIME_ARGS (collect_pad->duration));
}
@ -2311,7 +2319,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 8);
gst_ebml_write_seek (ebml, my_pos);
}
}
/* finish segment - this also writes element length */
gst_ebml_write_master_finish (ebml, mux->segment_pos);
}