Replace deprecated GStaticMutex with GMutex

This commit is contained in:
Tim-Philipp Müller 2012-01-22 22:52:28 +00:00
parent ef75dd6e90
commit 5487cb98ef
4 changed files with 26 additions and 26 deletions

View file

@ -94,7 +94,7 @@ static void gst_alsasink_reset (GstAudioSink * asink);
static gint output_ref; /* 0 */
static snd_output_t *output; /* NULL */
static GStaticMutex output_mutex = G_STATIC_MUTEX_INIT;
static GMutex output_mutex;
static GstStaticPadTemplate alsasink_sink_factory =
GST_STATIC_PAD_TEMPLATE ("sink",
@ -115,13 +115,13 @@ gst_alsasink_finalise (GObject * object)
g_free (sink->device);
g_mutex_free (sink->alsa_lock);
g_static_mutex_lock (&output_mutex);
g_mutex_lock (&output_mutex);
--output_ref;
if (output_ref == 0) {
snd_output_close (output);
output = NULL;
}
g_static_mutex_unlock (&output_mutex);
g_mutex_unlock (&output_mutex);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -247,12 +247,12 @@ gst_alsasink_init (GstAlsaSink * alsasink)
alsasink->cached_caps = NULL;
alsasink->alsa_lock = g_mutex_new ();
g_static_mutex_lock (&output_mutex);
g_mutex_lock (&output_mutex);
if (output_ref == 0) {
snd_output_stdio_attach (&output, stdout, 0);
++output_ref;
}
g_static_mutex_unlock (&output_mutex);
g_mutex_unlock (&output_mutex);
}
#define CHECK(call, error) \

View file

@ -75,7 +75,7 @@ static void gst_cd_paranoia_src_close (GstAudioCdSrc * src);
* easy way to find out the calling object from within the paranoia
* callback, and we need the object instance in there to emit our signals */
static GstCdParanoiaSrc *cur_cb_source;
static GStaticMutex cur_cb_mutex = G_STATIC_MUTEX_INIT;
static GMutex cur_cb_mutex;
static gint cdpsrc_signals[NUM_SIGNALS]; /* all 0 */
@ -378,7 +378,7 @@ gst_cd_paranoia_src_read_sector (GstAudioCdSrc * audiocdsrc, gint sector)
if (do_serialize) {
GST_LOG_OBJECT (src, "Signal handlers connected, serialising access");
g_static_mutex_lock (&cur_cb_mutex);
g_mutex_lock (&cur_cb_mutex);
GST_LOG_OBJECT (src, "Got lock");
cur_cb_source = src;
@ -386,7 +386,7 @@ gst_cd_paranoia_src_read_sector (GstAudioCdSrc * audiocdsrc, gint sector)
cur_cb_source = NULL;
GST_LOG_OBJECT (src, "Releasing lock");
g_static_mutex_unlock (&cur_cb_mutex);
g_mutex_unlock (&cur_cb_mutex);
} else {
cdda_buf = paranoia_read (src->p, gst_cd_paranoia_dummy_callback);
}

View file

