gst/gstutils.h: gst/gstutils.c (g_static_rec_cond_wait)

Original commit message from CVS:
2005-11-19  Andy Wingo  <wingo@pobox.com>

* 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.
This commit is contained in:
Andy Wingo 2005-11-19 17:50:52 +00:00
parent 4bccc99723
commit 5748aa1156
6 changed files with 14 additions and 135 deletions

View file

@ -1,5 +1,17 @@
2005-11-19 Andy Wingo <wingo@pobox.com>
* 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...

View file

@ -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)
{

View file

@ -1911,35 +1911,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

View file

@ -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 */

View file

@ -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

View file

@ -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,