summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2018-03-08 10:10:01 +0100
committerEdward Hervey <bilboed@bilboed.com>2018-03-09 12:11:23 +0100
commitac840248106c62cedc2814ca0fd43598968f3e13 (patch)
treefd4b97c3ed3abc1de0f05ef763154bd7336028f5
parent9700dcb1e464a815b21fac1060de9619ae76f391 (diff)
qtmux: Add comments and doc about prefill mode
-rw-r--r--gst/isomp4/gstqtmux.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c
index 8808203ac..9c2609c09 100644
--- a/gst/isomp4/gstqtmux.c
+++ b/gst/isomp4/gstqtmux.c
@@ -97,6 +97,17 @@
* #GstQTMux::reserved-duration-remaining property to see how close to full
* the reserved space is becoming.
*
+ * Applications that wish to be able to use/edit a file while it is being
+ * written to by live content, can use the "Robust Prefill Muxing" mode. That
+ * mode is a variant of the "Robust Muxing" mode in that it will pre-allocate a
+ * completely valid header from the start for all tracks (i.e. it appears as
+ * though the file is "reserved-max-duration" long with all samples
+ * present). This mode can be enabled by setting the
+ * #GstQTMux::reserved-moov-update-period and #GstQTMux::reserved-prefill
+ * properties. Note that this mode is only possible with input streams that have
+ * a fixed sample size (such as raw audio and Prores Video) and that don't
+ * have reordered samples.
+ *
* <refsect2>
* <title>Example pipelines</title>
* |[
@@ -2547,12 +2558,17 @@ prefill_update_sample_size (GstQTMux * qtmux, GstQTPad * qpad)
}
}
+/* Only called at startup when doing the "fake" iteration of all tracks in order
+ * to prefill the sample tables in the header. */
static GstQTPad *
-find_best_pad_prefill (GstQTMux * qtmux)
+find_best_pad_prefill_start (GstQTMux * qtmux)
{
GSList *walk;
GstQTPad *best_pad = NULL;
+ /* If interleave limits have been specified and the current pad is within
+ * those interleave limits, pick that one, otherwise let's try to figure out
+ * the next best one. */
if (qtmux->current_pad &&
(qtmux->interleave_bytes != 0 || qtmux->interleave_time != 0) &&
(qtmux->interleave_bytes == 0
@@ -2566,9 +2582,13 @@ find_best_pad_prefill (GstQTMux * qtmux)
best_pad = qtmux->current_pad;
}
} else if (qtmux->collect->data->next) {
+ /* Attempt to try another pad if we have one. Otherwise use the only pad
+ * present */
best_pad = qtmux->current_pad = NULL;
}
+ /* The next best pad is the one which has the lowest timestamp and hasn't
+ * exceeded the reserved max duration */
if (!best_pad) {
GstClockTime best_time = GST_CLOCK_TIME_NONE;
@@ -2593,6 +2613,11 @@ find_best_pad_prefill (GstQTMux * qtmux)
return best_pad;
}
+/* Called when starting the file in prefill_mode to figure out all the entries
+ * of the header based on the input stream and reserved maximum duration.
+ *
+ * The _actual_ header (i.e. with the proper duration and trimmed sample tables)
+ * will be updated and written on EOS. */
static gboolean
gst_qt_mux_prefill_samples (GstQTMux * qtmux)
{
@@ -2650,7 +2675,7 @@ gst_qt_mux_prefill_samples (GstQTMux * qtmux)
}
}
- while ((qpad = find_best_pad_prefill (qtmux))) {
+ while ((qpad = find_best_pad_prefill_start (qtmux))) {
GstClockTime timestamp, next_timestamp, duration;
guint nsamples, sample_size;
guint64 chunk_offset;