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;
unsigned int flags;
gchar * filename;
gchar * basename; /* base name (non-dir part) of plugin path */

View 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;
/**

View 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);

View 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);

View 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 ||

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);
/* 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);

View 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;
}