source: trunk/third/gstreamer/docs/manual/basics-plugins.xml @ 21448

Revision 21448, 2.4 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21447, which included commits to RCS files with non-trunk default branches.
Line 
1<chapter id="chapter-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
32  <para>
33    All plugins should implement one function, <function>plugin_init</function>,
34    that creates all the element factories and registers all the type
35    definitions contained in the plugin.
36    Without this function, a plugin cannot be registered.
37  </para>
38  <para>
39    The plugins are maintained in the plugin system. Optionally, the
40    type definitions and the element factories can be saved into an XML
41    representation so that the plugin system does not have to load all
42    available plugins in order to know their definition.
43  </para>
44                                                                                                                 
45  <para>
46    The basic plugin structure has the following fields:
47  </para>
48  <programlisting>
49typedef struct _GstPlugin   GstPlugin;
50
51struct _GstPlugin {
52  gchar *name;                  /* name of the plugin */
53  gchar *longname;              /* long name of plugin */
54  gchar *filename;              /* filename it came from */
55
56  GList *types;                 /* list of types provided */
57  gint numtypes;
58  GList *elements;              /* list of elements provided */
59  gint numelements;
60  GList *autopluggers;          /* list of autopluggers provided */
61  gint numautopluggers;
62
63  gboolean loaded;              /* if the plugin is in memory */
64};
65  </programlisting>
66
67  <para>
68    You can query a <classname>GList</classname> of available plugins with the
69    function <function>gst_registry_pool_plugin_list</function> as this example
70    shows:
71  </para>
72  <programlisting>
73    GList *plugins;
74   
75    plugins = gst_registry_pool_plugin_list ();
76
77    while (plugins) {
78      GstPlugin *plugin = (GstPlugin *)plugins-&gt;data;
79
80      g_print ("plugin: %s\n", gst_plugin_get_name (plugin));
81
82      plugins = g_list_next (plugins);
83    }
84  </programlisting>
85</chapter>
Note: See TracBrowser for help on using the repository browser.