mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 13:06:23 +00:00
Use macros to register boxed types thread safely
This commit is contained in:
parent
8f8335a7f4
commit
e234a10c63
10 changed files with 24 additions and 122 deletions
|
@ -351,16 +351,7 @@ gst_caps_new_full_valist (GstStructure * structure, va_list var_args)
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
G_DEFINE_POINTER_TYPE (GstStaticCaps, gst_static_caps);
|
||||||
gst_static_caps_get_type (void)
|
|
||||||
{
|
|
||||||
static GType staticcaps_type = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (staticcaps_type == 0)) {
|
|
||||||
staticcaps_type = g_pointer_type_register_static ("GstStaticCaps");
|
|
||||||
}
|
|
||||||
return staticcaps_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_static_caps_get:
|
* gst_static_caps_get:
|
||||||
|
|
|
@ -85,16 +85,8 @@ gst_iterator_copy (const GstIterator * it)
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
G_DEFINE_BOXED_TYPE (GstIterator, gst_iterator,
|
||||||
gst_iterator_get_type (void)
|
|
||||||
{
|
|
||||||
static GType type = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (type == 0))
|
|
||||||
type = g_boxed_type_register_static ("GstIterator",
|
|
||||||
(GBoxedCopyFunc) gst_iterator_copy, (GBoxedFreeFunc) gst_iterator_free);
|
(GBoxedCopyFunc) gst_iterator_copy, (GBoxedFreeFunc) gst_iterator_free);
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_iterator_init (GstIterator * it,
|
gst_iterator_init (GstIterator * it,
|
||||||
|
|
|
@ -272,17 +272,7 @@ name_is_valid (const gchar * name, GstPadPresence presence)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
G_DEFINE_POINTER_TYPE (GstStaticPadTemplate, gst_static_pad_template);
|
||||||
gst_static_pad_template_get_type (void)
|
|
||||||
{
|
|
||||||
static GType staticpadtemplate_type = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (staticpadtemplate_type == 0)) {
|
|
||||||
staticpadtemplate_type =
|
|
||||||
g_pointer_type_register_static ("GstStaticPadTemplate");
|
|
||||||
}
|
|
||||||
return staticpadtemplate_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_static_pad_template_get:
|
* gst_static_pad_template_get:
|
||||||
|
|
|
@ -64,19 +64,9 @@ gst_parse_context_copy (const GstParseContext * context)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
G_DEFINE_BOXED_TYPE (GstParseContext, gst_parse_context,
|
||||||
gst_parse_context_get_type (void)
|
|
||||||
{
|
|
||||||
static GType type = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (type == 0)) {
|
|
||||||
type = g_boxed_type_register_static ("GstParseContext",
|
|
||||||
(GBoxedCopyFunc) gst_parse_context_copy,
|
(GBoxedCopyFunc) gst_parse_context_copy,
|
||||||
(GBoxedFreeFunc) gst_parse_context_free);
|
(GBoxedFreeFunc) gst_parse_context_free);
|
||||||
}
|
|
||||||
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_parse_error_quark:
|
* gst_parse_error_quark:
|
||||||
|
|
|
@ -113,18 +113,8 @@ gst_segment_copy_into (const GstSegment * src, GstSegment * dest)
|
||||||
memcpy (dest, src, sizeof (GstSegment));
|
memcpy (dest, src, sizeof (GstSegment));
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
G_DEFINE_BOXED_TYPE (GstSegment, gst_segment,
|
||||||
gst_segment_get_type (void)
|
|
||||||
{
|
|
||||||
static GType gst_segment_type = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (gst_segment_type == 0)) {
|
|
||||||
gst_segment_type = g_boxed_type_register_static ("GstSegment",
|
|
||||||
(GBoxedCopyFunc) gst_segment_copy, (GBoxedFreeFunc) gst_segment_free);
|
(GBoxedCopyFunc) gst_segment_copy, (GBoxedFreeFunc) gst_segment_free);
|
||||||
}
|
|
||||||
|
|
||||||
return gst_segment_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_segment_new:
|
* gst_segment_new:
|
||||||
|
|
|
@ -82,23 +82,13 @@ static GMutex __tag_mutex;
|
||||||
/* tags hash table: maps tag name string => GstTagInfo */
|
/* tags hash table: maps tag name string => GstTagInfo */
|
||||||
static GHashTable *__tags;
|
static GHashTable *__tags;
|
||||||
|
|
||||||
GType
|
G_DEFINE_BOXED_TYPE (GstTagList, gst_tag_list,
|
||||||
gst_tag_list_get_type (void)
|
|
||||||
{
|
|
||||||
static GType _gst_tag_list_type = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (_gst_tag_list_type == 0)) {
|
|
||||||
_gst_tag_list_type = g_boxed_type_register_static ("GstTagList",
|
|
||||||
(GBoxedCopyFunc) gst_tag_list_copy, (GBoxedFreeFunc) gst_tag_list_free);
|
(GBoxedCopyFunc) gst_tag_list_copy, (GBoxedFreeFunc) gst_tag_list_free);
|
||||||
|
|
||||||
#if 0
|
/* FIXME: had code:
|
||||||
g_value_register_transform_func (_gst_tag_list_type, G_TYPE_STRING,
|
* g_value_register_transform_func (_gst_tag_list_type, G_TYPE_STRING,
|
||||||
_gst_structure_transform_to_string);
|
* _gst_structure_transform_to_string);
|
||||||
#endif
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
return _gst_tag_list_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_priv_gst_tag_initialize (void)
|
_priv_gst_tag_initialize (void)
|
||||||
|
|
|
@ -38,16 +38,7 @@
|
||||||
GST_DEBUG_CATEGORY_EXTERN (type_find_debug);
|
GST_DEBUG_CATEGORY_EXTERN (type_find_debug);
|
||||||
#define GST_CAT_DEFAULT type_find_debug
|
#define GST_CAT_DEFAULT type_find_debug
|
||||||
|
|
||||||
GType
|
G_DEFINE_POINTER_TYPE (GstTypeFind, gst_type_find);
|
||||||
gst_type_find_get_type (void)
|
|
||||||
{
|
|
||||||
static GType typefind_type = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (typefind_type == 0)) {
|
|
||||||
typefind_type = g_pointer_type_register_static ("GstTypeFind");
|
|
||||||
}
|
|
||||||
return typefind_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_type_find_register:
|
* gst_type_find_register:
|
||||||
|
|
|
@ -5508,19 +5508,8 @@ static const GTypeValueTable _gst_fraction_value_table = {
|
||||||
|
|
||||||
FUNC_VALUE_GET_TYPE (fraction, "GstFraction");
|
FUNC_VALUE_GET_TYPE (fraction, "GstFraction");
|
||||||
|
|
||||||
GType
|
G_DEFINE_BOXED_TYPE (GstDateTime, gst_date_time,
|
||||||
gst_date_time_get_type (void)
|
(GBoxedCopyFunc) gst_date_time_ref, (GBoxedFreeFunc) gst_date_time_unref);
|
||||||
{
|
|
||||||
static GType gst_date_time_type = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (gst_date_time_type == 0)) {
|
|
||||||
gst_date_time_type = g_boxed_type_register_static ("GstDateTime",
|
|
||||||
(GBoxedCopyFunc) gst_date_time_ref,
|
|
||||||
(GBoxedFreeFunc) gst_date_time_unref);
|
|
||||||
}
|
|
||||||
|
|
||||||
return gst_date_time_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const GTypeValueTable _gst_bitmask_value_table = {
|
static const GTypeValueTable _gst_bitmask_value_table = {
|
||||||
gst_value_init_bitmask,
|
gst_value_init_bitmask,
|
||||||
|
|
|
@ -611,21 +611,9 @@ gst_base_parse_frame_free (GstBaseParseFrame * frame)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
G_DEFINE_BOXED_TYPE (GstBaseParseFrame, gst_base_parse_frame,
|
||||||
gst_base_parse_frame_get_type (void)
|
|
||||||
{
|
|
||||||
static volatile gsize frame_type = 0;
|
|
||||||
|
|
||||||
if (g_once_init_enter (&frame_type)) {
|
|
||||||
GType _type;
|
|
||||||
|
|
||||||
_type = g_boxed_type_register_static ("GstBaseParseFrame",
|
|
||||||
(GBoxedCopyFunc) gst_base_parse_frame_copy,
|
(GBoxedCopyFunc) gst_base_parse_frame_copy,
|
||||||
(GBoxedFreeFunc) gst_base_parse_frame_free);
|
(GBoxedFreeFunc) gst_base_parse_frame_free);
|
||||||
g_once_init_leave (&frame_type, _type);
|
|
||||||
}
|
|
||||||
return (GType) frame_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_base_parse_frame_init:
|
* gst_base_parse_frame_init:
|
||||||
|
|
|
@ -131,18 +131,9 @@ gst_index_resolver_get_type (void)
|
||||||
return index_resolver_type;
|
return index_resolver_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
GType
|
G_DEFINE_BOXED_TYPE (GstIndexEntry, gst_index_entry,
|
||||||
gst_index_entry_get_type (void)
|
|
||||||
{
|
|
||||||
static GType index_entry_type = 0;
|
|
||||||
|
|
||||||
if (!index_entry_type) {
|
|
||||||
index_entry_type = g_boxed_type_register_static ("GstIndexEntry",
|
|
||||||
(GBoxedCopyFunc) gst_index_entry_copy,
|
(GBoxedCopyFunc) gst_index_entry_copy,
|
||||||
(GBoxedFreeFunc) gst_index_entry_free);
|
(GBoxedFreeFunc) gst_index_entry_free);
|
||||||
}
|
|
||||||
return index_entry_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#define _do_init \
|
#define _do_init \
|
||||||
|
|
Loading…
Reference in a new issue