1/* GStreamer
2 * Copyright (C) 2015 Jan Schmidt <jan@centricular.com>
3 *
4 * gstdynamictypefactory.h: Header for GstDynamicTypeFactory
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#ifndef __GST_DYNAMIC_TYPE_FACTORY_H__
23#define __GST_DYNAMIC_TYPE_FACTORY_H__
24
25/**
26 * GST_DYNAMIC_TYPE_REGISTER_DEFINE:
27 * @t_n: The dynamic type name in lower case, with words separated by '_'.
28 * Used to generate `gst_dynamic_type_register_*(GstPlugin* plugin)`.
29 * @t: The #GType of the dynamic type
30
31 * A convenience macro to define the entry point of a
32 * dynamic type `gst_dynamic_type_register_*(GstPlugin* plugin)`.
33 *
34 * Since: 1.20
35 */
36#define GST_DYNAMIC_TYPE_REGISTER_DEFINE(t_n, t) \
37G_BEGIN_DECLS \
38gboolean G_PASTE (gst_dynamic_type_register_, t_n) (GstPlugin * plugin) \
39{ \
40 return gst_dynamic_type_register (plugin, t); \
41} \
42G_END_DECLS
43
44/**
45 * GST_DYNAMIC_TYPE_REGISTER_DECLARE:
46 * @t_f: The dynamic type name in lower case, with words separated by '_'.
47 *
48 * This macro can be used to declare a new dynamic type.
49 * It has to be used in combination with #GST_DYNAMIC_TYPE_REGISTER_DEFINE macro
50 * and must be placed outside any block to declare the type find registration
51 * function.
52 *
53 * Since: 1.20
54 */
55#define GST_DYNAMIC_TYPE_REGISTER_DECLARE(t_n) \
56G_BEGIN_DECLS \
57gboolean G_PASTE(gst_dynamic_type_register_, t_n) (GstPlugin * plugin); \
58G_END_DECLS
59
60/**
61 * GST_DYNAMIC_TYPE_REGISTER:
62 * @t_n: The dynamic type name to register
63 * @plugin: The #GstPlugin where to register the dynamic type.
64 *
65 * This macro can be used to register a dynamic type into a #GstPlugin.
66 * This method will be usually called in the plugin init function
67 * but can also be called with a NULL plugin.
68 *
69 * Since: 1.20
70 */
71#define GST_DYNAMIC_TYPE_REGISTER(t_n, plugin) G_PASTE(gst_dynamic_type_register_, t_n) (plugin)
72
73/**
74 * GstDynamicTypeFactory:
75 *
76 * The opaque #GstDynamicTypeFactory data structure.
77 *
78 * Since: 1.12
79 */
80typedef struct _GstDynamicTypeFactory GstDynamicTypeFactory;
81typedef struct _GstDynamicTypeFactoryClass GstDynamicTypeFactoryClass;
82
83#include <gst/gstconfig.h>
84#include <gst/gstplugin.h>
85#include <gst/gstpluginfeature.h>
86
87G_BEGIN_DECLS
88
89#define GST_TYPE_DYNAMIC_TYPE_FACTORY (gst_dynamic_type_factory_get_type())
90#define GST_DYNAMIC_TYPE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DYNAMIC_TYPE_FACTORY,\
91 GstDynamicTypeFactory))
92#define GST_DYNAMIC_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DYNAMIC_TYPE_FACTORY,\
93 GstDynamicTypeFactoryClass))
94#define GST_IS_DYNAMIC_TYPE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DYNAMIC_TYPE_FACTORY))
95#define GST_IS_DYNAMIC_TYPE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DYNAMIC_TYPE_FACTORY))
96#define GST_DYNAMIC_TYPE_FACTORY_CAST(obj) ((GstDynamicTypeFactory *)(obj))
97
98GST_API
99GType gst_dynamic_type_factory_get_type (void);
100
101GST_API
102GType gst_dynamic_type_factory_load (const gchar *factoryname);
103
104GST_API
105gboolean gst_dynamic_type_register (GstPlugin *plugin, GType type);
106
107G_END_DECLS
108
109#endif
110

source code of include/gstreamer-1.0/gst/gstdynamictypefactory.h