2000-08-22 21:18:18 +00:00
|
|
|
<chapter id="cha-plugins">
|
2001-01-06 02:35:17 +00:00
|
|
|
<title>What are Plugins</title>
|
2000-08-22 21:18:18 +00:00
|
|
|
<para>
|
2001-01-06 02:35:17 +00:00
|
|
|
A plugin is a shared library that contains at least one of the following items:
|
2000-08-22 21:18:18 +00:00
|
|
|
</para>
|
|
|
|
|
2001-01-06 02:35:17 +00:00
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
one or more elementfactories
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
one or more typedefinitions
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
<para>
|
|
|
|
The plugins have one simple method: plugin_init () where all the elementfactories are
|
|
|
|
created and the typedefinitions are registered.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
the plugins are maintained in the plugin system. Optionally, the typedefinitions and
|
|
|
|
the elementfactories 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>
|
|
|
|
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;
|
|
|
|
|
|
|
|
gboolean loaded; /* if the plugin is in memory */
|
|
|
|
};
|
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
You can query a GList of available plugins with:
|
|
|
|
</para>
|
|
|
|
<programlisting>
|
|
|
|
GList *plugins;
|
|
|
|
|
|
|
|
plugins = gst_plugin_get_list ();
|
|
|
|
|
|
|
|
while (plugins) {
|
|
|
|
GstPlugin *plugin = (GstPlugin *)plugins->data;
|
|
|
|
|
2001-03-11 16:29:29 +00:00
|
|
|
g_print ("plugin: %s\n", gst_plugin_get_name (plugin));
|
2001-01-06 02:35:17 +00:00
|
|
|
|
|
|
|
plugins = g_list_next (plugins);
|
|
|
|
}
|
|
|
|
</programlisting>
|
2000-08-22 21:18:18 +00:00
|
|
|
</chapter>
|