mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 19:21:06 +00:00
docs: application-development: Clarify usage of static elements
Fixes https://gitlab.freedesktop.org/gstreamer/gst-docs/-/issues/41 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7859>
This commit is contained in:
parent
96d762c6eb
commit
7112f1b874
1 changed files with 22 additions and 8 deletions
|
@ -15,19 +15,33 @@ framework. In this section, we will solely discuss how to embed such
|
||||||
elements statically in your application. This can be useful for
|
elements statically in your application. This can be useful for
|
||||||
application-specific elements that have no use elsewhere in GStreamer.
|
application-specific elements that have no use elsewhere in GStreamer.
|
||||||
|
|
||||||
|
Elements do not need to be registered to be used in GStreamer, so one
|
||||||
|
can simply instantiate the elements with `g_object_new ()` and use them
|
||||||
|
in pipelines like any other.
|
||||||
|
|
||||||
|
If the statically linked elements should also be available through a
|
||||||
|
name for functions such as `gst_element_factory_make ()`, these elements
|
||||||
|
can be registered direclty without a plugin. For that you can use
|
||||||
|
`gst_element_register ()` with `NULL` as plugin parameter.
|
||||||
|
|
||||||
|
While these two methods are usually sufficient, it is also possible
|
||||||
|
to register a static plugin.
|
||||||
|
|
||||||
|
### Static plugins
|
||||||
|
|
||||||
Dynamically loaded plugins contain a structure that's defined using
|
Dynamically loaded plugins contain a structure that's defined using
|
||||||
`GST_PLUGIN_DEFINE ()`. This structure is loaded when the plugin is
|
`GST_PLUGIN_DEFINE ()`. This structure is loaded when the plugin is
|
||||||
loaded by the GStreamer core. The structure contains an initialization
|
loaded by the GStreamer core. The structure contains an initialization
|
||||||
function (usually called `plugin_init`) that will be called right after
|
function (usually called `plugin_init`) that will be called right after
|
||||||
that. It's purpose is to register the elements provided by the plugin
|
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
|
with the GStreamer framework. To register a static plugin, the only
|
||||||
your application, the only thing you need to do is to replace
|
thing you need to do is to replace `GST_PLUGIN_DEFINE ()` with a call
|
||||||
`GST_PLUGIN_DEFINE ()` with a call to `gst_plugin_register_static ()`.
|
to `gst_plugin_register_static ()`. As soon as you call
|
||||||
As soon as you call `gst_plugin_register_static ()`, the elements will
|
`gst_plugin_register_static ()`, the elements will from then on be
|
||||||
from then on be available like any other element, without them having to
|
available like any other element, without them having to be dynamically
|
||||||
be dynamically loadable libraries. In the example below, you would be
|
loadable libraries. In the example below, you would be able to call
|
||||||
able to call `gst_element_factory_make
|
`gst_element_factory_make("my-element-name", "some-name")` to create
|
||||||
("my-element-name", "some-name")` to create an instance of the element.
|
an instance of the element.
|
||||||
|
|
||||||
``` c
|
``` c
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue