mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
plugin: update doc to declare an element
Use GST_ELEMENT_REGISTER_DEFINE in addition to G_DEFINE_TYPE Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-docs/-/merge_requests/117>
This commit is contained in:
parent
491bf70f89
commit
5a004ed35b
4 changed files with 14 additions and 10 deletions
|
@ -40,8 +40,7 @@ able to call `gst_element_factory_make
|
||||||
static gboolean
|
static gboolean
|
||||||
register_elements (GstPlugin *plugin)
|
register_elements (GstPlugin *plugin)
|
||||||
{
|
{
|
||||||
return gst_element_register (plugin, "my-element-name",
|
return GST_ELEMENT_REGISTER (my_element_name, plugin);
|
||||||
GST_RANK_NONE, MY_PLUGIN_TYPE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
@ -112,7 +112,7 @@ G_DEFINE_TYPE_WITH_CODE (GstMyFilter, gst_my_filter,GST_TYPE_ELEMENT,
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_SOME_INTERFACE,
|
G_IMPLEMENT_INTERFACE (GST_TYPE_SOME_INTERFACE,
|
||||||
gst_my_filter_some_interface_init));
|
gst_my_filter_some_interface_init));
|
||||||
|
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE(my_filter, "my-filter", GST_RANK_NONE, GST_TYPE_MY_FILTER);
|
||||||
```
|
```
|
||||||
|
|
||||||
## URI interface
|
## URI interface
|
||||||
|
|
|
@ -124,7 +124,7 @@ static gboolean gst_my_filter_activate_mode (GstPad * pad,
|
||||||
static void gst_my_filter_loop (GstMyFilter * filter);
|
static void gst_my_filter_loop (GstMyFilter * filter);
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstMyFilter, gst_my_filter, GST_TYPE_ELEMENT);
|
G_DEFINE_TYPE (GstMyFilter, gst_my_filter, GST_TYPE_ELEMENT);
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE(my_filter, "my-filter", GST_RANK_NONE, GST_TYPE_MY_FILTER);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_my_filter_init (GstMyFilter * filter)
|
gst_my_filter_init (GstMyFilter * filter)
|
||||||
|
@ -300,7 +300,7 @@ static GstFlowReturn
|
||||||
GstBuffer ** buf);
|
GstBuffer ** buf);
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstMyFilter, gst_my_filter, GST_TYPE_ELEMENT);
|
G_DEFINE_TYPE (GstMyFilter, gst_my_filter, GST_TYPE_ELEMENT);
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE(my_filter, "my-filter", GST_RANK_NONE, GST_TYPE_MY_FILTER);
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -156,19 +156,26 @@ typedef struct _GstMyFilterClass {
|
||||||
/* Standard function returning type information. */
|
/* Standard function returning type information. */
|
||||||
GType gst_my_filter_get_type (void);
|
GType gst_my_filter_get_type (void);
|
||||||
|
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE(my_filter)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Using this header file, you can use the following macro to setup the
|
Using this header file, you can use the following macros to setup the
|
||||||
`GObject` basics in your source file so that all functions will be
|
`Element` basics in your source file so that all functions will be
|
||||||
called appropriately:
|
called appropriately:
|
||||||
|
|
||||||
``` c
|
``` c
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstMyFilter, gst_my_filter, GST_TYPE_ELEMENT);
|
G_DEFINE_TYPE (GstMyFilter, gst_my_filter, GST_TYPE_ELEMENT);
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE(my_filter, "my-filter", GST_RANK_NONE, GST_TYPE_MY_FILTER);
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The macro `GST_ELEMENT_REGISTER_DEFINE` in combination with `GST_ELEMENT_REGISTER_DECLARE`
|
||||||
|
allows to register the element from within the plugin or from any other plugin/application by calling
|
||||||
|
`GST_ELEMENT_REGISTER (my_filter)`.
|
||||||
|
|
||||||
## Element metadata
|
## Element metadata
|
||||||
|
|
||||||
The Element metadata provides extra element information. It is
|
The Element metadata provides extra element information. It is
|
||||||
|
@ -337,9 +344,7 @@ plugin should be registered.
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin *plugin)
|
plugin_init (GstPlugin *plugin)
|
||||||
{
|
{
|
||||||
return gst_element_register (plugin, "my_filter",
|
return GST_ELEMENT_REGISTER (my_filter, plugin);
|
||||||
GST_RANK_NONE,
|
|
||||||
GST_TYPE_MY_FILTER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (
|
GST_PLUGIN_DEFINE (
|
||||||
|
|
Loading…
Reference in a new issue