gboolean do_timestamp;
volatile gint dynamic_size;
+ volatile gint automatic_eos;
/* stream sequence number */
guint32 seqnum;
g_cond_init (&basesrc->live_cond);
basesrc->num_buffers = DEFAULT_NUM_BUFFERS;
basesrc->num_buffers_left = -1;
+ basesrc->priv->automatic_eos = TRUE;
basesrc->can_activate_push = TRUE;
}
/**
+ * gst_base_src_set_automatic_eos:
+ * @src: base source instance
+ * @automatic_eos: automatic eos
+ *
+ * If @automatic_eos is %TRUE, basesrc will automatically go EOS if a buffer
+ * after the total size is returned. By default this is %TRUE but sources
+ * that can't return an authoritative size and only know that they're EOS
+ * when trying to read more should set this to %FALSE.
+ *
+ * Since: 1.4
+ */
+void
+gst_base_src_set_automatic_eos (GstBaseSrc * src, gboolean automatic_eos)
+{
+ g_return_if_fail (GST_IS_BASE_SRC (src));
+
+ g_atomic_int_set (&src->priv->automatic_eos, automatic_eos);
+}
+
+/**
* gst_base_src_set_async:
* @src: base source instance
* @async: new async mode
stop = src->segment.stop;
/* get total file size */
size = src->segment.duration;
+ if (!g_atomic_int_get (&src->priv->automatic_eos))
+ size = -1;
/* only operate if we are working with bytes */
if (format != GST_FORMAT_BYTES)
/* the max amount of bytes to read is the total size or
* up to the segment.stop if present. */
if (stop != -1)
- maxsize = MIN (size, stop);
+ maxsize = size != -1 ? MIN (size, stop) : stop;
else
maxsize = size;