From: Edward Hervey Date: Wed, 20 Oct 2010 15:40:43 +0000 (+0200) Subject: gstclock: New API to re-use a single shot GstClockID X-Git-Tag: RELEASE-0.10.32~273 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4285611ad177b67dd32c5022b62d255b5cdd5f5;p=platform%2Fupstream%2Fgstreamer.git 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 --- diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 61adf21..967c8f0 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -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 diff --git a/gst/gstclock.c b/gst/gstclock.c index 00373d2..24f7dc5 100644 --- a/gst/gstclock.c +++ b/gst/gstclock.c @@ -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 diff --git a/gst/gstclock.h b/gst/gstclock.h index f83face..ee2e064 100644 --- a/gst/gstclock.h +++ b/gst/gstclock.h @@ -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 diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index 44d83d5..5934a02 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -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