[Gstreamer-openmax] [PATCH] Add GSTOMX_BOILERPLATE macros
Rob Clark
rob at ti.com
Tue Nov 3 18:26:28 PST 2009
These work like the GST_BOILERPLATE macros, but following the naming conventions for init functions used in the gst-openmax code, to remove a lot of gobject related boilerplate code.
Signed-off-by: Rob Clark <rob at ti.com>
---
omx/gstomx_aacdec.c | 27 +----------------------
omx/gstomx_aacenc.c | 28 +----------------------
omx/gstomx_adpcmdec.c | 27 +----------------------
omx/gstomx_adpcmenc.c | 27 +----------------------
omx/gstomx_amrnbdec.c | 27 +----------------------
omx/gstomx_amrnbenc.c | 28 +----------------------
omx/gstomx_amrwbdec.c | 27 +----------------------
omx/gstomx_amrwbenc.c | 28 +----------------------
omx/gstomx_audiosink.c | 27 +----------------------
omx/gstomx_base_filter.c | 51 +++++++++++++++++--------------------------
omx/gstomx_base_sink.c | 52 ++++++++++++++++---------------------------
omx/gstomx_base_src.c | 32 +++++----------------------
omx/gstomx_base_videodec.c | 27 +----------------------
omx/gstomx_base_videoenc.c | 28 +----------------------
omx/gstomx_dummy.c | 27 +----------------------
omx/gstomx_filereadersrc.c | 27 +----------------------
omx/gstomx_g711dec.c | 27 +----------------------
omx/gstomx_g711enc.c | 27 +----------------------
omx/gstomx_g729dec.c | 27 +----------------------
omx/gstomx_g729enc.c | 28 +----------------------
omx/gstomx_h263dec.c | 27 +----------------------
omx/gstomx_h263enc.c | 27 +----------------------
omx/gstomx_h264dec.c | 27 +----------------------
omx/gstomx_h264enc.c | 27 +----------------------
omx/gstomx_ilbcdec.c | 27 +----------------------
omx/gstomx_ilbcenc.c | 27 +----------------------
omx/gstomx_jpegenc.c | 28 +----------------------
omx/gstomx_mp2dec.c | 27 +----------------------
omx/gstomx_mp3dec.c | 27 +----------------------
omx/gstomx_mpeg4dec.c | 27 +----------------------
omx/gstomx_mpeg4enc.c | 27 +----------------------
omx/gstomx_util.h | 42 +++++++++++++++++++++++++++++++++++
omx/gstomx_videosink.c | 28 +----------------------
omx/gstomx_volume.c | 27 +----------------------
omx/gstomx_vorbisdec.c | 28 +----------------------
omx/gstomx_wmvdec.c | 27 +----------------------
36 files changed, 119 insertions(+), 930 deletions(-)
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index dbe7846..4f20370 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -127,7 +127,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -208,27 +207,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_aacdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAacDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAacDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAacDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_aacenc.c b/omx/gstomx_aacenc.c
index e1f8720..f640ed4 100644
--- a/omx/gstomx_aacenc.c
+++ b/omx/gstomx_aacenc.c
@@ -37,7 +37,7 @@ enum
#define DEFAULT_PROFILE OMX_AUDIO_AACObjectLC
#define DEFAULT_OUTPUT_FORMAT OMX_AUDIO_AACStreamFormatRAW
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAacEnc, gst_omx_aacenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
#define GST_TYPE_OMX_AACENC_PROFILE (gst_omx_aacenc_profile_get_type ())
static GType
@@ -251,8 +251,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -406,27 +404,3 @@ type_instance_init (GTypeInstance *instance,
self->profile = DEFAULT_PROFILE;
self->output_format = DEFAULT_OUTPUT_FORMAT;
}
-
-GType
-gst_omx_aacenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAacEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAacEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAacEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_adpcmdec.c b/omx/gstomx_adpcmdec.c
index a35a6cc..61b0d20 100644
--- a/omx/gstomx_adpcmdec.c
+++ b/omx/gstomx_adpcmdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAdpcmDec, gst_omx_adpcmdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -101,7 +101,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -165,27 +164,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_adpcmdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAdpcmDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAdpcmDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAdpcmDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_adpcmenc.c b/omx/gstomx_adpcmenc.c
index c17a7b4..7e4b5c6 100644
--- a/omx/gstomx_adpcmenc.c
+++ b/omx/gstomx_adpcmenc.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAdpcmEnc, gst_omx_adpcmenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -101,7 +101,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -223,27 +222,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_adpcmenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAdpcmEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAdpcmEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAdpcmEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_amrnbdec.c b/omx/gstomx_amrnbdec.c
index 9250420..f481e6d 100644
--- a/omx/gstomx_amrnbdec.c
+++ b/omx/gstomx_amrnbdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -100,7 +100,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -150,27 +149,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_amrnbdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAmrNbDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAmrNbDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAmrNbDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_amrnbenc.c b/omx/gstomx_amrnbenc.c
index 92df603..0309d89 100644
--- a/omx/gstomx_amrnbenc.c
+++ b/omx/gstomx_amrnbenc.c
@@ -33,7 +33,7 @@ enum
#define DEFAULT_BITRATE 64000
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAmrNbEnc, gst_omx_amrnbenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -155,8 +155,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -253,27 +251,3 @@ type_instance_init (GTypeInstance *instance,
self->bitrate = DEFAULT_BITRATE;
}
-
-GType
-gst_omx_amrnbenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAmrNbEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAmrNbEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAmrNbEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_amrwbdec.c b/omx/gstomx_amrwbdec.c
index bc406c0..cee5334 100644
--- a/omx/gstomx_amrwbdec.c
+++ b/omx/gstomx_amrwbdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -100,7 +100,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -150,27 +149,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_amrwbdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAmrWbDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAmrWbDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAmrWbDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_amrwbenc.c b/omx/gstomx_amrwbenc.c
index 40d0cf5..b73fa9c 100644
--- a/omx/gstomx_amrwbenc.c
+++ b/omx/gstomx_amrwbenc.c
@@ -33,7 +33,7 @@ enum
#define DEFAULT_BITRATE 64000
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAmrWbEnc, gst_omx_amrwbenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -155,8 +155,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -253,27 +251,3 @@ type_instance_init (GTypeInstance *instance,
self->bitrate = DEFAULT_BITRATE;
}
-
-GType
-gst_omx_amrwbenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAmrWbEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAmrWbEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxAmrWbEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_audiosink.c b/omx/gstomx_audiosink.c
index 44dc92a..d74623b 100644
--- a/omx/gstomx_audiosink.c
+++ b/omx/gstomx_audiosink.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseSinkClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxAudioSink, gst_omx_audiosink, GstOmxBaseSink, GST_OMX_BASE_SINK_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -130,7 +130,6 @@ type_class_init (gpointer g_class,
{
GstBaseSinkClass *gst_base_sink_class;
- parent_class = g_type_class_ref (GST_OMX_BASE_SINK_TYPE);
gst_base_sink_class = GST_BASE_SINK_CLASS (g_class);
gst_base_sink_class->set_caps = setcaps;
@@ -146,27 +145,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
}
-
-GType
-gst_omx_audiosink_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxAudioSinkClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxAudioSink);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_SINK_TYPE, "GstOmxAudioSink", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 418915c..f57ce96 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -35,7 +35,8 @@ enum
ARG_NUM_OUTPUT_BUFFERS,
};
-static GstElementClass *parent_class;
+static void init_interfaces (GType type);
+GSTOMX_BOILERPLATE_FULL (GstOmxBaseFilter, gst_omx_base_filter, GstElement, GST_TYPE_ELEMENT, init_interfaces);
static inline void
log_buffer (GstOmxBaseFilter *self,
@@ -281,6 +282,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -290,8 +296,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
gstelement_class = GST_ELEMENT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
gobject_class->finalize = finalize;
gstelement_class->change_state = change_state;
@@ -993,38 +997,23 @@ interface_init (GstImplementsInterfaceClass *klass)
klass->supported = interface_supported;
}
-GType
-gst_omx_base_filter_get_type (void)
+static void
+init_interfaces (GType type)
{
- static GType type = 0;
+ GInterfaceInfo *iface_info;
+ GInterfaceInfo *omx_info;
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
- GInterfaceInfo *iface_info;
- GInterfaceInfo *omx_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseFilterClass);
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseFilter);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_TYPE_ELEMENT, "GstOmxBaseFilter", type_info, 0);
- g_free (type_info);
- iface_info = g_new0 (GInterfaceInfo, 1);
- iface_info->interface_init = (GInterfaceInitFunc) interface_init;
+ iface_info = g_new0 (GInterfaceInfo, 1);
+ iface_info->interface_init = (GInterfaceInitFunc) interface_init;
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
- g_free (iface_info);
+ g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
+ g_free (iface_info);
- omx_info = g_new0 (GInterfaceInfo, 1);
- omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
+ omx_info = g_new0 (GInterfaceInfo, 1);
+ omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
- g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
- g_free (omx_info);
- }
-
- return type;
+ g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
+ g_free (omx_info);
}
+
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index c25c0ad..3e3347b 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -39,7 +39,8 @@ enum
ARG_LIBRARY_NAME,
};
-static GstElementClass *parent_class;
+static void init_interfaces (GType type);
+GSTOMX_BOILERPLATE_FULL (GstOmxBaseSink, gst_omx_base_sink, GstBaseSink, GST_TYPE_BASE_SINK, init_interfaces);
static void
setup_ports (GstOmxBaseSink *self)
@@ -328,6 +329,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -339,8 +345,6 @@ type_class_init (gpointer g_class,
gst_base_sink_class = GST_BASE_SINK_CLASS (g_class);
gstelement_class = GST_ELEMENT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
gobject_class->finalize = finalize;
gstelement_class->change_state = change_state;
@@ -484,39 +488,21 @@ interface_init (GstImplementsInterfaceClass *klass)
{
klass->supported = interface_supported;
}
-
-GType
-gst_omx_base_sink_get_type (void)
+static void
+init_interfaces (GType type)
{
- static GType type = 0;
+ GInterfaceInfo *iface_info;
+ GInterfaceInfo *omx_info;
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
- GInterfaceInfo *iface_info;
- GInterfaceInfo *omx_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseSinkClass);
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseSink);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_TYPE_BASE_SINK, "GstOmxBaseSink", type_info, 0);
- g_free (type_info);
+ iface_info = g_new0 (GInterfaceInfo, 1);
+ iface_info->interface_init = (GInterfaceInitFunc) interface_init;
- iface_info = g_new0 (GInterfaceInfo, 1);
- iface_info->interface_init = (GInterfaceInitFunc) interface_init;
+ g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
+ g_free (iface_info);
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
- g_free (iface_info);
-
- omx_info = g_new0 (GInterfaceInfo, 1);
- omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
-
- g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
- g_free (omx_info);
- }
+ omx_info = g_new0 (GInterfaceInfo, 1);
+ omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
- return type;
+ g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
+ g_free (omx_info);
}
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 94bf5e9..1c9ff48 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -31,7 +31,7 @@ enum
ARG_LIBRARY_NAME,
};
-static GstElementClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_SRC);
static void
setup_ports (GstOmxBaseSrc *self)
@@ -398,6 +398,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -407,8 +412,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
gst_base_src_class = GST_BASE_SRC_CLASS (g_class);
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
gobject_class->finalize = finalize;
gst_base_src_class->start = start;
@@ -449,26 +452,3 @@ type_instance_init (GTypeInstance *instance,
GST_LOG_OBJECT (self, "end");
}
-
-GType
-gst_omx_base_src_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseSrcClass);
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseSrc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_TYPE_BASE_SRC, "GstOmxBaseSrc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c
index ce7dfc8..91436d3 100644
--- a/omx/gstomx_base_videodec.c
+++ b/omx/gstomx_base_videodec.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseVideoDec, gst_omx_base_videodec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -91,7 +91,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -256,27 +255,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_base_videodec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseVideoDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseVideoDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxBaseVideoDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c
index a3e0625..c9067c4 100644
--- a/omx/gstomx_base_videoenc.c
+++ b/omx/gstomx_base_videoenc.c
@@ -32,7 +32,7 @@ enum
#define DEFAULT_BITRATE 0
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseVideoEnc, gst_omx_base_videoenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -146,8 +146,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -285,27 +283,3 @@ type_instance_init (GTypeInstance *instance,
self->bitrate = DEFAULT_BITRATE;
}
-
-GType
-gst_omx_base_videoenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseVideoEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseVideoEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxBaseVideoEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_dummy.c b/omx/gstomx_dummy.c
index 63fde61..03ebc41 100644
--- a/omx/gstomx_dummy.c
+++ b/omx/gstomx_dummy.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxDummy, gst_omx_dummy, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -88,7 +88,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -101,27 +100,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
}
-
-GType
-gst_omx_dummy_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxDummyClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxDummy);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxDummy", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_filereadersrc.c b/omx/gstomx_filereadersrc.c
index cea5ca9..38b6964 100644
--- a/omx/gstomx_filereadersrc.c
+++ b/omx/gstomx_filereadersrc.c
@@ -29,7 +29,7 @@ enum
ARG_FILE_NAME,
};
-static GstOmxBaseSrcClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxFilereaderSrc, gst_omx_filereadersrc, GstOmxBaseSrc, GST_OMX_BASE_SRC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -167,7 +167,6 @@ type_class_init (gpointer g_class,
GstBaseSrcClass *gst_base_src_class;
GObjectClass *gobject_class;
- parent_class = g_type_class_ref (GST_OMX_BASE_SRC_TYPE);
gst_base_src_class = GST_BASE_SRC_CLASS (g_class);
gobject_class = G_OBJECT_CLASS (g_class);
@@ -201,27 +200,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "end");
}
-
-GType
-gst_omx_filereadersrc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxFilereaderSrcClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxFilereaderSrc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_SRC_TYPE, "GstOmxFilereaderSrc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c
index f62796b..14edf5d 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset, strcmp */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG711Dec, gst_omx_g711dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -112,7 +112,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -182,27 +181,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_g711dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG711DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG711Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG711Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g711enc.c b/omx/gstomx_g711enc.c
index bcfb72b..2137cfe 100644
--- a/omx/gstomx_g711enc.c
+++ b/omx/gstomx_g711enc.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset, strcmp */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG711Enc, gst_omx_g711enc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -112,7 +112,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -196,27 +195,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_g711enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG711EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG711Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG711Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g729dec.c b/omx/gstomx_g729dec.c
index 1aefa60..666d5ab 100644
--- a/omx/gstomx_g729dec.c
+++ b/omx/gstomx_g729dec.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG729Dec, gst_omx_g729dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -142,27 +141,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_g729dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG729DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG729Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG729Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g729enc.c b/omx/gstomx_g729enc.c
index aa44c35..9a2cf3e 100644
--- a/omx/gstomx_g729enc.c
+++ b/omx/gstomx_g729enc.c
@@ -33,7 +33,7 @@ enum
ARG_DTX,
};
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG729Enc, gst_omx_g729enc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -160,8 +160,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -253,27 +251,3 @@ type_instance_init (GTypeInstance *instance,
self->dtx = DEFAULT_DTX;
}
-
-GType
-gst_omx_g729enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG729EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG729Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG729Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h263dec.c b/omx/gstomx_h263dec.c
index 14d65b7..233e041 100644
--- a/omx/gstomx_h263dec.c
+++ b/omx/gstomx_h263dec.c
@@ -22,7 +22,7 @@
#include "gstomx_h263dec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH263Dec, gst_omx_h263dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -77,7 +77,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -90,27 +89,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingH263;
}
-
-GType
-gst_omx_h263dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH263DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH263Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxH263Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h263enc.c b/omx/gstomx_h263enc.c
index 19d313a..f9af2ce 100644
--- a/omx/gstomx_h263enc.c
+++ b/omx/gstomx_h263enc.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH263Enc, gst_omx_h263enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -74,7 +74,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -129,27 +128,3 @@ type_instance_init (GTypeInstance *instance,
omx_base_filter->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_h263enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH263EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH263Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEOENC_TYPE, "GstOmxH263Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h264dec.c b/omx/gstomx_h264dec.c
index bf13966..4f950df 100644
--- a/omx/gstomx_h264dec.c
+++ b/omx/gstomx_h264dec.c
@@ -22,7 +22,7 @@
#include "gstomx_h264dec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH264Dec, gst_omx_h264dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -76,7 +76,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -89,27 +88,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingAVC;
}
-
-GType
-gst_omx_h264dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH264DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH264Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxH264Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h264enc.c b/omx/gstomx_h264enc.c
index 1a4510e..c1e9966 100644
--- a/omx/gstomx_h264enc.c
+++ b/omx/gstomx_h264enc.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH264Enc, gst_omx_h264enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -73,7 +73,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -127,27 +126,3 @@ type_instance_init (GTypeInstance *instance,
omx_base_filter->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_h264enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH264EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH264Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEOENC_TYPE, "GstOmxH264Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_ilbcdec.c b/omx/gstomx_ilbcdec.c
index 0547768..9d03f01 100644
--- a/omx/gstomx_ilbcdec.c
+++ b/omx/gstomx_ilbcdec.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxIlbcDec, gst_omx_ilbcdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -122,7 +122,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -167,27 +166,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_ilbcdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxIlbcDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxIlbcDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxIlbcDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_ilbcenc.c b/omx/gstomx_ilbcenc.c
index 789c381..1da2c53 100644
--- a/omx/gstomx_ilbcenc.c
+++ b/omx/gstomx_ilbcenc.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxIlbcEnc, gst_omx_ilbcenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -122,7 +122,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -167,27 +166,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_ilbcenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxIlbcEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxIlbcEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxIlbcEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_jpegenc.c b/omx/gstomx_jpegenc.c
index d826149..b42171c 100644
--- a/omx/gstomx_jpegenc.c
+++ b/omx/gstomx_jpegenc.c
@@ -34,7 +34,7 @@ enum
#define DEFAULT_QUALITY 90
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxJpegEnc, gst_omx_jpegenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -177,8 +177,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -354,27 +352,3 @@ type_instance_init (GTypeInstance *instance,
self->framerate_denom = 1;
self->quality = DEFAULT_QUALITY;
}
-
-GType
-gst_omx_jpegenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxJpegEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxJpegEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxJpegEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c
index b6bef4f..8160c53 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -161,27 +160,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_mp2dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMp2DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMp2Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxMp2Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c
index 0036fac..facf03f 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -161,27 +160,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_mp3dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMp3DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMp3Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxMp3Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mpeg4dec.c b/omx/gstomx_mpeg4dec.c
index 614daf6..a23fef0 100644
--- a/omx/gstomx_mpeg4dec.c
+++ b/omx/gstomx_mpeg4dec.c
@@ -22,7 +22,7 @@
#include "gstomx_mpeg4dec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMpeg4Dec, gst_omx_mpeg4dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -116,27 +115,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingMPEG4;
}
-
-GType
-gst_omx_mpeg4dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMpeg4DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMpeg4Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxMpeg4Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mpeg4enc.c b/omx/gstomx_mpeg4enc.c
index 62f9f23..8311c3b 100644
--- a/omx/gstomx_mpeg4enc.c
+++ b/omx/gstomx_mpeg4enc.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMpeg4Enc, gst_omx_mpeg4enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -75,7 +75,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -131,27 +130,3 @@ type_instance_init (GTypeInstance *instance,
omx_base_filter->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_mpeg4enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMpeg4EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMpeg4Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEOENC_TYPE, "GstOmxMpeg4Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 6627a49..76152ba 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -144,6 +144,48 @@ void g_omx_port_enable (GOmxPort *port);
void g_omx_port_disable (GOmxPort *port);
void g_omx_port_finish (GOmxPort *port);
+/**
+ * Basically like GST_BOILERPLATE / GST_BOILERPLATE_FULL, but follows the
+ * init fxn naming conventions used by gst-openmax. It expects the following
+ * functions to be defined in the same src file following this macro
+ * <ul>
+ * <li> type_base_init(gpointer g_class)
+ * <li> type_class_init(gpointer g_class, gpointer class_data)
+ * <li> type_instance_init(GTypeInstance *instance, gpointer g_class)
+ * </ul>
+ */
+#define GSTOMX_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations) \
+static void type_base_init (gpointer g_class); \
+static void type_class_init (gpointer g_class, gpointer class_data); \
+static void type_instance_init (GTypeInstance *instance, gpointer g_class); \
+static parent_type ## Class *parent_class; \
+static void type_class_init_trampoline (gpointer g_class, gpointer class_data)\
+{ \
+ parent_class = g_type_class_ref (parent_type_macro); \
+ type_class_init (g_class, class_data); \
+} \
+GType type_as_function ## _get_type (void) \
+{ \
+ static GType _type = 0; \
+ if (G_UNLIKELY (_type == 0)) \
+ { \
+ GTypeInfo *type_info; \
+ type_info = g_new0 (GTypeInfo, 1); \
+ type_info->class_size = sizeof (type ## Class); \
+ type_info->base_init = type_base_init; \
+ type_info->class_init = type_class_init_trampoline; \
+ type_info->instance_size = sizeof (type); \
+ type_info->instance_init = type_instance_init; \
+ _type = g_type_register_static (parent_type_macro, #type, type_info, 0);\
+ g_free (type_info); \
+ additional_initializations (_type); \
+ } \
+ return _type; \
+}
+#define GSTOMX_BOILERPLATE(type,type_as_function,parent_type,parent_type_macro) \
+ GSTOMX_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \
+ __GST_DO_NOTHING)
+
/* Utility Macros */
diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c
index dbced76..b2186c6 100644
--- a/omx/gstomx_videosink.c
+++ b/omx/gstomx_videosink.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset, strcmp */
-static GstOmxBaseSinkClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxVideoSink, gst_omx_videosink, GstOmxBaseSink, GST_OMX_BASE_SINK_TYPE);
enum
{
@@ -280,8 +280,6 @@ type_class_init (gpointer g_class,
gobject_class = (GObjectClass *) g_class;
gst_base_sink_class = GST_BASE_SINK_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_SINK_TYPE);
-
gst_base_sink_class->set_caps = setcaps;
gobject_class->set_property = set_property;
@@ -313,27 +311,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
}
-
-GType
-gst_omx_videosink_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxVideoSinkClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxVideoSink);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_SINK_TYPE, "GstOmxVideoSink", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_volume.c b/omx/gstomx_volume.c
index 9e79176..7ccc772 100644
--- a/omx/gstomx_volume.c
+++ b/omx/gstomx_volume.c
@@ -26,7 +26,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxVolume, gst_omx_volume, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -105,7 +105,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -163,27 +162,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_volume_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxVolumeClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxVolume);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxVolume", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c
index aba6b45..b906e67 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -98,7 +98,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -153,28 +152,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_vorbisdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
-
- type_info->class_size = sizeof (GstOmxVorbisDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxVorbisDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxVorbisDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_wmvdec.c b/omx/gstomx_wmvdec.c
index 7c12336..b16fd88 100644
--- a/omx/gstomx_wmvdec.c
+++ b/omx/gstomx_wmvdec.c
@@ -22,7 +22,7 @@
#include "gstomx_wmvdec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxWmvDec, gst_omx_wmvdec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -76,7 +76,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -89,27 +88,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingWMV;
}
-
-GType
-gst_omx_wmvdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxWmvDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxWmvDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxWmvDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
--
1.6.3.2
More information about the Gstreamer-openmax
mailing list