mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
controller, dataprotocol: make public enum _get_type() functions thread-safe
Not that it is likely to matter in practice, but since these are public API they should probably be thread-safe.
This commit is contained in:
parent
c7e3bab65d
commit
9bd4432d08
2 changed files with 25 additions and 23 deletions
|
@ -580,26 +580,27 @@ enum
|
|||
GType
|
||||
gst_lfo_waveform_get_type (void)
|
||||
{
|
||||
static GType gtype = 0;
|
||||
static gsize gtype = 0;
|
||||
static const GEnumValue values[] = {
|
||||
{GST_LFO_WAVEFORM_SINE, "GST_LFO_WAVEFORM_SINE",
|
||||
"sine"},
|
||||
{GST_LFO_WAVEFORM_SQUARE, "GST_LFO_WAVEFORM_SQUARE",
|
||||
"square"},
|
||||
{GST_LFO_WAVEFORM_SAW, "GST_LFO_WAVEFORM_SAW",
|
||||
"saw"},
|
||||
{GST_LFO_WAVEFORM_REVERSE_SAW, "GST_LFO_WAVEFORM_REVERSE_SAW",
|
||||
"reverse-saw"},
|
||||
{GST_LFO_WAVEFORM_TRIANGLE, "GST_LFO_WAVEFORM_TRIANGLE",
|
||||
"triangle"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
if (gtype == 0) {
|
||||
static const GEnumValue values[] = {
|
||||
{GST_LFO_WAVEFORM_SINE, "GST_LFO_WAVEFORM_SINE",
|
||||
"sine"},
|
||||
{GST_LFO_WAVEFORM_SQUARE, "GST_LFO_WAVEFORM_SQUARE",
|
||||
"square"},
|
||||
{GST_LFO_WAVEFORM_SAW, "GST_LFO_WAVEFORM_SAW",
|
||||
"saw"},
|
||||
{GST_LFO_WAVEFORM_REVERSE_SAW, "GST_LFO_WAVEFORM_REVERSE_SAW",
|
||||
"reverse-saw"},
|
||||
{GST_LFO_WAVEFORM_TRIANGLE, "GST_LFO_WAVEFORM_TRIANGLE",
|
||||
"triangle"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
gtype = g_enum_register_static ("GstLFOWaveform", values);
|
||||
if (g_once_init_enter (>ype)) {
|
||||
GType tmp = g_enum_register_static ("GstLFOWaveform", values);
|
||||
g_once_init_leave (>ype, tmp);
|
||||
}
|
||||
return gtype;
|
||||
|
||||
return (GType) gtype;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GstLFOControlSource, gst_lfo_control_source,
|
||||
|
|
|
@ -292,18 +292,19 @@ gst_dp_dump_byte_array (guint8 * array, guint length)
|
|||
GType
|
||||
gst_dp_version_get_type (void)
|
||||
{
|
||||
static GType gst_dp_version_type = 0;
|
||||
static gsize gst_dp_version_type = 0;
|
||||
static const GEnumValue gst_dp_version[] = {
|
||||
{GST_DP_VERSION_0_2, "GST_DP_VERSION_0_2", "0.2"},
|
||||
{GST_DP_VERSION_1_0, "GST_DP_VERSION_1_0", "1.0"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (!gst_dp_version_type) {
|
||||
gst_dp_version_type =
|
||||
g_enum_register_static ("GstDPVersion", gst_dp_version);
|
||||
if (g_once_init_enter (&gst_dp_version_type)) {
|
||||
GType tmp = g_enum_register_static ("GstDPVersion", gst_dp_version);
|
||||
g_once_init_leave (&gst_dp_version_type, tmp);
|
||||
}
|
||||
return gst_dp_version_type;
|
||||
|
||||
return (GType) gst_dp_version_type;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue