plugin: use GstObject flags for plugin flags

This commit is contained in:
Tim-Philipp Müller 2012-04-29 17:46:32 +01:00
parent 19d4c0ba73
commit c7eca5ca15
7 changed files with 15 additions and 18 deletions

View file

@ -274,8 +274,6 @@ struct _GstPlugin {
GstPluginDesc *orig_desc; GstPluginDesc *orig_desc;
unsigned int flags;
gchar * filename; gchar * filename;
gchar * basename; /* base name (non-dir part) of plugin path */ gchar * basename; /* base name (non-dir part) of plugin path */

View file

@ -80,8 +80,8 @@ typedef enum
*/ */
typedef enum typedef enum
{ {
GST_PLUGIN_FLAG_CACHED = (1<<0), GST_PLUGIN_FLAG_CACHED = (GST_OBJECT_FLAG_LAST << 0),
GST_PLUGIN_FLAG_BLACKLISTED = (1<<1) GST_PLUGIN_FLAG_BLACKLISTED = (GST_OBJECT_FLAG_LAST << 1)
} GstPluginFlags; } GstPluginFlags;
/** /**

View file

@ -339,7 +339,7 @@ plugin_loader_create_blacklist_plugin (GstPluginLoader * l,
plugin->filename = g_strdup (entry->filename); plugin->filename = g_strdup (entry->filename);
plugin->file_mtime = entry->file_mtime; plugin->file_mtime = entry->file_mtime;
plugin->file_size = entry->file_size; 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->basename = g_path_get_basename (plugin->filename);
plugin->desc.name = g_intern_string (plugin->basename); plugin->desc.name = g_intern_string (plugin->basename);
@ -849,7 +849,7 @@ handle_rx_packet (GstPluginLoader * l,
return FALSE; return FALSE;
} }
newplugin->flags &= ~GST_PLUGIN_FLAG_CACHED; GST_OBJECT_FLAG_UNSET (newplugin, GST_PLUGIN_FLAG_CACHED);
GST_LOG_OBJECT (l->registry, GST_LOG_OBJECT (l->registry,
"marking plugin %p as registered as %s", newplugin, "marking plugin %p as registered as %s", newplugin,
newplugin->filename); newplugin->filename);

View file

@ -438,7 +438,7 @@ gst_registry_add_plugin (GstRegistry * registry, GstPlugin * plugin)
GST_STR_NULL (plugin->filename)); GST_STR_NULL (plugin->filename));
/* If the new plugin is blacklisted and the existing one isn't cached, do not /* 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 */ * 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)) { strcmp (plugin->filename, existing_plugin->filename)) {
GST_WARNING_OBJECT (registry, GST_WARNING_OBJECT (registry,
"Not replacing plugin because new one (%s) is blacklisted but for a different location than existing one (%s)", "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)) && !(deps_changed = _priv_plugin_deps_files_changed (plugin)) &&
!strcmp (plugin->filename, filename)) { !strcmp (plugin->filename, filename)) {
GST_LOG_OBJECT (context->registry, "file %s cached", 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, GST_LOG_OBJECT (context->registry,
"marking plugin %p as registered as %s", plugin, filename); "marking plugin %p as registered as %s", plugin, filename);
plugin->registered = TRUE; plugin->registered = TRUE;
@ -1481,7 +1481,7 @@ gst_registry_remove_cache_plugins (GstRegistry * registry)
while (g) { while (g) {
g_next = g->next; g_next = g->next;
plugin = g->data; 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_DEBUG_OBJECT (registry, "removing cached plugin \"%s\"",
GST_STR_NULL (plugin->filename)); GST_STR_NULL (plugin->filename));
registry->priv->plugins = g_list_delete_link (registry->priv->plugins, g); 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 g_win32_get_package_installation_directory_of_module
(_priv_gst_dll_handle); (_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); GST_DEBUG ("scanning DLL dir %s", dir);
changed |= gst_registry_scan_path_internal (&context, dir); changed |= gst_registry_scan_path_internal (&context, dir);

View file

@ -378,7 +378,7 @@ priv_gst_registry_binary_write_cache (GstRegistry * registry, GList * plugins,
if (!plugin->filename) if (!plugin->filename)
continue; continue;
if (plugin->flags & GST_PLUGIN_FLAG_CACHED) { if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_CACHED)) {
GStatBuf statbuf; GStatBuf statbuf;
if (g_stat (plugin->filename, &statbuf) < 0 || if (g_stat (plugin->filename, &statbuf) < 0 ||

View file

@ -768,7 +768,7 @@ _priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in,
plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL); plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL);
/* TODO: also set GST_PLUGIN_FLAG_CONST */ /* 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_mtime = pe->file_mtime;
plugin->file_size = pe->file_size; 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 /* If the license string is 'BLACKLIST', mark this as a blacklisted
* plugin */ * plugin */
if (strcmp (plugin->desc.license, "BLACKLIST") == 0) 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); plugin->basename = g_path_get_basename (plugin->filename);

View file

@ -35,9 +35,6 @@
#include <locale.h> #include <locale.h>
#include <glib/gprintf.h> #include <glib/gprintf.h>
/* FIXME: shouldn't have to access private API */
#include "gst/gst_private.h"
static char *_name = NULL; static char *_name = NULL;
static int print_element_info (GstElementFactory * factory, static int print_element_info (GstElementFactory * factory,
@ -963,7 +960,7 @@ print_blacklist (void)
plugins = gst_registry_get_plugin_list (gst_registry_get ()); plugins = gst_registry_get_plugin_list (gst_registry_get ());
for (cur = plugins; cur != NULL; cur = g_list_next (cur)) { for (cur = plugins; cur != NULL; cur = g_list_next (cur)) {
GstPlugin *plugin = (GstPlugin *) (cur->data); 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)); g_print (" %s\n", gst_plugin_get_name (plugin));
count++; count++;
} }
@ -992,7 +989,7 @@ print_element_list (gboolean print_all)
plugins = g_list_next (plugins); plugins = g_list_next (plugins);
plugincount++; plugincount++;
if (plugin->flags & GST_PLUGIN_FLAG_BLACKLISTED) { if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED)) {
blacklistcount++; blacklistcount++;
continue; continue;
} }