mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
jack: make get_type functions thread-safe
Because we can (shouldn't be needed with other workarounds still there).
This commit is contained in:
parent
1f6a83ce1d
commit
1f5083a17c
3 changed files with 32 additions and 30 deletions
|
@ -27,22 +27,23 @@
|
||||||
GType
|
GType
|
||||||
gst_jack_connect_get_type (void)
|
gst_jack_connect_get_type (void)
|
||||||
{
|
{
|
||||||
static GType jack_connect_type = 0;
|
static volatile gsize jack_connect_type = 0;
|
||||||
static const GEnumValue jack_connect[] = {
|
|
||||||
{GST_JACK_CONNECT_NONE,
|
|
||||||
"Don't automatically connect ports to physical ports", "none"},
|
|
||||||
{GST_JACK_CONNECT_AUTO,
|
|
||||||
"Automatically connect ports to physical ports", "auto"},
|
|
||||||
{GST_JACK_CONNECT_AUTO_FORCED,
|
|
||||||
"Automatically connect ports to as many physical ports as possible",
|
|
||||||
"auto-forced"},
|
|
||||||
{0, NULL, NULL},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!jack_connect_type) {
|
if (g_once_init_enter (&jack_connect_type)) {
|
||||||
jack_connect_type = g_enum_register_static ("GstJackConnect", jack_connect);
|
static const GEnumValue jack_connect_enums[] = {
|
||||||
|
{GST_JACK_CONNECT_NONE,
|
||||||
|
"Don't automatically connect ports to physical ports", "none"},
|
||||||
|
{GST_JACK_CONNECT_AUTO,
|
||||||
|
"Automatically connect ports to physical ports", "auto"},
|
||||||
|
{GST_JACK_CONNECT_AUTO_FORCED,
|
||||||
|
"Automatically connect ports to as many physical ports as possible",
|
||||||
|
"auto-forced"},
|
||||||
|
{0, NULL, NULL},
|
||||||
|
};
|
||||||
|
GType tmp = g_enum_register_static ("GstJackConnect", jack_connect_enums);
|
||||||
|
g_once_init_leave (&jack_connect_type, tmp);
|
||||||
}
|
}
|
||||||
return jack_connect_type;
|
return (GType) jack_connect_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,16 +64,17 @@ gst_jack_client_free (gpointer jclient)
|
||||||
GType
|
GType
|
||||||
gst_jack_client_get_type (void)
|
gst_jack_client_get_type (void)
|
||||||
{
|
{
|
||||||
static GType type; /* 0 */
|
static volatile gsize jack_client_type = 0;
|
||||||
|
|
||||||
if (type == 0) {
|
if (g_once_init_enter (&jack_client_type)) {
|
||||||
/* hackish, but makes it show up nicely in gst-inspect */
|
/* hackish, but makes it show up nicely in gst-inspect */
|
||||||
type = g_boxed_type_register_static ("JackClient",
|
GType tmp = g_boxed_type_register_static ("JackClient",
|
||||||
(GBoxedCopyFunc) gst_jack_client_copy,
|
(GBoxedCopyFunc) gst_jack_client_copy,
|
||||||
(GBoxedFreeFunc) gst_jack_client_free);
|
(GBoxedFreeFunc) gst_jack_client_free);
|
||||||
|
g_once_init_leave (&jack_client_type, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return (GType) jack_client_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -129,9 +129,9 @@ gst_jack_audio_sink_free_channels (GstJackAudioSink * sink)
|
||||||
static GType
|
static GType
|
||||||
gst_jack_ring_buffer_get_type (void)
|
gst_jack_ring_buffer_get_type (void)
|
||||||
{
|
{
|
||||||
static GType ringbuffer_type = 0;
|
static volatile gsize ringbuffer_type = 0;
|
||||||
|
|
||||||
if (!ringbuffer_type) {
|
if (g_once_init_enter (&ringbuffer_type)) {
|
||||||
static const GTypeInfo ringbuffer_info = {
|
static const GTypeInfo ringbuffer_info = {
|
||||||
sizeof (GstJackRingBufferClass),
|
sizeof (GstJackRingBufferClass),
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -144,12 +144,12 @@ gst_jack_ring_buffer_get_type (void)
|
||||||
(GInstanceInitFunc) gst_jack_ring_buffer_init,
|
(GInstanceInitFunc) gst_jack_ring_buffer_init,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
GType tmp = g_type_register_static (GST_TYPE_RING_BUFFER,
|
||||||
ringbuffer_type =
|
|
||||||
g_type_register_static (GST_TYPE_RING_BUFFER,
|
|
||||||
"GstJackAudioSinkRingBuffer", &ringbuffer_info, 0);
|
"GstJackAudioSinkRingBuffer", &ringbuffer_info, 0);
|
||||||
|
g_once_init_leave (&ringbuffer_type, tmp);
|
||||||
}
|
}
|
||||||
return ringbuffer_type;
|
|
||||||
|
return (GType) ringbuffer_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -151,9 +151,9 @@ gst_jack_audio_src_free_channels (GstJackAudioSrc * src)
|
||||||
static GType
|
static GType
|
||||||
gst_jack_ring_buffer_get_type (void)
|
gst_jack_ring_buffer_get_type (void)
|
||||||
{
|
{
|
||||||
static GType ringbuffer_type = 0;
|
static volatile gsize ringbuffer_type = 0;
|
||||||
|
|
||||||
if (!ringbuffer_type) {
|
if (g_once_init_enter (&ringbuffer_type)) {
|
||||||
static const GTypeInfo ringbuffer_info = { sizeof (GstJackRingBufferClass),
|
static const GTypeInfo ringbuffer_info = { sizeof (GstJackRingBufferClass),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -165,12 +165,12 @@ gst_jack_ring_buffer_get_type (void)
|
||||||
(GInstanceInitFunc) gst_jack_ring_buffer_init,
|
(GInstanceInitFunc) gst_jack_ring_buffer_init,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
GType tmp = g_type_register_static (GST_TYPE_RING_BUFFER,
|
||||||
ringbuffer_type =
|
|
||||||
g_type_register_static (GST_TYPE_RING_BUFFER,
|
|
||||||
"GstJackAudioSrcRingBuffer", &ringbuffer_info, 0);
|
"GstJackAudioSrcRingBuffer", &ringbuffer_info, 0);
|
||||||
|
g_once_init_leave (&ringbuffer_type, tmp);
|
||||||
}
|
}
|
||||||
return ringbuffer_type;
|
|
||||||
|
return (GType) ringbuffer_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue