mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 23:42:28 +00:00
Replace deprecated GStaticMutex with GMutex
https://bugzilla.gnome.org/show_bug.cgi?id=662207
This commit is contained in:
parent
8c832a5e45
commit
2c8c44976f
8 changed files with 90 additions and 90 deletions
|
@ -37,7 +37,7 @@
|
||||||
#include "gstformat.h"
|
#include "gstformat.h"
|
||||||
#include "gstenumtypes.h"
|
#include "gstenumtypes.h"
|
||||||
|
|
||||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
static GMutex mutex;
|
||||||
static GList *_gst_formats = NULL;
|
static GList *_gst_formats = NULL;
|
||||||
static GHashTable *_nick_to_format = NULL;
|
static GHashTable *_nick_to_format = NULL;
|
||||||
static GHashTable *_format_to_nick = NULL;
|
static GHashTable *_format_to_nick = NULL;
|
||||||
|
@ -57,7 +57,7 @@ _priv_gst_format_initialize (void)
|
||||||
{
|
{
|
||||||
GstFormatDefinition *standards = standard_definitions;
|
GstFormatDefinition *standards = standard_definitions;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
if (_nick_to_format == NULL) {
|
if (_nick_to_format == NULL) {
|
||||||
_nick_to_format = g_hash_table_new (g_str_hash, g_str_equal);
|
_nick_to_format = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
_format_to_nick = g_hash_table_new (NULL, NULL);
|
_format_to_nick = g_hash_table_new (NULL, NULL);
|
||||||
|
@ -76,7 +76,7 @@ _priv_gst_format_initialize (void)
|
||||||
}
|
}
|
||||||
/* getting the type registers the enum */
|
/* getting the type registers the enum */
|
||||||
g_type_class_ref (gst_format_get_type ());
|
g_type_class_ref (gst_format_get_type ());
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +151,7 @@ gst_format_register (const gchar * nick, const gchar * description)
|
||||||
if (query != GST_FORMAT_UNDEFINED)
|
if (query != GST_FORMAT_UNDEFINED)
|
||||||
return query;
|
return query;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
format = g_slice_new (GstFormatDefinition);
|
format = g_slice_new (GstFormatDefinition);
|
||||||
format->value = (GstFormat) _n_values;
|
format->value = (GstFormat) _n_values;
|
||||||
format->nick = g_strdup (nick);
|
format->nick = g_strdup (nick);
|
||||||
|
@ -163,7 +163,7 @@ gst_format_register (const gchar * nick, const gchar * description)
|
||||||
format);
|
format);
|
||||||
_gst_formats = g_list_append (_gst_formats, format);
|
_gst_formats = g_list_append (_gst_formats, format);
|
||||||
_n_values++;
|
_n_values++;
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
|
|
||||||
return format->value;
|
return format->value;
|
||||||
}
|
}
|
||||||
|
@ -184,9 +184,9 @@ gst_format_get_by_nick (const gchar * nick)
|
||||||
|
|
||||||
g_return_val_if_fail (nick != NULL, GST_FORMAT_UNDEFINED);
|
g_return_val_if_fail (nick != NULL, GST_FORMAT_UNDEFINED);
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
format = g_hash_table_lookup (_nick_to_format, nick);
|
format = g_hash_table_lookup (_nick_to_format, nick);
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
|
|
||||||
if (format != NULL)
|
if (format != NULL)
|
||||||
return format->value;
|
return format->value;
|
||||||
|
@ -234,9 +234,9 @@ gst_format_get_details (GstFormat format)
|
||||||
{
|
{
|
||||||
const GstFormatDefinition *result;
|
const GstFormatDefinition *result;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
result = g_hash_table_lookup (_format_to_nick, GINT_TO_POINTER (format));
|
result = g_hash_table_lookup (_format_to_nick, GINT_TO_POINTER (format));
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -254,11 +254,11 @@ gst_format_iterate_definitions (void)
|
||||||
{
|
{
|
||||||
GstIterator *result;
|
GstIterator *result;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
/* FIXME: register a boxed type for GstFormatDefinition */
|
/* FIXME: register a boxed type for GstFormatDefinition */
|
||||||
result = gst_iterator_new_list (G_TYPE_POINTER,
|
result = gst_iterator_new_list (G_TYPE_POINTER,
|
||||||
g_static_mutex_get_mutex (&mutex), &_n_values, &_gst_formats, NULL, NULL);
|
&mutex, &_n_values, &_gst_formats, NULL, NULL);
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ struct _GstDebugMessage
|
||||||
};
|
};
|
||||||
|
|
||||||
/* list of all name/level pairs from --gst-debug and GST_DEBUG */
|
/* list of all name/level pairs from --gst-debug and GST_DEBUG */
|
||||||
static GStaticMutex __level_name_mutex = G_STATIC_MUTEX_INIT;
|
static GMutex __level_name_mutex;
|
||||||
static GSList *__level_name = NULL;
|
static GSList *__level_name = NULL;
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -249,7 +249,7 @@ typedef struct
|
||||||
LevelNameEntry;
|
LevelNameEntry;
|
||||||
|
|
||||||
/* list of all categories */
|
/* list of all categories */
|
||||||
static GStaticMutex __cat_mutex = G_STATIC_MUTEX_INIT;
|
static GMutex __cat_mutex;
|
||||||
static GSList *__categories = NULL;
|
static GSList *__categories = NULL;
|
||||||
|
|
||||||
/* all registered debug handlers */
|
/* all registered debug handlers */
|
||||||
|
@ -259,7 +259,7 @@ typedef struct
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
}
|
}
|
||||||
LogFuncEntry;
|
LogFuncEntry;
|
||||||
static GStaticMutex __log_func_mutex = G_STATIC_MUTEX_INIT;
|
static GMutex __log_func_mutex;
|
||||||
static GSList *__log_functions = NULL;
|
static GSList *__log_functions = NULL;
|
||||||
|
|
||||||
#define PRETTY_TAGS_DEFAULT TRUE
|
#define PRETTY_TAGS_DEFAULT TRUE
|
||||||
|
@ -977,13 +977,13 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
||||||
/* colors, windows. We take a lock to keep colors and content together.
|
/* colors, windows. We take a lock to keep colors and content together.
|
||||||
* Maybe there is a better way but for now this will do the right
|
* Maybe there is a better way but for now this will do the right
|
||||||
* thing. */
|
* thing. */
|
||||||
static GStaticMutex win_print_mutex = G_STATIC_MUTEX_INIT;
|
static GMutex win_print_mutex;
|
||||||
const gint clear = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
const gint clear = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
||||||
#define SET_COLOR(c) G_STMT_START { \
|
#define SET_COLOR(c) G_STMT_START { \
|
||||||
if (log_file == stderr) \
|
if (log_file == stderr) \
|
||||||
SetConsoleTextAttribute (GetStdHandle (STD_ERROR_HANDLE), (c)); \
|
SetConsoleTextAttribute (GetStdHandle (STD_ERROR_HANDLE), (c)); \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
g_static_mutex_lock (&win_print_mutex);
|
g_mutex_lock (&win_print_mutex);
|
||||||
/* timestamp */
|
/* timestamp */
|
||||||
fprintf (log_file, "%" GST_TIME_FORMAT " ", GST_TIME_ARGS (elapsed));
|
fprintf (log_file, "%" GST_TIME_FORMAT " ", GST_TIME_ARGS (elapsed));
|
||||||
fflush (log_file);
|
fflush (log_file);
|
||||||
|
@ -1009,7 +1009,7 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
|
||||||
SET_COLOR (clear);
|
SET_COLOR (clear);
|
||||||
fprintf (log_file, " %s\n", gst_debug_message_get (message));
|
fprintf (log_file, " %s\n", gst_debug_message_get (message));
|
||||||
fflush (log_file);
|
fflush (log_file);
|
||||||
g_static_mutex_unlock (&win_print_mutex);
|
g_mutex_unlock (&win_print_mutex);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* no color, all platforms */
|
/* no color, all platforms */
|
||||||
|
@ -1087,10 +1087,10 @@ gst_debug_add_log_function (GstLogFunction func, gpointer data)
|
||||||
* It'd probably be clever to use some kind of RCU here, but I don't know
|
* It'd probably be clever to use some kind of RCU here, but I don't know
|
||||||
* anything about that.
|
* anything about that.
|
||||||
*/
|
*/
|
||||||
g_static_mutex_lock (&__log_func_mutex);
|
g_mutex_lock (&__log_func_mutex);
|
||||||
list = g_slist_copy (__log_functions);
|
list = g_slist_copy (__log_functions);
|
||||||
__log_functions = g_slist_prepend (list, entry);
|
__log_functions = g_slist_prepend (list, entry);
|
||||||
g_static_mutex_unlock (&__log_func_mutex);
|
g_mutex_unlock (&__log_func_mutex);
|
||||||
|
|
||||||
GST_DEBUG ("prepended log function %p (user data %p) to log functions",
|
GST_DEBUG ("prepended log function %p (user data %p) to log functions",
|
||||||
func, data);
|
func, data);
|
||||||
|
@ -1119,7 +1119,7 @@ gst_debug_remove_with_compare_func (GCompareFunc func, gpointer data)
|
||||||
GSList *new;
|
GSList *new;
|
||||||
guint removals = 0;
|
guint removals = 0;
|
||||||
|
|
||||||
g_static_mutex_lock (&__log_func_mutex);
|
g_mutex_lock (&__log_func_mutex);
|
||||||
new = __log_functions;
|
new = __log_functions;
|
||||||
while ((found = g_slist_find_custom (new, data, func))) {
|
while ((found = g_slist_find_custom (new, data, func))) {
|
||||||
if (new == __log_functions) {
|
if (new == __log_functions) {
|
||||||
|
@ -1134,7 +1134,7 @@ gst_debug_remove_with_compare_func (GCompareFunc func, gpointer data)
|
||||||
}
|
}
|
||||||
/* FIXME: We leak the old list here. See _add_log_function for why. */
|
/* FIXME: We leak the old list here. See _add_log_function for why. */
|
||||||
__log_functions = new;
|
__log_functions = new;
|
||||||
g_static_mutex_unlock (&__log_func_mutex);
|
g_mutex_unlock (&__log_func_mutex);
|
||||||
|
|
||||||
return removals;
|
return removals;
|
||||||
}
|
}
|
||||||
|
@ -1282,7 +1282,7 @@ gst_debug_reset_threshold (gpointer category, gpointer unused)
|
||||||
GstDebugCategory *cat = (GstDebugCategory *) category;
|
GstDebugCategory *cat = (GstDebugCategory *) category;
|
||||||
GSList *walk;
|
GSList *walk;
|
||||||
|
|
||||||
g_static_mutex_lock (&__level_name_mutex);
|
g_mutex_lock (&__level_name_mutex);
|
||||||
walk = __level_name;
|
walk = __level_name;
|
||||||
while (walk) {
|
while (walk) {
|
||||||
LevelNameEntry *entry = walk->data;
|
LevelNameEntry *entry = walk->data;
|
||||||
|
@ -1298,15 +1298,15 @@ gst_debug_reset_threshold (gpointer category, gpointer unused)
|
||||||
gst_debug_category_set_threshold (cat, gst_debug_get_default_threshold ());
|
gst_debug_category_set_threshold (cat, gst_debug_get_default_threshold ());
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
g_static_mutex_unlock (&__level_name_mutex);
|
g_mutex_unlock (&__level_name_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_debug_reset_all_thresholds (void)
|
gst_debug_reset_all_thresholds (void)
|
||||||
{
|
{
|
||||||
g_static_mutex_lock (&__cat_mutex);
|
g_mutex_lock (&__cat_mutex);
|
||||||
g_slist_foreach (__categories, gst_debug_reset_threshold, NULL);
|
g_slist_foreach (__categories, gst_debug_reset_threshold, NULL);
|
||||||
g_static_mutex_unlock (&__cat_mutex);
|
g_mutex_unlock (&__cat_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1342,12 +1342,12 @@ gst_debug_set_threshold_for_name (const gchar * name, GstDebugLevel level)
|
||||||
entry = g_slice_new (LevelNameEntry);
|
entry = g_slice_new (LevelNameEntry);
|
||||||
entry->pat = pat;
|
entry->pat = pat;
|
||||||
entry->level = level;
|
entry->level = level;
|
||||||
g_static_mutex_lock (&__level_name_mutex);
|
g_mutex_lock (&__level_name_mutex);
|
||||||
__level_name = g_slist_prepend (__level_name, entry);
|
__level_name = g_slist_prepend (__level_name, entry);
|
||||||
g_static_mutex_unlock (&__level_name_mutex);
|
g_mutex_unlock (&__level_name_mutex);
|
||||||
g_static_mutex_lock (&__cat_mutex);
|
g_mutex_lock (&__cat_mutex);
|
||||||
g_slist_foreach (__categories, for_each_threshold_by_entry, entry);
|
g_slist_foreach (__categories, for_each_threshold_by_entry, entry);
|
||||||
g_static_mutex_unlock (&__cat_mutex);
|
g_mutex_unlock (&__cat_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1365,7 +1365,7 @@ gst_debug_unset_threshold_for_name (const gchar * name)
|
||||||
g_return_if_fail (name != NULL);
|
g_return_if_fail (name != NULL);
|
||||||
|
|
||||||
pat = g_pattern_spec_new (name);
|
pat = g_pattern_spec_new (name);
|
||||||
g_static_mutex_lock (&__level_name_mutex);
|
g_mutex_lock (&__level_name_mutex);
|
||||||
walk = __level_name;
|
walk = __level_name;
|
||||||
/* improve this if you want, it's mighty slow */
|
/* improve this if you want, it's mighty slow */
|
||||||
while (walk) {
|
while (walk) {
|
||||||
|
@ -1379,7 +1379,7 @@ gst_debug_unset_threshold_for_name (const gchar * name)
|
||||||
walk = __level_name;
|
walk = __level_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_static_mutex_unlock (&__level_name_mutex);
|
g_mutex_unlock (&__level_name_mutex);
|
||||||
g_pattern_spec_free (pat);
|
g_pattern_spec_free (pat);
|
||||||
gst_debug_reset_all_thresholds ();
|
gst_debug_reset_all_thresholds ();
|
||||||
}
|
}
|
||||||
|
@ -1404,9 +1404,9 @@ _gst_debug_category_new (const gchar * name, guint color,
|
||||||
gst_debug_reset_threshold (cat, NULL);
|
gst_debug_reset_threshold (cat, NULL);
|
||||||
|
|
||||||
/* add to category list */
|
/* add to category list */
|
||||||
g_static_mutex_lock (&__cat_mutex);
|
g_mutex_lock (&__cat_mutex);
|
||||||
__categories = g_slist_prepend (__categories, cat);
|
__categories = g_slist_prepend (__categories, cat);
|
||||||
g_static_mutex_unlock (&__cat_mutex);
|
g_mutex_unlock (&__cat_mutex);
|
||||||
|
|
||||||
return cat;
|
return cat;
|
||||||
}
|
}
|
||||||
|
@ -1424,9 +1424,9 @@ gst_debug_category_free (GstDebugCategory * category)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* remove from category list */
|
/* remove from category list */
|
||||||
g_static_mutex_lock (&__cat_mutex);
|
g_mutex_lock (&__cat_mutex);
|
||||||
__categories = g_slist_remove (__categories, category);
|
__categories = g_slist_remove (__categories, category);
|
||||||
g_static_mutex_unlock (&__cat_mutex);
|
g_mutex_unlock (&__cat_mutex);
|
||||||
|
|
||||||
g_free ((gpointer) category->name);
|
g_free ((gpointer) category->name);
|
||||||
g_free ((gpointer) category->description);
|
g_free ((gpointer) category->description);
|
||||||
|
@ -1549,9 +1549,9 @@ gst_debug_get_all_categories (void)
|
||||||
{
|
{
|
||||||
GSList *ret;
|
GSList *ret;
|
||||||
|
|
||||||
g_static_mutex_lock (&__cat_mutex);
|
g_mutex_lock (&__cat_mutex);
|
||||||
ret = g_slist_copy (__categories);
|
ret = g_slist_copy (__categories);
|
||||||
g_static_mutex_unlock (&__cat_mutex);
|
g_mutex_unlock (&__cat_mutex);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1574,7 +1574,7 @@ _gst_debug_get_category (const gchar * name)
|
||||||
/*** FUNCTION POINTERS ********************************************************/
|
/*** FUNCTION POINTERS ********************************************************/
|
||||||
|
|
||||||
static GHashTable *__gst_function_pointers; /* NULL */
|
static GHashTable *__gst_function_pointers; /* NULL */
|
||||||
static GStaticMutex __dbg_functions_mutex = G_STATIC_MUTEX_INIT;
|
static GMutex __dbg_functions_mutex;
|
||||||
|
|
||||||
/* This function MUST NOT return NULL */
|
/* This function MUST NOT return NULL */
|
||||||
const gchar *
|
const gchar *
|
||||||
|
@ -1589,14 +1589,14 @@ _gst_debug_nameof_funcptr (GstDebugFuncPtr func)
|
||||||
if (G_UNLIKELY (func == NULL))
|
if (G_UNLIKELY (func == NULL))
|
||||||
return "(NULL)";
|
return "(NULL)";
|
||||||
|
|
||||||
g_static_mutex_lock (&__dbg_functions_mutex);
|
g_mutex_lock (&__dbg_functions_mutex);
|
||||||
if (G_LIKELY (__gst_function_pointers)) {
|
if (G_LIKELY (__gst_function_pointers)) {
|
||||||
ptrname = g_hash_table_lookup (__gst_function_pointers, (gpointer) func);
|
ptrname = g_hash_table_lookup (__gst_function_pointers, (gpointer) func);
|
||||||
g_static_mutex_unlock (&__dbg_functions_mutex);
|
g_mutex_unlock (&__dbg_functions_mutex);
|
||||||
if (G_LIKELY (ptrname))
|
if (G_LIKELY (ptrname))
|
||||||
return ptrname;
|
return ptrname;
|
||||||
} else {
|
} else {
|
||||||
g_static_mutex_unlock (&__dbg_functions_mutex);
|
g_mutex_unlock (&__dbg_functions_mutex);
|
||||||
}
|
}
|
||||||
/* we need to create an entry in the hash table for this one so we don't leak
|
/* we need to create an entry in the hash table for this one so we don't leak
|
||||||
* the name */
|
* the name */
|
||||||
|
@ -1621,14 +1621,14 @@ _gst_debug_register_funcptr (GstDebugFuncPtr func, const gchar * ptrname)
|
||||||
{
|
{
|
||||||
gpointer ptr = (gpointer) func;
|
gpointer ptr = (gpointer) func;
|
||||||
|
|
||||||
g_static_mutex_lock (&__dbg_functions_mutex);
|
g_mutex_lock (&__dbg_functions_mutex);
|
||||||
|
|
||||||
if (!__gst_function_pointers)
|
if (!__gst_function_pointers)
|
||||||
__gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
|
__gst_function_pointers = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||||
if (!g_hash_table_lookup (__gst_function_pointers, ptr))
|
if (!g_hash_table_lookup (__gst_function_pointers, ptr))
|
||||||
g_hash_table_insert (__gst_function_pointers, ptr, (gpointer) ptrname);
|
g_hash_table_insert (__gst_function_pointers, ptr, (gpointer) ptrname);
|
||||||
|
|
||||||
g_static_mutex_unlock (&__dbg_functions_mutex);
|
g_mutex_unlock (&__dbg_functions_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** PRINTF EXTENSIONS ********************************************************/
|
/*** PRINTF EXTENSIONS ********************************************************/
|
||||||
|
|
|
@ -659,7 +659,7 @@ check_release_datetime (const gchar * date_time)
|
||||||
return (*date_time == '\0');
|
return (*date_time == '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
static GStaticMutex gst_plugin_loading_mutex = G_STATIC_MUTEX_INIT;
|
static GMutex gst_plugin_loading_mutex;
|
||||||
|
|
||||||
#define CHECK_PLUGIN_DESC_FIELD(desc,field,fn) \
|
#define CHECK_PLUGIN_DESC_FIELD(desc,field,fn) \
|
||||||
if (G_UNLIKELY ((desc)->field == NULL)) { \
|
if (G_UNLIKELY ((desc)->field == NULL)) { \
|
||||||
|
@ -692,13 +692,13 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
||||||
g_return_val_if_fail (filename != NULL, NULL);
|
g_return_val_if_fail (filename != NULL, NULL);
|
||||||
|
|
||||||
registry = gst_registry_get ();
|
registry = gst_registry_get ();
|
||||||
g_static_mutex_lock (&gst_plugin_loading_mutex);
|
g_mutex_lock (&gst_plugin_loading_mutex);
|
||||||
|
|
||||||
plugin = gst_registry_lookup (registry, filename);
|
plugin = gst_registry_lookup (registry, filename);
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
if (plugin->module) {
|
if (plugin->module) {
|
||||||
/* already loaded */
|
/* already loaded */
|
||||||
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
g_mutex_unlock (&gst_plugin_loading_mutex);
|
||||||
return plugin;
|
return plugin;
|
||||||
} else {
|
} else {
|
||||||
/* load plugin and update fields */
|
/* load plugin and update fields */
|
||||||
|
@ -836,14 +836,14 @@ gst_plugin_load_file (const gchar * filename, GError ** error)
|
||||||
gst_registry_add_plugin (gst_registry_get (), plugin);
|
gst_registry_add_plugin (gst_registry_get (), plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
g_mutex_unlock (&gst_plugin_loading_mutex);
|
||||||
return plugin;
|
return plugin;
|
||||||
|
|
||||||
return_error:
|
return_error:
|
||||||
{
|
{
|
||||||
if (plugin)
|
if (plugin)
|
||||||
gst_object_unref (plugin);
|
gst_object_unref (plugin);
|
||||||
g_static_mutex_unlock (&gst_plugin_loading_mutex);
|
g_mutex_unlock (&gst_plugin_loading_mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ typedef struct
|
||||||
|
|
||||||
#define GST_QUERY_STRUCTURE(q) (((GstQueryImpl *)(q))->structure)
|
#define GST_QUERY_STRUCTURE(q) (((GstQueryImpl *)(q))->structure)
|
||||||
|
|
||||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
static GMutex mutex;
|
||||||
static GList *_gst_queries = NULL;
|
static GList *_gst_queries = NULL;
|
||||||
static GHashTable *_nick_to_query = NULL;
|
static GHashTable *_nick_to_query = NULL;
|
||||||
static GHashTable *_query_type_to_nick = NULL;
|
static GHashTable *_query_type_to_nick = NULL;
|
||||||
|
@ -121,7 +121,7 @@ _priv_gst_query_initialize (void)
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_query_debug, "query", 0, "query system");
|
GST_DEBUG_CATEGORY_INIT (gst_query_debug, "query", 0, "query system");
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
if (_nick_to_query == NULL) {
|
if (_nick_to_query == NULL) {
|
||||||
_nick_to_query = g_hash_table_new (g_str_hash, g_str_equal);
|
_nick_to_query = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
_query_type_to_nick = g_hash_table_new (NULL, NULL);
|
_query_type_to_nick = g_hash_table_new (NULL, NULL);
|
||||||
|
@ -137,7 +137,7 @@ _priv_gst_query_initialize (void)
|
||||||
standards++;
|
standards++;
|
||||||
_n_values++;
|
_n_values++;
|
||||||
}
|
}
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
|
|
||||||
_gst_query_type = gst_query_get_type ();
|
_gst_query_type = gst_query_get_type ();
|
||||||
}
|
}
|
||||||
|
@ -210,13 +210,13 @@ gst_query_type_register (const gchar * nick, const gchar * description)
|
||||||
query->description = g_strdup (description);
|
query->description = g_strdup (description);
|
||||||
query->quark = g_quark_from_static_string (query->nick);
|
query->quark = g_quark_from_static_string (query->nick);
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
g_hash_table_insert (_nick_to_query, (gpointer) query->nick, query);
|
g_hash_table_insert (_nick_to_query, (gpointer) query->nick, query);
|
||||||
g_hash_table_insert (_query_type_to_nick, GINT_TO_POINTER (query->value),
|
g_hash_table_insert (_query_type_to_nick, GINT_TO_POINTER (query->value),
|
||||||
query);
|
query);
|
||||||
_gst_queries = g_list_append (_gst_queries, query);
|
_gst_queries = g_list_append (_gst_queries, query);
|
||||||
_n_values++;
|
_n_values++;
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
|
|
||||||
return query->value;
|
return query->value;
|
||||||
}
|
}
|
||||||
|
@ -237,9 +237,9 @@ gst_query_type_get_by_nick (const gchar * nick)
|
||||||
|
|
||||||
g_return_val_if_fail (nick != NULL, GST_QUERY_NONE);
|
g_return_val_if_fail (nick != NULL, GST_QUERY_NONE);
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
query = g_hash_table_lookup (_nick_to_query, nick);
|
query = g_hash_table_lookup (_nick_to_query, nick);
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
|
|
||||||
if (query != NULL)
|
if (query != NULL)
|
||||||
return query->value;
|
return query->value;
|
||||||
|
@ -285,9 +285,9 @@ gst_query_type_get_details (GstQueryType type)
|
||||||
{
|
{
|
||||||
const GstQueryTypeDefinition *result;
|
const GstQueryTypeDefinition *result;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
result = g_hash_table_lookup (_query_type_to_nick, GINT_TO_POINTER (type));
|
result = g_hash_table_lookup (_query_type_to_nick, GINT_TO_POINTER (type));
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -307,11 +307,11 @@ gst_query_type_iterate_definitions (void)
|
||||||
{
|
{
|
||||||
GstIterator *result;
|
GstIterator *result;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
g_mutex_lock (&mutex);
|
||||||
/* FIXME: register a boxed type for GstQueryTypeDefinition */
|
/* FIXME: register a boxed type for GstQueryTypeDefinition */
|
||||||
result = gst_iterator_new_list (G_TYPE_POINTER,
|
result = gst_iterator_new_list (G_TYPE_POINTER,
|
||||||
g_static_mutex_get_mutex (&mutex), &_n_values, &_gst_queries, NULL, NULL);
|
&mutex, &_n_values, &_gst_queries, NULL, NULL);
|
||||||
g_static_mutex_unlock (&mutex);
|
g_mutex_unlock (&mutex);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ struct _GstRegistryPrivate
|
||||||
|
|
||||||
/* the one instance of the default registry and the mutex protecting the
|
/* the one instance of the default registry and the mutex protecting the
|
||||||
* variable. */
|
* variable. */
|
||||||
static GStaticMutex _gst_registry_mutex = G_STATIC_MUTEX_INIT;
|
static GMutex _gst_registry_mutex;
|
||||||
static GstRegistry *_gst_registry_default = NULL;
|
static GstRegistry *_gst_registry_default = NULL;
|
||||||
|
|
||||||
/* defaults */
|
/* defaults */
|
||||||
|
@ -330,13 +330,13 @@ gst_registry_get (void)
|
||||||
{
|
{
|
||||||
GstRegistry *registry;
|
GstRegistry *registry;
|
||||||
|
|
||||||
g_static_mutex_lock (&_gst_registry_mutex);
|
g_mutex_lock (&_gst_registry_mutex);
|
||||||
if (G_UNLIKELY (!_gst_registry_default)) {
|
if (G_UNLIKELY (!_gst_registry_default)) {
|
||||||
_gst_registry_default = g_object_newv (GST_TYPE_REGISTRY, 0, NULL);
|
_gst_registry_default = g_object_newv (GST_TYPE_REGISTRY, 0, NULL);
|
||||||
gst_object_ref_sink (GST_OBJECT_CAST (_gst_registry_default));
|
gst_object_ref_sink (GST_OBJECT_CAST (_gst_registry_default));
|
||||||
}
|
}
|
||||||
registry = _gst_registry_default;
|
registry = _gst_registry_default;
|
||||||
g_static_mutex_unlock (&_gst_registry_mutex);
|
g_mutex_unlock (&_gst_registry_mutex);
|
||||||
|
|
||||||
return registry;
|
return registry;
|
||||||
}
|
}
|
||||||
|
@ -1388,11 +1388,11 @@ _priv_gst_registry_cleanup (void)
|
||||||
{
|
{
|
||||||
GstRegistry *registry;
|
GstRegistry *registry;
|
||||||
|
|
||||||
g_static_mutex_lock (&_gst_registry_mutex);
|
g_mutex_lock (&_gst_registry_mutex);
|
||||||
if ((registry = _gst_registry_default) != NULL) {
|
if ((registry = _gst_registry_default) != NULL) {
|
||||||
_gst_registry_default = NULL;
|
_gst_registry_default = NULL;
|
||||||
}
|
}
|
||||||
g_static_mutex_unlock (&_gst_registry_mutex);
|
g_mutex_unlock (&_gst_registry_mutex);
|
||||||
|
|
||||||
/* unref outside of the lock because we can. */
|
/* unref outside of the lock because we can. */
|
||||||
if (registry)
|
if (registry)
|
||||||
|
|
|
@ -121,7 +121,7 @@ static void gst_system_clock_async_thread (GstClock * clock);
|
||||||
static gboolean gst_system_clock_start_async (GstSystemClock * clock);
|
static gboolean gst_system_clock_start_async (GstSystemClock * clock);
|
||||||
static void gst_system_clock_add_wakeup (GstSystemClock * sysclock);
|
static void gst_system_clock_add_wakeup (GstSystemClock * sysclock);
|
||||||
|
|
||||||
static GStaticMutex _gst_sysclock_mutex = G_STATIC_MUTEX_INIT;
|
static GMutex _gst_sysclock_mutex;
|
||||||
|
|
||||||
/* static guint gst_system_clock_signals[LAST_SIGNAL] = { 0 }; */
|
/* static guint gst_system_clock_signals[LAST_SIGNAL] = { 0 }; */
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ gst_system_clock_obtain (void)
|
||||||
{
|
{
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
|
|
||||||
g_static_mutex_lock (&_gst_sysclock_mutex);
|
g_mutex_lock (&_gst_sysclock_mutex);
|
||||||
clock = _the_system_clock;
|
clock = _the_system_clock;
|
||||||
|
|
||||||
if (clock == NULL) {
|
if (clock == NULL) {
|
||||||
|
@ -289,9 +289,9 @@ gst_system_clock_obtain (void)
|
||||||
gst_object_ref_sink (clock);
|
gst_object_ref_sink (clock);
|
||||||
|
|
||||||
_the_system_clock = clock;
|
_the_system_clock = clock;
|
||||||
g_static_mutex_unlock (&_gst_sysclock_mutex);
|
g_mutex_unlock (&_gst_sysclock_mutex);
|
||||||
} else {
|
} else {
|
||||||
g_static_mutex_unlock (&_gst_sysclock_mutex);
|
g_mutex_unlock (&_gst_sysclock_mutex);
|
||||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "returning static system clock");
|
GST_CAT_DEBUG (GST_CAT_CLOCK, "returning static system clock");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ static void gst_task_finalize (GObject * object);
|
||||||
|
|
||||||
static void gst_task_func (GstTask * task);
|
static void gst_task_func (GstTask * task);
|
||||||
|
|
||||||
static GStaticMutex pool_lock = G_STATIC_MUTEX_INIT;
|
static GMutex pool_lock;
|
||||||
|
|
||||||
#define _do_init \
|
#define _do_init \
|
||||||
{ \
|
{ \
|
||||||
|
@ -153,14 +153,14 @@ G_DEFINE_TYPE_WITH_CODE (GstTask, gst_task, GST_TYPE_OBJECT, _do_init);
|
||||||
static void
|
static void
|
||||||
init_klass_pool (GstTaskClass * klass)
|
init_klass_pool (GstTaskClass * klass)
|
||||||
{
|
{
|
||||||
g_static_mutex_lock (&pool_lock);
|
g_mutex_lock (&pool_lock);
|
||||||
if (klass->pool) {
|
if (klass->pool) {
|
||||||
gst_task_pool_cleanup (klass->pool);
|
gst_task_pool_cleanup (klass->pool);
|
||||||
gst_object_unref (klass->pool);
|
gst_object_unref (klass->pool);
|
||||||
}
|
}
|
||||||
klass->pool = gst_task_pool_new ();
|
klass->pool = gst_task_pool_new ();
|
||||||
gst_task_pool_prepare (klass->pool, NULL);
|
gst_task_pool_prepare (klass->pool, NULL);
|
||||||
g_static_mutex_unlock (&pool_lock);
|
g_mutex_unlock (&pool_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -194,9 +194,9 @@ gst_task_init (GstTask * task)
|
||||||
|
|
||||||
/* use the default klass pool for this task, users can
|
/* use the default klass pool for this task, users can
|
||||||
* override this later */
|
* override this later */
|
||||||
g_static_mutex_lock (&pool_lock);
|
g_mutex_lock (&pool_lock);
|
||||||
task->priv->pool = gst_object_ref (klass->pool);
|
task->priv->pool = gst_object_ref (klass->pool);
|
||||||
g_static_mutex_unlock (&pool_lock);
|
g_mutex_unlock (&pool_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
|
|
||||||
static GStaticMutex _check_lock = G_STATIC_MUTEX_INIT;
|
static GMutex _check_lock;
|
||||||
|
|
||||||
static GstElement *
|
static GstElement *
|
||||||
setup_multiqueue (GstElement * pipe, GstElement * inputs[],
|
setup_multiqueue (GstElement * pipe, GstElement * inputs[],
|
||||||
|
@ -335,13 +335,13 @@ mq_dummypad_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buf)
|
||||||
|
|
||||||
pad_data = gst_pad_get_element_private (sinkpad);
|
pad_data = gst_pad_get_element_private (sinkpad);
|
||||||
|
|
||||||
g_static_mutex_lock (&_check_lock);
|
g_mutex_lock (&_check_lock);
|
||||||
fail_if (pad_data == NULL);
|
fail_if (pad_data == NULL);
|
||||||
/* Read an ID from the first 4 bytes of the buffer data and check it's
|
/* Read an ID from the first 4 bytes of the buffer data and check it's
|
||||||
* what we expect */
|
* what we expect */
|
||||||
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||||
fail_unless (size >= 4);
|
fail_unless (size >= 4);
|
||||||
g_static_mutex_unlock (&_check_lock);
|
g_mutex_unlock (&_check_lock);
|
||||||
cur_id = GST_READ_UINT32_BE (data);
|
cur_id = GST_READ_UINT32_BE (data);
|
||||||
gst_buffer_unmap (buf, data, size);
|
gst_buffer_unmap (buf, data, size);
|
||||||
|
|
||||||
|
@ -353,12 +353,12 @@ mq_dummypad_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buf)
|
||||||
if (!pad_data->is_linked) {
|
if (!pad_data->is_linked) {
|
||||||
/* If there are no linked pads, we can't track a max_id for them :) */
|
/* If there are no linked pads, we can't track a max_id for them :) */
|
||||||
if (pad_data->n_linked > 0 && !pad_data->first_buf) {
|
if (pad_data->n_linked > 0 && !pad_data->first_buf) {
|
||||||
g_static_mutex_lock (&_check_lock);
|
g_mutex_lock (&_check_lock);
|
||||||
fail_unless (cur_id <= *(pad_data->max_linked_id_ptr) + 1,
|
fail_unless (cur_id <= *(pad_data->max_linked_id_ptr) + 1,
|
||||||
"Got buffer %u on pad %u before buffer %u was seen on a "
|
"Got buffer %u on pad %u before buffer %u was seen on a "
|
||||||
"linked pad (max: %u)", cur_id, pad_data->pad_num, cur_id - 1,
|
"linked pad (max: %u)", cur_id, pad_data->pad_num, cur_id - 1,
|
||||||
*(pad_data->max_linked_id_ptr));
|
*(pad_data->max_linked_id_ptr));
|
||||||
g_static_mutex_unlock (&_check_lock);
|
g_mutex_unlock (&_check_lock);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Update the max_id value */
|
/* Update the max_id value */
|
||||||
|
@ -382,9 +382,9 @@ mq_dummypad_event (GstPad * sinkpad, GstObject * parent, GstEvent * event)
|
||||||
struct PadData *pad_data;
|
struct PadData *pad_data;
|
||||||
|
|
||||||
pad_data = gst_pad_get_element_private (sinkpad);
|
pad_data = gst_pad_get_element_private (sinkpad);
|
||||||
g_static_mutex_lock (&_check_lock);
|
g_mutex_lock (&_check_lock);
|
||||||
fail_if (pad_data == NULL);
|
fail_if (pad_data == NULL);
|
||||||
g_static_mutex_unlock (&_check_lock);
|
g_mutex_unlock (&_check_lock);
|
||||||
|
|
||||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
||||||
g_mutex_lock (pad_data->mutex);
|
g_mutex_lock (pad_data->mutex);
|
||||||
|
@ -501,9 +501,9 @@ run_output_order_test (gint n_linked)
|
||||||
cur_pad = pad_pattern[i % n];
|
cur_pad = pad_pattern[i % n];
|
||||||
|
|
||||||
buf = gst_buffer_new_and_alloc (4);
|
buf = gst_buffer_new_and_alloc (4);
|
||||||
g_static_mutex_lock (&_check_lock);
|
g_mutex_lock (&_check_lock);
|
||||||
fail_if (buf == NULL);
|
fail_if (buf == NULL);
|
||||||
g_static_mutex_unlock (&_check_lock);
|
g_mutex_unlock (&_check_lock);
|
||||||
|
|
||||||
data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
GST_WRITE_UINT32_BE (data, i + 1);
|
GST_WRITE_UINT32_BE (data, i + 1);
|
||||||
|
@ -511,7 +511,7 @@ run_output_order_test (gint n_linked)
|
||||||
GST_BUFFER_TIMESTAMP (buf) = (i + 1) * GST_SECOND;
|
GST_BUFFER_TIMESTAMP (buf) = (i + 1) * GST_SECOND;
|
||||||
|
|
||||||
ret = gst_pad_push (inputpads[cur_pad], buf);
|
ret = gst_pad_push (inputpads[cur_pad], buf);
|
||||||
g_static_mutex_lock (&_check_lock);
|
g_mutex_lock (&_check_lock);
|
||||||
if (pad_data[cur_pad].is_linked) {
|
if (pad_data[cur_pad].is_linked) {
|
||||||
fail_unless (ret == GST_FLOW_OK,
|
fail_unless (ret == GST_FLOW_OK,
|
||||||
"Push on pad %d returned %d when FLOW_OK was expected", cur_pad, ret);
|
"Push on pad %d returned %d when FLOW_OK was expected", cur_pad, ret);
|
||||||
|
@ -521,7 +521,7 @@ run_output_order_test (gint n_linked)
|
||||||
"Push on pad %d returned %d when FLOW_OK or NOT_LINKED was expected",
|
"Push on pad %d returned %d when FLOW_OK or NOT_LINKED was expected",
|
||||||
cur_pad, ret);
|
cur_pad, ret);
|
||||||
}
|
}
|
||||||
g_static_mutex_unlock (&_check_lock);
|
g_mutex_unlock (&_check_lock);
|
||||||
}
|
}
|
||||||
for (i = 0; i < NPADS; i++) {
|
for (i = 0; i < NPADS; i++) {
|
||||||
gst_pad_push_event (inputpads[i], gst_event_new_eos ());
|
gst_pad_push_event (inputpads[i], gst_event_new_eos ());
|
||||||
|
@ -660,9 +660,9 @@ GST_START_TEST (test_sparse_stream)
|
||||||
ts = gst_util_uint64_scale_int (GST_SECOND, i, 10);
|
ts = gst_util_uint64_scale_int (GST_SECOND, i, 10);
|
||||||
|
|
||||||
buf = gst_buffer_new_and_alloc (4);
|
buf = gst_buffer_new_and_alloc (4);
|
||||||
g_static_mutex_lock (&_check_lock);
|
g_mutex_lock (&_check_lock);
|
||||||
fail_if (buf == NULL);
|
fail_if (buf == NULL);
|
||||||
g_static_mutex_unlock (&_check_lock);
|
g_mutex_unlock (&_check_lock);
|
||||||
|
|
||||||
data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
data = gst_buffer_map (buf, NULL, NULL, GST_MAP_WRITE);
|
||||||
GST_WRITE_UINT32_BE (data, i + 1);
|
GST_WRITE_UINT32_BE (data, i + 1);
|
||||||
|
@ -675,10 +675,10 @@ GST_START_TEST (test_sparse_stream)
|
||||||
ret = gst_pad_push (inputpads[1], gst_buffer_ref (buf));
|
ret = gst_pad_push (inputpads[1], gst_buffer_ref (buf));
|
||||||
|
|
||||||
ret = gst_pad_push (inputpads[0], buf);
|
ret = gst_pad_push (inputpads[0], buf);
|
||||||
g_static_mutex_lock (&_check_lock);
|
g_mutex_lock (&_check_lock);
|
||||||
fail_unless (ret == GST_FLOW_OK,
|
fail_unless (ret == GST_FLOW_OK,
|
||||||
"Push on pad %d returned %d when FLOW_OK was expected", 0, ret);
|
"Push on pad %d returned %d when FLOW_OK was expected", 0, ret);
|
||||||
g_static_mutex_unlock (&_check_lock);
|
g_mutex_unlock (&_check_lock);
|
||||||
|
|
||||||
/* Push a new segment update on the 2nd pad */
|
/* Push a new segment update on the 2nd pad */
|
||||||
gst_segment_init (&segment, GST_FORMAT_TIME);
|
gst_segment_init (&segment, GST_FORMAT_TIME);
|
||||||
|
|
Loading…
Reference in a new issue