decklink: use GOnce in type registration

This commit is contained in:
David Schleef 2012-07-02 17:49:54 -07:00 committed by Sebastian Dröge
parent 963e6e3397
commit 70cef922a4

View file

@ -29,9 +29,7 @@
GType
gst_decklink_mode_get_type (void)
{
static GType type;
if (!type) {
static gsize id = 0;
static const GEnumValue modes[] = {
{GST_DECKLINK_MODE_NTSC, "ntsc", "NTSC SD 60i"},
{GST_DECKLINK_MODE_NTSC2398, "ntsc2398", "NTSC SD 60i (24 fps)"},
@ -60,17 +58,18 @@ gst_decklink_mode_get_type (void)
{0, NULL, NULL}
};
type = g_enum_register_static ("GstDecklinkModes", modes);
if (g_once_init_enter (&id)) {
GType tmp = g_enum_register_static ("GstDecklinkModes", modes);
g_once_init_leave (&id, tmp);
}
return type;
return (GType) id;
}
GType
gst_decklink_connection_get_type (void)
{
static GType type;
if (!type) {
static gsize id = 0;
static const GEnumValue connections[] = {
{GST_DECKLINK_CONNECTION_SDI, "sdi", "SDI"},
{GST_DECKLINK_CONNECTION_HDMI, "hdmi", "HDMI"},
@ -81,17 +80,18 @@ gst_decklink_connection_get_type (void)
{0, NULL, NULL}
};
type = g_enum_register_static ("GstDecklinkConnection", connections);
if (g_once_init_enter (&id)) {
GType tmp = g_enum_register_static ("GstDecklinkConnection", connections);
g_once_init_leave (&id, tmp);
}
return type;
return (GType) id;
}
GType
gst_decklink_audio_connection_get_type (void)
{
static GType type;
if (!type) {
static gsize id = 0;
static const GEnumValue connections[] = {
{GST_DECKLINK_AUDIO_CONNECTION_AUTO, "auto", "Automatic"},
{GST_DECKLINK_AUDIO_CONNECTION_EMBEDDED, "embedded",
@ -101,9 +101,13 @@ gst_decklink_audio_connection_get_type (void)
{0, NULL, NULL}
};
type = g_enum_register_static ("GstDecklinkAudioConnection", connections);
if (g_once_init_enter (&id)) {
GType tmp =
g_enum_register_static ("GstDecklinkAudioConnection", connections);
g_once_init_leave (&id, tmp);
}
return type;
return (GType) id;
}
#define NTSC 10, 11, false, false