summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8df1fda)
raw | patch | inline | side by side (parent: 8df1fda)
author | Alessandro Decina <alessandro.decina@collabora.co.uk> | |
Mon, 5 Jul 2010 10:56:40 +0000 (12:56 +0200) | ||
committer | Alessandro Decina <alessandro.d@gmail.com> | |
Tue, 6 Jul 2010 08:46:42 +0000 (10:46 +0200) |
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.
allows passing a GDestroyNotify to destroy user_data.
gst/gstclock.c | patch | blob | history | |
gst/gstclock.h | patch | blob | history |
diff --git a/gst/gstclock.c b/gst/gstclock.c
index 925823f43e3b649387889f91ab7a1e84683e9db0..ccc928b3f61c45718a592fc513f8fd3fb27cacd8 100644 (file)
--- a/gst/gstclock.c
+++ b/gst/gstclock.c
entry->status = GST_CLOCK_OK;
entry->func = NULL;
entry->user_data = NULL;
+ entry->destroy_data = NULL;
return (GstClockID) entry;
}
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);
}
/**
- * 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
* 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;
entry->func = func;
entry->user_data = user_data;
+ entry->destroy_data = destroy_data;
res = cclass->wait_async (clock, entry);
}
}
+/**
+ * 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
diff --git a/gst/gstclock.h b/gst/gstclock.h
index c0d65c5ec8c7e7125742b32f0ed0c8637824628e..8710dfa67613351a3d420f369e4429d4850de538 100644 (file)
--- a/gst/gstclock.h
+++ b/gst/gstclock.h
GstClockReturn status;
GstClockCallback func;
gpointer user_data;
+ GDestroyNotify destroy_data;
};
/**
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);