mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
manual: move embedding elements to separate chapter
This commit is contained in:
parent
19011cd2fc
commit
0f9fb7d884
3 changed files with 78 additions and 68 deletions
|
@ -1572,72 +1572,4 @@ main (int argc, char **argv)
|
|||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="section-data-manager">
|
||||
<title>Embedding static elements in your application</title>
|
||||
<para>
|
||||
The <ulink type="http"
|
||||
url="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/index.html">Plugin
|
||||
Writer's Guide</ulink> describes in great detail how to write elements
|
||||
for the &GStreamer; framework. In this section, we will solely discuss
|
||||
how to embed such elements statically in your application. This can be
|
||||
useful for application-specific elements that have no use elsewhere in
|
||||
&GStreamer;.
|
||||
</para>
|
||||
<para>
|
||||
Dynamically loaded plugins contain a structure that's defined using
|
||||
<function>GST_PLUGIN_DEFINE ()</function>. This structure is loaded
|
||||
when the plugin is loaded by the &GStreamer; core. The structure
|
||||
contains an initialization function (usually called
|
||||
<function>plugin_init</function>) that will be called right after that.
|
||||
It's purpose is to register the elements provided by the plugin with
|
||||
the &GStreamer; framework.
|
||||
If you want to embed elements directly in
|
||||
your application, the only thing you need to do is to replace
|
||||
<function>GST_PLUGIN_DEFINE ()</function> with a call to
|
||||
<function>gst_plugin_register_static ()</function>. As soon as you
|
||||
call <function>gst_plugin_register_static ()</function>, the elements
|
||||
will from then on be available like any other element, without them
|
||||
having to be dynamically loadable libraries. In the example below, you
|
||||
would be able to call <function>gst_element_factory_make
|
||||
("my-element-name", "some-name")</function> to create an instance of the
|
||||
element.
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
/*
|
||||
* Here, you would write the actual plugin code.
|
||||
*/
|
||||
|
||||
[..]
|
||||
|
||||
static gboolean
|
||||
register_elements (GstPlugin *plugin)
|
||||
{
|
||||
return gst_element_register (plugin, "my-element-name",
|
||||
GST_RANK_NONE, MY_PLUGIN_TYPE);
|
||||
}
|
||||
|
||||
static
|
||||
my_code_init (void)
|
||||
{
|
||||
...
|
||||
|
||||
gst_plugin_register_static (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"my-private-plugins",
|
||||
"Private elements of my application",
|
||||
register_elements,
|
||||
VERSION,
|
||||
"LGPL",
|
||||
"my-application-source",
|
||||
"my-application",
|
||||
"http://www.my-application.net/")
|
||||
|
||||
...
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
|
76
docs/manual/appendix-compiling.xml
Normal file
76
docs/manual/appendix-compiling.xml
Normal file
|
@ -0,0 +1,76 @@
|
|||
<chapter id="chapter-compiling">
|
||||
<title>Compiling</title>
|
||||
<para>
|
||||
This section talks about the different things you can do when building
|
||||
and shipping your applications and plugins.
|
||||
</para>
|
||||
|
||||
<sect1 id="section-compiling-embedding">
|
||||
<title>Embedding static elements in your application</title>
|
||||
<para>
|
||||
The <ulink type="http"
|
||||
url="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/index.html">Plugin
|
||||
Writer's Guide</ulink> describes in great detail how to write elements
|
||||
for the &GStreamer; framework. In this section, we will solely discuss
|
||||
how to embed such elements statically in your application. This can be
|
||||
useful for application-specific elements that have no use elsewhere in
|
||||
&GStreamer;.
|
||||
</para>
|
||||
<para>
|
||||
Dynamically loaded plugins contain a structure that's defined using
|
||||
<function>GST_PLUGIN_DEFINE ()</function>. This structure is loaded
|
||||
when the plugin is loaded by the &GStreamer; core. The structure
|
||||
contains an initialization function (usually called
|
||||
<function>plugin_init</function>) that will be called right after that.
|
||||
It's purpose is to register the elements provided by the plugin with
|
||||
the &GStreamer; framework.
|
||||
If you want to embed elements directly in
|
||||
your application, the only thing you need to do is to replace
|
||||
<function>GST_PLUGIN_DEFINE ()</function> with a call to
|
||||
<function>gst_plugin_register_static ()</function>. As soon as you
|
||||
call <function>gst_plugin_register_static ()</function>, the elements
|
||||
will from then on be available like any other element, without them
|
||||
having to be dynamically loadable libraries. In the example below, you
|
||||
would be able to call <function>gst_element_factory_make
|
||||
("my-element-name", "some-name")</function> to create an instance of the
|
||||
element.
|
||||
</para>
|
||||
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
/*
|
||||
* Here, you would write the actual plugin code.
|
||||
*/
|
||||
|
||||
[..]
|
||||
|
||||
static gboolean
|
||||
register_elements (GstPlugin *plugin)
|
||||
{
|
||||
return gst_element_register (plugin, "my-element-name",
|
||||
GST_RANK_NONE, MY_PLUGIN_TYPE);
|
||||
}
|
||||
|
||||
static
|
||||
my_code_init (void)
|
||||
{
|
||||
...
|
||||
|
||||
gst_plugin_register_static (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"my-private-plugins",
|
||||
"Private elements of my application",
|
||||
register_elements,
|
||||
VERSION,
|
||||
"LGPL",
|
||||
"my-application-source",
|
||||
"my-application",
|
||||
"http://www.my-application.net/")
|
||||
|
||||
...
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</sect1>
|
||||
</chapter>
|
|
@ -52,6 +52,7 @@
|
|||
|
||||
<!-- Appendices -->
|
||||
<!ENTITY PROGRAMS SYSTEM "appendix-programs.xml">
|
||||
<!ENTITY COMPILING SYSTEM "appendix-compiling.xml">
|
||||
<!ENTITY CHECKLIST SYSTEM "appendix-checklist.xml">
|
||||
<!ENTITY PORTING SYSTEM "appendix-porting.xml">
|
||||
<!ENTITY INTEGRATION SYSTEM "appendix-integration.xml">
|
||||
|
@ -257,6 +258,7 @@
|
|||
-->
|
||||
|
||||
&PROGRAMS;
|
||||
&COMPILING;
|
||||
&CHECKLIST;
|
||||
&PORTING;
|
||||
&INTEGRATION;
|
||||
|
|
Loading…
Reference in a new issue