docs: include tracers in the documentation

Requires exposing the tracer GType from the GstTracerFactory in order
to link the plugin with the tracer in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=791253
diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt
index 3c5e641..1f65c31 100644
--- a/docs/gst/gstreamer-sections.txt
+++ b/docs/gst/gstreamer-sections.txt
@@ -3354,6 +3354,7 @@
 <TITLE>GstTracerFactory</TITLE>
 GstTracerFactory
 gst_tracer_factory_get_list
+gst_tracer_factory_get_tracer_type
 <SUBSECTION Standard>
 GstTracerFactoryClass
 GST_TRACER_FACTORY
diff --git a/docs/plugins/Makefile.am b/docs/plugins/Makefile.am
index 88cd4b0..8f41089 100644
--- a/docs/plugins/Makefile.am
+++ b/docs/plugins/Makefile.am
@@ -23,7 +23,7 @@
 # The directory containing the source code.
 # gtk-doc will search all .c & .h files beneath here for inline comments
 # documenting functions and macros.
-DOC_SOURCE_DIR = $(top_srcdir)/plugins/elements
+DOC_SOURCE_DIR = $(top_srcdir)/plugins/elements $(top_srcdir)/plugins/tracers
 
 # Extra options to supply to gtkdoc-scan.
 SCAN_OPTIONS=
@@ -38,8 +38,8 @@
 	--extra-dir=$(datadir)/gtk-doc/html
 
 # Used for dependencies.
-HFILE_GLOB=$(top_srcdir)/plugins/elements/*.h
-CFILE_GLOB=$(top_srcdir)/plugins/elements/*.c
+HFILE_GLOB=$(top_srcdir)/plugins/elements/*.h $(top_srcdir)/plugins/tracers/*.h
+CFILE_GLOB=$(top_srcdir)/plugins/elements/*.c $(top_srcdir)/plugins/tracers/*.c
 
 # Header files to ignore when scanning.
 IGNORE_HFILES =
diff --git a/docs/plugins/gstreamer-plugins-docs.sgml b/docs/plugins/gstreamer-plugins-docs.sgml
index 686115c..6d823c9 100644
--- a/docs/plugins/gstreamer-plugins-docs.sgml
+++ b/docs/plugins/gstreamer-plugins-docs.sgml
@@ -41,8 +41,18 @@
   </chapter>
 
   <chapter>
+    <title>gstreamer Tracers</title>
+    <xi:include href="xml/element-latencytracer.xml" />
+    <xi:include href="xml/element-leakstracer.xml" />
+    <xi:include href="xml/element-logtracer.xml" />
+    <xi:include href="xml/element-rusagetracer.xml" />
+    <xi:include href="xml/element-statstracer.xml" />
+  </chapter>
+
+  <chapter>
     <title>gstreamer Plugins</title>
     <xi:include href="xml/plugin-coreelements.xml" />
+    <xi:include href="xml/plugin-coretracers.xml" />
   </chapter>
 </book>
 
diff --git a/docs/plugins/gstreamer-plugins-sections.txt b/docs/plugins/gstreamer-plugins-sections.txt
index e73a329..89d4906 100644
--- a/docs/plugins/gstreamer-plugins-sections.txt
+++ b/docs/plugins/gstreamer-plugins-sections.txt
@@ -218,6 +218,54 @@
 </SECTION>
 
 <SECTION>
+<FILE>element-latencytracer</FILE>
+<TITLE>latencytracer</TITLE>
+GstLatencyTracer
+<SUBSECTION Standard>
+GstLatencyTracerClass
+GST_LATENCY_TRACER
+GST_LATENCY_TRACER_CAST
+GST_IS_LATENCY_TRACER
+GST_LATENCY_TRACER_CLASS
+GST_IS_LATENCY_TRACER_CLASS
+GST_TYPE_LATENCY_TRACER
+<SUBSECTION Private>
+gst_latency_tracer_get_type
+</SECTION>
+
+<SECTION>
+<FILE>element-leakstracer</FILE>
+<TITLE>leakstracer</TITLE>
+GstLeaksTracer
+<SUBSECTION Standard>
+GstLeaksTracerClass
+GST_LEAKS_TRACER
+GST_LEAKS_TRACER_CAST
+GST_IS_LEAKS_TRACER
+GST_LEAKS_TRACER_CLASS
+GST_IS_LEAKS_TRACER_CLASS
+GST_TYPE_LEAKS_TRACER
+<SUBSECTION Private>
+gst_leaks_tracer_get_type
+</SECTION>
+
+<SECTION>
+<FILE>element-logtracer</FILE>
+<TITLE>logtracer</TITLE>
+GstLogTracer
+<SUBSECTION Standard>
+GstLogTracerClass
+GST_LOG_TRACER
+GST_LOG_TRACER_CAST
+GST_IS_LOG_TRACER
+GST_LOG_TRACER_CLASS
+GST_IS_LOG_TRACER_CLASS
+GST_TYPE_LOG_TRACER
+<SUBSECTION Private>
+gst_log_tracer_get_type
+</SECTION>
+
+<SECTION>
 <FILE>element-multiqueue</FILE>
 <TITLE>multiqueue</TITLE>
 GstMultiQueue
@@ -286,6 +334,38 @@
 </SECTION>
 
 <SECTION>
+<FILE>element-rusagetracer</FILE>
+<TITLE>rusagetracer</TITLE>
+GstRUsageTracer
+<SUBSECTION Standard>
+GstRUsageTracerClass
+GST_RUSAGE_TRACER
+GST_RUSAGE_TRACER_CAST
+GST_IS_RUSAGE_TRACER
+GST_RUSAGE_TRACER_CLASS
+GST_IS_RUSAGE_TRACER_CLASS
+GST_TYPE_RUSAGE_TRACER
+<SUBSECTION Private>
+gst_rusage_tracer_get_type
+</SECTION>
+
+<SECTION>
+<FILE>element-statstracer</FILE>
+<TITLE>statstracer</TITLE>
+GstStatsTracer
+<SUBSECTION Standard>
+GstStatsTracerClass
+GST_STATS_TRACER
+GST_STATS_TRACER_CAST
+GST_IS_STATS_TRACER
+GST_STATS_TRACER_CLASS
+GST_IS_STATS_TRACER_CLASS
+GST_TYPE_STATS_TRACER
+<SUBSECTION Private>
+gst_stats_tracer_get_type
+</SECTION>
+
+<SECTION>
 <FILE>element-streamiddemux</FILE>
 <TITLE>streamiddemux</TITLE>
 GstStreamidDemux
diff --git a/docs/plugins/inspect/plugin-coretracers.xml b/docs/plugins/inspect/plugin-coretracers.xml
new file mode 100644
index 0000000..979d323
--- /dev/null
+++ b/docs/plugins/inspect/plugin-coretracers.xml
@@ -0,0 +1,28 @@
+<plugin>
+  <name>coretracers</name>
+  <description>GStreamer core tracers</description>
+  <filename>../../plugins/tracers/.libs/libgstcoretracers.so</filename>
+  <basename>libgstcoretracers.so</basename>
+  <version>1.13.0.1</version>
+  <license>LGPL</license>
+  <source>gstreamer</source>
+  <package>GStreamer git</package>
+  <origin>Unknown package origin</origin>
+  <elements>
+    <tracer>
+      <name>latency</name>
+    </tracer>
+    <tracer>
+      <name>leaks</name>
+    </tracer>
+    <tracer>
+      <name>log</name>
+    </tracer>
+    <tracer>
+      <name>rusage</name>
+    </tracer>
+    <tracer>
+      <name>stats</name>
+    </tracer>
+  </elements>
+</plugin>
\ No newline at end of file
diff --git a/gst/gsttracerfactory.c b/gst/gsttracerfactory.c
index 3e0100c..32c4c74 100644
--- a/gst/gsttracerfactory.c
+++ b/gst/gsttracerfactory.c
@@ -77,3 +77,22 @@
   return gst_registry_get_feature_list (gst_registry_get (),
       GST_TYPE_TRACER_FACTORY);
 }
+
+/**
+ * gst_tracer_factory_get_tracer_type:
+ * @factory: factory to get managed #GType from
+ *
+ * Get the #GType for elements managed by this factory. The type can
+ * only be retrieved if the element factory is loaded, which can be
+ * assured with gst_plugin_feature_load().
+ *
+ * Returns: the #GType for tracers managed by this factory or 0 if
+ * the factory is not loaded.
+ */
+GType
+gst_tracer_factory_get_tracer_type (GstTracerFactory * factory)
+{
+  g_return_val_if_fail (GST_IS_TRACER_FACTORY (factory), 0);
+
+  return factory->type;
+}
diff --git a/gst/gsttracerfactory.h b/gst/gsttracerfactory.h
index a08f22f..92ea889 100644
--- a/gst/gsttracerfactory.h
+++ b/gst/gsttracerfactory.h
@@ -54,6 +54,8 @@
 GST_EXPORT
 GList *         gst_tracer_factory_get_list          (void);
 
