docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
[platform/upstream/gstreamer.git] / gst / gstregistry.c
index c03a1ef..2838737 100644 (file)
  *   <listitem>
  *     <para>default locations (if GST_PLUGIN_SYSTEM_PATH is not set). Those
  *       default locations are:
- *       <filename>~/.gstreamer-$GST_API_VERSION/plugins/</filename>
+ *       <filename>$XDG_DATA_HOME/gstreamer-$GST_API_VERSION/plugins/</filename>
  *       and <filename>$prefix/libs/gstreamer-$GST_API_VERSION/</filename>.
+ *       <ulink url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">
+ *       <filename>$XDG_DATA_HOME</filename></ulink> defaults to
+ *       <filename>$HOME/.local/share</filename>.
  *     </para>
  *   </listitem>
  * </itemizedlist>
  * The registry cache file is loaded from
- * <filename>~/.gstreamer-$GST_API_VERSION/registry-$ARCH.bin</filename> or the
- * file listed in the GST_REGISTRY env var. One reason to change the registry
- * location is for testing.
+ * <filename>$XDG_CACHE_HOME/gstreamer-$GST_API_VERSION/registry-$ARCH.bin</filename>
+ * (where
+ * <ulink url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">
+ * <filename>$XDG_CACHE_HOME</filename></ulink> defaults to
+ * <filename>$HOME/.cache</filename>) or the file listed in the GST_REGISTRY
+ * env var. One reason to change the registry location is for testing.
  *
  * For each plugin that is found in the plugin search path, there could be 3
  * possibilities for cached information:
  * stored in the default registry, and plugins not relevant to the current
  * process are marked with the %GST_PLUGIN_FLAG_CACHED bit. These plugins are
  * removed at the end of initialization.
- *
- * Last reviewed on 2012-03-29 (0.11.3)
  */
 
 #ifdef HAVE_CONFIG_H
 #include "gstinfo.h"
 #include "gsterror.h"
 #include "gstregistry.h"
+#include "gstdevicemonitorfactory.h"
 
 #include "gstpluginloader.h"
 
@@ -161,6 +166,8 @@ struct _GstRegistryPrivate
   guint32 efl_cookie;
   GList *typefind_factory_list;
   guint32 tfl_cookie;
+  GList *device_monitor_factory_list;
+  guint32 dmfl_cookie;
 };
 
 /* the one instance of the default registry and the mutex protecting the
@@ -310,6 +317,12 @@ gst_registry_finalize (GObject * object)
     gst_plugin_feature_list_free (registry->priv->typefind_factory_list);
   }
 
+  if (registry->priv->device_monitor_factory_list) {
+    GST_DEBUG_OBJECT (registry,
+        "Cleaning up cached device monitor factory list");
+    gst_plugin_feature_list_free (registry->priv->device_monitor_factory_list);
+  }
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -417,7 +430,7 @@ gst_registry_get_path_list (GstRegistry * registry)
  * Add the plugin to the registry. The plugin-added signal will be emitted.
  * This function will sink @plugin.
  *
- * Returns: TRUE on success.
+ * Returns: %TRUE on success.
  *
  * MT safe.
  */
@@ -543,7 +556,7 @@ gst_registry_remove_plugin (GstRegistry * registry, GstPlugin * plugin)
  * Add the feature to the registry. The feature-added signal will be emitted.
  * This function sinks @feature.
  *
- * Returns: TRUE on success.
+ * Returns: %TRUE on success.
  *
  * MT safe.
  */
@@ -774,6 +787,28 @@ gst_registry_get_typefind_factory_list (GstRegistry * registry)
   return list;
 }
 
+
+static GList *
+gst_registry_get_device_monitor_factory_list (GstRegistry * registry)
+{
+  GList *list;
+
+  GST_OBJECT_LOCK (registry);
+
+  gst_registry_get_feature_list_or_create (registry,
+      &registry->priv->device_monitor_factory_list,
+      &registry->priv->dmfl_cookie, GST_TYPE_DEVICE_MONITOR_FACTORY);
+
+  /* Return reffed copy */
+  list =
+      gst_plugin_feature_list_copy (registry->
+      priv->device_monitor_factory_list);
+
+  GST_OBJECT_UNLOCK (registry);
+
+  return list;
+}
+
 /**
  * gst_registry_feature_filter:
  * @registry: registry to query
@@ -833,7 +868,7 @@ gst_registry_plugin_name_filter (GstPlugin * plugin, const gchar * name)
  * Find the plugin with the given name in the registry.
  * The plugin will be reffed; caller is responsible for unreffing.
  *
- * Returns: (transfer full): the plugin with the given name or NULL if the
+ * Returns: (transfer full): the plugin with the given name or %NULL if the
  *     plugin was not found. gst_object_unref() after usage.
  *
  * MT safe.
@@ -868,7 +903,7 @@ gst_registry_find_plugin (GstRegistry * registry, const gchar * name)
  * Find the pluginfeature with the given name and type in the registry.
  *
  * Returns: (transfer full): the pluginfeature with the given name and type
- *     or NULL if the plugin was not found. gst_object_unref() after usage.
+ *     or %NULL if the plugin was not found. gst_object_unref() after usage.
  *
  * MT safe.
  */
@@ -916,6 +951,8 @@ gst_registry_get_feature_list (GstRegistry * registry, GType type)
     return gst_registry_get_element_factory_list (registry);
   else if (type == GST_TYPE_TYPE_FIND_FACTORY)
     return gst_registry_get_typefind_factory_list (registry);
+  else if (type == GST_TYPE_DEVICE_MONITOR_FACTORY)
+    return gst_registry_get_device_monitor_factory_list (registry);
 
   data.type = type;
   data.name = NULL;
@@ -1018,7 +1055,7 @@ gst_registry_lookup_bn (GstRegistry * registry, const char *basename)
  * Look up a plugin in the given registry with the given filename.
  * If found, plugin is reffed.
  *
- * Returns: (transfer full): the #GstPlugin if found, or NULL if not.
+ * Returns: (transfer full): the #GstPlugin if found, or %NULL if not.
  *     gst_object_unref() after usage.
  */
 GstPlugin *
@@ -1415,8 +1452,8 @@ _priv_gst_registry_cleanup (void)
  * @registry and whether its version is at least the
  * version required.
  *
- * Returns: #TRUE if the feature could be found and the version is
- * the same as the required version or newer, and #FALSE otherwise.
+ * Returns: %TRUE if the feature could be found and the version is
+ * the same as the required version or newer, and %FALSE otherwise.
  */
 gboolean
 gst_registry_check_feature_version (GstRegistry * registry,
@@ -1471,7 +1508,7 @@ load_plugin_func (gpointer data, gpointer user_data)
 
 #ifndef GST_DISABLE_REGISTRY
 /* Unref all plugins marked 'cached', to clear old plugins that no
- * longer exist. Returns TRUE if any plugins were removed */
+ * longer exist. Returns %TRUE if any plugins were removed */
 static gboolean
 gst_registry_remove_cache_plugins (GstRegistry * registry)
 {
@@ -1593,8 +1630,6 @@ scan_and_update_registry (GstRegistry * default_registry,
     g_free (home_plugins);
 
     /* add the main (installed) library path */
-    GST_DEBUG ("scanning main plugins %s", PLUGINDIR);
-    changed |= gst_registry_scan_path_internal (&context, PLUGINDIR);
 
 #ifdef G_OS_WIN32
     {
@@ -1605,9 +1640,11 @@ scan_and_update_registry (GstRegistry * default_registry,
           g_win32_get_package_installation_directory_of_module
           (_priv_gst_dll_handle);
 
-      dir =
-          g_build_filename (base_dir, "lib", "gstreamer-" GST_API_VERSION,
-          NULL);
+      dir = g_build_filename (base_dir,
+#ifdef _DEBUG
+          "debug"
+#endif
+          "lib", "gstreamer-" GST_API_VERSION, NULL);
       GST_DEBUG ("scanning DLL dir %s", dir);
 
       changed |= gst_registry_scan_path_internal (&context, dir);
@@ -1615,6 +1652,9 @@ scan_and_update_registry (GstRegistry * default_registry,
       g_free (dir);
       g_free (base_dir);
     }
+#else
+    GST_DEBUG ("scanning main plugins %s", PLUGINDIR);
+    changed |= gst_registry_scan_path_internal (&context, PLUGINDIR);
 #endif
   } else {
     gchar **list;
@@ -1807,7 +1847,7 @@ gst_update_registry (void)
  * gst_registry_get_feature_list_cookie:
  * @registry: the registry
  *
- * Returns the registrys feature list cookie. This changes
+ * Returns the registry's feature list cookie. This changes
  * every time a feature is added or removed from the registry.
  *
  * Returns: the feature list cookie.