From 482823463937e4c88c41c5fc78486bf31e6b8397 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 4 Dec 2011 20:38:19 +0000 Subject: [PATCH] alsamixer: use GRectMutext instead of GStaticRecMutex with newer glib versions --- ext/alsa/gstalsamixer.c | 13 ++++++++++--- ext/alsa/gstalsamixer.h | 10 ++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ext/alsa/gstalsamixer.c b/ext/alsa/gstalsamixer.c index 79be56d..87b2db3 100644 --- a/ext/alsa/gstalsamixer.c +++ b/ext/alsa/gstalsamixer.c @@ -492,7 +492,11 @@ gst_alsa_mixer_new (const char *device, GstAlsaMixerDirection dir) if (pipe (ret->pfd) == -1) goto error; +#if !GLIB_CHECK_VERSION (2, 31, 0) g_static_rec_mutex_init (&ret->rec_mutex); +#else + g_rec_mutex_init (&ret->rec_mutex); +#endif g_static_rec_mutex_init (&ret->task_mutex); ret->task = gst_task_create (task_monitor_alsa, ret); @@ -575,8 +579,11 @@ gst_alsa_mixer_free (GstAlsaMixer * mixer) snd_mixer_close (mixer->handle); mixer->handle = NULL; } - +#if !GLIB_CHECK_VERSION (2, 31, 0) g_static_rec_mutex_free (&mixer->rec_mutex); +#else + g_rec_mutex_clear (&mixer->rec_mutex); +#endif g_free (mixer); } @@ -759,8 +766,8 @@ gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track, for (i = 0; i < ((GstMixerTrack *) ctrl_track)->num_channels; i++) { long vol = - mute ? ((GstMixerTrack *) ctrl_track)-> - min_volume : ctrl_track->volumes[i]; + mute ? ((GstMixerTrack *) ctrl_track)->min_volume : ctrl_track-> + volumes[i]; snd_mixer_selem_set_playback_volume (ctrl_track->element, i, vol); } } diff --git a/ext/alsa/gstalsamixer.h b/ext/alsa/gstalsamixer.h index 18a9688..dc20cf2 100644 --- a/ext/alsa/gstalsamixer.h +++ b/ext/alsa/gstalsamixer.h @@ -54,7 +54,12 @@ struct _GstAlsaMixer GstTask * task; GStaticRecMutex task_mutex; + +#if !GLIB_CHECK_VERSION (2, 31, 0) GStaticRecMutex rec_mutex; +#else + GRecMutex rec_mutex; +#endif int pfd[2]; @@ -65,8 +70,13 @@ struct _GstAlsaMixer GstAlsaMixerDirection dir; }; +#if !GLIB_CHECK_VERSION (2, 31, 0) #define GST_ALSA_MIXER_LOCK(mixer) g_static_rec_mutex_lock (&mixer->rec_mutex) #define GST_ALSA_MIXER_UNLOCK(mixer) g_static_rec_mutex_unlock (&mixer->rec_mutex) +#else +#define GST_ALSA_MIXER_LOCK(mixer) g_rec_mutex_lock (&mixer->rec_mutex) +#define GST_ALSA_MIXER_UNLOCK(mixer) g_rec_mutex_unlock (&mixer->rec_mutex) +#endif GstAlsaMixer* gst_alsa_mixer_new (const gchar *device, GstAlsaMixerDirection dir); -- 2.7.4