+GST_EXPORT
+GType           gst_tracer_factory_get_tracer_type   (GstTracerFactory * factory);
 
 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstTracerFactory, gst_object_unref)
diff --git a/plugins/tracers/gstlatency.c b/plugins/tracers/gstlatency.c
index a32b517..f94193a 100644
--- a/plugins/tracers/gstlatency.c
+++ b/plugins/tracers/gstlatency.c
@@ -19,7 +19,7 @@
  * Boston, MA 02110-1301, USA.
  */
 /**
- * SECTION:gstlatency
+ * SECTION:element-latencytracer
  * @short_description: log processing latency stats
  *
  * A tracing module that determines src-to-sink latencies by injecting custom
diff --git a/plugins/tracers/gstleaks.c b/plugins/tracers/gstleaks.c
index 8e2ed92..f95b7c7 100644
--- a/plugins/tracers/gstleaks.c
+++ b/plugins/tracers/gstleaks.c
@@ -19,7 +19,7 @@
  * Boston, MA 02110-1301, USA.
  */
 /**
- * SECTION:gstleaks
+ * SECTION:element-leakstracer
  * @short_description: detect GstObject and GstMiniObject leaks
  *
  * A tracing module tracking the lifetime of objects by logging those still
diff --git a/plugins/tracers/gstlog.c b/plugins/tracers/gstlog.c
index d55b21b..cc7471a 100644
--- a/plugins/tracers/gstlog.c
+++ b/plugins/tracers/gstlog.c
@@ -19,7 +19,7 @@
  * Boston, MA 02110-1301, USA.
  */
 /**
- * SECTION:gstlog
+ * SECTION:element-logtracer
  * @short_description: log hook event
  *
  * A tracing module that logs all data from all hooks.
diff --git a/plugins/tracers/gstrusage.c b/plugins/tracers/gstrusage.c
index 9512831..9086f1e 100644
--- a/plugins/tracers/gstrusage.c
+++ b/plugins/tracers/gstrusage.c
@@ -19,7 +19,7 @@
  * Boston, MA 02110-1301, USA.
  */
 /**
- * SECTION:gstrusage
+ * SECTION:element-rusagetracer
  * @short_description: log resource usage stats
  *
  * A tracing module that take rusage() snapshots and logs them.
diff --git a/plugins/tracers/gststats.c b/plugins/tracers/gststats.c
index 1a8f892..7ca1eca 100644
--- a/plugins/tracers/gststats.c
+++ b/plugins/tracers/gststats.c
@@ -19,7 +19,7 @@
  * Boston, MA 02110-1301, USA.
  */
 /**
- * SECTION:gststats
+ * SECTION:element-statstracer
  * @short_description: log event stats
  *
  * A tracing module that builds usage statistic for elements and pads.