summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <rob@ti.com>2010-03-15 17:29:35 -0500
committerFelipe Contreras <felipe.contreras@nokia.com>2010-04-16 17:24:34 +0300
commitbe97f6edbfdccfe37227361ea089aecdef7905ff (patch)
tree476bf69988ae1b76837d38b6eae2feaa3c5d98ff
parent099c6febe3d7e8772cd142e7793be74500620da0 (diff)
Add GSTOMX_BOILERPLATE macros
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: Felipe Contreras <felipe.contreras@nokia.com>
-rw-r--r--omx/gstomx_aacdec.c27
-rw-r--r--omx/gstomx_aacenc.c28
-rw-r--r--omx/gstomx_adpcmdec.c27
-rw-r--r--omx/gstomx_adpcmenc.c27
-rw-r--r--omx/gstomx_amrnbdec.c27
-rw-r--r--omx/gstomx_amrnbenc.c28
-rw-r--r--omx/gstomx_amrwbdec.c27
-rw-r--r--omx/gstomx_amrwbenc.c28
-rw-r--r--omx/gstomx_audiosink.c27
-rw-r--r--omx/gstomx_base_filter.c50
-rw-r--r--omx/gstomx_base_sink.c52
-rw-r--r--omx/gstomx_base_src.c32
-rw-r--r--omx/gstomx_base_videodec.c27
-rw-r--r--omx/gstomx_base_videoenc.c28
-rw-r--r--omx/gstomx_dummy.c27
-rw-r--r--omx/gstomx_filereadersrc.c27
-rw-r--r--omx/gstomx_g711dec.c27
-rw-r--r--omx/gstomx_g711enc.c27
-rw-r--r--omx/gstomx_g729dec.c27
-rw-r--r--omx/gstomx_g729enc.c28
-rw-r--r--omx/gstomx_h263dec.c27
-rw-r--r--omx/gstomx_h263enc.c27
-rw-r--r--omx/gstomx_h264dec.c27
-rw-r--r--omx/gstomx_h264enc.c27
-rw-r--r--omx/gstomx_ilbcdec.c27
-rw-r--r--omx/gstomx_ilbcenc.c27
-rw-r--r--omx/gstomx_jpegenc.c28
-rw-r--r--omx/gstomx_mp2dec.c27
-rw-r--r--omx/gstomx_mp3dec.c27
-rw-r--r--omx/gstomx_mpeg4dec.c27
-rw-r--r--omx/gstomx_mpeg4enc.c27
-rw-r--r--omx/gstomx_util.h44
-rw-r--r--omx/gstomx_videosink.c28
-rw-r--r--omx/gstomx_volume.c27
-rw-r--r--omx/gstomx_vorbisdec.c28
-rw-r--r--omx/gstomx_wmvdec.c27
36 files changed, 120 insertions, 930 deletions
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index 2ec2b4d..f72178d 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
@@ -214,27 +213,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 ae870e3..5882a31 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;
@@ -431,27 +429,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 86bb54c..ed77085 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
@@ -171,27 +170,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 967ebf9..ab5ce61 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
@@ -235,27 +234,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 bdacb06..a32f162 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
@@ -156,27 +155,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 9cd3e7a..e1c9b19 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;
@@ -266,27 +264,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 0914f84..26e1692 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
@@ -156,27 +155,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 9a11f48..a19e670 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;
@@ -266,27 +264,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 8fa1748..a05a7cd 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)
@@ -136,7 +136,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;
@@ -152,27 +151,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 7ebc52d..9e9d31e 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -33,7 +33,8 @@ enum
ARG_USE_TIMESTAMPS,
};
-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,
@@ -238,6 +239,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -247,8 +253,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;
@@ -929,38 +933,22 @@ 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;
-
- 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_sink.c b/omx/gstomx_base_sink.c
index 4062146..97200b0 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)
@@ -308,6 +309,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -319,8 +325,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;
@@ -462,39 +466,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 70888e7..ee04e78 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)
@@ -372,6 +372,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -381,8 +386,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;
@@ -421,26 +424,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 c6dd364..3ff2f44 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
@@ -277,27 +276,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 6f21a48..7c99a53 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;
@@ -297,27 +295,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 a391b69..f6c8dd1 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 f2b5e73..40cd64b 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
@@ -188,27 +187,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 440f3f4..16d58aa 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
@@ -202,27 +201,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 6a47c0f..b6c41f0 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;
@@ -259,27 +257,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 90237e4..5f39029 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
@@ -135,27 +134,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 3dbf245..336ea9a 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
@@ -133,27 +132,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 2c7c1a1..2799521 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;
@@ -377,27 +375,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 90dcb7f..f6c2568 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
@@ -167,27 +166,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 ad53d29..08f1896 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
@@ -167,27 +166,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 8f40da1..7a91c1c 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
@@ -137,27 +136,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 ce0156c..593b491 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -145,4 +145,48 @@ void g_omx_port_enable (GOmxPort *port);
void g_omx_port_disable (GOmxPort *port);
void g_omx_port_finish (GOmxPort *port);
+/* Utility Macros */
+
+/**
+ * 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)
+
#endif /* GSTOMX_UTIL_H */
diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c
index 3a8cbaa..683ee4c 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
{
@@ -298,8 +298,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;
@@ -331,27 +329,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 3fbc4e9..cd23103 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
@@ -169,27 +168,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 437dc90..2adad9b 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
@@ -158,28 +157,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;
-}