Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
dynamic type: add convenience macros to register
This macros will help to register a dynamic type
apart from a given plugin such as in a static build
of gstreamer where libgstreamer-full is generated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661>
  • Loading branch information
Stéphane Cerveau committed Dec 10, 2020
1 parent 9fd20cf commit a41f37d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions gst/gstdynamictypefactory.h
Expand Up @@ -22,6 +22,55 @@
#ifndef __GST_DYNAMIC_TYPE_FACTORY_H__
#define __GST_DYNAMIC_TYPE_FACTORY_H__

/**
* GST_DYNAMIC_TYPE_REGISTER_DEFINE:
*
* @t_n: The dynamic type name in lower case, with words separated by '_'.
* Used to generate `gst_dynamic_type_register_*(GstPlugin* plugin)`.
* @t: The #GType of the dynamic type
* A convenience macro to define the entry point of a
* dynamic type `gst_dynamic_type_register_*(GstPlugin* plugin)`.
*
* Since: 1.20
*/
#define GST_DYNAMIC_TYPE_REGISTER_DEFINE(t_n, t) \
G_BEGIN_DECLS \
gboolean G_PASTE (gst_dynamic_type_register_, t_n) (GstPlugin * plugin) \
{ \
return gst_dynamic_type_register (plugin, t); \
} \
G_END_DECLS

/**
* GST_DYNAMIC_TYPE_REGISTER_DECLARE:
* @t_f: The dynamic type name in lower case, with words separated by '_'.
*
* This macro can be used to declare a new dynamic type.
* It has to be used in combination with #GST_DYNAMIC_TYPE_REGISTER_DEFINE macro
* and must be placed outside any block to declare the type find registration
* function.
*
* Since: 1.20
*/
#define GST_DYNAMIC_TYPE_REGISTER_DECLARE(t_n) \
G_BEGIN_DECLS \
gboolean G_PASTE(gst_dynamic_type_register_, t_n) (GstPlugin * plugin); \
G_END_DECLS

/**
* GST_DYNAMIC_TYPE_REGISTER:
* @t_n: The dynamic type name to register
* @plugin: The #GstPlugin where to register the dynamic type.
*
* This macro can be used to register a dynamic type into a #GstPlugin.
* This method will be usually called in the plugin init function
* but can also be called with a NULL plugin.
*
* Since: 1.20
*/
#define GST_DYNAMIC_TYPE_REGISTER(t_n, plugin) G_PASTE(gst_dynamic_type_register_, t_n) (plugin)

/**
* GstDynamicTypeFactory:
*
Expand Down

0 comments on commit a41f37d

Please sign in to comment.