alsamixer: use GRectMutext instead of GStaticRecMutex with newer glib versions

This commit is contained in:
Tim-Philipp Müller 2011-12-04 20:38:19 +00:00
parent 9c307bccc5
commit 4828234639
2 changed files with 20 additions and 3 deletions

View file

@ -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);
}
}

View file

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