/* copies */
-#if GLIB_CHECK_VERSION (2, 31, 0)
-#define g_mutex_new gst_g_mutex_new
-static inline GMutex *
-gst_g_mutex_new (void)
-{
- GMutex *mutex = g_slice_new (GMutex);
- g_mutex_init (mutex);
- return mutex;
-}
-#define g_mutex_free gst_g_mutex_free
-static inline void
-gst_g_mutex_free (GMutex *mutex)
-{
- g_mutex_clear (mutex);
- g_slice_free (GMutex, mutex);
-}
-#define g_static_rec_mutex_init gst_g_static_rec_mutex_init
-static inline void
-gst_g_static_rec_mutex_init (GStaticRecMutex *mutex)
-{
- static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
-
- *mutex = init_mutex;
-}
-#define g_cond_new gst_g_cond_new
-static inline GCond *
-gst_g_cond_new (void)
-{
- GCond *cond = g_slice_new (GCond);
- g_cond_init (cond);
- return cond;
-}
-#define g_cond_free gst_g_cond_free
-static inline void
-gst_g_cond_free (GCond *cond)
-{
- g_cond_clear (cond);
- g_slice_free (GCond, cond);
-}
-#define g_cond_timed_wait gst_g_cond_timed_wait
-static inline gboolean
-gst_g_cond_timed_wait (GCond *cond, GMutex *mutex, GTimeVal *abs_time)
-{
- gint64 end_time;
-
- if (abs_time == NULL) {
- g_cond_wait (cond, mutex);
- return TRUE;
- }
-
- end_time = abs_time->tv_sec;
- end_time *= 1000000;
- end_time += abs_time->tv_usec;
-
- /* would be nice if we had clock_rtoffset, but that didn't seem to
- * make it into the kernel yet...
- */
- /* if CLOCK_MONOTONIC is not defined then g_get_montonic_time() and
- * g_get_real_time() are returning the same clock and we'd add ~0
- */
- end_time += g_get_monotonic_time () - g_get_real_time ();
- return g_cond_wait_until (cond, mutex, end_time);
-}
-#endif /* GLIB_CHECK_VERSION (2, 31, 0) */
-
/* adaptations */
G_END_DECLS
* Last reviewed on 2006-04-28 (0.10.6)
*/
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include "gstevent.h"
*
*/
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include "glib-compat-private.h"
#define GST_BUFFER_POOL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BUFFER_POOL, GstBufferPoolPrivate))
-#define GST_BUFFER_POOL_LOCK(pool) (g_static_rec_mutex_lock(&pool->priv->rec_lock))
-#define GST_BUFFER_POOL_UNLOCK(pool) (g_static_rec_mutex_unlock(&pool->priv->rec_lock))
+#define GST_BUFFER_POOL_LOCK(pool) (g_rec_mutex_lock(&pool->priv->rec_lock))
+#define GST_BUFFER_POOL_UNLOCK(pool) (g_rec_mutex_unlock(&pool->priv->rec_lock))
struct _GstBufferPoolPrivate
{
- GStaticRecMutex rec_lock;
+ GRecMutex rec_lock;
guint size;
guint min_buffers;
guint max_buffers;
{
pool->priv = GST_BUFFER_POOL_GET_PRIVATE (pool);
- g_static_rec_mutex_init (&pool->priv->rec_lock);
+ g_rec_mutex_init (&pool->priv->rec_lock);
pool->poll = gst_poll_new_timer ();
pool->queue = gst_atomic_queue_new (10);
gst_atomic_queue_unref (pool->queue);
gst_poll_free (pool->poll);
gst_structure_free (pool->config);
- g_static_rec_mutex_free (&pool->priv->rec_lock);
+ g_rec_mutex_clear (&pool->priv->rec_lock);
G_OBJECT_CLASS (gst_buffer_pool_parent_class)->finalize (object);
}
gst_bus_init (GstBus * bus)
{
bus->queue = gst_atomic_queue_new (32);
- bus->queue_lock = g_mutex_new ();
+ g_mutex_init (&bus->queue_lock);
bus->priv = G_TYPE_INSTANCE_GET_PRIVATE (bus, GST_TYPE_BUS, GstBusPrivate);
bus->priv->enable_async = DEFAULT_ENABLE_ASYNC;
if (bus->queue) {
GstMessage *message;
- g_mutex_lock (bus->queue_lock);
+ g_mutex_lock (&bus->queue_lock);
do {
message = gst_atomic_queue_pop (bus->queue);
if (message)
} while (message != NULL);
gst_atomic_queue_unref (bus->queue);
bus->queue = NULL;
- g_mutex_unlock (bus->queue_lock);
- g_mutex_free (bus->queue_lock);
- bus->queue_lock = NULL;
+ g_mutex_unlock (&bus->queue_lock);
+ g_mutex_clear (&bus->queue_lock);
if (bus->priv->poll)
gst_poll_free (bus->priv->poll);
{
/* async delivery, we need a mutex and a cond to block
* on */
- GMutex *lock = g_mutex_new ();
- GCond *cond = g_cond_new ();
+ GCond *cond = GST_MESSAGE_GET_COND (message);
+ GMutex *lock = GST_MESSAGE_GET_LOCK (message);
- GST_MESSAGE_COND (message) = cond;
- GST_MESSAGE_GET_LOCK (message) = lock;
+ g_cond_init (cond);
+ g_mutex_init (lock);
GST_DEBUG_OBJECT (bus, "[msg %p] waiting for async delivery", message);
GST_DEBUG_OBJECT (bus, "[msg %p] delivered asynchronously", message);
- g_mutex_free (lock);
- g_cond_free (cond);
+ g_mutex_clear (lock);
+ g_cond_clear (cond);
break;
}
default:
g_return_val_if_fail (types != 0, NULL);
g_return_val_if_fail (timeout == 0 || bus->priv->poll != NULL, NULL);
- g_mutex_lock (bus->queue_lock);
+ g_mutex_lock (&bus->queue_lock);
while (TRUE) {
gint ret;
/* only here in timeout case */
g_assert (bus->priv->poll);
- g_mutex_unlock (bus->queue_lock);
+ g_mutex_unlock (&bus->queue_lock);
ret = gst_poll_wait (bus->priv->poll, timeout - elapsed);
- g_mutex_lock (bus->queue_lock);
+ g_mutex_lock (&bus->queue_lock);
if (ret == 0) {
GST_INFO_OBJECT (bus, "timed out, breaking loop");
beach:
- g_mutex_unlock (bus->queue_lock);
+ g_mutex_unlock (&bus->queue_lock);
return message;
}
* Returns: (transfer full): the #GstMessage that is on the bus after the
* specified timeout or NULL if the bus is empty after the timeout expired.
* The message is taken from the bus and needs to be unreffed with
- * gst_message_unref() after usage.
+ * gst_message_unre:f() after usage.
*
* MT safe.
*
g_return_val_if_fail (GST_IS_BUS (bus), NULL);
- g_mutex_lock (bus->queue_lock);
+ g_mutex_lock (&bus->queue_lock);
message = gst_atomic_queue_peek (bus->queue);
if (message)
gst_message_ref (message);
- g_mutex_unlock (bus->queue_lock);
+ g_mutex_unlock (&bus->queue_lock);
GST_DEBUG_OBJECT (bus, "peek on bus, got message %p", message);
/*< private >*/
GstAtomicQueue *queue;
- GMutex *queue_lock;
+ GMutex queue_lock;
GstBusSyncHandler sync_handler;
gpointer sync_handler_data;
{
clock->last_time = 0;
clock->entries = NULL;
- clock->entries_changed = g_cond_new ();
+ g_cond_init (&clock->entries_changed);
clock->stats = FALSE;
clock->priv =
clock->rate_numerator = 1;
clock->rate_denominator = 1;
- clock->slave_lock = g_mutex_new ();
+ g_mutex_init (&clock->slave_lock);
clock->window_size = DEFAULT_WINDOW_SIZE;
clock->window_threshold = DEFAULT_WINDOW_THRESHOLD;
clock->filling = TRUE;
clock->times = NULL;
GST_CLOCK_SLAVE_UNLOCK (clock);
- g_cond_free (clock->entries_changed);
- g_mutex_free (clock->slave_lock);
+ g_cond_clear (&clock->entries_changed);
+ g_mutex_clear (&clock->slave_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
#define GST_CLOCK_GET_CLASS(clock) (G_TYPE_INSTANCE_GET_CLASS ((clock), GST_TYPE_CLOCK, GstClockClass))
#define GST_CLOCK_CAST(clock) ((GstClock*)(clock))
-#define GST_CLOCK_SLAVE_LOCK(clock) g_mutex_lock (GST_CLOCK_CAST (clock)->slave_lock)
-#define GST_CLOCK_SLAVE_UNLOCK(clock) g_mutex_unlock (GST_CLOCK_CAST (clock)->slave_lock)
+#define GST_CLOCK_SLAVE_LOCK(clock) g_mutex_lock (&GST_CLOCK_CAST (clock)->slave_lock)
+#define GST_CLOCK_SLAVE_UNLOCK(clock) g_mutex_unlock (&GST_CLOCK_CAST (clock)->slave_lock)
/**
* GstClockTime:
#define GST_CLOCK_FLAGS(clock) GST_OBJECT_FLAGS(clock)
/**
- * GST_CLOCK_COND:
+ * GST_CLOCK_GET_COND:
* @clock: the clock to query
*
* Gets the #GCond that gets signalled when the entries of the clock
* changed.
*/
-#define GST_CLOCK_COND(clock) (GST_CLOCK_CAST(clock)->entries_changed)
+#define GST_CLOCK_GET_COND(clock) (&GST_CLOCK_CAST(clock)->entries_changed)
/**
* GST_CLOCK_WAIT:
* @clock: the clock to wait on
*
* Wait on the clock until the entries changed.
*/
-#define GST_CLOCK_WAIT(clock) g_cond_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock))
+#define GST_CLOCK_WAIT(clock) g_cond_wait(GST_CLOCK_GET_COND(clock),GST_OBJECT_GET_LOCK(clock))
/**
* GST_CLOCK_TIMED_WAIT:
* @clock: the clock to wait on
* Wait on the clock until the entries changed or the specified timeout
* occurred.
*/
-#define GST_CLOCK_TIMED_WAIT(clock,tv) g_cond_timed_wait(GST_CLOCK_COND(clock),GST_OBJECT_GET_LOCK(clock),tv)
+#define GST_CLOCK_TIMED_WAIT(clock,tv) g_cond_timed_wait(GST_CLOCK_GET_COND(clock),GST_OBJECT_GET_LOCK(clock),tv)
/**
* GST_CLOCK_BROADCAST:
* @clock: the clock to broadcast
*
* Signal that the entries in the clock have changed.
*/
-#define GST_CLOCK_BROADCAST(clock) g_cond_broadcast(GST_CLOCK_COND(clock))
+#define GST_CLOCK_BROADCAST(clock) g_cond_broadcast(GST_CLOCK_GET_COND(clock))
/**
* GstClock:
struct _GstClock {
GstObject object;
- GMutex *slave_lock; /* order: SLAVE_LOCK, OBJECT_LOCK */
+ GMutex slave_lock; /* order: SLAVE_LOCK, OBJECT_LOCK */
/*< protected >*/ /* with LOCK */
GstClockTime internal_calibration;
GstClockTime rate_denominator;
GstClockTime last_time;
GList *entries;
- GCond *entries_changed;
+ GCond entries_changed;
/*< private >*/ /* with LOCK */
GstClockTime resolution;
* Last reviewed on 2009-05-29 (0.10.24)
*/
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include <glib.h>
#include <stdarg.h>
GST_STATE_PENDING (element) = GST_STATE_VOID_PENDING;
GST_STATE_RETURN (element) = GST_STATE_CHANGE_SUCCESS;
- g_static_rec_mutex_init (&element->state_lock);
- element->state_cond = g_cond_new ();
+ g_rec_mutex_init (&element->state_lock);
+ g_cond_init (&element->state_cond);
}
/**
old_pending = GST_STATE_PENDING (element);
if (old_pending != GST_STATE_VOID_PENDING) {
- GTimeVal *timeval, abstimeout;
+ gboolean signaled;
guint32 cookie;
- if (timeout != GST_CLOCK_TIME_NONE) {
- glong add = timeout / 1000;
-
- if (add == 0)
- goto done;
-
- /* make timeout absolute */
- g_get_current_time (&abstimeout);
- g_time_val_add (&abstimeout, add);
- timeval = &abstimeout;
- } else {
- timeval = NULL;
- }
/* get cookie to detect state changes during waiting */
cookie = element->state_cookie;
"waiting for element to commit state");
/* we have a pending state change, wait for it to complete */
- if (!GST_STATE_TIMED_WAIT (element, timeval)) {
+ if (timeout != GST_CLOCK_TIME_NONE) {
+ gint64 end_time;
+ /* make timeout absolute */
+ end_time = g_get_monotonic_time () + (timeout / 1000);
+ signaled = GST_STATE_WAIT_UNTIL (element, end_time);
+ } else {
+ GST_STATE_WAIT (element);
+ signaled = TRUE;
+ }
+
+ if (!signaled) {
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "timed out");
/* timeout triggered */
ret = GST_STATE_CHANGE_ASYNC;
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "finalize");
- g_cond_free (element->state_cond);
- g_static_rec_mutex_free (&element->state_lock);
+ g_cond_clear (&element->state_cond);
+ g_rec_mutex_clear (&element->state_lock);
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "finalize parent");
*
* Get the conditional used to signal the completion of a state change.
*/
-#define GST_STATE_GET_COND(elem) (GST_ELEMENT_CAST(elem)->state_cond)
+#define GST_STATE_GET_COND(elem) (&GST_ELEMENT_CAST(elem)->state_cond)
-#define GST_STATE_LOCK(elem) g_static_rec_mutex_lock(GST_STATE_GET_LOCK(elem))
-#define GST_STATE_TRYLOCK(elem) g_static_rec_mutex_trylock(GST_STATE_GET_LOCK(elem))
-#define GST_STATE_UNLOCK(elem) g_static_rec_mutex_unlock(GST_STATE_GET_LOCK(elem))
-#define GST_STATE_UNLOCK_FULL(elem) g_static_rec_mutex_unlock_full(GST_STATE_GET_LOCK(elem))
-#define GST_STATE_LOCK_FULL(elem,t) g_static_rec_mutex_lock_full(GST_STATE_GET_LOCK(elem), t)
+#define GST_STATE_LOCK(elem) g_rec_mutex_lock(GST_STATE_GET_LOCK(elem))
+#define GST_STATE_TRYLOCK(elem) g_rec_mutex_trylock(GST_STATE_GET_LOCK(elem))
+#define GST_STATE_UNLOCK(elem) g_rec_mutex_unlock(GST_STATE_GET_LOCK(elem))
+#define GST_STATE_UNLOCK_FULL(elem) g_rec_mutex_unlock_full(GST_STATE_GET_LOCK(elem))
+#define GST_STATE_LOCK_FULL(elem,t) g_rec_mutex_lock_full(GST_STATE_GET_LOCK(elem), t)
#define GST_STATE_WAIT(elem) g_cond_wait (GST_STATE_GET_COND (elem), \
GST_OBJECT_GET_LOCK (elem))
-#define GST_STATE_TIMED_WAIT(elem, timeval) g_cond_timed_wait (GST_STATE_GET_COND (elem), \
- GST_OBJECT_GET_LOCK (elem), timeval)
+#define GST_STATE_WAIT_UNTIL(elem, end_time) g_cond_wait_until (GST_STATE_GET_COND (elem), \
+ GST_OBJECT_GET_LOCK (elem), end_time)
#define GST_STATE_SIGNAL(elem) g_cond_signal (GST_STATE_GET_COND (elem));
#define GST_STATE_BROADCAST(elem) g_cond_broadcast (GST_STATE_GET_COND (elem));
GstObject object;
/*< public >*/ /* with LOCK */
- GStaticRecMutex state_lock;
+ GRecMutex state_lock;
/* element state */
- GCond *state_cond;
+ GCond state_cond;
guint32 state_cookie;
GstState target_state;
GstState current_state;
#include "config.h"
#endif
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include "gstmemory.h"
return FALSE;
}
-static GStaticRWLock lock = G_STATIC_RW_LOCK_INIT;
+static GRWLock lock;
static GHashTable *allocators;
void
NULL
};
+ g_rw_lock_init (&lock);
allocators = g_hash_table_new (g_str_hash, g_str_equal);
#ifdef HAVE_GETPAGESIZE
GST_DEBUG ("registering allocator \"%s\"", name);
- g_static_rw_lock_writer_lock (&lock);
+ g_rw_lock_writer_lock (&lock);
g_hash_table_insert (allocators, (gpointer) name, (gpointer) allocator);
- g_static_rw_lock_writer_unlock (&lock);
+ g_rw_lock_writer_unlock (&lock);
return allocator;
}
{
const GstAllocator *allocator;
- g_static_rw_lock_reader_lock (&lock);
+ g_rw_lock_reader_lock (&lock);
if (name) {
allocator = g_hash_table_lookup (allocators, (gconstpointer) name);
} else {
allocator = _default_allocator;
}
- g_static_rw_lock_reader_unlock (&lock);
+ g_rw_lock_reader_unlock (&lock);
return allocator;
}
{
g_return_if_fail (allocator != NULL);
- g_static_rw_lock_writer_lock (&lock);
+ g_rw_lock_writer_lock (&lock);
_default_allocator = allocator;
- g_static_rw_lock_writer_unlock (&lock);
+ g_rw_lock_writer_unlock (&lock);
}
/**
GST_MESSAGE_SRC (message) = NULL;
}
- if (message->lock) {
+ if (message->lock.p) {
GST_MESSAGE_LOCK (message);
GST_MESSAGE_SIGNAL (message);
GST_MESSAGE_UNLOCK (message);
GST_MESSAGE_SRC (copy) = gst_object_ref (GST_MESSAGE_SRC (message));
}
- GST_MESSAGE_GET_LOCK (copy) = GST_MESSAGE_GET_LOCK (message);
- GST_MESSAGE_COND (copy) = GST_MESSAGE_COND (message);
-
structure = GST_MESSAGE_STRUCTURE (message);
if (structure) {
copy->structure = gst_structure_copy (structure);
/* the lock is used to handle the synchronous handling of messages,
* the emiting thread is block until the handling thread processed
* the message using this mutex/cond pair */
-#define GST_MESSAGE_GET_LOCK(message) (GST_MESSAGE_CAST(message)->lock)
+#define GST_MESSAGE_GET_LOCK(message) (&GST_MESSAGE_CAST(message)->lock)
#define GST_MESSAGE_LOCK(message) g_mutex_lock(GST_MESSAGE_GET_LOCK(message))
#define GST_MESSAGE_UNLOCK(message) g_mutex_unlock(GST_MESSAGE_GET_LOCK(message))
-#define GST_MESSAGE_COND(message) (GST_MESSAGE_CAST(message)->cond)
-#define GST_MESSAGE_WAIT(message) g_cond_wait(GST_MESSAGE_COND(message),GST_MESSAGE_GET_LOCK(message))
-#define GST_MESSAGE_SIGNAL(message) g_cond_signal(GST_MESSAGE_COND(message))
+#define GST_MESSAGE_GET_COND(message) (&GST_MESSAGE_CAST(message)->cond)
+#define GST_MESSAGE_WAIT(message) g_cond_wait(GST_MESSAGE_GET_COND(message),GST_MESSAGE_GET_LOCK(message))
+#define GST_MESSAGE_SIGNAL(message) g_cond_signal(GST_MESSAGE_GET_COND(message))
/**
* GST_MESSAGE_TYPE:
*/
struct _GstMessage
{
- GstMiniObject mini_object;
+ GstMiniObject mini_object;
/*< public > *//* with COW */
- GstMessageType type;
- guint64 timestamp;
- GstObject *src;
- guint32 seqnum;
+ GstMessageType type;
+ guint64 timestamp;
+ GstObject *src;
+ guint32 seqnum;
/*< private >*//* with MESSAGE_LOCK */
- GMutex *lock; /* lock and cond for async delivery */
- GCond *cond;
+ GMutex lock; /* lock and cond for async delivery */
+ GCond cond;
};
GType gst_message_get_type (void);
*
* Last reviewed on December 17th, 2009 (0.10.26)
*/
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include "gstbuffer.h"
#include "gstutils.h"
static GHashTable *metainfo = NULL;
-static GStaticRWLock lock = G_STATIC_RW_LOCK_INIT;
+static GRWLock lock;
void
_priv_gst_meta_initialize (void)
{
+ g_rw_lock_init (&lock);
metainfo = g_hash_table_new (g_str_hash, g_str_equal);
}
GST_DEBUG ("register \"%s\" implementing \"%s\" of size %" G_GSIZE_FORMAT,
api, impl, size);
- g_static_rw_lock_writer_lock (&lock);
+ g_rw_lock_writer_lock (&lock);
g_hash_table_insert (metainfo, (gpointer) impl, (gpointer) info);
- g_static_rw_lock_writer_unlock (&lock);
+ g_rw_lock_writer_unlock (&lock);
return info;
}
g_return_val_if_fail (impl != NULL, NULL);
- g_static_rw_lock_reader_lock (&lock);
+ g_rw_lock_reader_lock (&lock);
info = g_hash_table_lookup (metainfo, impl);
- g_static_rw_lock_reader_unlock (&lock);
+ g_rw_lock_reader_unlock (&lock);
return info;
}
static void
gst_object_init (GstObject * object)
{
- object->lock = g_mutex_new ();
+ g_mutex_init (&object->lock);
object->parent = NULL;
object->name = NULL;
GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "%p new", object);
g_signal_handlers_destroy (object);
g_free (gstobject->name);
- g_mutex_free (gstobject->lock);
+ g_mutex_clear (&gstobject->lock);
#ifndef GST_DISABLE_TRACE
gst_alloc_trace_free (_gst_object_trace, object);
*
* Acquire a reference to the mutex of this object.
*/
-#define GST_OBJECT_GET_LOCK(obj) (GST_OBJECT_CAST(obj)->lock)
+#define GST_OBJECT_GET_LOCK(obj) (&GST_OBJECT_CAST(obj)->lock)
/**
* GST_OBJECT_LOCK:
* @obj: a #GstObject to lock
GInitiallyUnowned object;
/*< public >*/ /* with LOCK */
- GMutex *lock; /* object LOCK */
+ GMutex lock; /* object LOCK */
gchar *name; /* object name */
GstObject *parent; /* this object's parent, weak ref */
guint32 flags;
* Last reviewed on 2006-07-06 (0.10.9)
*/
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include "gstpad.h"
GST_PAD_SET_FLUSHING (pad);
- g_static_rec_mutex_init (&pad->stream_rec_lock);
+ g_rec_mutex_init (&pad->stream_rec_lock);
- pad->block_cond = g_cond_new ();
+ g_cond_init (&pad->block_cond);
g_hook_list_init (&pad->probes, sizeof (GstProbe));
if (pad->iterintlinknotify)
pad->iterintlinknotify (pad);
- g_static_rec_mutex_free (&pad->stream_rec_lock);
- g_cond_free (pad->block_cond);
+ g_rec_mutex_clear (&pad->stream_rec_lock);
+ g_cond_clear (&pad->block_cond);
g_array_free (pad->priv->events, TRUE);
G_OBJECT_CLASS (parent_class)->finalize (object);
/*< private >*/
/* streaming rec_lock */
- GStaticRecMutex stream_rec_lock;
+ GRecMutex stream_rec_lock;
GstTask *task;
/* block cond, mutex is from the object */
- GCond *block_cond;
+ GCond block_cond;
GHookList probes;
GstPadMode mode;
*
* Lock the stream lock of @pad.
*/
-#define GST_PAD_STREAM_LOCK(pad) (g_static_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad)))
+#define GST_PAD_STREAM_LOCK(pad) (g_rec_mutex_lock(GST_PAD_GET_STREAM_LOCK(pad)))
/**
* GST_PAD_STREAM_TRYLOCK:
* @pad: a #GstPad
* Try to Lock the stream lock of the pad, return TRUE if the lock could be
* taken.
*/
-#define GST_PAD_STREAM_TRYLOCK(pad) (g_static_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad)))
+#define GST_PAD_STREAM_TRYLOCK(pad) (g_rec_mutex_trylock(GST_PAD_GET_STREAM_LOCK(pad)))
/**
* GST_PAD_STREAM_UNLOCK:
* @pad: a #GstPad
*
* Unlock the stream lock of @pad.
*/
-#define GST_PAD_STREAM_UNLOCK(pad) (g_static_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad)))
+#define GST_PAD_STREAM_UNLOCK(pad) (g_rec_mutex_unlock(GST_PAD_GET_STREAM_LOCK(pad)))
-#define GST_PAD_BLOCK_GET_COND(pad) (GST_PAD_CAST(pad)->block_cond)
+#define GST_PAD_BLOCK_GET_COND(pad) (&GST_PAD_CAST(pad)->block_cond)
#define GST_PAD_BLOCK_WAIT(pad) (g_cond_wait(GST_PAD_BLOCK_GET_COND (pad), GST_OBJECT_GET_LOCK (pad)))
#define GST_PAD_BLOCK_SIGNAL(pad) (g_cond_signal(GST_PAD_BLOCK_GET_COND (pad)))
#define GST_PAD_BLOCK_BROADCAST(pad) (g_cond_broadcast(GST_PAD_BLOCK_GET_COND (pad)))
{
GstPollMode mode;
- GMutex *lock;
+ GMutex lock;
/* array of fds, always written to and read from with lock */
GArray *fds;
/* array of active fds, only written to from the waiting thread with the
{
guint i;
- g_mutex_lock (set->lock);
+ g_mutex_lock (&set->lock);
for (i = 0; i < set->fds->len; i++) {
struct pollfd *pfd = &g_array_index (set->fds, struct pollfd, i);
if (pfd->fd >= FD_SETSIZE)
goto too_many;
}
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
return TRUE;
too_many:
{
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
return FALSE;
}
}
FD_ZERO (writefds);
FD_ZERO (errorfds);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&set->lock);
for (i = 0; i < set->active_fds->len; i++) {
struct pollfd *pfd = &g_array_index (set->fds, struct pollfd, i);
}
}
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
return max_fd;
}
{
guint i;
- g_mutex_lock (set->lock);
+ g_mutex_lock (&set->lock);
for (i = 0; i < set->active_fds->len; i++) {
struct pollfd *pfd = &g_array_index (set->active_fds, struct pollfd, i);
}
}
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
}
#else /* G_OS_WIN32 */
/*
GST_DEBUG ("controllable : %d", controllable);
nset = g_slice_new0 (GstPoll);
- nset->lock = g_mutex_new ();
+ g_mutex_init (&nset->lock);
#ifndef G_OS_WIN32
nset->mode = GST_POLL_MODE_AUTO;
nset->fds = g_array_new (FALSE, FALSE, sizeof (struct pollfd));
g_array_free (set->active_fds, TRUE);
g_array_free (set->fds, TRUE);
- g_mutex_free (set->lock);
+ g_mutex_clear (&set->lock);
g_slice_free (GstPoll, set);
}
g_return_val_if_fail (fd != NULL, FALSE);
g_return_val_if_fail (fd->fd >= 0, FALSE);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&set->lock);
ret = gst_poll_add_fd_unlocked (set, fd);
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
return ret;
}
GST_DEBUG ("%p: fd (fd:%d, idx:%d)", set, fd->fd, fd->idx);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&set->lock);
/* get the index, -1 is an fd that is not added */
idx = find_index (set->fds, fd);
GST_WARNING ("%p: couldn't find fd !", set);
}
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
return idx >= 0;
}
GST_DEBUG ("%p: fd (fd:%d, idx:%d), active : %d", set,
fd->fd, fd->idx, active);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&set->lock);
idx = find_index (set->fds, fd);
if (idx >= 0) {
GST_WARNING ("%p: couldn't find fd !", set);
}
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
return idx >= 0;
}
g_return_val_if_fail (fd != NULL, FALSE);
g_return_val_if_fail (fd->fd >= 0, FALSE);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&set->lock);
ret = gst_poll_fd_ctl_read_unlocked (set, fd, active);
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
return ret;
}
g_return_if_fail (fd != NULL);
g_return_if_fail (fd->fd >= 0);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&set->lock);
idx = find_index (set->fds, fd);
if (idx >= 0) {
MARK_REBUILD (set);
}
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
#endif
}
GST_DEBUG ("%p: fd (fd:%d, idx:%d)", set, fd->fd, fd->idx);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&((GstPoll *) set)->lock);
idx = find_index (set->active_fds, fd);
if (idx >= 0) {
GST_WARNING ("%p: couldn't find fd !", set);
}
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&((GstPoll *) set)->lock);
return res;
}
GST_DEBUG ("%p: fd (fd:%d, idx:%d)", set, fd->fd, fd->idx);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&((GstPoll *) set)->lock);
idx = find_index (set->active_fds, fd);
if (idx >= 0) {
GST_WARNING ("%p: couldn't find fd !", set);
}
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&((GstPoll *) set)->lock);
return res;
}
g_return_val_if_fail (fd != NULL, FALSE);
g_return_val_if_fail (fd->fd >= 0, FALSE);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&((GstPoll *) set)->lock);
res = gst_poll_fd_can_read_unlocked (set, fd);
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&((GstPoll *) set)->lock);
return res;
}
GST_DEBUG ("%p: fd (fd:%d, idx:%d)", set, fd->fd, fd->idx);
- g_mutex_lock (set->lock);
+ g_mutex_lock (&((GstPoll *) set)->lock);
idx = find_index (set->active_fds, fd);
if (idx >= 0) {
GST_WARNING ("%p: couldn't find fd !", set);
}
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&((GstPoll *) set)->lock);
return res;
}
mode = choose_mode (set, timeout);
if (TEST_REBUILD (set)) {
- g_mutex_lock (set->lock);
+ g_mutex_lock (&set->lock);
#ifndef G_OS_WIN32
g_array_set_size (set->active_fds, set->fds->len);
memcpy (set->active_fds->data, set->fds->data,
if (!gst_poll_prepare_winsock_active_sets (set))
goto winsock_error;
#endif
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
}
switch (mode) {
winsock_error:
{
GST_LOG ("%p: winsock error", set);
- g_mutex_unlock (set->lock);
+ g_mutex_unlock (&set->lock);
DEC_WAITING (set);
return -1;
}
* Last reviewed on 2010-03-15 (0.10.29)
*/
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include "gstinfo.h"
task->running = FALSE;
task->thread = NULL;
task->lock = NULL;
- task->cond = g_cond_new ();
+ g_cond_init (&task->cond);
SET_TASK_STATE (task, GST_TASK_STOPPED);
task->priv->prio_set = FALSE;
/* task thread cannot be running here since it holds a ref
* to the task so that the finalize could not have happened */
- g_cond_free (task->cond);
- task->cond = NULL;
+ g_cond_clear (&task->cond);
G_OBJECT_CLASS (gst_task_parent_class)->finalize (object);
}
static void
gst_task_func (GstTask * task)
{
- GStaticRecMutex *lock;
+ GRecMutex *lock;
GThread *tself;
GstTaskPrivate *priv;
priv->thr_callbacks.enter_thread (task, tself, priv->thr_user_data);
/* locking order is TASK_LOCK, LOCK */
- g_static_rec_mutex_lock (lock);
+ g_rec_mutex_lock (lock);
/* configure the thread name now */
gst_task_configure_name (task);
if (G_UNLIKELY (GET_TASK_STATE (task) == GST_TASK_PAUSED)) {
GST_OBJECT_LOCK (task);
while (G_UNLIKELY (GST_TASK_STATE (task) == GST_TASK_PAUSED)) {
- g_static_rec_mutex_unlock (lock);
+ g_rec_mutex_unlock (lock);
GST_TASK_SIGNAL (task);
GST_TASK_WAIT (task);
GST_OBJECT_UNLOCK (task);
/* locking order.. */
- g_static_rec_mutex_lock (lock);
+ g_rec_mutex_lock (lock);
GST_OBJECT_LOCK (task);
if (G_UNLIKELY (GET_TASK_STATE (task) == GST_TASK_STOPPED)) {
task->func (task->data);
}
done:
- g_static_rec_mutex_unlock (lock);
+ g_rec_mutex_unlock (lock);
GST_OBJECT_LOCK (task);
task->thread = NULL;
/**
* gst_task_set_lock:
* @task: The #GstTask to use
- * @mutex: The #GMutex to use
+ * @mutex: The #GRecMutex to use
*
* Set the mutex used by the task. The mutex will be acquired before
* calling the #GstTaskFunction.
* MT safe.
*/
void
-gst_task_set_lock (GstTask * task, GStaticRecMutex * mutex)
+gst_task_set_lock (GstTask * task, GRecMutex * mutex)
{
GST_OBJECT_LOCK (task);
if (G_UNLIKELY (task->running))
*
* Get access to the cond of the task.
*/
-#define GST_TASK_GET_COND(task) (GST_TASK_CAST(task)->cond)
+#define GST_TASK_GET_COND(task) (&GST_TASK_CAST(task)->cond)
/**
* GST_TASK_WAIT:
* @task: Task to wait for
/*< public >*/ /* with LOCK */
GstTaskState state;
- GCond *cond;
+ GCond cond;
- GStaticRecMutex *lock;
+ GRecMutex *lock;
GstTaskFunction func;
gpointer data;
GType gst_task_get_type (void);
GstTask* gst_task_new (GstTaskFunction func, gpointer data);
-void gst_task_set_lock (GstTask *task, GStaticRecMutex *mutex);
+void gst_task_set_lock (GstTask *task, GRecMutex *mutex);
void gst_task_set_priority (GstTask *task, GThreadPriority priority);
GstTaskPool * gst_task_get_pool (GstTask *task);
*
*/
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst_private.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/base/gstadapter.h>
#include "gstbaseparse.h"
# include "config.h"
#endif
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst_private.h>
#include "gstbasesink.h"
gst_element_add_pad (GST_ELEMENT_CAST (basesink), basesink->sinkpad);
basesink->pad_mode = GST_PAD_MODE_NONE;
- basesink->preroll_lock = g_mutex_new ();
- basesink->preroll_cond = g_cond_new ();
+ g_mutex_init (&basesink->preroll_lock);
+ g_cond_init (&basesink->preroll_cond);
priv->have_latency = FALSE;
basesink->can_activate_push = DEFAULT_CAN_ACTIVATE_PUSH;
basesink = GST_BASE_SINK (object);
- g_mutex_free (basesink->preroll_lock);
- g_cond_free (basesink->preroll_cond);
+ g_mutex_clear (&basesink->preroll_lock);
+ g_cond_clear (&basesink->preroll_cond);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
*/
#define GST_BASE_SINK_PAD(obj) (GST_BASE_SINK_CAST (obj)->sinkpad)
-#define GST_BASE_SINK_GET_PREROLL_LOCK(pad) (GST_BASE_SINK_CAST(pad)->preroll_lock)
+#define GST_BASE_SINK_GET_PREROLL_LOCK(pad) (&GST_BASE_SINK_CAST(pad)->preroll_lock)
#define GST_BASE_SINK_PREROLL_LOCK(pad) (g_mutex_lock(GST_BASE_SINK_GET_PREROLL_LOCK(pad)))
#define GST_BASE_SINK_PREROLL_TRYLOCK(pad) (g_mutex_trylock(GST_BASE_SINK_GET_PREROLL_LOCK(pad)))
#define GST_BASE_SINK_PREROLL_UNLOCK(pad) (g_mutex_unlock(GST_BASE_SINK_GET_PREROLL_LOCK(pad)))
-#define GST_BASE_SINK_GET_PREROLL_COND(pad) (GST_BASE_SINK_CAST(pad)->preroll_cond)
+#define GST_BASE_SINK_GET_PREROLL_COND(pad) (&GST_BASE_SINK_CAST(pad)->preroll_cond)
#define GST_BASE_SINK_PREROLL_WAIT(pad) \
g_cond_wait (GST_BASE_SINK_GET_PREROLL_COND (pad), GST_BASE_SINK_GET_PREROLL_LOCK (pad))
-#define GST_BASE_SINK_PREROLL_TIMED_WAIT(pad, timeval) \
- g_cond_timed_wait (GST_BASE_SINK_GET_PREROLL_COND (pad), GST_BASE_SINK_GET_PREROLL_LOCK (pad), timeval)
+#define GST_BASE_SINK_PREROLL_WAIT_UNTIL(pad, end_time) \
+ g_cond_wait_until (GST_BASE_SINK_GET_PREROLL_COND (pad), GST_BASE_SINK_GET_PREROLL_LOCK (pad), end_time)
#define GST_BASE_SINK_PREROLL_SIGNAL(pad) g_cond_signal (GST_BASE_SINK_GET_PREROLL_COND (pad));
#define GST_BASE_SINK_PREROLL_BROADCAST(pad) g_cond_broadcast (GST_BASE_SINK_GET_PREROLL_COND (pad));
gboolean can_activate_push;
/*< protected >*/ /* with PREROLL_LOCK */
- GMutex *preroll_lock;
- GCond *preroll_cond;
+ GMutex preroll_lock;
+ GCond preroll_cond;
gboolean eos;
gboolean need_preroll;
gboolean have_preroll;
#include <stdlib.h>
#include <string.h>
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst_private.h>
#include <gst/glib-compat-private.h>
GST_DEBUG_CATEGORY_STATIC (gst_base_src_debug);
#define GST_CAT_DEFAULT gst_base_src_debug
-#define GST_LIVE_GET_LOCK(elem) (GST_BASE_SRC_CAST(elem)->live_lock)
+#define GST_LIVE_GET_LOCK(elem) (&GST_BASE_SRC_CAST(elem)->live_lock)
#define GST_LIVE_LOCK(elem) g_mutex_lock(GST_LIVE_GET_LOCK(elem))
#define GST_LIVE_TRYLOCK(elem) g_mutex_trylock(GST_LIVE_GET_LOCK(elem))
#define GST_LIVE_UNLOCK(elem) g_mutex_unlock(GST_LIVE_GET_LOCK(elem))
-#define GST_LIVE_GET_COND(elem) (GST_BASE_SRC_CAST(elem)->live_cond)
+#define GST_LIVE_GET_COND(elem) (&GST_BASE_SRC_CAST(elem)->live_cond)
#define GST_LIVE_WAIT(elem) g_cond_wait (GST_LIVE_GET_COND (elem), GST_LIVE_GET_LOCK (elem))
-#define GST_LIVE_TIMED_WAIT(elem, timeval) g_cond_timed_wait (GST_LIVE_GET_COND (elem), GST_LIVE_GET_LOCK (elem),\
- timeval)
+#define GST_LIVE_WAIT_UNTIL(elem, end_time) g_cond_timed_wait (GST_LIVE_GET_COND (elem), GST_LIVE_GET_LOCK (elem), end_time)
#define GST_LIVE_SIGNAL(elem) g_cond_signal (GST_LIVE_GET_COND (elem));
#define GST_LIVE_BROADCAST(elem) g_cond_broadcast (GST_LIVE_GET_COND (elem));
basesrc->priv = GST_BASE_SRC_GET_PRIVATE (basesrc);
basesrc->is_live = FALSE;
- basesrc->live_lock = g_mutex_new ();
- basesrc->live_cond = g_cond_new ();
+ g_mutex_init (&basesrc->live_lock);
+ g_cond_init (&basesrc->live_cond);
basesrc->num_buffers = DEFAULT_NUM_BUFFERS;
basesrc->num_buffers_left = -1;
basesrc = GST_BASE_SRC (object);
- g_mutex_free (basesrc->live_lock);
- g_cond_free (basesrc->live_cond);
+ g_mutex_clear (&basesrc->live_lock);
+ g_cond_clear (&basesrc->live_cond);
event_p = &basesrc->pending_seek;
gst_event_replace (event_p, NULL);
/* available to subclass implementations */
/* MT-protected (with LIVE_LOCK) */
- GMutex *live_lock;
- GCond *live_cond;
+ GMutex live_lock;
+ GCond live_cond;
gboolean is_live;
gboolean live_running;
#include <stdlib.h>
#include <string.h>
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "../../../gst/gst_private.h"
#include "../../../gst/gst-i18n-lib.h"
#include "../../../gst/glib-compat-private.h"
trans = GST_BASE_TRANSFORM (object);
- g_mutex_free (trans->transform_lock);
+ g_mutex_clear (&trans->transform_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GST_DEBUG_FUNCPTR (gst_base_transform_query));
gst_element_add_pad (GST_ELEMENT (trans), trans->srcpad);
- trans->transform_lock = g_mutex_new ();
+ g_mutex_init (&trans->transform_lock);
trans->priv->qos_enabled = DEFAULT_PROP_QOS;
trans->cache_caps1 = NULL;
trans->cache_caps2 = NULL;
*
* Since: 0.10.13
*/
-#define GST_BASE_TRANSFORM_LOCK(obj) g_mutex_lock (GST_BASE_TRANSFORM_CAST (obj)->transform_lock)
+#define GST_BASE_TRANSFORM_LOCK(obj) g_mutex_lock (&GST_BASE_TRANSFORM_CAST (obj)->transform_lock)
/**
* GST_BASE_TRANSFORM_UNLOCK:
*
* Since: 0.10.13
*/
-#define GST_BASE_TRANSFORM_UNLOCK(obj) g_mutex_unlock (GST_BASE_TRANSFORM_CAST (obj)->transform_lock)
+#define GST_BASE_TRANSFORM_UNLOCK(obj) g_mutex_unlock (&GST_BASE_TRANSFORM_CAST (obj)->transform_lock)
typedef struct _GstBaseTransform GstBaseTransform;
typedef struct _GstBaseTransformClass GstBaseTransformClass;
/* MT-protected (with STREAM_LOCK) */
GstSegment segment;
- GMutex *transform_lock;
+ GMutex transform_lock;
/*< private >*/
GstBaseTransformPrivate *priv;
{
pads->priv = GST_COLLECT_PADS_GET_PRIVATE (pads);
- pads->cond = g_cond_new ();
+ g_cond_init (&pads->cond);
pads->data = NULL;
pads->cookie = 0;
pads->numpads = 0;
pads->started = FALSE;
/* members to manage the pad list */
- pads->pad_lock = g_mutex_new ();
+ g_mutex_init (&pads->pad_lock);
pads->pad_cookie = 0;
pads->pad_list = NULL;
}
GST_DEBUG ("finalize");
- g_cond_free (pads->cond);
- g_mutex_free (pads->pad_lock);
+ g_cond_clear (&pads->cond);
+ g_mutex_clear (&pads->pad_lock);
/* Remove pads */
collected = pads->pad_list;
*/
typedef GstFlowReturn (*GstCollectPadsFunction) (GstCollectPads *pads, gpointer user_data);
-#define GST_COLLECT_PADS_GET_PAD_LOCK(pads) (((GstCollectPads *)pads)->pad_lock)
+#define GST_COLLECT_PADS_GET_PAD_LOCK(pads) (&((GstCollectPads *)pads)->pad_lock)
#define GST_COLLECT_PADS_PAD_LOCK(pads) (g_mutex_lock(GST_COLLECT_PADS_GET_PAD_LOCK (pads)))
#define GST_COLLECT_PADS_PAD_UNLOCK(pads) (g_mutex_unlock(GST_COLLECT_PADS_GET_PAD_LOCK (pads)))
-#define GST_COLLECT_PADS_GET_COND(pads) (((GstCollectPads *)pads)->cond)
+#define GST_COLLECT_PADS_GET_COND(pads) (&((GstCollectPads *)pads)->cond)
#define GST_COLLECT_PADS_WAIT(pads) (g_cond_wait (GST_COLLECT_PADS_GET_COND (pads), GST_OBJECT_GET_LOCK (pads)))
#define GST_COLLECT_PADS_SIGNAL(pads) (g_cond_signal (GST_COLLECT_PADS_GET_COND (pads)))
#define GST_COLLECT_PADS_BROADCAST(pads)(g_cond_broadcast (GST_COLLECT_PADS_GET_COND (pads)))
guint32 cookie; /* @data list cookie */
/* with LOCK */
- GCond *cond; /* to signal removal of data */
+ GCond cond; /* to signal removal of data */
GstCollectPadsFunction func; /* function and user_data for callback */
gpointer user_data;
gboolean started;
/* with PAD_LOCK */
- GMutex *pad_lock; /* used to serialize add/remove */
+ GMutex pad_lock; /* used to serialize add/remove */
GSList *pad_list; /* updated pad list */
guint32 pad_cookie; /* updated cookie */
GstCollectPadsPrivate *priv;
# include "config.h"
#endif
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst_private.h>
#include "gstcollectpads2.h"
* Alternative implementations are possible, e.g. some low-level re-implementing
* of the 2 above locks to drop both of them atomically when going into _WAIT.
*/
-#define GST_COLLECT_PADS2_GET_EVT_COND(pads) (((GstCollectPads2 *)pads)->evt_cond)
-#define GST_COLLECT_PADS2_GET_EVT_LOCK(pads) (((GstCollectPads2 *)pads)->evt_lock)
+#define GST_COLLECT_PADS2_GET_EVT_COND(pads) (&((GstCollectPads2 *)pads)->evt_cond)
+#define GST_COLLECT_PADS2_GET_EVT_LOCK(pads) (&((GstCollectPads2 *)pads)->evt_lock)
#define GST_COLLECT_PADS2_EVT_WAIT(pads, cookie) G_STMT_START { \
g_mutex_lock (GST_COLLECT_PADS2_GET_EVT_LOCK (pads)); \
/* should work unless a lot of event'ing and thread starvation */\
pads->eospads = 0;
pads->started = FALSE;
- g_static_rec_mutex_init (&pads->stream_lock);
+ g_rec_mutex_init (&pads->stream_lock);
pads->func = gst_collect_pads2_default_collected;
pads->user_data = NULL;
pads->pad_list = NULL;
/* members for event */
- pads->evt_lock = g_mutex_new ();
- pads->evt_cond = g_cond_new ();
+ g_mutex_init (&pads->evt_lock);
+ g_cond_init (&pads->evt_cond);
pads->evt_cookie = 0;
}
GST_DEBUG_OBJECT (object, "finalize");
- g_static_rec_mutex_free (&pads->stream_lock);
+ g_rec_mutex_clear (&pads->stream_lock);
- g_cond_free (pads->evt_cond);
- g_mutex_free (pads->evt_lock);
+ g_cond_clear (&pads->evt_cond);
+ g_mutex_clear (&pads->evt_lock);
/* Remove pads and free pads list */
g_slist_foreach (pads->pad_list, (GFunc) unref_data, NULL);
*
* Since: 0.10.36
*/
-#define GST_COLLECT_PADS2_STREAM_LOCK(pads) (g_static_rec_mutex_lock(GST_COLLECT_PADS2_GET_STREAM_LOCK (pads)))
+#define GST_COLLECT_PADS2_STREAM_LOCK(pads) (g_rec_mutex_lock(GST_COLLECT_PADS2_GET_STREAM_LOCK (pads)))
/**
* GST_COLLECT_PADS2_STREAM_UNLOCK:
* @pads: a #GstCollectPads2
*
* Since: 0.10.36
*/
-#define GST_COLLECT_PADS2_STREAM_UNLOCK(pads) (g_static_rec_mutex_unlock(GST_COLLECT_PADS2_GET_STREAM_LOCK (pads)))
+#define GST_COLLECT_PADS2_STREAM_UNLOCK(pads) (g_rec_mutex_unlock(GST_COLLECT_PADS2_GET_STREAM_LOCK (pads)))
/**
* GstCollectPads2:
GSList *data; /* list of CollectData items */
/*< private >*/
- GStaticRecMutex stream_lock; /* used to serialize collection among several streams */
+ GRecMutex stream_lock; /* used to serialize collection among several streams */
/* with LOCK and/or STREAM_LOCK*/
gboolean started;
gpointer clip_user_data;
/* no other lock needed */
- GMutex *evt_lock; /* these make up sort of poor man's event signaling */
- GCond *evt_cond;
+ GMutex evt_lock; /* these make up sort of poor man's event signaling */
+ GCond evt_cond;
guint32 evt_cookie;
gpointer _gst_reserved[GST_PADDING];
gboolean ret = FALSE;
GSequenceIter *iter;
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
iter =
gst_timed_value_control_source_find_control_point_iter (self, timestamp);
*value = _interpolate_none (self, iter);
ret = TRUE;
}
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return ret;
}
gdouble val;
GSequenceIter *iter1 = NULL, *iter2 = NULL;
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
for (i = 0; i < n_values; i++) {
GST_LOG ("values[%3d] : ts=%" GST_TIME_FORMAT ", next_ts=%" GST_TIME_FORMAT,
ts += interval;
values++;
}
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return ret;
}
GSequenceIter *iter;
GstControlPoint *cp1, *cp2;
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
iter =
gst_timed_value_control_source_find_control_point_iter (self, timestamp);
(cp2 ? cp2->value : 0.0), timestamp);
ret = TRUE;
}
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return ret;
}
GSequenceIter *iter1, *iter2 = NULL;
GstControlPoint *cp1 = NULL, *cp2 = NULL;
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
for (i = 0; i < n_values; i++) {
GST_LOG ("values[%3d] : ts=%" GST_TIME_FORMAT ", next_ts=%" GST_TIME_FORMAT,
ts += interval;
values++;
}
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return ret;
}
if (self->nvalues <= 2)
return interpolate_linear_get (self, timestamp, value);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
iter =
gst_timed_value_control_source_find_control_point_iter (self, timestamp);
(cp2 ? cp2->value : 0.0), timestamp);
ret = TRUE;
}
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return ret;
}
return interpolate_linear_get_value_array (self, timestamp, interval,
n_values, values);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
for (i = 0; i < n_values; i++) {
GST_LOG ("values[%3d] : ts=%" GST_TIME_FORMAT ", next_ts=%" GST_TIME_FORMAT,
ts += interval;
values++;
}
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return ret;
}
GstLFOControlSourcePrivate *priv = self->priv;
gst_object_sync_values (GST_OBJECT (self), timestamp);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*value = _sine_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, timestamp);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return TRUE;
}
for (i = 0; i < n_values; i++) {
gst_object_sync_values (GST_OBJECT (self), ts);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*values = _sine_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, ts);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
ts += interval;
values++;
}
GstLFOControlSourcePrivate *priv = self->priv;
gst_object_sync_values (GST_OBJECT (self), timestamp);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*value = _square_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, timestamp);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return TRUE;
}
for (i = 0; i < n_values; i++) {
gst_object_sync_values (GST_OBJECT (self), ts);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*values = _square_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, ts);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
ts += interval;
values++;
}
GstLFOControlSourcePrivate *priv = self->priv;
gst_object_sync_values (GST_OBJECT (self), timestamp);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*value = _saw_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, timestamp);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return TRUE;
}
for (i = 0; i < n_values; i++) {
gst_object_sync_values (GST_OBJECT (self), ts);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*values = _saw_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, ts);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
ts += interval;
values++;
}
GstLFOControlSourcePrivate *priv = self->priv;
gst_object_sync_values (GST_OBJECT (self), timestamp);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*value = _rsaw_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, timestamp);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return TRUE;
}
for (i = 0; i < n_values; i++) {
gst_object_sync_values (GST_OBJECT (self), ts);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*values = _rsaw_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, ts);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
ts += interval;
values++;
}
GstLFOControlSourcePrivate *priv = self->priv;
gst_object_sync_values (GST_OBJECT (self), timestamp);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*value = _triangle_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, timestamp);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return TRUE;
}
for (i = 0; i < n_values; i++) {
gst_object_sync_values (GST_OBJECT (self), ts);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
*values =
_triangle_get (self, priv->amplitude, priv->offset, priv->timeshift,
priv->period, priv->frequency, ts);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
ts += interval;
values++;
}
self->priv->period = GST_SECOND / self->priv->frequency;
self->priv->timeshift = 0;
- self->lock = g_mutex_new ();
+ g_mutex_init (&self->lock);
}
static void
GstLFOControlSource *self = GST_LFO_CONTROL_SOURCE (obj);
gst_lfo_control_source_reset (self);
- g_mutex_free (self->lock);
+ g_mutex_clear (&self->lock);
G_OBJECT_CLASS (gst_lfo_control_source_parent_class)->finalize (obj);
}
switch (prop_id) {
case PROP_WAVEFORM:
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
gst_lfo_control_source_set_waveform (self,
(GstLFOWaveform) g_value_get_enum (value));
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
break;
case PROP_FREQUENCY:{
gdouble frequency = g_value_get_double (value);
g_return_if_fail (frequency > 0
|| ((GstClockTime) (GST_SECOND / frequency)) != 0);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
self->priv->frequency = frequency;
self->priv->period = GST_SECOND / frequency;
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
break;
}
case PROP_TIMESHIFT:
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
self->priv->timeshift = g_value_get_uint64 (value);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
break;
case PROP_AMPLITUDE:
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
self->priv->amplitude = g_value_get_double (value);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
break;
case PROP_OFFSET:
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
self->priv->offset = g_value_get_double (value);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
/* <private> */
GstLFOControlSourcePrivate *priv;
- GMutex *lock;
+ GMutex lock;
gpointer _gst_reserved[GST_PADDING];
};
g_return_val_if_fail (GST_IS_TIMED_VALUE_CONTROL_SOURCE (self), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
gst_timed_value_control_source_set_internal (self, timestamp, value);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return TRUE;
}
GST_WARNING ("GstTimedValued with invalid timestamp passed to %s",
GST_FUNCTION);
} else {
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
gst_timed_value_control_source_set_internal (self, tv->timestamp,
tv->value);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
res = TRUE;
}
}
g_return_val_if_fail (GST_IS_TIMED_VALUE_CONTROL_SOURCE (self), FALSE);
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
/* check if a control point for the timestamp exists */
if (G_LIKELY (self->values) && (iter =
g_sequence_search (self->values, ×tamp,
res = TRUE;
}
}
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return res;
}
{
g_return_if_fail (GST_IS_TIMED_VALUE_CONTROL_SOURCE (self));
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
/* free GstControlPoint structures */
if (self->values) {
g_sequence_free (self->values);
self->nvalues = 0;
self->valid_cache = FALSE;
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
}
static void
g_return_val_if_fail (GST_IS_TIMED_VALUE_CONTROL_SOURCE (self), NULL);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
if (G_LIKELY (self->values))
g_sequence_foreach (self->values, (GFunc) _append_control_point, &res);
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return res.head;
}
static void
gst_timed_value_control_source_init (GstTimedValueControlSource * self)
{
- self->lock = g_mutex_new ();
+ g_mutex_init (&self->lock);
}
static void
{
GstTimedValueControlSource *self = GST_TIMED_VALUE_CONTROL_SOURCE (obj);
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
gst_timed_value_control_source_reset (self);
- g_mutex_unlock (self->lock);
- g_mutex_free (self->lock);
+ g_mutex_unlock (&self->lock);
+ g_mutex_clear (&self->lock);
G_OBJECT_CLASS (gst_timed_value_control_source_parent_class)->finalize (obj);
}
GstControlSource parent;
/*< protected >*/
- GMutex *lock;
+ GMutex lock;
GSequence *values; /* List of GstControlPoint */
gint nvalues; /* Number of control points */
};
#define GST_TIMED_VALUE_CONTROL_SOURCE_LOCK(o) \
- g_mutex_lock(((GstTimedValueControlSource *)o)->lock)
+ g_mutex_lock(&((GstTimedValueControlSource *)o)->lock)
#define GST_TIMED_VALUE_CONTROL_SOURCE_UNLOCK(o) \
- g_mutex_unlock(((GstTimedValueControlSource *)o)->lock)
+ g_mutex_unlock(&((GstTimedValueControlSource *)o)->lock)
GType gst_timed_value_control_source_get_type (void);
gboolean ret = FALSE;
GSequenceIter *iter;
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
iter =
gst_timed_value_control_source_find_control_point_iter (self, timestamp);
if (!isnan (*value))
ret = TRUE;
}
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return ret;
}
GSequenceIter *iter1 = NULL, *iter2 = NULL;
gboolean triggered = FALSE;
- g_mutex_lock (self->lock);
+ g_mutex_lock (&self->lock);
for (i = 0; i < n_values; i++) {
val = NAN;
if (ts >= next_ts) {
if (!isnan (val))
ret = TRUE;
} else {
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return FALSE;
}
triggered = TRUE;
if (!isnan (val))
ret = TRUE;
} else {
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return FALSE;
}
triggered = FALSE;
ts += interval;
values++;
}
- g_mutex_unlock (self->lock);
+ g_mutex_unlock (&self->lock);
return ret;
}
GST_CAT_LOG (data_queue_dataflow, \
"locking qlock from thread %p", \
g_thread_self ()); \
- g_mutex_lock (q->qlock); \
+ g_mutex_lock (&q->qlock); \
GST_CAT_LOG (data_queue_dataflow, \
"locked qlock from thread %p", \
g_thread_self ()); \
GST_CAT_LOG (data_queue_dataflow, \
"unlocking qlock from thread %p", \
g_thread_self ()); \
- g_mutex_unlock (q->qlock); \
+ g_mutex_unlock (&q->qlock); \
} G_STMT_END
#define STATUS(q, msg) \
queue->checkfull = NULL;
- queue->qlock = g_mutex_new ();
- queue->item_add = g_cond_new ();
- queue->item_del = g_cond_new ();
+ g_mutex_init (&queue->qlock);
+ g_cond_init (&queue->item_add);
+ g_cond_init (&queue->item_del);
queue->queue = g_queue_new ();
GST_DEBUG ("initialized queue's not_empty & not_full conditions");
g_queue_free (queue->queue);
GST_DEBUG ("free mutex");
- g_mutex_free (queue->qlock);
+ g_mutex_clear (&queue->qlock);
GST_DEBUG ("done free mutex");
- g_cond_free (queue->item_add);
- g_cond_free (queue->item_del);
+ g_cond_clear (&queue->item_add);
+ g_cond_clear (&queue->item_del);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
STATUS (queue, "after flushing");
/* we deleted something... */
if (queue->waiting_del)
- g_cond_signal (queue->item_del);
+ g_cond_signal (&queue->item_del);
}
static inline gboolean
if (flushing) {
/* release push/pop functions */
if (queue->waiting_add)
- g_cond_signal (queue->item_add);
+ g_cond_signal (&queue->item_add);
if (queue->waiting_del)
- g_cond_signal (queue->item_del);
+ g_cond_signal (&queue->item_del);
}
GST_DATA_QUEUE_MUTEX_UNLOCK (queue);
}
/* signal might have removed some items */
while (gst_data_queue_locked_is_full (queue)) {
queue->waiting_del = TRUE;
- g_cond_wait (queue->item_del, queue->qlock);
+ g_cond_wait (&queue->item_del, &queue->qlock);
queue->waiting_del = FALSE;
if (queue->flushing)
goto flushing;
STATUS (queue, "after pushing");
if (queue->waiting_add)
- g_cond_signal (queue->item_add);
+ g_cond_signal (&queue->item_add);
GST_DATA_QUEUE_MUTEX_UNLOCK (queue);
while (gst_data_queue_locked_is_empty (queue)) {
queue->waiting_add = TRUE;
- g_cond_wait (queue->item_add, queue->qlock);
+ g_cond_wait (&queue->item_add, &queue->qlock);
queue->waiting_add = FALSE;
if (queue->flushing)
goto flushing;
STATUS (queue, "after popping");
if (queue->waiting_del)
- g_cond_signal (queue->item_del);
+ g_cond_signal (&queue->item_del);
GST_DATA_QUEUE_MUTEX_UNLOCK (queue);
GST_DATA_QUEUE_MUTEX_LOCK (queue);
if (queue->waiting_del) {
GST_DEBUG ("signal del");
- g_cond_signal (queue->item_del);
+ g_cond_signal (&queue->item_del);
}
GST_DATA_QUEUE_MUTEX_UNLOCK (queue);
}
GstDataQueueCheckFullFunction checkfull; /* Callback to check if the queue is full */
gpointer *checkdata;
- GMutex *qlock; /* lock for queue (vs object lock) */
+ GMutex qlock; /* lock for queue (vs object lock) */
gboolean waiting_add;
- GCond *item_add; /* signals buffers now available for reading */
+ GCond item_add; /* signals buffers now available for reading */
gboolean waiting_del;
- GCond *item_del; /* signals space now available for writing */
+ GCond item_del; /* signals space now available for writing */
gboolean flushing; /* indicates whether conditions where signalled because
* of external flushing */
GstDataQueueFullCallback fullcallback;
#define NOTIFY_MUTEX_UNLOCK()
#else
static GStaticRecMutex notify_mutex = G_STATIC_REC_MUTEX_INIT;
-#define NOTIFY_MUTEX_LOCK() g_static_rec_mutex_lock (¬ify_mutex)
-#define NOTIFY_MUTEX_UNLOCK() g_static_rec_mutex_unlock (¬ify_mutex)
+#define NOTIFY_MUTEX_LOCK() g_rec_mutex_lock (¬ify_mutex)
+#define NOTIFY_MUTEX_UNLOCK() g_rec_mutex_unlock (¬ify_mutex)
#endif
-#define GST_INPUT_SELECTOR_GET_LOCK(sel) (((GstInputSelector*)(sel))->lock)
-#define GST_INPUT_SELECTOR_GET_COND(sel) (((GstInputSelector*)(sel))->cond)
-#define GST_INPUT_SELECTOR_LOCK(sel) (g_mutex_lock (GST_INPUT_SELECTOR_GET_LOCK(sel)))
-#define GST_INPUT_SELECTOR_UNLOCK(sel) (g_mutex_unlock (GST_INPUT_SELECTOR_GET_LOCK(sel)))
-#define GST_INPUT_SELECTOR_WAIT(sel) (g_cond_wait (GST_INPUT_SELECTOR_GET_COND(sel), \
- GST_INPUT_SELECTOR_GET_LOCK(sel)))
-#define GST_INPUT_SELECTOR_BROADCAST(sel) (g_cond_broadcast (GST_INPUT_SELECTOR_GET_COND(sel)))
-
static GstStaticPadTemplate gst_input_selector_sink_factory =
GST_STATIC_PAD_TEMPLATE ("sink_%u",
GST_PAD_SINK,
}
static void gst_input_selector_dispose (GObject * object);
+static void gst_input_selector_finalize (GObject * object);
static void gst_input_selector_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
gobject_class->dispose = gst_input_selector_dispose;
+ gobject_class->finalize = gst_input_selector_finalize;
gobject_class->set_property = gst_input_selector_set_property;
gobject_class->get_property = gst_input_selector_get_property;
sel->padcount = 0;
sel->sync_streams = DEFAULT_SYNC_STREAMS;
- sel->lock = g_mutex_new ();
- sel->cond = g_cond_new ();
+ g_mutex_init (&sel->lock);
+ g_cond_init (&sel->cond);
sel->blocked = FALSE;
}
gst_object_unref (sel->active_sinkpad);
sel->active_sinkpad = NULL;
}
- if (sel->lock) {
- g_mutex_free (sel->lock);
- sel->lock = NULL;
- }
- if (sel->cond) {
- g_cond_free (sel->cond);
- sel->cond = NULL;
- }
-
G_OBJECT_CLASS (parent_class)->dispose (object);
}
+static void
+gst_input_selector_finalize (GObject * object)
+{
+ GstInputSelector *sel = GST_INPUT_SELECTOR (object);
+
+ g_mutex_clear (&sel->lock);
+ g_cond_clear (&sel->cond);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
/* this function must be called with the SELECTOR_LOCK. It returns TRUE when the
* active pad changed. */
static gboolean
typedef struct _GstInputSelector GstInputSelector;
typedef struct _GstInputSelectorClass GstInputSelectorClass;
-#define GST_INPUT_SELECTOR_GET_LOCK(sel) (((GstInputSelector*)(sel))->lock)
-#define GST_INPUT_SELECTOR_GET_COND(sel) (((GstInputSelector*)(sel))->cond)
+#define GST_INPUT_SELECTOR_GET_LOCK(sel) (&((GstInputSelector*)(sel))->lock)
+#define GST_INPUT_SELECTOR_GET_COND(sel) (&((GstInputSelector*)(sel))->cond)
#define GST_INPUT_SELECTOR_LOCK(sel) (g_mutex_lock (GST_INPUT_SELECTOR_GET_LOCK(sel)))
#define GST_INPUT_SELECTOR_UNLOCK(sel) (g_mutex_unlock (GST_INPUT_SELECTOR_GET_LOCK(sel)))
#define GST_INPUT_SELECTOR_WAIT(sel) (g_cond_wait (GST_INPUT_SELECTOR_GET_COND(sel), \
guint padcount;
gboolean sync_streams;
- GMutex *lock;
- GCond *cond;
+ GMutex lock;
+ GCond cond;
gboolean blocked;
gboolean flushing;
};
# include "config.h"
#endif
-/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
- * with newer GLib versions (>= 2.31.0) */
-#define GLIB_DISABLE_DEPRECATION_WARNINGS
-
#include <gst/gst.h>
#include <stdio.h>
#include "gstmultiqueue.h"
guint32 last_oldid; /* Previously observed old_id, reset to MAXUINT32 on flush */
GstClockTime next_time; /* End running time of next buffer to be pushed */
GstClockTime last_time; /* Start running time of last pushed buffer */
- GCond *turn; /* SingleQueue turn waiting conditional */
+ GCond turn; /* SingleQueue turn waiting conditional */
};
};
#define GST_MULTI_QUEUE_MUTEX_LOCK(q) G_STMT_START { \
- g_mutex_lock (q->qlock); \
+ g_mutex_lock (&q->qlock); \
} G_STMT_END
#define GST_MULTI_QUEUE_MUTEX_UNLOCK(q) G_STMT_START { \
- g_mutex_unlock (q->qlock); \
+ g_mutex_unlock (&q->qlock); \
} G_STMT_END
static void gst_multi_queue_finalize (GObject * object);
mqueue->highid = -1;
mqueue->high_time = GST_CLOCK_TIME_NONE;
- mqueue->qlock = g_mutex_new ();
+ g_mutex_init (&mqueue->qlock);
}
static void
mqueue->queues_cookie++;
/* free/unref instance data */
- g_mutex_free (mqueue->qlock);
+ g_mutex_clear (&mqueue->qlock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
for (tmp = mqueue->queues; tmp; tmp = g_list_next (tmp)) {
sq = (GstSingleQueue *) tmp->data;
sq->flushing = TRUE;
- g_cond_signal (sq->turn);
+ g_cond_signal (&sq->turn);
}
GST_MULTI_QUEUE_MUTEX_UNLOCK (mqueue);
break;
GST_LOG_OBJECT (mq, "SingleQueue %d : waking up eventually waiting task",
sq->id);
GST_MULTI_QUEUE_MUTEX_LOCK (mq);
- g_cond_signal (sq->turn);
+ g_cond_signal (&sq->turn);
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
GST_LOG_OBJECT (mq, "SingleQueue %d : pausing task", sq->id);
wake_up_next_non_linked (mq);
mq->numwaiting++;
- g_cond_wait (sq->turn, mq->qlock);
+ g_cond_wait (&sq->turn, &mq->qlock);
mq->numwaiting--;
if (sq->flushing) {
&& sq->next_time >= mq->high_time)
|| (sq->nextid != 0 && sq->nextid <= mq->highid)) {
GST_LOG_OBJECT (mq, "Waking up singlequeue %d", sq->id);
- g_cond_signal (sq->turn);
+ g_cond_signal (&sq->turn);
}
}
}
/* DRAIN QUEUE */
gst_data_queue_flush (sq->queue);
g_object_unref (sq->queue);
- g_cond_free (sq->turn);
+ g_cond_clear (&sq->turn);
g_free (sq);
}
sq->oldid = 0;
sq->next_time = GST_CLOCK_TIME_NONE;
sq->last_time = GST_CLOCK_TIME_NONE;
- sq->turn = g_cond_new ();
+ g_cond_init (&sq->turn);
sq->sinktime = GST_CLOCK_TIME_NONE;
sq->srctime = GST_CLOCK_TIME_NONE;
/* only activate the pads when we are not in the NULL state
* and add the pad under the state_lock to prevend state changes
* between activating and adding */
- g_static_rec_mutex_lock (GST_STATE_GET_LOCK (mqueue));
+ g_rec_mutex_lock (GST_STATE_GET_LOCK (mqueue));
if (GST_STATE_TARGET (mqueue) != GST_STATE_NULL) {
gst_pad_set_active (sq->srcpad, TRUE);
gst_pad_set_active (sq->sinkpad, TRUE);
}
gst_element_add_pad (GST_ELEMENT (mqueue), sq->srcpad);
gst_element_add_pad (GST_ELEMENT (mqueue), sq->sinkpad);
- g_static_rec_mutex_unlock (GST_STATE_GET_LOCK (mqueue));
+ g_rec_mutex_unlock (GST_STATE_GET_LOCK (mqueue));
GST_DEBUG_OBJECT (mqueue, "GstSingleQueue [%d] created and pads added",
sq->id);
guint32 highid; /* contains highest id of last outputted object */
GstClockTime high_time; /* highest start running time */
- GMutex * qlock; /* Global queue lock (vs object lock or individual */
+ GMutex qlock; /* Global queue lock (vs object lock or individual */
/* queues lock). Protects nbqueues, queues, global */
/* GstMultiQueueSize, counter and highid */
#define DEFAULT_MAX_SIZE_TIME GST_SECOND /* 1 second */
#define GST_QUEUE_MUTEX_LOCK(q) G_STMT_START { \
- g_mutex_lock (q->qlock); \
+ g_mutex_lock (&q->qlock); \
} G_STMT_END
#define GST_QUEUE_MUTEX_LOCK_CHECK(q,label) G_STMT_START { \
} G_STMT_END
#define GST_QUEUE_MUTEX_UNLOCK(q) G_STMT_START { \
- g_mutex_unlock (q->qlock); \
+ g_mutex_unlock (&q->qlock); \
} G_STMT_END
#define GST_QUEUE_WAIT_DEL_CHECK(q, label) G_STMT_START { \
STATUS (q, q->sinkpad, "wait for DEL"); \
q->waiting_del = TRUE; \
- g_cond_wait (q->item_del, q->qlock); \
+ g_cond_wait (&q->item_del, &q->qlock); \
q->waiting_del = FALSE; \
if (q->srcresult != GST_FLOW_OK) { \
STATUS (q, q->srcpad, "received DEL wakeup"); \
#define GST_QUEUE_WAIT_ADD_CHECK(q, label) G_STMT_START { \
STATUS (q, q->srcpad, "wait for ADD"); \
q->waiting_add = TRUE; \
- g_cond_wait (q->item_add, q->qlock); \
+ g_cond_wait (&q->item_add, &q->qlock); \
q->waiting_add = FALSE; \
if (q->srcresult != GST_FLOW_OK) { \
STATUS (q, q->srcpad, "received ADD wakeup"); \
#define GST_QUEUE_SIGNAL_DEL(q) G_STMT_START { \
if (q->waiting_del) { \
STATUS (q, q->srcpad, "signal DEL"); \
- g_cond_signal (q->item_del); \
+ g_cond_signal (&q->item_del); \
} \
} G_STMT_END
#define GST_QUEUE_SIGNAL_ADD(q) G_STMT_START { \
if (q->waiting_add) { \
STATUS (q, q->sinkpad, "signal ADD"); \
- g_cond_signal (q->item_add); \
+ g_cond_signal (&q->item_add); \
} \
} G_STMT_END
queue->leaky = GST_QUEUE_NO_LEAK;
queue->srcresult = GST_FLOW_WRONG_STATE;
- queue->qlock = g_mutex_new ();
- queue->item_add = g_cond_new ();
- queue->item_del = g_cond_new ();
+ g_mutex_init (&queue->qlock);
+ g_cond_init (&queue->item_add);
+ g_cond_init (&queue->item_del);
g_queue_init (&queue->queue);
gst_mini_object_unref (data);
g_queue_clear (&queue->queue);
- g_mutex_free (queue->qlock);
- g_cond_free (queue->item_add);
- g_cond_free (queue->item_del);
+ g_mutex_clear (&queue->qlock);
+ g_cond_clear (&queue->item_add);
+ g_cond_clear (&queue->item_del);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GST_QUEUE_MUTEX_LOCK (queue);
queue->srcresult = GST_FLOW_WRONG_STATE;
/* the item add signal will unblock */
- g_cond_signal (queue->item_add);
+ g_cond_signal (&queue->item_add);
GST_QUEUE_MUTEX_UNLOCK (queue);
/* step 2, make sure streaming finishes */
/* whether we leak data, and at which end */
gint leaky;
- GMutex *qlock; /* lock for queue (vs object lock) */
+ GMutex qlock; /* lock for queue (vs object lock) */
gboolean waiting_add;
- GCond *item_add; /* signals buffers now available for reading */
+ GCond item_add; /* signals buffers now available for reading */
gboolean waiting_del;
- GCond *item_del; /* signals space now available for writing */
+ GCond item_del; /* signals space now available for writing */
gboolean head_needs_discont, tail_needs_discont;
gboolean push_newsegment;
queue->queue.length))
#define GST_QUEUE2_MUTEX_LOCK(q) G_STMT_START { \
- g_mutex_lock (q->qlock); \
+ g_mutex_lock (&q->qlock); \
} G_STMT_END
#define GST_QUEUE2_MUTEX_LOCK_CHECK(q,res,label) G_STMT_START { \
} G_STMT_END
#define GST_QUEUE2_MUTEX_UNLOCK(q) G_STMT_START { \
- g_mutex_unlock (q->qlock); \
+ g_mutex_unlock (&q->qlock); \
} G_STMT_END
#define GST_QUEUE2_WAIT_DEL_CHECK(q, res, label) G_STMT_START { \
STATUS (queue, q->sinkpad, "wait for DEL"); \
q->waiting_del = TRUE; \
- g_cond_wait (q->item_del, queue->qlock); \
+ g_cond_wait (&q->item_del, &queue->qlock); \
q->waiting_del = FALSE; \
if (res != GST_FLOW_OK) { \
STATUS (queue, q->srcpad, "received DEL wakeup"); \
#define GST_QUEUE2_WAIT_ADD_CHECK(q, res, label) G_STMT_START { \
STATUS (queue, q->srcpad, "wait for ADD"); \
q->waiting_add = TRUE; \
- g_cond_wait (q->item_add, q->qlock); \
+ g_cond_wait (&q->item_add, &q->qlock); \
q->waiting_add = FALSE; \
if (res != GST_FLOW_OK) { \
STATUS (queue, q->srcpad, "received ADD wakeup"); \
#define GST_QUEUE2_SIGNAL_DEL(q) G_STMT_START { \
if (q->waiting_del) { \
STATUS (q, q->srcpad, "signal DEL"); \
- g_cond_signal (q->item_del); \
+ g_cond_signal (&q->item_del); \
} \
} G_STMT_END
#define GST_QUEUE2_SIGNAL_ADD(q) G_STMT_START { \
if (q->waiting_add) { \
STATUS (q, q->sinkpad, "signal ADD"); \
- g_cond_signal (q->item_add); \
+ g_cond_signal (&q->item_add); \
} \
} G_STMT_END
queue->in_timer = g_timer_new ();
queue->out_timer = g_timer_new ();
- queue->qlock = g_mutex_new ();
+ g_mutex_init (&queue->qlock);
queue->waiting_add = FALSE;
- queue->item_add = g_cond_new ();
+ g_cond_init (&queue->item_add);
queue->waiting_del = FALSE;
- queue->item_del = g_cond_new ();
+ g_cond_init (&queue->item_del);
g_queue_init (&queue->queue);
queue->buffering_percent = 100;
}
g_queue_clear (&queue->queue);
- g_mutex_free (queue->qlock);
- g_cond_free (queue->item_add);
- g_cond_free (queue->item_del);
+ g_mutex_clear (&queue->qlock);
+ g_cond_clear (&queue->item_add);
+ g_cond_clear (&queue->item_del);
g_timer_destroy (queue->in_timer);
g_timer_destroy (queue->out_timer);
guint64 bytes_out;
gdouble byte_out_rate;
- GMutex *qlock; /* lock for queue (vs object lock) */
+ GMutex qlock; /* lock for queue (vs object lock) */
gboolean waiting_add;
- GCond *item_add; /* signals buffers now available for reading */
+ GCond item_add; /* signals buffers now available for reading */
gboolean waiting_del;
- GCond *item_del; /* signals space now available for writing */
+ GCond item_del; /* signals space now available for writing */
/* temp location stuff */
gchar *temp_template;
}
/* lock to protect request pads from being removed while downstream */
-#define GST_TEE_DYN_LOCK(tee) g_mutex_lock ((tee)->dyn_lock)
-#define GST_TEE_DYN_UNLOCK(tee) g_mutex_unlock ((tee)->dyn_lock)
+#define GST_TEE_DYN_LOCK(tee) g_mutex_lock (&(tee)->dyn_lock)
+#define GST_TEE_DYN_UNLOCK(tee) g_mutex_unlock (&(tee)->dyn_lock)
#define DEFAULT_PROP_NUM_SRC_PADS 0
#define DEFAULT_PROP_HAS_SINK_LOOP FALSE
g_free (tee->last_message);
- g_mutex_free (tee->dyn_lock);
+ g_mutex_clear (&tee->dyn_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_tee_init (GstTee * tee)
{
- tee->dyn_lock = g_mutex_new ();
+ g_mutex_init (&tee->dyn_lock);
tee->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
tee->sink_mode = GST_PAD_MODE_NONE;
/*< private >*/
/* lock protecting dynamic pads */
- GMutex *dyn_lock;
+ GMutex dyn_lock;
GstPad *sinkpad;
GstPad *allocpad;
#define MAX_THREADS 1000
static guint64 nbbuffers;
-static GMutex *mutex;
+static GMutex mutex;
static void *
GstBuffer *buf;
GstClockTime start, end;
- g_mutex_lock (mutex);
- g_mutex_unlock (mutex);
+ g_mutex_lock (&mutex);
+ g_mutex_unlock (&mutex);
start = gst_util_get_timestamp ();
GstClockTime start, end;
gst_init (&argc, &argv);
- mutex = g_mutex_new ();
+ g_mutex_init (&mutex);
if (argc != 3) {
g_print ("usage: %s <num_threads> <nbbuffers>\n", argv[0]);
exit (-3);
}
- g_mutex_lock (mutex);
+ g_mutex_lock (&mutex);
/* Let's just make sure the GstBufferClass is loaded ... */
tmp = gst_buffer_new ();
/* Signal all threads to start */
start = gst_util_get_timestamp ();
- g_mutex_unlock (mutex);
+ g_mutex_unlock (&mutex);
for (t = 0; t < num_threads; t++) {
if (threads[t])
static GstPoll *set;
static GList *fds = NULL;
-static GMutex *fdlock;
+static GMutex fdlock;
static GTimer *timer;
#define MAX_THREADS 100
gint random;
gint removed = 0;
- g_mutex_lock (fdlock);
+ g_mutex_lock (&fdlock);
for (walk = fds; walk;) {
GstPollFD *fd = (GstPollFD *) walk->data;
}
}
- g_mutex_unlock (fdlock);
+ g_mutex_unlock (&fdlock);
}
static void *
} else {
mess_some_more ();
if (g_timer_elapsed (timer, NULL) > 0.5) {
- g_mutex_lock (fdlock);
+ g_mutex_lock (&fdlock);
g_print ("active fds :%d\n", g_list_length (fds));
g_timer_start (timer);
- g_mutex_unlock (fdlock);
+ g_mutex_unlock (&fdlock);
}
g_usleep (1);
}
gst_init (&argc, &argv);
- fdlock = g_mutex_new ();
+ g_mutex_init (&fdlock);
timer = g_timer_new ();
if (argc != 2) {
#include <gst/check/gstcheck.h>
-static GMutex *task_lock;
-static GCond *task_cond;
+static GMutex task_lock;
+static GCond task_cond;
-static GStaticRecMutex task_mutex = G_STATIC_REC_MUTEX_INIT;
+static GRecMutex task_mutex;
static void
task_func2 (void *data)
gboolean ret;
GstTask *t = *((GstTask **) data);
- g_mutex_lock (task_lock);
+ g_mutex_lock (&task_lock);
GST_DEBUG ("signal");
- g_cond_signal (task_cond);
- g_mutex_unlock (task_lock);
+ g_cond_signal (&task_cond);
+ g_mutex_unlock (&task_lock);
ASSERT_WARNING (ret = gst_task_join (t));
fail_unless (ret == FALSE);
t = gst_task_new (task_func2, &t);
fail_if (t == NULL);
+ g_rec_mutex_init (&task_mutex);
gst_task_set_lock (t, &task_mutex);
- task_cond = g_cond_new ();
- task_lock = g_mutex_new ();
+ g_cond_init (&task_cond);
+ g_mutex_init (&task_lock);
- g_mutex_lock (task_lock);
+ g_mutex_lock (&task_lock);
GST_DEBUG ("starting");
ret = gst_task_start (t);
fail_unless (ret == TRUE);
/* wait for it to spin up */
GST_DEBUG ("waiting");
- g_cond_wait (task_cond, task_lock);
+ g_cond_wait (&task_cond, &task_lock);
GST_DEBUG ("done waiting");
- g_mutex_unlock (task_lock);
+ g_mutex_unlock (&task_lock);
GST_DEBUG ("joining");
ret = gst_task_join (t);
static void
task_func (void *data)
{
- g_mutex_lock (task_lock);
+ g_mutex_lock (&task_lock);
GST_DEBUG ("signal");
- g_cond_signal (task_cond);
- g_mutex_unlock (task_lock);
+ g_cond_signal (&task_cond);
+ g_mutex_unlock (&task_lock);
}
GST_START_TEST (test_lock_start)
t = gst_task_new (task_func, NULL);
fail_if (t == NULL);
+ g_rec_mutex_init (&task_mutex);
gst_task_set_lock (t, &task_mutex);
- task_cond = g_cond_new ();
- task_lock = g_mutex_new ();
+ g_cond_init (&task_cond);
+ g_mutex_init (&task_lock);
- g_mutex_lock (task_lock);
+ g_mutex_lock (&task_lock);
GST_DEBUG ("starting");
ret = gst_task_start (t);
fail_unless (ret == TRUE);
/* wait for it to spin up */
GST_DEBUG ("waiting");
- g_cond_wait (task_cond, task_lock);
+ g_cond_wait (&task_cond, &task_lock);
GST_DEBUG ("done waiting");
- g_mutex_unlock (task_lock);
+ g_mutex_unlock (&task_lock);
/* cannot set mutex now */
ASSERT_WARNING (gst_task_set_lock (t, &task_mutex));
t = gst_task_new (task_func, NULL);
fail_if (t == NULL);
+ g_rec_mutex_init (&task_mutex);
gst_task_set_lock (t, &task_mutex);
GST_DEBUG ("pause");