aggregator: Fix StartTimeSelection enum type registration
authorSebastian Dröge <sebastian@centricular.com>
Wed, 10 Jun 2020 08:23:42 +0000 (11:23 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 10 Jun 2020 08:23:42 +0000 (11:23 +0300)
Make it thread-safe and use the actual C identifiers for the "name"
field, as otherwise gobject-introspection will fall apart.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/527>

libs/gst/base/gstaggregator.c

index c41e463..640dc02 100644 (file)
@@ -96,18 +96,20 @@ gst_aggregator_start_time_selection_get_type (void)
 {
   static GType gtype = 0;
 
-  if (gtype == 0) {
+  if (g_once_init_enter (&gtype)) {
     static const GEnumValue values[] = {
       {GST_AGGREGATOR_START_TIME_SELECTION_ZERO,
-          "Start at 0 running time (default)", "zero"},
+          "GST_AGGREGATOR_START_TIME_SELECTION_ZERO", "zero"},
       {GST_AGGREGATOR_START_TIME_SELECTION_FIRST,
-          "Start at first observed input running time", "first"},
+          "GST_AGGREGATOR_START_TIME_SELECTION_FIRST", "first"},
       {GST_AGGREGATOR_START_TIME_SELECTION_SET,
-          "Set start time with start-time property", "set"},
+          "GST_AGGREGATOR_START_TIME_SELECTION_SET", "set"},
       {0, NULL, NULL}
     };
+    GType new_type =
+        g_enum_register_static ("GstAggregatorStartTimeSelection", values);
 
-    gtype = g_enum_register_static ("GstAggregatorStartTimeSelection", values);
+    g_once_init_leave (&gtype, new_type);
   }
   return gtype;
 }