Commit 15848066 authored by Wim Taymans's avatar Wim Taymans

port to new gthread API

parent 339509ab
......@@ -22,10 +22,6 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <string.h>
#include <math.h>
......
......@@ -42,10 +42,6 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <string.h>
#include "gstflacdec.h"
......
......@@ -43,8 +43,8 @@ static GList *connections;
typedef struct
{
gint refcount;
GMutex *lock;
GCond *flush_cond;
GMutex lock;
GCond flush_cond;
/* id/server pair and the connection */
gchar *id;
......@@ -113,7 +113,7 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
}
}
g_mutex_lock (conn->lock);
g_mutex_lock (&conn->lock);
/* call sources first, then sinks. Sources will either push data into the
* ringbuffer of the sinks, which will then pull the data out of it, or
* sinks will pull the data from the sources. */
......@@ -125,7 +125,7 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
res = client->process (nframes, client->user_data);
if (client->deactivate) {
client->deactivate = FALSE;
g_cond_signal (conn->flush_cond);
g_cond_signal (&conn->flush_cond);
}
}
}
......@@ -137,11 +137,11 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
res = client->process (nframes, client->user_data);
if (client->deactivate) {
client->deactivate = FALSE;
g_cond_signal (conn->flush_cond);
g_cond_signal (&conn->flush_cond);
}
}
}
g_mutex_unlock (conn->lock);
g_mutex_unlock (&conn->lock);
return res;
}
......@@ -168,7 +168,7 @@ jack_shutdown_cb (void *arg)
GST_DEBUG ("disconnect client %s from server %s", conn->id,
GST_STR_NULL (conn->server));
g_mutex_lock (conn->lock);
g_mutex_lock (&conn->lock);
for (walk = conn->src_clients; walk; walk = g_list_next (walk)) {
GstJackAudioClient *client = (GstJackAudioClient *) walk->data;
......@@ -181,7 +181,7 @@ jack_shutdown_cb (void *arg)
if (client->shutdown)
client->shutdown (client->user_data);
}
g_mutex_unlock (conn->lock);
g_mutex_unlock (&conn->lock);
}
typedef struct
......@@ -240,8 +240,8 @@ gst_jack_audio_make_connection (const gchar * id, const gchar * server,
/* now create object */
conn = g_new (GstJackAudioConnection, 1);
conn->refcount = 1;
conn->lock = g_mutex_new ();
conn->flush_cond = g_cond_new ();
g_mutex_init (&conn->lock);
g_cond_init (&conn->flush_cond);
conn->id = g_strdup (id);
conn->server = g_strdup (server);
conn->client = jclient;
......@@ -276,7 +276,7 @@ could_not_activate:
{
GST_ERROR ("Could not activate client (%d)", res);
*status = JackFailure;
g_mutex_free (conn->lock);
g_mutex_clear (&conn->lock);
g_free (conn->id);
g_free (conn->server);
g_free (conn);
......@@ -365,8 +365,8 @@ gst_jack_audio_unref_connection (GstJackAudioConnection * conn)
}
/* free resources */
g_mutex_free (conn->lock);
g_cond_free (conn->flush_cond);
g_mutex_clear (&conn->lock);
g_cond_clear (&conn->flush_cond);
g_free (conn->id);
g_free (conn->server);
g_free (conn);
......@@ -377,7 +377,7 @@ static void
gst_jack_audio_connection_add_client (GstJackAudioConnection * conn,
GstJackAudioClient * client)
{
g_mutex_lock (conn->lock);
g_mutex_lock (&conn->lock);
switch (client->type) {
case GST_JACK_CLIENT_SOURCE:
conn->src_clients = g_list_append (conn->src_clients, client);
......@@ -391,14 +391,14 @@ gst_jack_audio_connection_add_client (GstJackAudioConnection * conn,
g_warning ("trying to add unknown client type");
break;
}
g_mutex_unlock (conn->lock);
g_mutex_unlock (&conn->lock);
}
static void
gst_jack_audio_connection_remove_client (GstJackAudioConnection * conn,
GstJackAudioClient * client)
{
g_mutex_lock (conn->lock);
g_mutex_lock (&conn->lock);
switch (client->type) {
case GST_JACK_CLIENT_SOURCE:
conn->src_clients = g_list_remove (conn->src_clients, client);
......@@ -412,7 +412,7 @@ gst_jack_audio_connection_remove_client (GstJackAudioConnection * conn,
g_warning ("trying to remove unknown client type");
break;
}
g_mutex_unlock (conn->lock);
g_mutex_unlock (&conn->lock);
}
/**
......@@ -537,17 +537,17 @@ gst_jack_audio_client_set_active (GstJackAudioClient * client, gboolean active)
g_return_val_if_fail (client != NULL, -1);
/* make sure that we are not dispatching the client */
g_mutex_lock (client->conn->lock);
g_mutex_lock (&client->conn->lock);
if (client->active && !active) {
/* we need to process once more to flush the port */
client->deactivate = TRUE;
/* need to wait for process_cb run once more */
while (client->deactivate)
g_cond_wait (client->conn->flush_cond, client->conn->lock);
g_cond_wait (&client->conn->flush_cond, &client->conn->lock);
}
client->active = active;
g_mutex_unlock (client->conn->lock);
g_mutex_unlock (&client->conn->lock);
return 0;
}
......
......@@ -126,7 +126,7 @@ static pa_threaded_mainloop *mainloop = NULL;
static guint mainloop_ref_ct = 0;
/* lock for access to shared resources */
static GMutex *pa_shared_resource_mutex = NULL;
static GMutex pa_shared_resource_mutex;
/* We keep a custom ringbuffer that is backed up by data allocated by
* pulseaudio. We must also overide the commit function to write into
......@@ -184,8 +184,7 @@ G_DEFINE_TYPE (GstPulseRingBuffer, gst_pulseringbuffer,
static void
gst_pulsesink_init_contexts (void)
{
g_assert (pa_shared_resource_mutex == NULL);
pa_shared_resource_mutex = g_mutex_new ();
g_mutex_init (&pa_shared_resource_mutex);
gst_pulse_shared_contexts = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, NULL);
}
......@@ -285,7 +284,7 @@ gst_pulsering_destroy_stream (GstPulseRingBuffer * pbuf)
static void
gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf)
{
g_mutex_lock (pa_shared_resource_mutex);
g_mutex_lock (&pa_shared_resource_mutex);
GST_DEBUG_OBJECT (pbuf, "destroying ringbuffer %p", pbuf);
......@@ -326,7 +325,7 @@ gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf)
g_free (pbuf->context_name);
pbuf->context_name = NULL;
}
g_mutex_unlock (pa_shared_resource_mutex);
g_mutex_unlock (&pa_shared_resource_mutex);
}
static void
......@@ -472,7 +471,7 @@ gst_pulseringbuffer_open_device (GstAudioRingBuffer * buf)
pa_threaded_mainloop_lock (mainloop);
g_mutex_lock (pa_shared_resource_mutex);
g_mutex_lock (&pa_shared_resource_mutex);
need_unlock_shared = TRUE;
pctx = g_hash_table_lookup (gst_pulse_shared_contexts, pbuf->context_name);
......@@ -509,7 +508,7 @@ gst_pulseringbuffer_open_device (GstAudioRingBuffer * buf)
pctx->ring_buffers = g_slist_prepend (pctx->ring_buffers, pbuf);
}
g_mutex_unlock (pa_shared_resource_mutex);
g_mutex_unlock (&pa_shared_resource_mutex);
need_unlock_shared = FALSE;
/* context created or shared okay */
......@@ -543,7 +542,7 @@ gst_pulseringbuffer_open_device (GstAudioRingBuffer * buf)
unlock_and_fail:
{
if (need_unlock_shared)
g_mutex_unlock (pa_shared_resource_mutex);
g_mutex_unlock (&pa_shared_resource_mutex);
gst_pulsering_destroy_context (pbuf);
pa_threaded_mainloop_unlock (mainloop);
return FALSE;
......@@ -1937,7 +1936,7 @@ gst_pulsesink_sink_info_cb (pa_context * c, const pa_sink_info * i, int eol,
g_free (psink->device_description);
psink->device_description = g_strdup (i->description);
g_mutex_lock (psink->sink_formats_lock);
g_mutex_lock (&psink->sink_formats_lock);
for (l = g_list_first (psink->sink_formats); l; l = g_list_next (l))
pa_format_info_free ((pa_format_info *) l->data);
......@@ -1949,7 +1948,7 @@ gst_pulsesink_sink_info_cb (pa_context * c, const pa_sink_info * i, int eol,
psink->sink_formats = g_list_prepend (psink->sink_formats,
pa_format_info_copy (i->formats[j]));
g_mutex_unlock (psink->sink_formats_lock);
g_mutex_unlock (&psink->sink_formats_lock);
done:
pa_threaded_mainloop_signal (mainloop, 0);
......@@ -2028,14 +2027,14 @@ gst_pulsesink_query_acceptcaps (GstPulseSink * psink, GstCaps * caps)
goto out;
}
g_mutex_lock (psink->sink_formats_lock);
g_mutex_lock (&psink->sink_formats_lock);
for (i = g_list_first (psink->sink_formats); i; i = g_list_next (i)) {
if (pa_format_info_is_compatible ((pa_format_info *) i->data, format)) {
ret = TRUE;
break;
}
}
g_mutex_unlock (psink->sink_formats_lock);
g_mutex_unlock (&psink->sink_formats_lock);
} else {
/* We're in READY, let's connect a stream to see if the format is
* accpeted by whatever sink we're routed to */
......@@ -2093,7 +2092,7 @@ gst_pulsesink_init (GstPulseSink * pulsesink)
pulsesink->device_description = NULL;
pulsesink->client_name = gst_pulse_client_name ();
pulsesink->sink_formats_lock = g_mutex_new ();
g_mutex_init (&pulsesink->sink_formats_lock);
pulsesink->sink_formats = NULL;
pulsesink->volume = DEFAULT_VOLUME;
......@@ -2139,7 +2138,7 @@ gst_pulsesink_finalize (GObject * object)
pa_format_info_free ((pa_format_info *) i->data);
g_list_free (pulsesink->sink_formats);
g_mutex_free (pulsesink->sink_formats_lock);
g_mutex_clear (&pulsesink->sink_formats_lock);
if (pulsesink->properties)
gst_structure_free (pulsesink->properties);
......@@ -2840,7 +2839,7 @@ gst_pulsesink_release_mainloop (GstPulseSink * psink)
}
pa_threaded_mainloop_unlock (mainloop);
g_mutex_lock (pa_shared_resource_mutex);
g_mutex_lock (&pa_shared_resource_mutex);
mainloop_ref_ct--;
if (!mainloop_ref_ct) {
GST_INFO_OBJECT (psink, "terminating pa main loop thread");
......@@ -2848,7 +2847,7 @@ gst_pulsesink_release_mainloop (GstPulseSink * psink)
pa_threaded_mainloop_free (mainloop);
mainloop = NULL;
}
g_mutex_unlock (pa_shared_resource_mutex);
g_mutex_unlock (&pa_shared_resource_mutex);
}
static GstStateChangeReturn
......@@ -2859,18 +2858,18 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
g_mutex_lock (pa_shared_resource_mutex);
g_mutex_lock (&pa_shared_resource_mutex);
if (!mainloop_ref_ct) {
GST_INFO_OBJECT (element, "new pa main loop thread");
if (!(mainloop = pa_threaded_mainloop_new ()))
goto mainloop_failed;
mainloop_ref_ct = 1;
pa_threaded_mainloop_start (mainloop);
g_mutex_unlock (pa_shared_resource_mutex);
g_mutex_unlock (&pa_shared_resource_mutex);
} else {
GST_INFO_OBJECT (element, "reusing pa main loop thread");
mainloop_ref_ct++;
g_mutex_unlock (pa_shared_resource_mutex);
g_mutex_unlock (&pa_shared_resource_mutex);
}
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
......@@ -2906,7 +2905,7 @@ gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
/* ERRORS */
mainloop_failed:
{
g_mutex_unlock (pa_shared_resource_mutex);
g_mutex_unlock (&pa_shared_resource_mutex);
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED,
("pa_threaded_mainloop_new() failed"), (NULL));
return GST_STATE_CHANGE_FAILURE;
......
......@@ -77,7 +77,7 @@ struct _GstPulseSink
GstStructure *properties;
pa_proplist *proplist;
GMutex *sink_formats_lock;
GMutex sink_formats_lock;
GList *sink_formats;
volatile gint format_lost;
GstClockTime format_lost_time;
......
......@@ -202,8 +202,8 @@ gst_soup_http_client_sink_init (GstSoupHttpClientSink * souphttpsink)
{
const char *proxy;
souphttpsink->mutex = g_mutex_new ();
souphttpsink->cond = g_cond_new ();
g_mutex_init (&souphttpsink->mutex);
g_cond_init (&souphttpsink->cond);
souphttpsink->location = NULL;
souphttpsink->automatic_redirect = TRUE;
......@@ -260,7 +260,7 @@ gst_soup_http_client_sink_set_property (GObject * object, guint property_id,
{
GstSoupHttpClientSink *souphttpsink = GST_SOUP_HTTP_CLIENT_SINK (object);
g_mutex_lock (souphttpsink->mutex);
g_mutex_lock (&souphttpsink->mutex);
switch (property_id) {
case PROP_SESSION:
if (souphttpsink->prop_session) {
......@@ -321,7 +321,7 @@ gst_soup_http_client_sink_set_property (GObject * object, guint property_id,
break;
}
done:
g_mutex_unlock (souphttpsink->mutex);
g_mutex_unlock (&souphttpsink->mutex);
}
void
......@@ -403,8 +403,8 @@ gst_soup_http_client_sink_finalize (GObject * object)
soup_uri_free (souphttpsink->proxy);
g_free (souphttpsink->location);
g_cond_free (souphttpsink->cond);
g_mutex_free (souphttpsink->mutex);
g_cond_clear (&souphttpsink->cond);
g_mutex_clear (&souphttpsink->mutex);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -454,9 +454,9 @@ thread_ready_idle_cb (gpointer data)
GST_LOG_OBJECT (souphttpsink, "thread ready");
g_mutex_lock (souphttpsink->mutex);
g_cond_signal (souphttpsink->cond);
g_mutex_unlock (souphttpsink->mutex);
g_mutex_lock (&souphttpsink->mutex);
g_cond_signal (&souphttpsink->cond);
g_mutex_unlock (&souphttpsink->mutex);
return FALSE; /* only run once */
}
......@@ -497,7 +497,7 @@ gst_soup_http_client_sink_start (GstBaseSink * sink)
souphttpsink->loop = g_main_loop_new (souphttpsink->context, TRUE);
g_mutex_lock (souphttpsink->mutex);
g_mutex_lock (&souphttpsink->mutex);
/* FIXME: error handling */
#if !GLIB_CHECK_VERSION (2, 31, 0)
......@@ -509,8 +509,8 @@ gst_soup_http_client_sink_start (GstBaseSink * sink)
#endif
GST_LOG_OBJECT (souphttpsink, "waiting for main loop thread to start up");
g_cond_wait (souphttpsink->cond, souphttpsink->mutex);
g_mutex_unlock (souphttpsink->mutex);
g_cond_wait (&souphttpsink->cond, &souphttpsink->mutex);
g_mutex_unlock (&souphttpsink->mutex);
GST_LOG_OBJECT (souphttpsink, "main loop thread running");
souphttpsink->session =
......@@ -574,12 +574,12 @@ gst_soup_http_client_sink_event (GstBaseSink * sink, GstEvent * event)
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
GST_DEBUG_OBJECT (souphttpsink, "got eos");
g_mutex_lock (souphttpsink->mutex);
g_mutex_lock (&souphttpsink->mutex);
while (souphttpsink->message) {
GST_DEBUG_OBJECT (souphttpsink, "waiting");
g_cond_wait (souphttpsink->cond, souphttpsink->mutex);
g_cond_wait (&souphttpsink->cond, &souphttpsink->mutex);
}
g_mutex_unlock (souphttpsink->mutex);
g_mutex_unlock (&souphttpsink->mutex);
GST_DEBUG_OBJECT (souphttpsink, "finished eos");
}
......@@ -687,9 +687,9 @@ send_message_locked (GstSoupHttpClientSink * souphttpsink)
static gboolean
send_message (GstSoupHttpClientSink * souphttpsink)
{
g_mutex_lock (souphttpsink->mutex);
g_mutex_lock (&souphttpsink->mutex);
send_message_locked (souphttpsink);
g_mutex_unlock (souphttpsink->mutex);
g_mutex_unlock (&souphttpsink->mutex);
return FALSE;
}
......@@ -702,14 +702,14 @@ callback (SoupSession * session, SoupMessage * msg, gpointer user_data)
GST_DEBUG_OBJECT (souphttpsink, "callback status=%d %s",
msg->status_code, msg->reason_phrase);
g_mutex_lock (souphttpsink->mutex);
g_cond_signal (souphttpsink->cond);
g_mutex_lock (&souphttpsink->mutex);
g_cond_signal (&souphttpsink->cond);
souphttpsink->message = NULL;
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
souphttpsink->status_code = msg->status_code;
souphttpsink->reason_phrase = g_strdup (msg->reason_phrase);
g_mutex_unlock (souphttpsink->mutex);
g_mutex_unlock (&souphttpsink->mutex);
return;
}
......@@ -717,7 +717,7 @@ callback (SoupSession * session, SoupMessage * msg, gpointer user_data)
souphttpsink->sent_buffers = NULL;
send_message_locked (souphttpsink);
g_mutex_unlock (souphttpsink->mutex);
g_mutex_unlock (&souphttpsink->mutex);
}
static GstFlowReturn
......@@ -736,7 +736,7 @@ gst_soup_http_client_sink_render (GstBaseSink * sink, GstBuffer * buffer)
return GST_FLOW_ERROR;
}
g_mutex_lock (souphttpsink->mutex);
g_mutex_lock (&souphttpsink->mutex);
if (souphttpsink->location != NULL) {
wake = (souphttpsink->queued_buffers == NULL);
souphttpsink->queued_buffers =
......@@ -750,7 +750,7 @@ gst_soup_http_client_sink_render (GstBaseSink * sink, GstBuffer * buffer)
g_source_unref (source);
}
}
g_mutex_unlock (souphttpsink->mutex);
g_mutex_unlock (&souphttpsink->mutex);
return GST_FLOW_OK;
}
......
......@@ -38,8 +38,8 @@ struct _GstSoupHttpClientSink
{
GstBaseSink base_souphttpsink;
GMutex *mutex;
GCond *cond;
GMutex mutex;
GCond cond;
GMainContext *context;
GMainLoop *loop;
GThread *thread;
......
......@@ -42,10 +42,6 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/gst.h>
#include <gst/gst-i18n-plugin.h>
......
......@@ -45,10 +45,6 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <string.h>
#include <stdio.h>
......
......@@ -37,8 +37,8 @@
GST_DEBUG_CATEGORY (equalizer_debug);
#define GST_CAT_DEFAULT equalizer_debug
#define BANDS_LOCK(equ) g_mutex_lock(equ->bands_lock)
#define BANDS_UNLOCK(equ) g_mutex_unlock(equ->bands_lock)
#define BANDS_LOCK(equ) g_mutex_lock(&equ->bands_lock)
#define BANDS_UNLOCK(equ) g_mutex_unlock(&equ->bands_lock)
static void gst_iir_equalizer_child_proxy_interface_init (gpointer g_iface,
gpointer iface_data);
......@@ -371,7 +371,7 @@ gst_iir_equalizer_class_init (GstIirEqualizerClass * klass)
static void
gst_iir_equalizer_init (GstIirEqualizer * eq)
{
eq->bands_lock = g_mutex_new ();
g_mutex_init (&eq->bands_lock);
eq->need_new_coefficients = TRUE;
}
......@@ -391,7 +391,7 @@ gst_iir_equalizer_finalize (GObject * object)
g_free (equ->bands);
g_free (equ->history);
g_mutex_free (equ->bands_lock);
g_mutex_clear (&equ->bands_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -50,7 +50,7 @@ struct _GstIirEqualizer
/*< private >*/
GMutex *bands_lock;
GMutex bands_lock;
GstIirEqualizerBand **bands;
/* properties */
......
......@@ -34,10 +34,6 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gstflvdemux.h"
#include "gstflvmux.h"
......
......@@ -41,10 +41,6 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <gst/glib-compat-private.h>
#include "gstimagefreeze.h"
......
......@@ -65,10 +65,6 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <glib/gstdio.h>
#include <gst/gst.h>
......@@ -348,7 +344,7 @@ gst_qt_moov_recover_change_state (GstElement * element,
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
qtmr->task = gst_task_new (gst_qt_moov_recover_run, qtmr);
g_static_rec_mutex_init (&qtmr->task_mutex);
g_rec_mutex_init (&qtmr->task_mutex);
gst_task_set_lock (qtmr->task, &qtmr->task_mutex);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
......@@ -369,7 +365,7 @@ gst_qt_moov_recover_change_state (GstElement * element,
g_assert (gst_task_get_state (qtmr->task) == GST_TASK_STOPPED);
gst_object_unref (qtmr->task);
qtmr->task = NULL;
g_static_rec_mutex_free (&qtmr->task_mutex);
g_rec_mutex_clear (&qtmr->task_mutex);
break;
default:
break;
......
......@@ -66,7 +66,7 @@ struct _GstQTMoovRecover
GstPipeline pipeline;
GstTask *task;
GStaticRecMutex task_mutex;
GRecMutex task_mutex;
/* properties */
gboolean faststart_mode;
......
......@@ -47,10 +47,6 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include "gst/gst-i18n-plugin.h"
#include <glib/gprintf.h>
......
......@@ -49,10 +49,6 @@
#include "config.h"
#endif
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <math.h>
#include <string.h>
#include <glib/gprintf.h>
......
......@@ -181,12 +181,12 @@ GST_STATIC_PAD_TEMPLATE ("send_rtp_src_%u",
#define GST_RTP_BIN_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_RTP_BIN, GstRtpBinPrivate))
#define GST_RTP_BIN_LOCK(bin) g_mutex_lock ((bin)->priv->bin_lock)
#define GST_RTP_BIN_UNLOCK(bin) g_mutex_unlock ((bin)->priv->bin_lock)
#define GST_RTP_BIN_LOCK(bin) g_mutex_lock (&(bin)->priv->bin_lock)
#define GST_RTP_BIN_UNLOCK(bin) g_mutex_unlock (&(bin)->priv->bin_lock)
/* lock to protect dynamic callbacks, like pad-added and new ssrc. */
#define GST_RTP_BIN_DYN_LOCK(bin) g_mutex_lock ((bin)->priv->dyn_lock)
#define GST_RTP_BIN_DYN_UNLOCK(bin) g_mutex_unlock ((bin)->priv->dyn_lock)
#define GST_RTP_BIN_DYN_LOCK(bin) g_mutex_lock (&(bin)->priv->dyn_lock)
#define GST_RTP_BIN_DYN_UNLOCK(bin) g_mutex_unlock (&(bin)->priv->dyn_lock)
/* lock for shutdown */
#define GST_RTP_BIN_SHUTDOWN_LOCK(bin,label) \
......@@ -206,10 +206,10 @@ G_STMT_START { \
struct _GstRtpBinPrivate
{
GMutex *bin_lock;
GMutex bin_lock;
/* lock protecting dynamic adding/removing */
GMutex *dyn_lock;
GMutex dyn_lock;
/* if we are shutting down or not */
gint shutdown;
......@@ -349,8 +349,8 @@ struct _GstRtpBinStream
gint64 clock_base;
};
#define GST_RTP_SESSION_LOCK(sess) g_mutex_lock ((sess)->lock)
#define GST_RTP_SESSION_UNLOCK(sess) g_mutex_unlock ((sess)->lock)
#define GST_RTP_SESSION_LOCK(sess) g_mutex_lock (&(sess)->lock)
#define GST_RTP_SESSION_UNLOCK(sess) g_mutex_unlock (&(sess)->lock)
/* Manages the receiving end of the packets.
*
......@@ -373,7 +373,7 @@ struct _GstRtpBinSession
gulong demux_newpad_sig;
gulong demux_padremoved_sig;
GMutex *lock;
GMutex lock;
/* list of GstRtpBinStream */
GSList *streams;
......@@ -564,7 +564,7 @@ create_session (GstRtpBin * rtpbin, gint id)
goto no_demux;
sess = g_new0 (GstRtpBinSession, 1);
sess->lock = g_mutex_new ();
g_mutex_init (&sess->lock);
sess->id = id;
sess->bin = rtpbin;
sess->session = session;
......@@ -703,7 +703,7 @@ free_session (GstRtpBinSession * sess, GstRtpBin * bin)
g_slist_foreach (sess->streams, (GFunc) free_stream, NULL);
g_slist_free (sess->streams);
g_mutex_free (sess->lock);
g_mutex_clear (&sess->lock);
g_hash_table_destroy (sess->ptmap);
g_free (sess);
......@@ -1883,8 +1883,8 @@ gst_rtp_bin_init (GstRtpBin * rtpbin)
gchar *str;
rtpbin->priv = GST_RTP_BIN_GET_PRIVATE (rtpbin);
rtpbin->priv->bin_lock = g_mutex_new ();
rtpbin->priv->dyn_lock = g_mutex_new ();
g_mutex_init (&rtpbin->priv->bin_lock);
g_mutex_init (&rtpbin->priv->dyn_lock);
rtpbin->latency_ms = DEFAULT_LATENCY_MS;
rtpbin->latency_ns = DEFAULT_LATENCY_MS * GST_MSECOND;
......@@ -1935,8 +1935,8 @@ gst_rtp_bin_finalize (GObject * object)
if (rtpbin->sdes)
gst_structure_free (rtpbin->sdes);
g_mutex_free (rtpbin->priv->bin_lock);
g_mutex_free (rtpbin->priv->dyn_lock);
g_mutex_clear (&rtpbin->priv->bin_lock);
g_mutex_clear (&rtpbin->priv->dyn_lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......
......@@ -102,7 +102,7 @@ enum
PROP_LAST
};
#define JBUF_LOCK(priv) (g_mutex_lock ((priv)->jbuf_lock))
#define JBUF_LOCK(priv) (g_mutex_lock (&(priv)->jbuf_lock))
#define JBUF_LOCK_CHECK(priv,label) G_STMT_START { \
JBUF_LOCK (priv); \
......@@ -110,8 +110,8 @@ enum
goto label; \
} G_STMT_END
#define JBUF_UNLOCK(priv) (g_mutex_unlock ((priv)->jbuf_lock))
#define JBUF_WAIT(priv) (g_cond_wait ((priv)->jbuf_cond, (priv)->jbuf_lock))
#define JBUF_UNLOCK(priv) (g_mutex_unlock (&(priv)->jbuf_lock))
#define JBUF_WAIT(priv) (g_cond_wait (&(priv)->jbuf_cond, &(priv)->jbuf_lock))
#define JBUF_WAIT_CHECK(priv,label) G_STMT_START { \
JBUF_WAIT(priv); \