{
GstEvent *event;
gboolean res;
+ gboolean dispatched;
} EventData;
static gboolean
data->res |= gst_pad_push_event (pad, gst_event_ref (data->event));
+ data->dispatched = TRUE;
+
/* don't stop */
return FALSE;
}
* @pad: a #GstPad
* @event: (transfer full): the #GstEvent to handle.
*
- * Forward @event to all internally linked pads of @pad.
+ * Forward @event to all internally linked pads of @pad. This function takes
+ * ownership of @event.
*
* Returns: TRUE if the event was sent succesfully.
*/
gboolean
gst_pad_event_forward (GstPad * pad, GstEvent * event)
{
+ gboolean res;
EventData data;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
gst_pad_forward (pad, (GstPadForwardFunction) event_forward_func, &data);
- return data.res;
+ gst_event_unref (event);
+
+ /* for sinkpads without a parent element or without internal links, nothing
+ * will be dispatched but we still want to return TRUE. */
+ if (data.dispatched)
+ res = data.res;
+ else
+ res = TRUE;
+
+ return res;
}
/**
*
* The CAPS event will never be forwarded.
*
- * The the event is sent to all pads internally linked to @pad.
+ * The the event is sent to all pads internally linked to @pad. This function
+ * takes ownership of @event.
*
* Returns: TRUE if the event was sent succesfully.
*/