@ -124,7 +124,7 @@ static GtkWidget *text_checkbox, *mute_checkbox, *volume_spinbutton;
static GtkWidget *skip_checkbox, *video_window, *download_checkbox;
static GtkWidget *buffer_checkbox, *rate_spinbutton;
static GStaticMutex state_mutex = G_STATIC_MUTEX_INIT;
static GMutex state_mutex;
static GtkWidget *format_combo, *step_amount_spinbutton, *step_rate_spinbutton;
static GtkWidget *shuttle_checkbox, *step_button;
@ -1502,7 +1502,7 @@ failed:
static void
pause_cb (GtkButton * button, gpointer data)
{
g_static_mutex_lock (&state_mutex);
g_mutex_lock (&state_mutex);
if (state != GST_STATE_PAUSED) {
GstStateChangeReturn ret;
@ -1522,13 +1522,13 @@ pause_cb (GtkButton * button, gpointer data)
state = GST_STATE_PAUSED;
gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Paused");
}
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
return;
failed:
{
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
g_print ("PAUSE failed\n");
gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Pause failed");
}
@ -1543,7 +1543,7 @@ stop_cb (GtkButton * button, gpointer data)
g_print ("READY pipeline\n");
gtk_statusbar_pop (GTK_STATUSBAR (statusbar), status_id);
g_static_mutex_lock (&state_mutex);
g_mutex_lock (&state_mutex);
ret = gst_element_set_state (pipeline, STOP_STATE);
if (ret == GST_STATE_CHANGE_FAILURE)
goto failed;
@ -1560,7 +1560,7 @@ stop_cb (GtkButton * button, gpointer data)
if (pipeline_type == 16)
clear_streams (pipeline);
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
#if 0
/* if one uses parse_launch, play, stop and play again it fails as all the
@ -1588,7 +1588,7 @@ stop_cb (GtkButton * button, gpointer data)
failed:
{
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
g_print ("STOP failed\n");
gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Stop failed");
}
@ -2164,10 +2164,10 @@ msg_sync_step_done (GstBus * bus, GstMessage * message, GstElement * element)
return;
}
if (g_static_mutex_trylock (&state_mutex)) {
if (g_mutex_trylock (&state_mutex)) {
if (shuttling)
do_shuttle (element);
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
} else {
/* ignore step messages that come while we are doing a state change */
g_print ("state change is busy\n");

View file

@ -109,7 +109,7 @@ static GtkWidget *text_checkbox, *mute_checkbox, *volume_spinbutton;
static GtkWidget *skip_checkbox, *video_window, *download_checkbox;
static GtkWidget *buffer_checkbox, *rate_spinbutton;
static GStaticMutex state_mutex = G_STATIC_MUTEX_INIT;
static GMutex state_mutex;
static GtkWidget *format_combo, *step_amount_spinbutton, *step_rate_spinbutton;
static GtkWidget *shuttle_checkbox, *step_button;
@ -651,7 +651,7 @@ failed:
static void
pause_cb (GtkButton * button, gpointer data)
{
g_static_mutex_lock (&state_mutex);
g_mutex_lock (&state_mutex);
if (state != GST_STATE_PAUSED) {
GstStateChangeReturn ret;
@ -671,13 +671,13 @@ pause_cb (GtkButton * button, gpointer data)
state = GST_STATE_PAUSED;
gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Paused");
}
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
return;
failed:
{
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
g_print ("PAUSE failed\n");
gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Pause failed");
}
@ -692,7 +692,7 @@ stop_cb (GtkButton * button, gpointer data)
g_print ("READY pipeline\n");
gtk_statusbar_pop (GTK_STATUSBAR (statusbar), status_id);
g_static_mutex_lock (&state_mutex);
g_mutex_lock (&state_mutex);
ret = gst_element_set_state (pipeline, STOP_STATE);
if (ret == GST_STATE_CHANGE_FAILURE)
goto failed;
@ -709,7 +709,7 @@ stop_cb (GtkButton * button, gpointer data)
if (pipeline_type == 16)
clear_streams (pipeline);
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
#if 0
/* if one uses parse_launch, play, stop and play again it fails as all the
@ -733,7 +733,7 @@ stop_cb (GtkButton * button, gpointer data)
failed:
{
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
g_print ("STOP failed\n");
gtk_statusbar_push (GTK_STATUSBAR (statusbar), status_id, "Stop failed");
}
@ -1317,10 +1317,10 @@ msg_sync_step_done (GstBus * bus, GstMessage * message, GstElement * element)
return;
}
if (g_static_mutex_trylock (&state_mutex)) {
if (g_mutex_trylock (&state_mutex)) {
if (shuttling)
do_shuttle (element);
g_static_mutex_unlock (&state_mutex);
g_mutex_unlock (&state_mutex);
} else {
/* ignore step messages that come while we are doing a state change */
g_print ("state change is busy\n");