}
/* cues */
- if (mux->index != NULL && !mux->streamable) {
+ if (mux->index != NULL) {
guint n;
guint64 master, pointentry_master, trackpos_master;
/* tags */
tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (mux));
- if (tags != NULL && !gst_tag_list_is_empty (tags) && !mux->streamable) {
+ if (tags != NULL && !gst_tag_list_is_empty (tags)) {
guint64 master_tags, master_tag;
GST_DEBUG ("Writing tags");
* 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->streamable) {
- GST_DEBUG_OBJECT (mux, "not streamable");
- gst_ebml_replace_uint (ebml, mux->seekhead_pos + 32,
- mux->info_pos - mux->segment_master);
- gst_ebml_replace_uint (ebml, mux->seekhead_pos + 60,
- mux->tracks_pos - mux->segment_master);
- if (mux->index != NULL) {
- gst_ebml_replace_uint (ebml, mux->seekhead_pos + 88,
- mux->cues_pos - mux->segment_master);
- } else {
- /* void'ify */
- guint64 my_pos = ebml->pos;
-
- gst_ebml_write_seek (ebml, mux->seekhead_pos + 68);
- 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 + 116,
- mux->tags_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);
- }
+ gst_ebml_replace_uint (ebml, mux->seekhead_pos + 32,
+ mux->info_pos - mux->segment_master);
+ gst_ebml_replace_uint (ebml, mux->seekhead_pos + 60,
+ mux->tracks_pos - mux->segment_master);
+ if (mux->index != NULL) {
+ gst_ebml_replace_uint (ebml, mux->seekhead_pos + 88,
+ mux->cues_pos - mux->segment_master);
+ } else {
+ /* void'ify */
+ guint64 my_pos = ebml->pos;
- /* update duration */
- /* first get the overall duration */
- /* a released track may have left a duration in here */
- duration = mux->duration;
- for (collected = mux->collect->data; collected;
- collected = g_slist_next (collected)) {
- GstMatroskaPad *collect_pad;
- GstClockTime min_duration; /* observed minimum duration */
+ gst_ebml_write_seek (ebml, mux->seekhead_pos + 68);
+ 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 + 116,
+ mux->tags_pos - mux->segment_master);
+ } else {
+ /* void'ify */
+ guint64 my_pos = ebml->pos;
- collect_pad = (GstMatroskaPad *) collected->data;
+ 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);
+ }
- 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));
+ /* update duration */
+ /* first get the overall duration */
+ /* a released track may have left a duration in here */
+ duration = mux->duration;
+ for (collected = mux->collect->data; collected;
+ collected = g_slist_next (collected)) {
+ GstMatroskaPad *collect_pad;
+ GstClockTime min_duration; /* observed minimum duration */
- if (GST_CLOCK_TIME_IS_VALID (collect_pad->start_ts) &&
- GST_CLOCK_TIME_IS_VALID (collect_pad->end_ts)) {
- min_duration =
- 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_TIME_ARGS (collect_pad->duration));
- }
+ collect_pad = (GstMatroskaPad *) collected->data;
- if (GST_CLOCK_TIME_IS_VALID (collect_pad->duration) &&
- duration < collect_pad->duration)
- duration = collect_pad->duration;
- }
- if (duration != 0) {
- GST_DEBUG_OBJECT (mux, "final total duration: %" GST_TIME_FORMAT,
- GST_TIME_ARGS (duration));
- pos = mux->ebml_write->pos;
- gst_ebml_write_seek (ebml, mux->duration_pos);
- gst_ebml_write_float (ebml, GST_MATROSKA_ID_DURATION,
- gst_guint64_to_gdouble (duration) /
- gst_guint64_to_gdouble (mux->time_scale));
- gst_ebml_write_seek (ebml, pos);
- } else {
- /* void'ify */
- guint64 my_pos = ebml->pos;
+ 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));
+
+ if (GST_CLOCK_TIME_IS_VALID (collect_pad->start_ts) &&
+ GST_CLOCK_TIME_IS_VALID (collect_pad->end_ts)) {
+ min_duration =
+ 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_TIME_ARGS (collect_pad->duration));
+ }
+
+ if (GST_CLOCK_TIME_IS_VALID (collect_pad->duration) &&
+ duration < collect_pad->duration)
+ duration = collect_pad->duration;
+ }
+ if (duration != 0) {
+ GST_DEBUG_OBJECT (mux, "final total duration: %" GST_TIME_FORMAT,
+ GST_TIME_ARGS (duration));
+ pos = mux->ebml_write->pos;
+ gst_ebml_write_seek (ebml, mux->duration_pos);
+ gst_ebml_write_float (ebml, GST_MATROSKA_ID_DURATION,
+ gst_guint64_to_gdouble (duration) /
+ gst_guint64_to_gdouble (mux->time_scale));
+ gst_ebml_write_seek (ebml, pos);
+ } else {
+ /* void'ify */
+ guint64 my_pos = ebml->pos;
- gst_ebml_write_seek (ebml, mux->duration_pos);
- gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 8);
- gst_ebml_write_seek (ebml, my_pos);
- }
+ gst_ebml_write_seek (ebml, mux->duration_pos);
+ gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 8);
+ gst_ebml_write_seek (ebml, my_pos);
}
GST_DEBUG_OBJECT (mux, "finishing segment");
/* finish segment - this also writes element length */
/* if there is no best pad, we have reached EOS */
if (best == NULL) {
GST_DEBUG_OBJECT (mux, "No best pad finishing...");
- gst_matroska_mux_finish (mux);
+ if (!mux->streamable) {
+ gst_matroska_mux_finish (mux);
+ } else {
+ GST_DEBUG_OBJECT (mux, "... but streamable, nothing to finish");
+ }
gst_pad_push_event (mux->srcpad, gst_event_new_eos ());
ret = GST_FLOW_UNEXPECTED;
break;