summaryrefslogtreecommitdiff
path: root/gst-libs/gst
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-12-17 10:10:55 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-12-17 14:56:11 +0100
commitb6f80238e91e4e969974f8288f055a4227f48dc3 (patch)
tree3a1029138474c8f8f575fd6354bc2325e86fed9c /gst-libs/gst
parentf17ac52573dae91eb524e570ac374778fb42a50d (diff)
libs: use glib >= 2.32 semantics for mutexes.
Use glib >= 2.32 semantics for GMutex and GRecMutex wrt. initialization and termination. Basically, the new mutex objects can be used as static mutex objects from the deprecated APIs, e.g. GStaticMutex and GStaticRecMutex.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay.c8
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_priv.h2
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplaycache.c22
-rw-r--r--gst-libs/gst/vaapi/gstvaapiutils_glx.c11
4 files changed, 20 insertions, 23 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.c b/gst-libs/gst/vaapi/gstvaapidisplay.c
index 40ac5a65..35a3d57c 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay.c
@@ -725,7 +725,7 @@ gst_vaapi_display_lock_default(GstVaapiDisplay *display)
if (priv->parent)
priv = priv->parent->priv;
- g_static_rec_mutex_lock(&priv->mutex);
+ g_rec_mutex_lock(&priv->mutex);
}
static void
@@ -735,7 +735,7 @@ gst_vaapi_display_unlock_default(GstVaapiDisplay *display)
if (priv->parent)
priv = priv->parent->priv;
- g_static_rec_mutex_unlock(&priv->mutex);
+ g_rec_mutex_unlock(&priv->mutex);
}
static void
@@ -745,7 +745,7 @@ gst_vaapi_display_finalize(GObject *object)
gst_vaapi_display_destroy(display);
- g_static_rec_mutex_free(&display->priv->mutex);
+ g_rec_mutex_clear(&display->priv->mutex);
G_OBJECT_CLASS(gst_vaapi_display_parent_class)->finalize(object);
}
@@ -998,7 +998,7 @@ gst_vaapi_display_init(GstVaapiDisplay *display)
priv->properties = NULL;
priv->create_display = TRUE;
- g_static_rec_mutex_init(&priv->mutex);
+ g_rec_mutex_init(&priv->mutex);
}
/**
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_priv.h b/gst-libs/gst/vaapi/gstvaapidisplay_priv.h
index ac0555e3..cb5302b0 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_priv.h
@@ -73,7 +73,7 @@ G_BEGIN_DECLS
*/
struct _GstVaapiDisplayPrivate {
GstVaapiDisplay *parent;
- GStaticRecMutex mutex;
+ GRecMutex mutex;
GstVaapiDisplayType display_type;
VADisplay display;
guint width;
diff --git a/gst-libs/gst/vaapi/gstvaapidisplaycache.c b/gst-libs/gst/vaapi/gstvaapidisplaycache.c
index 0e6ef36c..5f5ae8d4 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplaycache.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplaycache.c
@@ -33,7 +33,7 @@ struct _CacheEntry {
};
struct _GstVaapiDisplayCache {
- GStaticMutex mutex;
+ GMutex mutex;
GList *list;
};
@@ -86,14 +86,14 @@ error:
#define CACHE_LOOKUP(cache, res, prop, comp_func, comp_data, user_data) do { \
GList *l; \
\
- g_static_mutex_lock(&(cache)->mutex); \
+ g_mutex_lock(&(cache)->mutex); \
for (l = (cache)->list; l != NULL; l = l->next) { \
GstVaapiDisplayInfo * const info = \
&((CacheEntry *)l->data)->info; \
if (comp_func(info->prop, comp_data, user_data)) \
break; \
} \
- g_static_mutex_unlock(&(cache)->mutex); \
+ g_mutex_unlock(&(cache)->mutex); \
res = l; \
} while (0)
@@ -146,7 +146,7 @@ gst_vaapi_display_cache_new(void)
if (!cache)
return NULL;
- g_static_mutex_init(&cache->mutex);
+ g_mutex_init(&cache->mutex);
return cache;
}
@@ -170,7 +170,7 @@ gst_vaapi_display_cache_free(GstVaapiDisplayCache *cache)
g_list_free(cache->list);
cache->list = NULL;
}
- g_static_mutex_free(&cache->mutex);
+ g_mutex_clear(&cache->mutex);
g_slice_free(GstVaapiDisplayCache, cache);
}
@@ -189,9 +189,9 @@ gst_vaapi_display_cache_get_size(GstVaapiDisplayCache *cache)
g_return_val_if_fail(cache != NULL, 0);
- g_static_mutex_lock(&cache->mutex);
+ g_mutex_lock(&cache->mutex);
size = g_list_length(cache->list);
- g_static_mutex_unlock(&cache->mutex);
+ g_mutex_unlock(&cache->mutex);
return size;
}
@@ -220,9 +220,9 @@ gst_vaapi_display_cache_add(
if (!entry)
return FALSE;
- g_static_mutex_lock(&cache->mutex);
+ g_mutex_lock(&cache->mutex);
cache->list = g_list_prepend(cache->list, entry);
- g_static_mutex_unlock(&cache->mutex);
+ g_mutex_unlock(&cache->mutex);
return TRUE;
}
@@ -246,9 +246,9 @@ gst_vaapi_display_cache_remove(
return;
cache_entry_free(m->data);
- g_static_mutex_lock(&cache->mutex);
+ g_mutex_lock(&cache->mutex);
cache->list = g_list_delete_link(cache->list, m);
- g_static_mutex_unlock(&cache->mutex);
+ g_mutex_unlock(&cache->mutex);
}
/**
diff --git a/gst-libs/gst/vaapi/gstvaapiutils_glx.c b/gst-libs/gst/vaapi/gstvaapiutils_glx.c
index 9a742ca1..4788c95b 100644
--- a/gst-libs/gst/vaapi/gstvaapiutils_glx.c
+++ b/gst-libs/gst/vaapi/gstvaapiutils_glx.c
@@ -741,16 +741,13 @@ gl_init_vtable(void)
GLVTable *
gl_get_vtable(void)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
- static gboolean gl_vtable_init = TRUE;
+ static gsize gl_vtable_init = FALSE;
static GLVTable *gl_vtable = NULL;
- g_static_mutex_lock(&mutex);
- if (gl_vtable_init) {
- gl_vtable_init = FALSE;
- gl_vtable = gl_init_vtable();
+ if (g_once_init_enter(&gl_vtable_init)) {
+ gl_vtable = gl_init_vtable();
+ g_once_init_leave(&gl_vtable_init, TRUE);
}
- g_static_mutex_unlock(&mutex);
return gl_vtable;
}