mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:36:20 +00:00
context: add foreach function
Add a function to iterate over all stored events.
This commit is contained in:
parent
c4751ec8c1
commit
08dbe37f6f
2 changed files with 23 additions and 0 deletions
|
@ -181,3 +181,22 @@ gst_context_clear (GstContext * context)
|
||||||
for (i = 0; i < GST_EVENT_MAX_STICKY; i++)
|
for (i = 0; i < GST_EVENT_MAX_STICKY; i++)
|
||||||
gst_event_replace (&context->events[i], NULL);
|
gst_event_replace (&context->events[i], NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_context_foreach:
|
||||||
|
* @context: a #GstContext
|
||||||
|
* @func: a #GFunc
|
||||||
|
* @user_data: user data
|
||||||
|
*
|
||||||
|
* Call @func with the non NULL event and @user_data.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_context_foreach (GstContext * context, GFunc func, gpointer user_data)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
GstEvent *event;
|
||||||
|
|
||||||
|
for (i = 0; i < GST_EVENT_MAX_STICKY; i++)
|
||||||
|
if ((event = context->events[i]))
|
||||||
|
func (event, user_data);
|
||||||
|
}
|
||||||
|
|
|
@ -134,11 +134,15 @@ gst_context_copy (const GstContext * context)
|
||||||
|
|
||||||
GstContext * gst_context_new (void);
|
GstContext * gst_context_new (void);
|
||||||
|
|
||||||
|
/* updating and setting events */
|
||||||
void gst_context_update (GstContext *context, GstEvent *event);
|
void gst_context_update (GstContext *context, GstEvent *event);
|
||||||
GstEvent * gst_context_get (GstContext *context, GstEventType type);
|
GstEvent * gst_context_get (GstContext *context, GstEventType type);
|
||||||
|
|
||||||
void gst_context_clear (GstContext *context);
|
void gst_context_clear (GstContext *context);
|
||||||
|
|
||||||
|
/* foreach */
|
||||||
|
void gst_context_foreach (GstContext *context, GFunc func, gpointer user_data);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_CONTEXT_H__ */
|
#endif /* __GST_CONTEXT_H__ */
|
||||||
|
|
Loading…
Reference in a new issue