mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
clock: add gst_clock_id_wait_async_full.
Add gst_clock_id_wait_async_full. It's the same as gst_clock_id_wait_async but allows passing a GDestroyNotify to destroy user_data.
This commit is contained in:
parent
8df1fdab57
commit
dda8663811
2 changed files with 43 additions and 3 deletions
|
@ -202,6 +202,7 @@ gst_clock_entry_new (GstClock * clock, GstClockTime time,
|
|||
entry->status = GST_CLOCK_OK;
|
||||
entry->func = NULL;
|
||||
entry->user_data = NULL;
|
||||
entry->destroy_data = NULL;
|
||||
|
||||
return (GstClockID) entry;
|
||||
}
|
||||
|
@ -229,9 +230,13 @@ gst_clock_id_ref (GstClockID id)
|
|||
static void
|
||||
_gst_clock_id_free (GstClockID id)
|
||||
{
|
||||
GstClockEntry *entry;
|
||||
g_return_if_fail (id != NULL);
|
||||
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "freed entry %p", id);
|
||||
entry = (GstClockEntry *) id;
|
||||
if (entry->destroy_data)
|
||||
entry->destroy_data (entry->user_data);
|
||||
|
||||
#ifndef GST_DISABLE_TRACE
|
||||
gst_alloc_trace_free (_gst_clock_entry_trace, id);
|
||||
|
@ -457,10 +462,11 @@ not_supported:
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_clock_id_wait_async:
|
||||
* gst_clock_id_wait_async_full:
|
||||
* @id: a #GstClockID to wait on
|
||||
* @func: The callback function
|
||||
* @user_data: User data passed in the callback
|
||||
* @destroy_data: #GDestroyNotify for user_data
|
||||
*
|
||||
* Register a callback on the given #GstClockID @id with the given
|
||||
* function and user_data. When passing a #GstClockID with an invalid
|
||||
|
@ -474,10 +480,12 @@ not_supported:
|
|||
* Returns: the result of the non blocking wait.
|
||||
*
|
||||
* MT safe.
|
||||
*
|
||||
* Since: 0.10.30
|
||||
*/
|
||||
GstClockReturn
|
||||
gst_clock_id_wait_async (GstClockID id,
|
||||
GstClockCallback func, gpointer user_data)
|
||||
gst_clock_id_wait_async_full (GstClockID id,
|
||||
GstClockCallback func, gpointer user_data, GDestroyNotify destroy_data)
|
||||
{
|
||||
GstClockEntry *entry;
|
||||
GstClock *clock;
|
||||
|
@ -503,6 +511,7 @@ gst_clock_id_wait_async (GstClockID id,
|
|||
|
||||
entry->func = func;
|
||||
entry->user_data = user_data;
|
||||
entry->destroy_data = destroy_data;
|
||||
|
||||
res = cclass->wait_async (clock, entry);
|
||||
|
||||
|
@ -523,6 +532,32 @@ not_supported:
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clock_id_wait_async:
|
||||
* @id: a #GstClockID to wait on
|
||||
* @func: The callback function
|
||||
* @user_data: User data passed in the callback
|
||||
*
|
||||
* Register a callback on the given #GstClockID @id with the given
|
||||
* function and user_data. When passing a #GstClockID with an invalid
|
||||
* time to this function, the callback will be called immediately
|
||||
* with a time set to GST_CLOCK_TIME_NONE. The callback will
|
||||
* be called when the time of @id has been reached.
|
||||
*
|
||||
* The callback @func can be invoked from any thread, either provided by the
|
||||
* core or from a streaming thread. The application should be prepared for this.
|
||||
*
|
||||
* Returns: the result of the non blocking wait.
|
||||
*
|
||||
* MT safe.
|
||||
*/
|
||||
GstClockReturn
|
||||
gst_clock_id_wait_async (GstClockID id,
|
||||
GstClockCallback func, gpointer user_data)
|
||||
{
|
||||
return gst_clock_id_wait_async_full (id, func, user_data, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clock_id_unschedule:
|
||||
* @id: The id to unschedule
|
||||
|
|
|
@ -346,6 +346,7 @@ struct _GstClockEntry {
|
|||
GstClockReturn status;
|
||||
GstClockCallback func;
|
||||
gpointer user_data;
|
||||
GDestroyNotify destroy_data;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -544,6 +545,10 @@ GstClockReturn gst_clock_id_wait (GstClockID id,
|
|||
GstClockReturn gst_clock_id_wait_async (GstClockID id,
|
||||
GstClockCallback func,
|
||||
gpointer user_data);
|
||||
GstClockReturn gst_clock_id_wait_async_full (GstClockID id,
|
||||
GstClockCallback func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_data);
|
||||
void gst_clock_id_unschedule (GstClockID id);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue