mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
audio: make public get_type() functions thread-safe
This commit is contained in:
parent
6b7af81e30
commit
751c34bffc
3 changed files with 29 additions and 26 deletions
|
@ -56,28 +56,28 @@ static GstSystemClockClass *parent_class = NULL;
|
||||||
GType
|
GType
|
||||||
gst_audio_clock_get_type (void)
|
gst_audio_clock_get_type (void)
|
||||||
{
|
{
|
||||||
static GType clock_type = 0;
|
static volatile gsize clock_type = 0;
|
||||||
|
static const GTypeInfo clock_info = {
|
||||||
|
sizeof (GstAudioClockClass),
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
(GClassInitFunc) gst_audio_clock_class_init,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
sizeof (GstAudioClock),
|
||||||
|
4,
|
||||||
|
(GInstanceInitFunc) gst_audio_clock_init,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
if (!clock_type) {
|
if (g_once_init_enter (&clock_type)) {
|
||||||
static const GTypeInfo clock_info = {
|
GType tmp = g_type_register_static (GST_TYPE_SYSTEM_CLOCK, "GstAudioClock",
|
||||||
sizeof (GstAudioClockClass),
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_audio_clock_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstAudioClock),
|
|
||||||
4,
|
|
||||||
(GInstanceInitFunc) gst_audio_clock_init,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
clock_type = g_type_register_static (GST_TYPE_SYSTEM_CLOCK, "GstAudioClock",
|
|
||||||
&clock_info, 0);
|
&clock_info, 0);
|
||||||
|
g_once_init_leave (&clock_type, tmp);
|
||||||
}
|
}
|
||||||
return clock_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return (GType) clock_type;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_audio_clock_class_init (GstAudioClockClass * klass)
|
gst_audio_clock_class_init (GstAudioClockClass * klass)
|
||||||
|
|
|
@ -110,7 +110,7 @@ enum
|
||||||
GType
|
GType
|
||||||
gst_base_audio_sink_slave_method_get_type (void)
|
gst_base_audio_sink_slave_method_get_type (void)
|
||||||
{
|
{
|
||||||
static GType slave_method_type = 0;
|
static volatile gsize slave_method_type = 0;
|
||||||
static const GEnumValue slave_method[] = {
|
static const GEnumValue slave_method[] = {
|
||||||
{GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE, "GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE",
|
{GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE, "GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE",
|
||||||
"resample"},
|
"resample"},
|
||||||
|
@ -119,11 +119,13 @@ gst_base_audio_sink_slave_method_get_type (void)
|
||||||
{0, NULL, NULL},
|
{0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!slave_method_type) {
|
if (g_once_init_enter (&slave_method_type)) {
|
||||||
slave_method_type =
|
GType tmp =
|
||||||
g_enum_register_static ("GstBaseAudioSinkSlaveMethod", slave_method);
|
g_enum_register_static ("GstBaseAudioSinkSlaveMethod", slave_method);
|
||||||
|
g_once_init_leave (&slave_method_type, tmp);
|
||||||
}
|
}
|
||||||
return slave_method_type;
|
|
||||||
|
return (GType) slave_method_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_base_audio_src_debug);
|
||||||
GType
|
GType
|
||||||
gst_base_audio_src_slave_method_get_type (void)
|
gst_base_audio_src_slave_method_get_type (void)
|
||||||
{
|
{
|
||||||
static GType slave_method_type = 0;
|
static volatile gsize slave_method_type = 0;
|
||||||
/* FIXME 0.11: nick should be "retimestamp" not "re-timestamp" */
|
/* FIXME 0.11: nick should be "retimestamp" not "re-timestamp" */
|
||||||
static const GEnumValue slave_method[] = {
|
static const GEnumValue slave_method[] = {
|
||||||
{GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE,
|
{GST_BASE_AUDIO_SRC_SLAVE_RESAMPLE,
|
||||||
|
@ -60,11 +60,12 @@ gst_base_audio_src_slave_method_get_type (void)
|
||||||
{0, NULL, NULL},
|
{0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!slave_method_type) {
|
if (g_once_init_enter (&slave_method_type)) {
|
||||||
slave_method_type =
|
GType tmp =
|
||||||
g_enum_register_static ("GstBaseAudioSrcSlaveMethod", slave_method);
|
g_enum_register_static ("GstBaseAudioSrcSlaveMethod", slave_method);
|
||||||
|
g_once_init_leave (&slave_method_type, tmp);
|
||||||
}
|
}
|
||||||
return slave_method_type;
|
return (GType) slave_method_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GST_BASE_AUDIO_SRC_GET_PRIVATE(obj) \
|
#define GST_BASE_AUDIO_SRC_GET_PRIVATE(obj) \
|
||||||
|
|
Loading…
Reference in a new issue