summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-09-11 14:32:04 +0200
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-09-11 15:12:55 +0200
commit82f46a5efe85bf92dfb9914c2a84fa7afdc67e10 (patch)
tree9f63f022828006b0f1eeae377d3beafbae11b23e
parent2816380e7c1b40a9c5d54a85d68d6c50f91be504 (diff)
tests: mpeg2enc, mplex: port to the new GLib thread API
-rw-r--r--tests/check/elements/mpeg2enc.c24
-rw-r--r--tests/check/elements/mplex.c24
2 files changed, 24 insertions, 24 deletions
diff --git a/tests/check/elements/mpeg2enc.c b/tests/check/elements/mpeg2enc.c
index 41dc7e07d..78f7a50bf 100644
--- a/tests/check/elements/mpeg2enc.c
+++ b/tests/check/elements/mpeg2enc.c
@@ -53,8 +53,8 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
/* some global vars, makes it easy as for the ones above */
-static GMutex *mpeg2enc_mutex;
-static GCond *mpeg2enc_cond;
+static GMutex mpeg2enc_mutex;
+static GCond mpeg2enc_cond;
static gboolean arrived_eos;
static gboolean
@@ -63,10 +63,10 @@ test_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- g_mutex_lock (mpeg2enc_mutex);
+ g_mutex_lock (&mpeg2enc_mutex);
arrived_eos = TRUE;
- g_cond_signal (mpeg2enc_cond);
- g_mutex_unlock (mpeg2enc_mutex);
+ g_cond_signal (&mpeg2enc_cond);
+ g_mutex_unlock (&mpeg2enc_mutex);
break;
default:
break;
@@ -91,8 +91,8 @@ setup_mpeg2enc (void)
gst_pad_set_event_function (mysinkpad, test_sink_event);
/* and notify the test run */
- mpeg2enc_mutex = g_mutex_new ();
- mpeg2enc_cond = g_cond_new ();
+ g_mutex_init (&mpeg2enc_mutex);
+ g_cond_init (&mpeg2enc_cond);
return mpeg2enc;
}
@@ -109,8 +109,8 @@ cleanup_mpeg2enc (GstElement * mpeg2enc)
gst_check_teardown_sink_pad (mpeg2enc);
gst_check_teardown_element (mpeg2enc);
- g_mutex_free (mpeg2enc_mutex);
- g_cond_free (mpeg2enc_cond);
+ g_mutex_clear (&mpeg2enc_mutex);
+ g_cond_clear (&mpeg2enc_cond);
}
GST_START_TEST (test_video_pad)
@@ -141,10 +141,10 @@ GST_START_TEST (test_video_pad)
/* need to force eos and state change to make sure the encoding task ends */
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE);
/* need to wait a bit to make sure mpeg2enc task digested all this */
- g_mutex_lock (mpeg2enc_mutex);
+ g_mutex_lock (&mpeg2enc_mutex);
while (!arrived_eos)
- g_cond_wait (mpeg2enc_cond, mpeg2enc_mutex);
- g_mutex_unlock (mpeg2enc_mutex);
+ g_cond_wait (&mpeg2enc_cond, &mpeg2enc_mutex);
+ g_mutex_unlock (&mpeg2enc_mutex);
num_buffers = g_list_length (buffers);
/* well, we do not really know much with mpeg, but at least something ... */
diff --git a/tests/check/elements/mplex.c b/tests/check/elements/mplex.c
index 13a2c2779..3ac31dcb5 100644
--- a/tests/check/elements/mplex.c
+++ b/tests/check/elements/mplex.c
@@ -51,8 +51,8 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
/* some global vars, makes it easy as for the ones above */
-static GMutex *mplex_mutex;
-static GCond *mplex_cond;
+static GMutex mplex_mutex;
+static GCond mplex_cond;
static gboolean arrived_eos;
/* another easy hack, some mp2 audio data that should please mplex
@@ -103,10 +103,10 @@ test_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- g_mutex_lock (mplex_mutex);
+ g_mutex_lock (&mplex_mutex);
arrived_eos = TRUE;
- g_cond_signal (mplex_cond);
- g_mutex_unlock (mplex_mutex);
+ g_cond_signal (&mplex_cond);
+ g_mutex_unlock (&mplex_mutex);
break;
default:
break;
@@ -191,8 +191,8 @@ setup_mplex (void)
gst_pad_set_event_function (mysinkpad, test_sink_event);
/* and notify the test run */
- mplex_mutex = g_mutex_new ();
- mplex_cond = g_cond_new ();
+ g_mutex_init (&mplex_mutex);
+ g_cond_init (&mplex_cond);
return mplex;
}
@@ -209,8 +209,8 @@ cleanup_mplex (GstElement * mplex)
gst_check_teardown_sink_pad (mplex);
gst_check_teardown_element (mplex);
- g_mutex_free (mplex_mutex);
- g_cond_free (mplex_cond);
+ g_mutex_clear (&mplex_mutex);
+ g_cond_clear (&mplex_cond);
gst_deinit ();
}
@@ -245,10 +245,10 @@ GST_START_TEST (test_audio_pad)
/* need to force eos and state change to make sure the encoding task ends */
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_eos ()) == TRUE);
/* need to wait a bit to make sure mplex task digested all this */
- g_mutex_lock (mplex_mutex);
+ g_mutex_lock (&mplex_mutex);
while (!arrived_eos)
- g_cond_wait (mplex_cond, mplex_mutex);
- g_mutex_unlock (mplex_mutex);
+ g_cond_wait (&mplex_cond, &mplex_mutex);
+ g_mutex_unlock (&mplex_mutex);
num_buffers = g_list_length (buffers);
/* well, we do not really know much with mplex, but at least something ... */