From 5748aa1156e47fb291951c937a4247e133c42a26 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 19 Nov 2005 17:50:52 +0000 Subject: [PATCH] gst/gstutils.h: gst/gstutils.c (g_static_rec_cond_wait) Original commit message from CVS: 2005-11-19 Andy Wingo * gst/gstutils.h: * gst/gstutils.c (g_static_rec_cond_wait) (g_static_rec_cond_timed_wait): Removed, no longer needed. * gst/gstbin.c: Remove terrible continue_state prototype. * gst/gstelement.h (gst_element_continue_state): Make public. * gst/gstelement.h: * gst/gstelement.c (gst_element_commit_state): Removed, replaced by continue_state. Fixes #319389. --- ChangeLog | 12 ++++++++ gst/gstbin.c | 4 --- gst/gstelement.c | 29 ------------------ gst/gstelement.h | 3 +- gst/gstutils.c | 91 -------------------------------------------------------- gst/gstutils.h | 10 ------- 6 files changed, 14 insertions(+), 135 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83dfbd2..ef6654d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2005-11-19 Andy Wingo + * gst/gstutils.h: + * gst/gstutils.c (g_static_rec_cond_wait) + (g_static_rec_cond_timed_wait): Removed, no longer needed. + + * gst/gstbin.c: Remove terrible continue_state prototype. + + * gst/gstelement.h (gst_element_continue_state): Make public. + + * gst/gstelement.h: + * gst/gstelement.c (gst_element_commit_state): Removed, replaced + by continue_state. Fixes #319389. + * gst/gstindex.h (GstIndexFilter): Actually pass on the user_data. Really fixes #168438. However I don't see anywhere where the filter function is called... stupid GStreamer... diff --git a/gst/gstbin.c b/gst/gstbin.c index cb37f38..934cd13 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -1156,10 +1156,6 @@ gst_bin_get_state_func (GstElement * element, GstState * state, return ret; } -/* FIXME, defined in gstelement.c but not yet in the header */ -GstStateChangeReturn -gst_element_continue_state (GstElement * element, GstStateChangeReturn ret); - static void gst_bin_recalc_state (GstBin * bin, gboolean force) { diff --git a/gst/gstelement.c b/gst/gstelement.c index fe7fb51..54ea1e7 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -1912,35 +1912,6 @@ complete: } /** - * gst_element_commit_state: - * @element: a #GstElement to commit the state of. - * - * Commit the state change of the element. This function is used - * by elements that do asynchronous state changes. - * The core will normally call this method automatically when an - * element returned SUCCESS from the state change function. - * Elements that return ASYNC from the change_state function should - * eventually call this method from the streaming thread to signal - * successfull state change completion. - * - * If after calling this method the element still has not reached - * the pending state, the next state change is performed. - * - * This function can only be called with the STATE_LOCK held. - * - * Returns: The result of the commit state change. - * - * MT safe. - */ -GstStateChangeReturn -gst_element_commit_state (GstElement * element) -{ - g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_CHANGE_FAILURE); - - return gst_element_continue_state (element, GST_STATE_CHANGE_SUCCESS); -} - -/** * gst_element_lost_state: * @element: a #GstElement the state is lost of * diff --git a/gst/gstelement.h b/gst/gstelement.h index 43af955..5918960 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -588,7 +588,8 @@ GstStateChangeReturn gst_element_get_state (GstElement * element, GstStateChangeReturn gst_element_set_state (GstElement *element, GstState state); void gst_element_abort_state (GstElement * element); -GstStateChangeReturn gst_element_commit_state (GstElement * element); +GstStateChangeReturn gst_element_continue_state (GstElement * element, + GstStateChangeReturn ret); void gst_element_lost_state (GstElement * element); /* factory management */ diff --git a/gst/gstutils.c b/gst/gstutils.c index 35b4fdc..c05a940 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -1878,97 +1878,6 @@ gst_object_default_error (GstObject * source, GError * error, gchar * debug) g_free (name); } -#ifdef GST_COMPILE_STATIC_REC_COND_WAIT - -#if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P -# define g_system_thread_equal_simple(thread1, thread2) \ - ((thread1).dummy_pointer == (thread2).dummy_pointer) -# define g_system_thread_assign(dest, src) \ - ((dest).dummy_pointer = (src).dummy_pointer) -#else /* GLIB_SIZEOF_SYSTEM_THREAD != SIZEOF_VOID_P */ -# define g_system_thread_equal_simple(thread1, thread2) \ - (memcmp (&(thread1), &(thread2), GLIB_SIZEOF_SYSTEM_THREAD) == 0) -# define g_system_thread_assign(dest, src) \ - (memcpy (&(dest), &(src), GLIB_SIZEOF_SYSTEM_THREAD)) -#endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */ - -#define g_system_thread_equal(thread1, thread2) \ - (g_thread_functions_for_glib_use.thread_equal ? \ - g_thread_functions_for_glib_use.thread_equal (&(thread1), &(thread2)) :\ - g_system_thread_equal_simple((thread1), (thread2))) - -static GSystemThread zero_thread; - -/** - * g_static_rec_cond_timed_wait: - * @cond: the GCond to wait for - * @mutex: a currently locked mutex - * @end_time: timeout value. - * - * Waits until this thread is woken up on cond, but not longer than until the - * time, that is specified by abs_time. The mutex is fully unlocked before falling - * asleep and fully locked again before resuming. - * - * If abs_time is NULL, g_static_rec_cond_timed_wait() acts like g_static_rec_cond_wait(). - * - * This function can also be used, if g_thread_init() has not yet been called and will - * immediately return TRUE then. - * - * To easily calculate abs_time a combination of g_get_current_time() and g_time_val_add() - * can be used. - * - * Returns: TRUE, if the thread is woken up in time. - */ -gboolean -g_static_rec_cond_timed_wait (GCond * cond, - GStaticRecMutex * mutex, GTimeVal * end_time) -{ - GMutex *smutex; - guint depth; - GSystemThread self; - gboolean res; - - if (!g_thread_supported ()) - return FALSE; - - G_THREAD_UF (thread_self, (&self)); - - g_return_val_if_fail (g_system_thread_equal (self, mutex->owner), FALSE); - - depth = mutex->depth; - - g_system_thread_assign (mutex->owner, zero_thread); - mutex->depth = 0; - smutex = g_static_mutex_get_mutex (&mutex->mutex); - - res = g_cond_timed_wait (cond, smutex, end_time); - - g_system_thread_assign (mutex->owner, self); - mutex->depth = depth; - - return res; -} - -/** - * g_static_rec_cond_wait: - * @cond: the GCond to wait for - * @mutex: a currently locked mutex - * - * Waits until this thread is woken up on cond. - * The mutex is fully unlocked before falling - * asleep and fully locked again before resuming. - * - * This function can also be used, if g_thread_init() has not yet been called and will - * immediately return then. - */ -void -g_static_rec_cond_wait (GCond * cond, GStaticRecMutex * mutex) -{ - g_static_rec_cond_timed_wait (cond, mutex, NULL); -} - -#endif /* GST_COMPILE_STATIC_REC_COND_WAIT */ - /** * gst_bin_add_many: * @bin: a #GstBin diff --git a/gst/gstutils.h b/gst/gstutils.h index 534ac7e..e0bf667 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -479,16 +479,6 @@ GST_BOILERPLATE_FULL (type, type_as_function, parent_type, \ void gst_object_default_error (GstObject * source, GError * error, gchar * debug); -/* rec mutex */ -#ifndef g_static_rec_cond_wait -#define GST_COMPILE_STATIC_REC_COND_WAIT -void g_static_rec_cond_wait (GCond *cond, - GStaticRecMutex *mutex); -gboolean g_static_rec_cond_timed_wait (GCond *cond, - GStaticRecMutex *mutex, - GTimeVal *end_time); -#endif - /* element functions */ void gst_element_create_all_pads (GstElement *element); GstPad* gst_element_get_compatible_pad (GstElement *element, GstPad *pad, -- 2.7.4