2004-12-15 07:30:55 +00:00
|
|
|
<chapter id="chapter-plugins">
|
|
|
|
<title>Plugins</title>
|
|
|
|
<!-- FIXME: introduce type definitions before this chapter -->
|
|
|
|
<para>
|
|
|
|
A plugin is a shared library that contains at least one of the following
|
|
|
|
items:
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
one or more element factories
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
one or more type definitions
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
one or more auto-pluggers
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
exported symbols for use in other plugins
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
2004-12-15 17:32:49 +00:00
|
|
|
|
|
|
|
<para>
|
|
|
|
All plugins should implement one function, <function>plugin_init</function>,
|
|
|
|
that creates all the element factories and registers all the type
|
|
|
|
definitions contained in the plugin.
|
|
|
|
Without this function, a plugin cannot be registered.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The plugins are maintained in the plugin system. Optionally, the
|
|
|
|
type definitions and the element factories can be saved into an XML
|
|
|
|
representation so that the plugin system does not have to load all
|
|
|
|
available plugins in order to know their definition.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The basic plugin structure has the following fields:
|
|
|
|
</para>
|
|
|
|
<programlisting>
|
|
|
|
typedef struct _GstPlugin GstPlugin;
|
|
|
|
|
|
|
|
struct _GstPlugin {
|
|
|
|
gchar *name; /* name of the plugin */
|
|
|
|
gchar *longname; /* long name of plugin */
|
|
|
|
gchar *filename; /* filename it came from */
|
|
|
|
|
|
|
|
GList *types; /* list of types provided */
|
|
|
|
gint numtypes;
|
|
|
|
GList *elements; /* list of elements provided */
|
|
|
|
gint numelements;
|
|
|
|
GList *autopluggers; /* list of autopluggers provided */
|
|
|
|
gint numautopluggers;
|
|
|
|
|
|
|
|
gboolean loaded; /* if the plugin is in memory */
|
|
|
|
};
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
You can query a <classname>GList</classname> of available plugins with the
|
2005-01-18 14:15:30 +00:00
|
|
|
function <function>gst_registry_pool_plugin_list</function> as this example
|
|
|
|
shows:
|
2004-12-15 17:32:49 +00:00
|
|
|
</para>
|
|
|
|
<programlisting>
|
|
|
|
GList *plugins;
|
|
|
|
|
2005-01-18 14:15:30 +00:00
|
|
|
plugins = gst_registry_pool_plugin_list ();
|
2004-12-15 17:32:49 +00:00
|
|
|
|
|
|
|
while (plugins) {
|
|
|
|
GstPlugin *plugin = (GstPlugin *)plugins->data;
|
|
|
|
|
|
|
|
g_print ("plugin: %s\n", gst_plugin_get_name (plugin));
|
|
|
|
|
|
|
|
plugins = g_list_next (plugins);
|
|
|
|
}
|
|
|
|
</programlisting>
|
2004-12-15 07:30:55 +00:00
|
|
|
</chapter>
|