new proggy I never checked in
[platform/upstream/gstreamer.git] / docs / manual / plugins.xml
1 <chapter id="cha-plugins">
2   <title>Plugins</title>
3   <!-- FIXME: introduce type definitions before this chapter -->
4   <para> 
5     A plugin is a shared library that contains at least one of the following
6     items:
7   </para>
8
9   <itemizedlist>
10     <listitem>
11       <para>
12         one or more element factories
13       </para>
14     </listitem>
15     <listitem>
16       <para>
17         one or more type definitions
18       </para>
19     </listitem>
20     <listitem>
21       <para>
22         one or more auto-pluggers
23       </para>
24     </listitem>
25     <listitem>
26       <para>
27         exported symbols for use in other plugins
28       </para>
29     </listitem>
30   </itemizedlist>
31   <para> 
32     All plugins should implement one function, <function>plugin_init</function>,
33     that creates all the element factories and registers all the type
34     definitions contained in the plugin.
35     Without this function, a plugin cannot be registered.
36   </para> 
37   <para> 
38     The plugins are maintained in the plugin system. Optionally, the
39     type definitions and the element factories can be saved into an XML
40     representation so that the plugin system does not have to load all
41     available plugins in order to know their definition.
42   </para> 
43                                                                                                                   
44   <para> 
45     The basic plugin structure has the following fields:
46   </para> 
47   <programlisting>
48 typedef struct _GstPlugin   GstPlugin;
49
50 struct _GstPlugin {
51   gchar *name;                  /* name of the plugin */
52   gchar *longname;              /* long name of plugin */
53   gchar *filename;              /* filename it came from */
54
55   GList *types;                 /* list of types provided */
56   gint numtypes;
57   GList *elements;              /* list of elements provided */
58   gint numelements;
59   GList *autopluggers;          /* list of autopluggers provided */
60   gint numautopluggers;
61
62   gboolean loaded;              /* if the plugin is in memory */
63 };
64   </programlisting>
65
66   <para> 
67     You can query a <classname>GList</classname> of available plugins with the
68     function <function>gst_plugin_get_list</function> as this example shows:
69   </para> 
70   <programlisting>
71     GList *plugins;
72     
73     plugins = gst_plugin_get_list ();
74
75     while (plugins) {
76       GstPlugin *plugin = (GstPlugin *)plugins-&gt;data;
77
78       g_print ("plugin: %s\n", gst_plugin_get_name (plugin));
79
80       plugins = g_list_next (plugins);
81     }
82   </programlisting>
83 </chapter>