basesrc: Serialize tags into the dataflow. Fixes #588745

This commit is contained in:
Edward Hervey 2009-07-12 10:04:01 +02:00
parent 79c8e24885
commit 1d0c6a669f

View file

@ -232,6 +232,9 @@ struct _GstBaseSrcPrivate
/* stream sequence number */ /* stream sequence number */
guint32 seqnum; guint32 seqnum;
/* pending tags to be pushed in the data stream */
GList *pending_tags;
}; };
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
@ -438,6 +441,11 @@ gst_base_src_finalize (GObject * object)
event_p = &basesrc->data.ABI.pending_seek; event_p = &basesrc->data.ABI.pending_seek;
gst_event_replace (event_p, NULL); gst_event_replace (event_p, NULL);
if (basesrc->priv->pending_tags) {
g_list_foreach (basesrc->priv->pending_tags, (GFunc) gst_event_unref, NULL);
g_list_free (basesrc->priv->pending_tags);
}
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
@ -1444,7 +1452,10 @@ gst_base_src_send_event (GstElement * element, GstEvent * event)
/* sending random NEWSEGMENT downstream can break sync. */ /* sending random NEWSEGMENT downstream can break sync. */
break; break;
case GST_EVENT_TAG: case GST_EVENT_TAG:
/* sending tags could be useful, FIXME insert in dataflow */ /* Insert tag in the dataflow */
src->priv->pending_tags =
g_list_append (src->priv->pending_tags, gst_event_ref (event));
result = TRUE;
break; break;
case GST_EVENT_BUFFERSIZE: case GST_EVENT_BUFFERSIZE:
/* does not seem to make much sense currently */ /* does not seem to make much sense currently */
@ -2215,6 +2226,20 @@ gst_base_src_loop (GstPad * pad)
src->priv->start_segment = NULL; src->priv->start_segment = NULL;
} }
/* Push out pending tags if any */
if (G_UNLIKELY (src->priv->pending_tags)) {
GList *tmp = src->priv->pending_tags;
while (tmp) {
GstEvent *ev = (GstEvent *) tmp->data;
gst_pad_push_event (pad, ev);
tmp = g_list_next (tmp);
}
g_list_free (src->priv->pending_tags);
src->priv->pending_tags = NULL;
}
/* figure out the new position */ /* figure out the new position */
switch (src->segment.format) { switch (src->segment.format) {
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES: