trace: rework alloc tracing
[platform/upstream/gstreamer.git] / gst / gst.c
index a3cb227..f14cfef 100644 (file)
--- a/gst/gst.c
+++ b/gst/gst.c
@@ -360,32 +360,6 @@ gst_init_get_option_group (void)
     {NULL}
   };
 
-/* Since GLib 2.31.0 threading is always enabled and g_thread_init()
- * is not needed any longer and deprecated */
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-  /* Since GLib 2.23.2 calling g_thread_init() 'late' is allowed and is
-   * automatically done as part of g_type_init() */
-  if (glib_check_version (2, 23, 3)) {
-    /* The GLib threading system must be initialised before calling any other
-     * GLib function according to the documentation; if the application hasn't
-     * called gst_init() yet or initialised the threading system otherwise, we
-     * better issue a warning here (since chances are high that the application
-     * has already called other GLib functions such as g_option_context_new() */
-    if (!g_thread_get_initialized ()) {
-      g_warning ("The GStreamer function gst_init_get_option_group() was\n"
-          "\tcalled, but the GLib threading system has not been initialised\n"
-          "\tyet, something that must happen before any other GLib function\n"
-          "\tis called. The application needs to be fixed so that it calls\n"
-          "\t   if (!g_thread_get_initialized ()) g_thread_init(NULL);\n"
-          "\tas very first thing in its main() function. Please file a bug\n"
-          "\tagainst this application.");
-      g_thread_init (NULL);
-    }
-  } else {
-    /* GLib >= 2.23.2 */
-  }
-#endif
-
   group = g_option_group_new ("gst", _("GStreamer Options"),
       _("Show GStreamer Options"), NULL, NULL);
   g_option_group_set_parse_hooks (group, (GOptionParseFunc) init_pre,
@@ -428,11 +402,6 @@ gst_init_check (int *argc, char **argv[], GError ** err)
 #endif
   gboolean res;
 
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-  if (!g_thread_get_initialized ())
-    g_thread_init (NULL);
-#endif
-
   if (gst_initialized) {
     GST_DEBUG ("already initialized gst");
     return TRUE;
@@ -580,11 +549,6 @@ init_pre (GOptionContext * context, GOptionGroup * group, gpointer data,
 
   g_type_init ();
 
-#if !GLIB_CHECK_VERSION (2, 31, 0)
-  /* we need threading to be enabled right here */
-  g_assert (g_thread_get_initialized ());
-#endif
-
 #ifndef GST_DISABLE_GST_DEBUG
   _priv_gst_debug_init ();
 #endif
@@ -662,10 +626,6 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
 {
   GLogLevelFlags llf;
 
-#ifndef GST_DISABLE_TRACE
-  GstTrace *gst_trace;
-#endif /* GST_DISABLE_TRACE */
-
   if (gst_initialized) {
     GST_DEBUG ("already initialized");
     return TRUE;
@@ -674,6 +634,9 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
   llf = G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL;
   g_log_set_handler (g_log_domain_gstreamer, llf, debug_log_handler, NULL);
 
+  _priv_gst_alloc_trace_initialize ();
+
+  _priv_gst_mini_object_initialize ();
   _priv_gst_quarks_initialize ();
   _priv_gst_memory_initialize ();
   _priv_gst_format_initialize ();
@@ -780,8 +743,6 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
 
   _priv_gst_plugin_initialize ();
 
-  gst_g_error_get_type ();
-
   /* register core plugins */
   gst_plugin_register_static (GST_VERSION_MAJOR, GST_VERSION_MINOR,
       "staticelements", "core elements linked into the GStreamer library",
@@ -802,14 +763,6 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
   if (!gst_update_registry ())
     return FALSE;
 
-#ifndef GST_DISABLE_TRACE
-  _gst_trace_on = 0;
-  if (_gst_trace_on) {
-    gst_trace = gst_trace_new ("gst.trace", 1024);
-    gst_trace_set_default (gst_trace);
-  }
-#endif /* GST_DISABLE_TRACE */
-
   GST_INFO ("GLib runtime version: %d.%d.%d", glib_major_version,
       glib_minor_version, glib_micro_version);
   GST_INFO ("GLib headers version: %d.%d.%d", GLIB_MAJOR_VERSION,
@@ -842,7 +795,7 @@ gst_debug_help (void)
   if (!init_post (NULL, NULL, NULL, NULL))
     exit (1);
 
-  list2 = gst_registry_plugin_filter (gst_registry_get_default (),
+  list2 = gst_registry_plugin_filter (gst_registry_get (),
       select_all, FALSE, NULL);
 
   /* FIXME this is gross.  why don't debug have categories PluginFeatures? */
@@ -1052,6 +1005,8 @@ gst_deinit (void)
 
   _priv_gst_registry_cleanup ();
 
+  _priv_gst_alloc_trace_deinit ();
+
   g_type_class_unref (g_type_class_peek (gst_object_get_type ()));
   g_type_class_unref (g_type_class_peek (gst_pad_get_type ()));
   g_type_class_unref (g_type_class_peek (gst_element_factory_get_type ()));