pad: Add function to get sticky events from a pad

API: gst_pad_get_sticky_event()
This commit is contained in:
Sebastian Dröge 2011-05-18 16:26:31 +02:00
parent b1676b8c30
commit 6b30f0b056
2 changed files with 35 additions and 0 deletions

View file

@ -4875,6 +4875,39 @@ gst_pad_get_element_private (GstPad * pad)
return pad->element_private;
}
/**
* gst_pad_get_sticky_event:
* @pad: the #GstPad to get the event from.
* @event_type: the #GstEventType that should be retrieved.
* @active: If only active events should be retrieved
*
* Returns a new reference of the sticky event of type @event_type
* from the event. If @active is #TRUE only active events that
* were accepted downstream are returned.
*
* Returns: (transfer full): a #GstEvent of type @event_type. Unref after usage.
*/
GstEvent *
gst_pad_get_sticky_event (GstPad * pad, GstEventType event_type,
gboolean active)
{
GstEvent *event = NULL;
guint idx;
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
g_return_val_if_fail ((event_type & GST_EVENT_TYPE_STICKY) != 0, NULL);
idx = GST_EVENT_STICKY_IDX_TYPE (event_type);
if (!active || pad->priv->events[idx].active) {
if ((event = pad->priv->events[idx].event)) {
gst_event_ref (event);
}
}
return event;
}
static void
do_stream_status (GstPad * pad, GstStreamStatusType type,
GThread * thread, GstTask * task)

View file

@ -818,6 +818,8 @@ gpointer gst_pad_get_element_private (GstPad *pad);
GstPadTemplate* gst_pad_get_pad_template (GstPad *pad);
GstEvent* gst_pad_get_sticky_event (GstPad *pad, GstEventType event_type, gboolean active);
/* data passing setup functions */
void gst_pad_set_activate_function (GstPad *pad, GstPadActivateFunction activate);
void gst_pad_set_activatepull_function (GstPad *pad, GstPadActivateModeFunction activatepull);