mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
device provider: add custom register macro
This macro allows to register a device provider with a custom function which gives more flexibility when registering it (see v4l2 register). Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/773>
This commit is contained in:
parent
3d887c7f07
commit
178c7d2732
1 changed files with 35 additions and 2 deletions
|
@ -19,13 +19,46 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __GST_DEVICE_PROVIDER_H__
|
||||
#define __GST_DEVICE_PROVIDER_H__
|
||||
|
||||
#include <gst/gstelement.h>
|
||||
|
||||
/**
|
||||
* GST_DEVICE_PROVIDER_REGISTER_DEFINE_CUSTOM:
|
||||
* @d_p: The device provider name in lower case, with words separated by '_'.
|
||||
* Used to generate `gst_device_provider_register_*(GstPlugin* plugin)`.
|
||||
* @register_func: pointer to a method with the format: `gboolean register_func (GstPlugin* plugin);`
|
||||
*
|
||||
* A convenience macro to define the entry point of a
|
||||
* device provider `gst_device_provider_register_*(GstPlugin* plugin)` which uses
|
||||
* register_func as the main registration method for the device provider.
|
||||
* As an example, you may define the device provider named "device-provider"
|
||||
* with the namespace `my` as following using `device_provider_register_custom`:
|
||||
*
|
||||
* ```
|
||||
*
|
||||
* gboolean my_device_provider_register_custom (GstPlugin * plugin)
|
||||
* {
|
||||
* gboolean ret = FALSE;
|
||||
* ret |= gst_device_provider_register (plugin, "my-device-provider",
|
||||
GST_RANK_PRIMARY, GST_TYPE_MY_DEVICE_PROVIDER);
|
||||
* return TRUE;
|
||||
* }
|
||||
*
|
||||
* GST_DEVICE_PROVIDER_REGISTER_DEFINE_CUSTOM (my_device_provider, my_device_provider_register_custom)
|
||||
* ```
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
#define GST_DEVICE_PROVIDER_REGISTER_DEFINE_CUSTOM(d_p, register_func) \
|
||||
G_BEGIN_DECLS \
|
||||
gboolean G_PASTE (gst_device_provider_register_, d_p) (GstPlugin * plugin) \
|
||||
{ \
|
||||
return register_func (plugin); \
|
||||
} \
|
||||
G_END_DECLS
|
||||
|
||||
/**
|
||||
* GST_DEVICE_PROVIDER_REGISTER_DEFINE:
|
||||
* @d_p: The device provider name in lower case, with words separated by '_'.
|
||||
|
|
Loading…
Reference in a new issue