Commit b4285611 authored by Edward Hervey's avatar Edward Hervey 🤘

gstclock: New API to re-use a single shot GstClockID

API: gst_clock_single_shot_id_reinit

https://bugzilla.gnome.org/show_bug.cgi?id=632778
parent 7115b77a
......@@ -403,6 +403,7 @@ gst_clock_get_resolution
gst_clock_get_time
gst_clock_new_single_shot_id
gst_clock_new_periodic_id
gst_clock_single_shot_id_reinit
gst_clock_get_internal_time
gst_clock_adjust_unlocked
gst_clock_unadjust_unlocked
......
......@@ -207,6 +207,43 @@ gst_clock_entry_new (GstClock * clock, GstClockTime time,
return (GstClockID) entry;
}
/* WARNING : Does not modify the refoucnt
* WARNING : Do not use if a pending clock operation is happening on that entry */
static gboolean
gst_clock_entry_reinit (GstClock * clock, GstClockEntry * entry,
GstClockTime time, GstClockTime interval, GstClockEntryType type)
{
g_return_val_if_fail (entry->status != GST_CLOCK_BUSY, FALSE);
g_return_val_if_fail (entry->clock == clock, FALSE);
entry->type = type;
entry->time = time;
entry->interval = interval;
entry->status = GST_CLOCK_OK;
return TRUE;
}
/**
* gst_clock_single_shot_id_reinit:
* @clock: a #GstClock
* @id: a #GstClockID
* @time: The requested time.
*
* Reinitializes the provided single shot @id to the provided time. Does not
* modify the reference count.
*
* Returns: %TRUE if the GstClockID could be reinitialized to the provided
* @time, else %FALSE.
*/
gboolean
gst_clock_single_shot_id_reinit (GstClock * clock, GstClockID id,
GstClockTime time)
{
return gst_clock_entry_reinit (clock, (GstClockEntry *) id, time,
GST_CLOCK_TIME_NONE, GST_CLOCK_ENTRY_SINGLE);
}
/**
* gst_clock_id_ref:
* @id: The #GstClockID to ref
......
......@@ -553,6 +553,9 @@ GstClockReturn gst_clock_id_wait_async_full (GstClockID id,
GDestroyNotify destroy_data);
void gst_clock_id_unschedule (GstClockID id);
gboolean gst_clock_single_shot_id_reinit (GstClock * clock,
GstClockID id,
GstClockTime time);
G_END_DECLS
......
......@@ -224,6 +224,7 @@ EXPORTS
gst_clock_set_calibration
gst_clock_set_master
gst_clock_set_resolution
gst_clock_single_shot_id_reinit
gst_clock_type_get_type
gst_clock_unadjust_unlocked
gst_core_error_get_type
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment