directsoundsink: port to the new GLib thread API

This commit is contained in:
Mark Nauwelaerts 2012-09-11 12:36:56 +02:00
parent a374217786
commit fd162372f1
2 changed files with 8 additions and 4 deletions

View file

@ -136,6 +136,10 @@ G_DEFINE_TYPE_WITH_CODE (GstDirectSoundSink, gst_directsound_sink,
static void static void
gst_directsound_sink_finalize (GObject * object) gst_directsound_sink_finalize (GObject * object)
{ {
GstDirectSoundSink *dsoundsink = GST_DIRECTSOUND_SINK (object);
g_mutex_clear (&dsoundsink->dsound_lock);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
@ -208,7 +212,7 @@ gst_directsound_sink_init (GstDirectSoundSink * dsoundsink)
dsoundsink->current_circular_offset = 0; dsoundsink->current_circular_offset = 0;
dsoundsink->buffer_size = DSBSIZE_MIN; dsoundsink->buffer_size = DSBSIZE_MIN;
dsoundsink->volume = 100; dsoundsink->volume = 100;
dsoundsink->dsound_lock = g_mutex_new (); g_mutex_init (&dsoundsink->dsound_lock);
dsoundsink->first_buffer_after_reset = FALSE; dsoundsink->first_buffer_after_reset = FALSE;
} }

View file

@ -48,8 +48,8 @@ G_BEGIN_DECLS
typedef struct _GstDirectSoundSink GstDirectSoundSink; typedef struct _GstDirectSoundSink GstDirectSoundSink;
typedef struct _GstDirectSoundSinkClass GstDirectSoundSinkClass; typedef struct _GstDirectSoundSinkClass GstDirectSoundSinkClass;
#define GST_DSOUND_LOCK(obj) (g_mutex_lock (obj->dsound_lock)) #define GST_DSOUND_LOCK(obj) (g_mutex_lock (&obj->dsound_lock))
#define GST_DSOUND_UNLOCK(obj) (g_mutex_unlock (obj->dsound_lock)) #define GST_DSOUND_UNLOCK(obj) (g_mutex_unlock (&obj->dsound_lock))
struct _GstDirectSoundSink struct _GstDirectSoundSink
{ {
@ -76,7 +76,7 @@ struct _GstDirectSoundSink
GstCaps *cached_caps; GstCaps *cached_caps;
/* lock used to protect writes and resets */ /* lock used to protect writes and resets */
GMutex *dsound_lock; GMutex dsound_lock;
gboolean first_buffer_after_reset; gboolean first_buffer_after_reset;