audio: port to the new GLib thread API

This commit is contained in:
Thibault Saunier 2012-09-09 20:34:47 -03:00
parent acde0579f8
commit dc5bb008a3
4 changed files with 12 additions and 15 deletions

View file

@ -83,7 +83,7 @@ gst_audio_ring_buffer_init (GstAudioRingBuffer * ringbuffer)
ringbuffer->open = FALSE; ringbuffer->open = FALSE;
ringbuffer->acquired = FALSE; ringbuffer->acquired = FALSE;
ringbuffer->state = GST_AUDIO_RING_BUFFER_STATE_STOPPED; ringbuffer->state = GST_AUDIO_RING_BUFFER_STATE_STOPPED;
ringbuffer->cond = g_cond_new (); g_cond_init (&ringbuffer->cond);
ringbuffer->waiting = 0; ringbuffer->waiting = 0;
ringbuffer->empty_seg = NULL; ringbuffer->empty_seg = NULL;
ringbuffer->flushing = TRUE; ringbuffer->flushing = TRUE;
@ -105,7 +105,7 @@ gst_audio_ring_buffer_finalize (GObject * object)
{ {
GstAudioRingBuffer *ringbuffer = GST_AUDIO_RING_BUFFER (object); GstAudioRingBuffer *ringbuffer = GST_AUDIO_RING_BUFFER (object);
g_cond_free (ringbuffer->cond); g_cond_clear (&ringbuffer->cond);
g_free (ringbuffer->empty_seg); g_free (ringbuffer->empty_seg);
G_OBJECT_CLASS (gst_audio_ring_buffer_parent_class)->finalize (G_OBJECT G_OBJECT_CLASS (gst_audio_ring_buffer_parent_class)->finalize (G_OBJECT

View file

@ -145,7 +145,7 @@ struct _GstAudioRingBufferSpec
gpointer _gst_reserved[GST_PADDING]; gpointer _gst_reserved[GST_PADDING];
}; };
#define GST_AUDIO_RING_BUFFER_GET_COND(buf) (((GstAudioRingBuffer *)buf)->cond) #define GST_AUDIO_RING_BUFFER_GET_COND(buf) (&(((GstAudioRingBuffer *)buf)->cond))
#define GST_AUDIO_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIO_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf))) #define GST_AUDIO_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIO_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
#define GST_AUDIO_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIO_RING_BUFFER_GET_COND (buf))) #define GST_AUDIO_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIO_RING_BUFFER_GET_COND (buf)))
#define GST_AUDIO_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIO_RING_BUFFER_GET_COND (buf))) #define GST_AUDIO_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIO_RING_BUFFER_GET_COND (buf)))
@ -171,7 +171,7 @@ struct _GstAudioRingBuffer {
GstObject object; GstObject object;
/*< public >*/ /* with LOCK */ /*< public >*/ /* with LOCK */
GCond *cond; GCond cond;
gboolean open; gboolean open;
gboolean acquired; gboolean acquired;
guint8 *memory; guint8 *memory;

View file

@ -92,7 +92,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_audio_sink_debug);
typedef struct _GstAudioSinkRingBuffer GstAudioSinkRingBuffer; typedef struct _GstAudioSinkRingBuffer GstAudioSinkRingBuffer;
typedef struct _GstAudioSinkRingBufferClass GstAudioSinkRingBufferClass; typedef struct _GstAudioSinkRingBufferClass GstAudioSinkRingBufferClass;
#define GST_AUDIO_SINK_RING_BUFFER_GET_COND(buf) (((GstAudioSinkRingBuffer *)buf)->cond) #define GST_AUDIO_SINK_RING_BUFFER_GET_COND(buf) (&(((GstAudioSinkRingBuffer *)buf)->cond))
#define GST_AUDIO_SINK_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIO_SINK_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf))) #define GST_AUDIO_SINK_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIO_SINK_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
#define GST_AUDIO_SINK_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIO_SINK_RING_BUFFER_GET_COND (buf))) #define GST_AUDIO_SINK_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIO_SINK_RING_BUFFER_GET_COND (buf)))
#define GST_AUDIO_SINK_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIO_SINK_RING_BUFFER_GET_COND (buf))) #define GST_AUDIO_SINK_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIO_SINK_RING_BUFFER_GET_COND (buf)))
@ -104,7 +104,7 @@ struct _GstAudioSinkRingBuffer
gboolean running; gboolean running;
gint queuedseg; gint queuedseg;
GCond *cond; GCond cond;
}; };
struct _GstAudioSinkRingBufferClass struct _GstAudioSinkRingBufferClass
@ -320,7 +320,7 @@ gst_audio_sink_ring_buffer_init (GstAudioSinkRingBuffer * ringbuffer,
ringbuffer->running = FALSE; ringbuffer->running = FALSE;
ringbuffer->queuedseg = 0; ringbuffer->queuedseg = 0;
ringbuffer->cond = g_cond_new (); g_cond_init (&ringbuffer->cond);
} }
static void static void
@ -334,7 +334,7 @@ gst_audio_sink_ring_buffer_finalize (GObject * object)
{ {
GstAudioSinkRingBuffer *ringbuffer = GST_AUDIO_SINK_RING_BUFFER_CAST (object); GstAudioSinkRingBuffer *ringbuffer = GST_AUDIO_SINK_RING_BUFFER_CAST (object);
g_cond_free (ringbuffer->cond); g_cond_clear (&ringbuffer->cond);
G_OBJECT_CLASS (ring_parent_class)->finalize (object); G_OBJECT_CLASS (ring_parent_class)->finalize (object);
} }

