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,8 +27,10 @@
|
|||
GType
|
||||
gst_jack_connect_get_type (void)
|
||||
{
|
||||
static GType jack_connect_type = 0;
|
||||
static const GEnumValue jack_connect[] = {
|
||||
static volatile gsize jack_connect_type = 0;
|
||||
|
||||
if (g_once_init_enter (&jack_connect_type)) {
|
||||
static const GEnumValue jack_connect_enums[] = {
|
||||
{GST_JACK_CONNECT_NONE,
|
||||
"Don't automatically connect ports to physical ports", "none"},
|
||||
{GST_JACK_CONNECT_AUTO,
|
||||
|
@ -38,11 +40,10 @@ gst_jack_connect_get_type (void)
|
|||
"auto-forced"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!jack_connect_type) {
|
||||
jack_connect_type = g_enum_register_static ("GstJackConnect", jack_connect);
|
||||
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
|
||||
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 */
|
||||
type = g_boxed_type_register_static ("JackClient",
|
||||
GType tmp = g_boxed_type_register_static ("JackClient",
|
||||
(GBoxedCopyFunc) gst_jack_client_copy,
|
||||
(GBoxedFreeFunc) gst_jack_client_free);
|
||||
g_once_init_leave (&jack_client_type, tmp);
|
||||
}
|
||||
|
||||
return type;
|
||||
return (GType) jack_client_type;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -129,9 +129,9 @@ gst_jack_audio_sink_free_channels (GstJackAudioSink * sink)
|
|||
static GType
|
||||
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),
|
||||
NULL,
|
||||
|
@ -144,12 +144,12 @@ gst_jack_ring_buffer_get_type (void)
|
|||
(GInstanceInitFunc) gst_jack_ring_buffer_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
ringbuffer_type =
|
||||
g_type_register_static (GST_TYPE_RING_BUFFER,
|
||||
GType tmp = g_type_register_static (GST_TYPE_RING_BUFFER,
|
||||
"GstJackAudioSinkRingBuffer", &ringbuffer_info, 0);
|
||||
g_once_init_leave (&ringbuffer_type, tmp);
|
||||
}
|
||||
return ringbuffer_type;
|
||||
|
||||
return (GType) ringbuffer_type;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -151,9 +151,9 @@ gst_jack_audio_src_free_channels (GstJackAudioSrc * src)
|
|||
static GType
|
||||
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),
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -165,12 +165,12 @@ gst_jack_ring_buffer_get_type (void)
|
|||
(GInstanceInitFunc) gst_jack_ring_buffer_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
ringbuffer_type =
|
||||
g_type_register_static (GST_TYPE_RING_BUFFER,
|
||||
GType tmp = g_type_register_static (GST_TYPE_RING_BUFFER,
|
||||
"GstJackAudioSrcRingBuffer", &ringbuffer_info, 0);
|
||||
g_once_init_leave (&ringbuffer_type, tmp);
|
||||
}
|
||||
return ringbuffer_type;
|
||||
|
||||
return (GType) ringbuffer_type;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue