plugin: use GstObject flags for plugin flags
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Sun, 29 Apr 2012 16:46:32 +0000 (17:46 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Sun, 29 Apr 2012 16:46:32 +0000 (17:46 +0100)
gst/gst_private.h
gst/gstplugin.h
gst/gstpluginloader.c
gst/gstregistry.c
gst/gstregistrybinary.c
gst/gstregistrychunks.c
tools/gst-inspect.c

index 642a185..d62bed7 100644 (file)
@@ -274,8 +274,6 @@ struct _GstPlugin {
 
   GstPluginDesc *orig_desc;
 
-  unsigned int  flags;
-
   gchar *      filename;
   gchar *      basename;       /* base name (non-dir part) of plugin path */
 
index 275ccfe..90d4836 100644 (file)
@@ -80,8 +80,8 @@ typedef enum
  */
 typedef enum
 {
-  GST_PLUGIN_FLAG_CACHED = (1<<0),
-  GST_PLUGIN_FLAG_BLACKLISTED = (1<<1)
+  GST_PLUGIN_FLAG_CACHED      = (GST_OBJECT_FLAG_LAST << 0),
+  GST_PLUGIN_FLAG_BLACKLISTED = (GST_OBJECT_FLAG_LAST << 1)
 } GstPluginFlags;
 
 /**
index 4539421..a51fa89 100644 (file)
@@ -339,7 +339,7 @@ plugin_loader_create_blacklist_plugin (GstPluginLoader * l,
   plugin->filename = g_strdup (entry->filename);
   plugin->file_mtime = entry->file_mtime;
   plugin->file_size = entry->file_size;
-  plugin->flags |= GST_PLUGIN_FLAG_BLACKLISTED;
+  GST_OBJECT_FLAG_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED);
 
   plugin->basename = g_path_get_basename (plugin->filename);
   plugin->desc.name = g_intern_string (plugin->basename);
@@ -849,7 +849,7 @@ handle_rx_packet (GstPluginLoader * l,
           return FALSE;
         }
 
-        newplugin->flags &= ~GST_PLUGIN_FLAG_CACHED;
+        GST_OBJECT_FLAG_UNSET (newplugin, GST_PLUGIN_FLAG_CACHED);
         GST_LOG_OBJECT (l->registry,
             "marking plugin %p as registered as %s", newplugin,
             newplugin->filename);
index 21cebbf..5e4d7bc 100644 (file)
@@ -438,7 +438,7 @@ gst_registry_add_plugin (GstRegistry * registry, GstPlugin * plugin)
           GST_STR_NULL (plugin->filename));
       /* If the new plugin is blacklisted and the existing one isn't cached, do not
        * accept if it's from a different location than the existing one */
-      if ((plugin->flags & GST_PLUGIN_FLAG_BLACKLISTED) &&
+      if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED) &&
           strcmp (plugin->filename, existing_plugin->filename)) {
         GST_WARNING_OBJECT (registry,
             "Not replacing plugin because new one (%s) is blacklisted but for a different location than existing one (%s)",
@@ -1272,7 +1272,7 @@ gst_registry_scan_path_level (GstRegistryScanContext * context,
           !(deps_changed = _priv_plugin_deps_files_changed (plugin)) &&
           !strcmp (plugin->filename, filename)) {
         GST_LOG_OBJECT (context->registry, "file %s cached", filename);
-        plugin->flags &= ~GST_PLUGIN_FLAG_CACHED;
+        GST_OBJECT_FLAG_UNSET (plugin, GST_PLUGIN_FLAG_CACHED);
         GST_LOG_OBJECT (context->registry,
             "marking plugin %p as registered as %s", plugin, filename);
         plugin->registered = TRUE;
@@ -1481,7 +1481,7 @@ gst_registry_remove_cache_plugins (GstRegistry * registry)
   while (g) {
     g_next = g->next;
     plugin = g->data;
-    if (plugin->flags & GST_PLUGIN_FLAG_CACHED) {
+    if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_CACHED)) {
       GST_DEBUG_OBJECT (registry, "removing cached plugin \"%s\"",
           GST_STR_NULL (plugin->filename));
       registry->priv->plugins = g_list_delete_link (registry->priv->plugins, g);
@@ -1593,7 +1593,9 @@ 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, "lib", "gstreamer-" GST_API_VERSION,
+          NULL);
       GST_DEBUG ("scanning DLL dir %s", dir);
 
       changed |= gst_registry_scan_path_internal (&context, dir);
index c358f31..fe1710a 100644 (file)
@@ -378,7 +378,7 @@ priv_gst_registry_binary_write_cache (GstRegistry * registry, GList * plugins,
     if (!plugin->filename)
       continue;
 
-    if (plugin->flags & GST_PLUGIN_FLAG_CACHED) {
+    if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_CACHED)) {
       GStatBuf statbuf;
 
       if (g_stat (plugin->filename, &statbuf) < 0 ||
index 0c58dab..683738d 100644 (file)
@@ -768,7 +768,7 @@ _priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in,
   plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
 
   /* TODO: also set GST_PLUGIN_FLAG_CONST */
-  plugin->flags |= GST_PLUGIN_FLAG_CACHED;
+  GST_OBJECT_FLAG_SET (plugin, GST_PLUGIN_FLAG_CACHED);
   plugin->file_mtime = pe->file_mtime;
   plugin->file_size = pe->file_size;
 
@@ -804,7 +804,7 @@ _priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in,
   /* If the license string is 'BLACKLIST', mark this as a blacklisted
    * plugin */
   if (strcmp (plugin->desc.license, "BLACKLIST") == 0)
-    plugin->flags |= GST_PLUGIN_FLAG_BLACKLISTED;
+    GST_OBJECT_FLAG_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED);
 
   plugin->basename = g_path_get_basename (plugin->filename);
 
index b461656..b59bcb0 100644 (file)
@@ -35,9 +35,6 @@
 #include <locale.h>
 #include <glib/gprintf.h>
 
-/* FIXME: shouldn't have to access private API */
-#include "gst/gst_private.h"
-
 static char *_name = NULL;
 
 static int print_element_info (GstElementFactory * factory,
@@ -963,7 +960,7 @@ print_blacklist (void)
   plugins = gst_registry_get_plugin_list (gst_registry_get ());
   for (cur = plugins; cur != NULL; cur = g_list_next (cur)) {
     GstPlugin *plugin = (GstPlugin *) (cur->data);
-    if (plugin->flags & GST_PLUGIN_FLAG_BLACKLISTED) {
+    if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED)) {
       g_print ("  %s\n", gst_plugin_get_name (plugin));
       count++;
     }
@@ -992,7 +989,7 @@ print_element_list (gboolean print_all)
     plugins = g_list_next (plugins);
     plugincount++;
 
-    if (plugin->flags & GST_PLUGIN_FLAG_BLACKLISTED) {
+    if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED)) {
       blacklistcount++;
       continue;
     }