Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gstreamer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStéphane Cerveau <scerveau@collabora.com>2021-03-17 18:39:30 +0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-03-19 13:15:49 +0300
commit178c7d27326cd1370deedebedb42cbcc5f979e0e (patch)
tree0c2d2bd8582d2353ca60a9b04ddbe960975b4f38
parent3d887c7f0771e52eb03e3a8c7e2791b94ca35055 (diff)
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>
-rw-r--r--gst/gstdeviceprovider.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/gst/gstdeviceprovider.h b/gst/gstdeviceprovider.h
index 242071f4ee..1d69a7db97 100644
--- a/gst/gstdeviceprovider.h
+++ b/gst/gstdeviceprovider.h
@@ -19,14 +19,47 @@
* 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 '_'.
* Used to generate `gst_device_provider_register_*(GstPlugin* plugin)`.