View file

@ -90,7 +90,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_audio_src_debug);
typedef struct _GstAudioSrcRingBuffer GstAudioSrcRingBuffer; typedef struct _GstAudioSrcRingBuffer GstAudioSrcRingBuffer;
typedef struct _GstAudioSrcRingBufferClass GstAudioSrcRingBufferClass; typedef struct _GstAudioSrcRingBufferClass GstAudioSrcRingBufferClass;
#define GST_AUDIO_SRC_RING_BUFFER_GET_COND(buf) (((GstAudioSrcRingBuffer *)buf)->cond) #define GST_AUDIO_SRC_RING_BUFFER_GET_COND(buf) (&(((GstAudioSrcRingBuffer *)buf)->cond))
#define GST_AUDIO_SRC_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIO_SRC_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf))) #define GST_AUDIO_SRC_RING_BUFFER_WAIT(buf) (g_cond_wait (GST_AUDIO_SRC_RING_BUFFER_GET_COND (buf), GST_OBJECT_GET_LOCK (buf)))
#define GST_AUDIO_SRC_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIO_SRC_RING_BUFFER_GET_COND (buf))) #define GST_AUDIO_SRC_RING_BUFFER_SIGNAL(buf) (g_cond_signal (GST_AUDIO_SRC_RING_BUFFER_GET_COND (buf)))
#define GST_AUDIO_SRC_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIO_SRC_RING_BUFFER_GET_COND (buf))) #define GST_AUDIO_SRC_RING_BUFFER_BROADCAST(buf)(g_cond_broadcast (GST_AUDIO_SRC_RING_BUFFER_GET_COND (buf)))
@ -102,7 +102,7 @@ struct _GstAudioSrcRingBuffer
gboolean running; gboolean running;
gint queuedseg; gint queuedseg;
GCond *cond; GCond cond;
}; };
struct _GstAudioSrcRingBufferClass struct _GstAudioSrcRingBufferClass
@ -301,7 +301,7 @@ gst_audio_src_ring_buffer_init (GstAudioSrcRingBuffer * ringbuffer,
ringbuffer->running = FALSE; ringbuffer->running = FALSE;
ringbuffer->queuedseg = 0; ringbuffer->queuedseg = 0;
ringbuffer->cond = g_cond_new (); g_cond_init (&ringbuffer->cond);
} }
static void static void
@ -309,10 +309,7 @@ gst_audio_src_ring_buffer_dispose (GObject * object)
{ {
GstAudioSrcRingBuffer *ringbuffer = GST_AUDIO_SRC_RING_BUFFER (object); GstAudioSrcRingBuffer *ringbuffer = GST_AUDIO_SRC_RING_BUFFER (object);
if (ringbuffer->cond) { g_cond_clear (&ringbuffer->cond);
g_cond_free (ringbuffer->cond);
ringbuffer->cond = NULL;
}
G_OBJECT_CLASS (ring_parent_class)->dispose (object); G_OBJECT_CLASS (ring_parent_class)->dispose (object);
} }