adder: Collect incoming tag events and send them after newsegment. Fixes #588747

This commit is contained in:
Edward Hervey 2009-07-13 09:28:54 +02:00
parent 47d40c2553
commit 50b0cf2c03
2 changed files with 24 additions and 1 deletions

View file

@ -762,7 +762,7 @@ static gboolean
gst_adder_sink_event (GstPad * pad, GstEvent * event)
{
GstAdder *adder;
gboolean ret;
gboolean ret = TRUE;
adder = GST_ADDER (gst_pad_get_parent (pad));
@ -783,6 +783,12 @@ gst_adder_sink_event (GstPad * pad, GstEvent * event)
adder->flush_stop_pending = FALSE;
GST_OBJECT_UNLOCK (adder->collect);
break;
case GST_EVENT_TAG:
GST_OBJECT_LOCK (adder->collect);
/* collectpads is a pile of horse manure. */
adder->pending_events = g_list_append (adder->pending_events, event);
GST_OBJECT_UNLOCK (adder->collect);
goto beach;
default:
break;
}
@ -790,6 +796,7 @@ gst_adder_sink_event (GstPad * pad, GstEvent * event)
/* now GstCollectPads can take care of the rest, e.g. EOS */
ret = adder->collect_event (pad, event);
beach:
gst_object_unref (adder);
return ret;
}
@ -1148,6 +1155,19 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data)
}
}
if (G_UNLIKELY (adder->pending_events)) {
GList *tmp = adder->pending_events;
while (tmp) {
GstEvent *ev = (GstEvent *) tmp->data;
gst_pad_push_event (adder->srcpad, ev);
tmp = g_list_next (tmp);
}
g_list_free (adder->pending_events);
adder->pending_events = NULL;
}
/* set timestamps on the output buffer */
GST_BUFFER_TIMESTAMP (outbuf) = adder->timestamp;
GST_BUFFER_OFFSET (outbuf) = adder->offset;

View file

@ -92,6 +92,9 @@ struct _GstAdder {
/* target caps */
GstCaps *filter_caps;
/* Pending inline events */
GList *pending_events;
};
struct _GstAdderClass {