diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-09-07 18:06:27 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-09-07 18:12:38 +0200 |
commit | c7972692d3073a5d06a42bb8adadded96db8cc40 (patch) | |
tree | ace37817d97635c5310a1193bbe9f3ff67ac8eed | |
parent | 5f5c52cbc5ccbfba662c24619f4ba6ce7ae815a3 (diff) |
audioclock: add a function to invalidate the clock
Add a function to invalidate the time function of a clock. Useful for when the
function becomes invalid.
-rw-r--r-- | docs/libs/gst-plugins-base-libs-sections.txt | 1 | ||||
-rw-r--r-- | gst-libs/gst/audio/gstaudioclock.c | 29 | ||||
-rw-r--r-- | gst-libs/gst/audio/gstaudioclock.h | 2 |
3 files changed, 32 insertions, 0 deletions
diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt index d55a43a15..f9d09902f 100644 --- a/docs/libs/gst-plugins-base-libs-sections.txt +++ b/docs/libs/gst-plugins-base-libs-sections.txt @@ -111,6 +111,7 @@ gst_audio_clock_new_full gst_audio_clock_adjust gst_audio_clock_get_time gst_audio_clock_reset +gst_audio_clock_invalidate <SUBSECTION Standard> GstAudioClockClass GST_AUDIO_CLOCK diff --git a/gst-libs/gst/audio/gstaudioclock.c b/gst-libs/gst/audio/gstaudioclock.c index 5b324d632..95a8a0d8e 100644 --- a/gst-libs/gst/audio/gstaudioclock.c +++ b/gst-libs/gst/audio/gstaudioclock.c @@ -202,6 +202,12 @@ gst_audio_clock_reset (GstAudioClock * clock, GstClockTime time) } static GstClockTime +gst_audio_clock_func_invalid (GstClock * clock, gpointer user_data) +{ + return GST_CLOCK_TIME_NONE; +} + +static GstClockTime gst_audio_clock_get_internal_time (GstClock * clock) { GstAudioClock *aclock; @@ -283,3 +289,26 @@ gst_audio_clock_adjust (GstClock * clock, GstClockTime time) return result; } + +/** + * gst_audio_clock_invalidate: + * @clock: a #GstAudioClock + * + * Invalidate the clock function. Call this function when the provided + * #GstAudioClockGetTimeFunc cannot be called anymore, for example, when the + * user_data becomes invalid. + * + * After calling this function, @clock will return the last returned time for + * the rest of its lifetime. + * + * Since: 0.10.31 + */ +void +gst_audio_clock_invalidate (GstClock * clock) +{ + GstAudioClock *aclock; + + aclock = GST_AUDIO_CLOCK_CAST (clock); + + aclock->func = gst_audio_clock_func_invalid; +} diff --git a/gst-libs/gst/audio/gstaudioclock.h b/gst-libs/gst/audio/gstaudioclock.h index cdbe47451..fb50bcf6b 100644 --- a/gst-libs/gst/audio/gstaudioclock.h +++ b/gst-libs/gst/audio/gstaudioclock.h @@ -101,6 +101,8 @@ void gst_audio_clock_reset (GstAudioClock *clock, GstClockT GstClockTime gst_audio_clock_get_time (GstClock * clock); GstClockTime gst_audio_clock_adjust (GstClock * clock, GstClockTime time); +void gst_audio_clock_invalidate (GstClock * clock); + G_END_DECLS #endif /* __GST_AUDIO_CLOCK_H__ */ |