2 * Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
3 * 2012 Stefan Sauer <ensonic@users.sf.net>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
27 GST_DEBUG_CATEGORY (libvisual_debug);
28 #define GST_CAT_DEFAULT (libvisual_debug)
31 libvisual_log_handler (const char *message, const char *funcname, void *priv)
33 GST_CAT_LEVEL_LOG (libvisual_debug, (GstDebugLevel) (priv), NULL, "%s - %s",
38 * Replace invalid chars with _ in the type name
41 make_valid_name (gchar * name)
43 static const gchar extra_chars[] = "-_+";
47 gint valid = ((p[0] >= 'A' && p[0] <= 'Z') ||
48 (p[0] >= 'a' && p[0] <= 'z') ||
49 (p[0] >= '0' && p[0] <= '9') || strchr (extra_chars, p[0]));
56 gst_visual_actor_plugin_is_gl (VisObject * plugin, const gchar * name)
61 depth = VISUAL_ACTOR_PLUGIN (plugin)->vidoptions.depth;
62 /* FIXME: how to figure this out correctly in 0.4? */
63 is_gl = (depth & VISUAL_VIDEO_DEPTH_GL) == VISUAL_VIDEO_DEPTH_GL;
66 GST_DEBUG ("plugin %s is not a GL plugin (%d), registering", name, depth);
68 GST_DEBUG ("plugin %s is a GL plugin (%d), ignoring", name, depth);
75 plugin_init (GstPlugin * plugin)
80 GST_DEBUG_CATEGORY_INIT (libvisual_debug, "libvisual", 0,
81 "libvisual audio visualisations");
83 #ifdef LIBVISUAL_PLUGINSBASEDIR
84 gst_plugin_add_dependency_simple (plugin, "HOME/.libvisual/actor",
85 LIBVISUAL_PLUGINSBASEDIR "/actor", NULL, GST_PLUGIN_DEPENDENCY_FLAG_NONE);
88 visual_log_set_verboseness (VISUAL_LOG_VERBOSENESS_LOW);
89 visual_log_set_info_handler (libvisual_log_handler, (void *) GST_LEVEL_INFO);
90 visual_log_set_warning_handler (libvisual_log_handler,
91 (void *) GST_LEVEL_WARNING);
92 visual_log_set_critical_handler (libvisual_log_handler,
93 (void *) GST_LEVEL_ERROR);
94 visual_log_set_error_handler (libvisual_log_handler,
95 (void *) GST_LEVEL_ERROR);
97 if (!visual_is_initialized ())
98 if (visual_init (NULL, NULL) != 0)
101 list = visual_actor_get_list ();
103 count = visual_collection_size (VISUAL_COLLECTION (list));
105 for (i = 0; i < count; i++) {
106 VisPluginRef *ref = visual_list_get (list, i);
107 VisPluginData *visplugin = NULL;
108 gboolean skip = FALSE;
112 sizeof (GstVisualClass),
115 gst_visual_class_init,
123 visplugin = visual_plugin_load (ref);
125 if (ref->info->plugname == NULL)
128 /* Blacklist some plugins */
129 if (strcmp (ref->info->plugname, "gstreamer") == 0 ||
130 strcmp (ref->info->plugname, "gdkpixbuf") == 0) {
133 /* Ignore plugins that only support GL output for now */
134 skip = gst_visual_actor_plugin_is_gl (visplugin->info->plugin,
135 visplugin->info->plugname);
138 visual_plugin_unload (visplugin);
141 name = g_strdup_printf ("GstVisual%s", ref->info->plugname);
142 make_valid_name (name);
143 type = g_type_register_static (GST_TYPE_VISUAL, name, &info, 0);
146 name = g_strdup_printf ("libvisual_%s", ref->info->plugname);
147 make_valid_name (name);
148 if (!gst_element_register (plugin, name, GST_RANK_NONE, type)) {
159 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
162 "libvisual visualization plugins",
163 plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)