You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
(1) |
Nov
|
Dec
(8) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(5) |
Feb
(3) |
Mar
|
Apr
(2) |
May
(4) |
Jun
(1) |
Jul
(11) |
Aug
(31) |
Sep
(2) |
Oct
(21) |
Nov
(16) |
Dec
(56) |
| 2009 |
Jan
(12) |
Feb
(5) |
Mar
(34) |
Apr
(9) |
May
(5) |
Jun
(7) |
Jul
(18) |
Aug
(5) |
Sep
(2) |
Oct
(6) |
Nov
(50) |
Dec
|
| 2010 |
Jan
(3) |
Feb
(67) |
Mar
(135) |
Apr
(30) |
May
(2) |
Jun
(11) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(4) |
Nov
(17) |
Dec
(11) |
| 2011 |
Jan
(14) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:20:32
|
---
omx/gstomx_base_filter.c | 51 +++++++++++++++++++++++++++++++++++++
omx/gstomx_base_sink.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++
omx/gstomx_base_src.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 177 insertions(+), 0 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 16730fa..02cacaa 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -28,6 +28,8 @@
enum
{
ARG_USE_TIMESTAMPS = GSTOMX_LAST_COMMON_PROP,
+ ARG_NUM_INPUT_BUFFERS,
+ ARG_NUM_OUTPUT_BUFFERS,
};
static void init_interfaces (GType type);
@@ -199,6 +201,31 @@ set_property (GObject *obj,
case ARG_USE_TIMESTAMPS:
self->use_timestamps = g_value_get_boolean (value);
break;
+ case ARG_NUM_INPUT_BUFFERS:
+ case ARG_NUM_OUTPUT_BUFFERS:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+ OMX_U32 nBufferCountActual = g_value_get_uint (value);
+ GOmxPort *port = (prop_id == ARG_NUM_INPUT_BUFFERS) ?
+ self->in_port : self->out_port;
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = port->port_index;
+ g_omx_core_get_param (self->gomx, OMX_IndexParamPortDefinition, ¶m);
+
+ if (nBufferCountActual < param.nBufferCountMin)
+ {
+ GST_ERROR_OBJECT (self, "buffer count %lu is less than minimum %lu",
+ nBufferCountActual, param.nBufferCountMin);
+ return;
+ }
+
+ param.nBufferCountActual = nBufferCountActual;
+
+ g_omx_core_set_param (self->gomx, OMX_IndexParamPortDefinition, ¶m);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -222,6 +249,21 @@ get_property (GObject *obj,
case ARG_USE_TIMESTAMPS:
g_value_set_boolean (value, self->use_timestamps);
break;
+ case ARG_NUM_INPUT_BUFFERS:
+ case ARG_NUM_OUTPUT_BUFFERS:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+ GOmxPort *port = (prop_id == ARG_NUM_INPUT_BUFFERS) ?
+ self->in_port : self->out_port;
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = port->port_index;
+ g_omx_core_get_param (self->gomx, OMX_IndexParamPortDefinition, ¶m);
+
+ g_value_set_uint (value, param.nBufferCountActual);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -258,6 +300,15 @@ type_class_init (gpointer g_class,
g_param_spec_boolean ("use-timestamps", "Use timestamps",
"Whether or not to use timestamps",
TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, ARG_NUM_INPUT_BUFFERS,
+ g_param_spec_uint ("input-buffers", "Input buffers",
+ "The number of OMX input buffers",
+ 1, 10, 4, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, ARG_NUM_OUTPUT_BUFFERS,
+ g_param_spec_uint ("output-buffers", "Output buffers",
+ "The number of OMX output buffers",
+ 1, 10, 4, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index f990bba..8deeafb 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -28,6 +28,11 @@
#include <string.h> /* for memcpy */
+enum
+{
+ ARG_NUM_INPUT_BUFFERS = GSTOMX_LAST_COMMON_PROP,
+};
+
static gboolean share_input_buffer;
static inline gboolean omx_init (GstOmxBaseSink *self);
@@ -275,6 +280,46 @@ handle_event (GstBaseSink *gst_base,
}
static void
+set_property (GObject *obj,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GstOmxBaseSink *self;
+
+ self = GST_OMX_BASE_SINK (obj);
+
+ switch (prop_id)
+ {
+ case ARG_NUM_INPUT_BUFFERS:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+ OMX_U32 nBufferCountActual = g_value_get_uint (value);
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = self->in_port->port_index;
+ g_omx_core_get_param (self->gomx, OMX_IndexParamPortDefinition, ¶m);
+
+ if (nBufferCountActual < param.nBufferCountMin)
+ {
+ GST_ERROR_OBJECT (self, "buffer count %lu is less than minimum %lu",
+ nBufferCountActual, param.nBufferCountMin);
+ return;
+ }
+
+ param.nBufferCountActual = nBufferCountActual;
+
+ g_omx_core_set_param (self->gomx, OMX_IndexParamPortDefinition, ¶m);
+ }
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+ break;
+ }
+}
+
+static void
get_property (GObject *obj,
guint prop_id,
GValue *value,
@@ -288,6 +333,18 @@ get_property (GObject *obj,
{
switch (prop_id)
{
+ case ARG_NUM_INPUT_BUFFERS:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = self->in_port->port_index;
+ g_omx_core_get_param (self->gomx, OMX_IndexParamPortDefinition, ¶m);
+
+ g_value_set_uint (value, param.nBufferCountActual);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -322,9 +379,15 @@ type_class_init (gpointer g_class,
/* Properties stuff */
{
+ gobject_class->set_property = set_property;
gobject_class->get_property = get_property;
gstomx_install_property_helper (gobject_class);
+
+ g_object_class_install_property (gobject_class, ARG_NUM_INPUT_BUFFERS,
+ g_param_spec_uint ("input-buffers", "Input buffers",
+ "The number of OMX input buffers",
+ 1, 10, 4, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index f651644..e8edf5a 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -24,6 +24,11 @@
#include <string.h> /* for memcpy */
+enum
+{
+ ARG_NUM_OUTPUT_BUFFERS = GSTOMX_LAST_COMMON_PROP,
+};
+
GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_SRC);
static void
@@ -338,6 +343,46 @@ handle_event (GstBaseSrc *gst_base,
}
static void
+set_property (GObject *obj,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GstOmxBaseSrc *self;
+
+ self = GST_OMX_BASE_SRC (obj);
+
+ switch (prop_id)
+ {
+ case ARG_NUM_OUTPUT_BUFFERS:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+ OMX_U32 nBufferCountActual = g_value_get_uint (value);
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = self->out_port->port_index;
+ g_omx_core_get_param (self->gomx, OMX_IndexParamPortDefinition, ¶m);
+
+ if (nBufferCountActual < param.nBufferCountMin)
+ {
+ GST_ERROR_OBJECT (self, "buffer count %lu is less than minimum %lu",
+ nBufferCountActual, param.nBufferCountMin);
+ return;
+ }
+
+ param.nBufferCountActual = nBufferCountActual;
+
+ g_omx_core_set_param (self->gomx, OMX_IndexParamPortDefinition, ¶m);
+ }
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+ break;
+ }
+}
+
+static void
get_property (GObject *obj,
guint prop_id,
GValue *value,
@@ -351,6 +396,18 @@ get_property (GObject *obj,
{
switch (prop_id)
{
+ case ARG_NUM_OUTPUT_BUFFERS:
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = self->out_port->port_index;
+ g_omx_core_get_param (self->gomx, OMX_IndexParamPortDefinition, ¶m);
+
+ g_value_set_uint (value, param.nBufferCountActual);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -382,9 +439,15 @@ type_class_init (gpointer g_class,
/* Properties stuff */
{
+ gobject_class->set_property = set_property;
gobject_class->get_property = get_property;
gstomx_install_property_helper (gobject_class);
+
+ g_object_class_install_property (gobject_class, ARG_NUM_OUTPUT_BUFFERS,
+ g_param_spec_uint ("output-buffers", "Output buffers",
+ "The number of OMX output buffers",
+ 1, 10, 4, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:20:12
|
The helper functions consolidate error handling.
---
omx/gstomx_aacdec.c | 2 +-
omx/gstomx_aacenc.c | 14 ++++----
omx/gstomx_adpcmdec.c | 4 +-
omx/gstomx_adpcmenc.c | 6 ++--
omx/gstomx_amrnbdec.c | 2 +-
omx/gstomx_amrnbenc.c | 6 ++--
omx/gstomx_amrwbdec.c | 2 +-
omx/gstomx_amrwbenc.c | 6 ++--
omx/gstomx_audiosink.c | 4 +-
omx/gstomx_base_filter.c | 4 +-
omx/gstomx_base_sink.c | 2 +-
omx/gstomx_base_src.c | 2 +-
omx/gstomx_base_videodec.c | 10 +++---
omx/gstomx_base_videoenc.c | 8 ++--
omx/gstomx_filereadersrc.c | 2 +-
omx/gstomx_g711dec.c | 4 +-
omx/gstomx_g711enc.c | 4 +-
omx/gstomx_g729enc.c | 4 +-
omx/gstomx_h263enc.c | 2 +-
omx/gstomx_h264enc.c | 2 +-
omx/gstomx_jpegenc.c | 12 ++++----
omx/gstomx_mp2dec.c | 2 +-
omx/gstomx_mp3dec.c | 2 +-
omx/gstomx_mpeg4enc.c | 2 +-
omx/gstomx_util.c | 66 ++++++++++++++++++++++++++++++++++++++++++++
omx/gstomx_util.h | 4 ++
omx/gstomx_videosink.c | 12 ++++----
omx/gstomx_volume.c | 2 +-
omx/gstomx_vorbisdec.c | 2 +-
29 files changed, 132 insertions(+), 62 deletions(-)
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index b8f0fb2..782ec2f 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -144,7 +144,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_aacenc.c b/omx/gstomx_aacenc.c
index 2eb0e96..fdcd7fc 100644
--- a/omx/gstomx_aacenc.c
+++ b/omx/gstomx_aacenc.c
@@ -304,12 +304,12 @@ sink_setcaps (GstPad *pad,
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
param.nChannels = channels;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m);
}
{
@@ -349,7 +349,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
/* Output port configuration. */
{
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioAac, ¶m);
GST_DEBUG_OBJECT (omx_base, "setting bitrate: %i", self->bitrate);
param.nBitRate = self->bitrate;
@@ -361,7 +361,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
self->output_format);
param.eAACStreamFormat = self->output_format;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioAac, ¶m);
}
}
@@ -373,7 +373,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
@@ -385,12 +385,12 @@ omx_setup (GstOmxBaseFilter *omx_base)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioAac, ¶m);
param.nSampleRate = rate;
param.nChannels = channels;
- OMX_SetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
+ g_omx_core_set_param (omx_base->gomx, OMX_IndexParamAudioAac, ¶m);
}
#endif
diff --git a/omx/gstomx_adpcmdec.c b/omx/gstomx_adpcmdec.c
index 63151d9..8826387 100644
--- a/omx/gstomx_adpcmdec.c
+++ b/omx/gstomx_adpcmdec.c
@@ -126,11 +126,11 @@ sink_setcaps (GstPad *pad,
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m);
}
/* set caps on the srcpad */
diff --git a/omx/gstomx_adpcmenc.c b/omx/gstomx_adpcmenc.c
index fabb4bd..cf97200 100644
--- a/omx/gstomx_adpcmenc.c
+++ b/omx/gstomx_adpcmenc.c
@@ -117,7 +117,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAdpcm, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioAdpcm, ¶m);
rate = param.nSampleRate;
}
@@ -178,11 +178,11 @@ sink_setcaps (GstPad *pad,
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m);
}
/* set caps on the srcpad */
diff --git a/omx/gstomx_amrnbdec.c b/omx/gstomx_amrnbdec.c
index 6d0cbaf..600a513 100644
--- a/omx/gstomx_amrnbdec.c
+++ b/omx/gstomx_amrnbdec.c
@@ -117,7 +117,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_amrnbenc.c b/omx/gstomx_amrnbenc.c
index 5e1ccff..f6401d5 100644
--- a/omx/gstomx_amrnbenc.c
+++ b/omx/gstomx_amrnbenc.c
@@ -182,7 +182,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioAmr, ¶m);
channels = param.nChannels;
}
@@ -229,12 +229,12 @@ sink_setcaps (GstPad *pad,
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
param.nChannels = channels;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m);
}
return gst_pad_set_caps (pad, caps);
diff --git a/omx/gstomx_amrwbdec.c b/omx/gstomx_amrwbdec.c
index cb41789..2e77188 100644
--- a/omx/gstomx_amrwbdec.c
+++ b/omx/gstomx_amrwbdec.c
@@ -117,7 +117,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_amrwbenc.c b/omx/gstomx_amrwbenc.c
index 352b93f..a4b93d8 100644
--- a/omx/gstomx_amrwbenc.c
+++ b/omx/gstomx_amrwbenc.c
@@ -182,7 +182,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioAmr, ¶m);
channels = param.nChannels;
}
@@ -229,12 +229,12 @@ sink_setcaps (GstPad *pad,
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
param.nChannels = channels;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m);
}
return gst_pad_set_caps (pad, caps);
diff --git a/omx/gstomx_audiosink.c b/omx/gstomx_audiosink.c
index 5f63d4c..5a3e753 100644
--- a/omx/gstomx_audiosink.c
+++ b/omx/gstomx_audiosink.c
@@ -110,7 +110,7 @@ setcaps (GstBaseSink *gst_sink,
G_OMX_INIT_PARAM (param);
param.nPortIndex = self->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m);
param.nChannels = channels;
param.eNumData = is_signed ? OMX_NumericalDataSigned : OMX_NumericalDataUnsigned;
@@ -118,7 +118,7 @@ setcaps (GstBaseSink *gst_sink,
param.nBitPerSample = width;
param.nSamplingRate = rate;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m);
}
}
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 487e4ee..16730fa 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -60,14 +60,14 @@ setup_ports (GstOmxBaseFilter *self)
/* Input port configuration. */
param.nPortIndex = self->in_port->port_index;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
/* Output port configuration. */
param.nPortIndex = self->out_port->port_index;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->out_port, ¶m);
gst_pad_set_element_private (self->srcpad, self->out_port);
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index bc7e26b..f990bba 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -48,7 +48,7 @@ setup_ports (GstOmxBaseSink *self)
/* Input port configuration. */
param.nPortIndex = self->in_port->port_index;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
}
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index ba6ad8e..f651644 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -39,7 +39,7 @@ setup_ports (GstOmxBaseSrc *self)
/* Input port configuration. */
param.nPortIndex = self->out_port->port_index;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->out_port, ¶m);
if (self->setup_ports)
diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c
index 56b79d1..74114ef 100644
--- a/omx/gstomx_base_videodec.c
+++ b/omx/gstomx_base_videodec.c
@@ -111,7 +111,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
height = param.format.video.nFrameHeight;
@@ -209,12 +209,12 @@ sink_setcaps (GstPad *pad,
/* Input port configuration. */
{
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m);
param.format.video.nFrameWidth = width;
param.format.video.nFrameHeight = height;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m);
}
return gst_pad_set_caps (pad, caps);
@@ -239,11 +239,11 @@ omx_setup (GstOmxBaseFilter *omx_base)
/* Input port configuration. */
{
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m);
param.format.video.eCompressionFormat = self->compression_format;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m);
}
}
diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c
index f469494..dbb006d 100644
--- a/omx/gstomx_base_videoenc.c
+++ b/omx/gstomx_base_videoenc.c
@@ -221,7 +221,7 @@ sink_setcaps (GstPad *pad,
/* Input port configuration. */
{
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m);
param.format.video.nFrameWidth = width;
param.format.video.nFrameHeight = height;
@@ -234,7 +234,7 @@ sink_setcaps (GstPad *pad,
gst_value_get_fraction_denominator (framerate);
}
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m);
}
}
@@ -260,14 +260,14 @@ omx_setup (GstOmxBaseFilter *omx_base)
/* Output port configuration. */
{
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m);
param.format.video.eCompressionFormat = self->compression_format;
if (self->bitrate != 0)
param.format.video.nBitrate = self->bitrate;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m);
}
}
diff --git a/omx/gstomx_filereadersrc.c b/omx/gstomx_filereadersrc.c
index f6c8dd1..298b7c3 100644
--- a/omx/gstomx_filereadersrc.c
+++ b/omx/gstomx_filereadersrc.c
@@ -110,7 +110,7 @@ setup_ports (GstOmxBaseSrc *base_src)
{
OMX_INDEXTYPE index;
OMX_GetExtensionIndex (gomx->omx_handle, "OMX.ST.index.param.filereader.inputfilename", &index);
- OMX_SetParameter (gomx->omx_handle, index, self->file_name);
+ g_omx_core_set_param (gomx, index, self->file_name);
}
}
diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c
index 623101e..cd11e4a 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -140,14 +140,14 @@ sink_setcaps (GstPad *pad,
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m);
if (strcmp (mode, "audio/x-alaw") == 0)
param.ePCMMode = OMX_AUDIO_PCMModeALaw;
else if (strcmp (mode, "audio/x-mulaw") == 0)
param.ePCMMode = OMX_AUDIO_PCMModeMULaw;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m);
}
/* set caps on the srcpad */
diff --git a/omx/gstomx_g711enc.c b/omx/gstomx_g711enc.c
index 003058e..915301a 100644
--- a/omx/gstomx_g711enc.c
+++ b/omx/gstomx_g711enc.c
@@ -150,14 +150,14 @@ sink_setcaps (GstPad *pad,
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioPcm, ¶m);
if (strcmp (mode, "audio/x-alaw") == 0)
param.ePCMMode = OMX_AUDIO_PCMModeALaw;
else if (strcmp (mode, "audio/x-mulaw") == 0)
param.ePCMMode = OMX_AUDIO_PCMModeMULaw;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioPcm, ¶m);
}
leave:
diff --git a/omx/gstomx_g729enc.c b/omx/gstomx_g729enc.c
index 89d58db..3a388f1 100644
--- a/omx/gstomx_g729enc.c
+++ b/omx/gstomx_g729enc.c
@@ -226,11 +226,11 @@ omx_setup (GstOmxBaseFilter *omx_base)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamAudioG729, ¶m);
param.bDTX = self->dtx;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamAudioG729, ¶m);
}
GST_INFO_OBJECT (omx_base, "end");
diff --git a/omx/gstomx_h263enc.c b/omx/gstomx_h263enc.c
index 9caaff7..f7b2999 100644
--- a/omx/gstomx_h263enc.c
+++ b/omx/gstomx_h263enc.c
@@ -93,7 +93,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base_filter->out_port->port_index;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
height = param.format.video.nFrameHeight;
diff --git a/omx/gstomx_h264enc.c b/omx/gstomx_h264enc.c
index efc4092..95f3894 100644
--- a/omx/gstomx_h264enc.c
+++ b/omx/gstomx_h264enc.c
@@ -92,7 +92,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base_filter->out_port->port_index;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
height = param.format.video.nFrameHeight;
diff --git a/omx/gstomx_jpegenc.c b/omx/gstomx_jpegenc.c
index e34c3fc..9d45ce6 100644
--- a/omx/gstomx_jpegenc.c
+++ b/omx/gstomx_jpegenc.c
@@ -209,7 +209,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamPortDefinition, ¶m);
width = param.format.image.nFrameWidth;
height = param.format.image.nFrameHeight;
@@ -289,13 +289,13 @@ sink_setcaps (GstPad *pad,
/* Input port configuration. */
{
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m);
param.format.image.nFrameWidth = width;
param.format.image.nFrameHeight = height;
param.format.image.eColorFormat = color_format;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m);
}
}
@@ -321,11 +321,11 @@ omx_setup (GstOmxBaseFilter *omx_base)
/* Output port configuration. */
{
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m);
param.format.image.eCompressionFormat = OMX_IMAGE_CodingJPEG;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m);
}
}
@@ -337,7 +337,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
param.nQFactor = self->quality;
param.nPortIndex = omx_base->out_port->port_index;
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamQFactor, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamQFactor, ¶m);
}
GST_INFO_OBJECT (omx_base, "end");
diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c
index 564e14c..7f7c312 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -120,7 +120,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c
index a766689..e7bf6ec 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -120,7 +120,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_mpeg4enc.c b/omx/gstomx_mpeg4enc.c
index 3f97fb0..bc524d0 100644
--- a/omx/gstomx_mpeg4enc.c
+++ b/omx/gstomx_mpeg4enc.c
@@ -94,7 +94,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base_filter->out_port->port_index;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (core, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
height = param.format.video.nFrameHeight;
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index b6633e4..128f06a 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -480,9 +480,75 @@ g_omx_core_get_handle (GOmxCore *core)
{
if (!core->omx_handle)
g_omx_core_init (core);
+ if (!core->omx_handle)
+ GST_WARNING_OBJECT (core->object, "could not get handle");
return core->omx_handle;
}
+void
+g_omx_core_get_param (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param)
+{
+ OMX_HANDLETYPE omx_handle = g_omx_core_get_handle (core);
+ OMX_ERRORTYPE err;
+
+ if (!omx_handle)
+ return;
+
+ err = OMX_GetParameter (omx_handle, idx, param);
+
+ if (OMX_ErrorNone != err)
+ GST_WARNING_OBJECT (core->object, "OMX_GetParameter(%d) failed: %s",
+ idx, omx_error_to_str (err));
+}
+
+void
+g_omx_core_set_param (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param)
+{
+ OMX_HANDLETYPE omx_handle = g_omx_core_get_handle (core);
+ OMX_ERRORTYPE err;
+
+ if (!omx_handle)
+ return;
+
+ err = OMX_SetParameter (omx_handle, idx, param);
+
+ if (OMX_ErrorNone != err)
+ GST_WARNING_OBJECT (core->object, "OMX_SetParameter(%d) failed: %s",
+ idx, omx_error_to_str (err));
+}
+
+void
+g_omx_core_get_config (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param)
+{
+ OMX_HANDLETYPE omx_handle = g_omx_core_get_handle (core);
+ OMX_ERRORTYPE err;
+
+ if (!omx_handle)
+ return;
+
+ err = OMX_GetConfig (omx_handle, idx, param);
+
+ if (OMX_ErrorNone != err)
+ GST_WARNING_OBJECT (core->object, "OMX_GetConfig(%d) failed: %s",
+ idx, omx_error_to_str (err));
+}
+
+void
+g_omx_core_set_config (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param)
+{
+ OMX_HANDLETYPE omx_handle = g_omx_core_get_handle (core);
+ OMX_ERRORTYPE err;
+
+ if (!omx_handle)
+ return;
+
+ err = OMX_SetConfig (omx_handle, idx, param);
+
+ if (OMX_ErrorNone != err)
+ GST_WARNING_OBJECT (core->object, "OMX_SetConfig(%d) failed: %s",
+ idx, omx_error_to_str (err));
+}
+
/*
* Port
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 87a1f3f..c647998 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -131,6 +131,10 @@ void g_omx_core_wait_for_done (GOmxCore *core);
void g_omx_core_flush_start (GOmxCore *core);
void g_omx_core_flush_stop (GOmxCore *core);
OMX_HANDLETYPE g_omx_core_get_handle (GOmxCore *core);
+void g_omx_core_get_param (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param);
+void g_omx_core_set_param (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param);
+void g_omx_core_get_config (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param);
+void g_omx_core_set_config (GOmxCore *core, OMX_INDEXTYPE idx, OMX_PTR param);
GOmxPort *g_omx_core_get_port (GOmxCore *core, guint index);
GOmxPort *g_omx_port_new (GOmxCore *core, guint index);
diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c
index 4cfc300..30ae6a5 100644
--- a/omx/gstomx_videosink.c
+++ b/omx/gstomx_videosink.c
@@ -164,7 +164,7 @@ setcaps (GstBaseSink *gst_sink,
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
- OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_get_param (gomx, OMX_IndexParamPortDefinition, ¶m);
switch (color_format)
{
@@ -191,7 +191,7 @@ setcaps (GstBaseSink *gst_sink,
gst_value_get_fraction_denominator (framerate);
}
- OMX_SetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ g_omx_core_set_param (gomx, OMX_IndexParamPortDefinition, ¶m);
}
{
@@ -200,11 +200,11 @@ setcaps (GstBaseSink *gst_sink,
G_OMX_INIT_PARAM (config);
config.nPortIndex = omx_base->in_port->port_index;
- OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
+ g_omx_core_get_config (gomx, OMX_IndexConfigCommonScale, &config);
config.nRotation = self->rotation;
- OMX_SetConfig (gomx->omx_handle, OMX_IndexConfigCommonRotate, &config);
+ g_omx_core_set_config (gomx, OMX_IndexConfigCommonRotate, &config);
}
{
@@ -213,12 +213,12 @@ setcaps (GstBaseSink *gst_sink,
G_OMX_INIT_PARAM (config);
config.nPortIndex = omx_base->in_port->port_index;
- OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
+ g_omx_core_get_config (gomx, OMX_IndexConfigCommonScale, &config);
config.xWidth = self->x_scale;
config.xHeight = self->y_scale;
- OMX_SetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
+ g_omx_core_set_config (gomx, OMX_IndexConfigCommonScale, &config);
}
}
diff --git a/omx/gstomx_volume.c b/omx/gstomx_volume.c
index 61c7f79..a9724c3 100644
--- a/omx/gstomx_volume.c
+++ b/omx/gstomx_volume.c
@@ -122,7 +122,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c
index fa532df..d405dfa 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -115,7 +115,7 @@ settings_changed_cb (GOmxCore *core)
G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+ g_omx_core_get_param (omx_base->gomx, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
channels = param.nChannels;
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:19:21
|
---
omx/gstomx_aacdec.c | 7 +------
omx/gstomx_aacenc.c | 22 ++++------------------
omx/gstomx_adpcmdec.c | 7 +------
omx/gstomx_adpcmenc.c | 12 ++----------
omx/gstomx_amrnbdec.c | 7 +------
omx/gstomx_amrnbenc.c | 12 ++----------
omx/gstomx_amrwbdec.c | 7 +------
omx/gstomx_amrwbenc.c | 12 ++----------
omx/gstomx_audiosink.c | 7 +------
omx/gstomx_base_filter.c | 7 ++-----
omx/gstomx_base_sink.c | 7 ++-----
omx/gstomx_base_src.c | 7 ++-----
omx/gstomx_base_videodec.c | 18 +++---------------
omx/gstomx_base_videoenc.c | 13 ++++---------
omx/gstomx_g711dec.c | 7 ++-----
omx/gstomx_g711enc.c | 7 ++-----
omx/gstomx_g729enc.c | 7 +------
omx/gstomx_h263enc.c | 7 +------
omx/gstomx_h264enc.c | 7 +------
omx/gstomx_jpegenc.c | 20 ++++----------------
omx/gstomx_mp2dec.c | 7 +------
omx/gstomx_mp3dec.c | 7 +------
omx/gstomx_mpeg4enc.c | 7 +------
omx/gstomx_util.h | 9 +++++++++
omx/gstomx_videosink.c | 17 ++++-------------
omx/gstomx_volume.c | 7 +------
omx/gstomx_vorbisdec.c | 7 +------
27 files changed, 57 insertions(+), 204 deletions(-)
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index 1f22dd8..b8f0fb2 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -143,10 +141,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_aacenc.c b/omx/gstomx_aacenc.c
index 565bc82..2eb0e96 100644
--- a/omx/gstomx_aacenc.c
+++ b/omx/gstomx_aacenc.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
enum
{
ARG_0,
@@ -303,10 +301,7 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
@@ -349,10 +344,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_AUDIO_PARAM_AACPROFILETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_AACPROFILETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
/* Output port configuration. */
{
@@ -378,10 +370,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
@@ -393,10 +382,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_AUDIO_PARAM_AACPROFILETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_AACPROFILETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
diff --git a/omx/gstomx_adpcmdec.c b/omx/gstomx_adpcmdec.c
index 12ee81f..63151d9 100644
--- a/omx/gstomx_adpcmdec.c
+++ b/omx/gstomx_adpcmdec.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxAdpcmDec, gst_omx_adpcmdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -125,10 +123,7 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_adpcmenc.c b/omx/gstomx_adpcmenc.c
index fea6bf4..fabb4bd 100644
--- a/omx/gstomx_adpcmenc.c
+++ b/omx/gstomx_adpcmenc.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxAdpcmEnc, gst_omx_adpcmenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -116,10 +114,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_ADPCMTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_ADPCMTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAdpcm, ¶m);
@@ -180,10 +175,7 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_amrnbdec.c b/omx/gstomx_amrnbdec.c
index f32b15f..6d0cbaf 100644
--- a/omx/gstomx_amrnbdec.c
+++ b/omx/gstomx_amrnbdec.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -116,10 +114,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_amrnbenc.c b/omx/gstomx_amrnbenc.c
index cc3486f..5e1ccff 100644
--- a/omx/gstomx_amrnbenc.c
+++ b/omx/gstomx_amrnbenc.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
enum
{
ARG_0,
@@ -181,10 +179,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_AMRTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_AMRTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m);
@@ -231,10 +226,7 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_amrwbdec.c b/omx/gstomx_amrwbdec.c
index 20dddcb..cb41789 100644
--- a/omx/gstomx_amrwbdec.c
+++ b/omx/gstomx_amrwbdec.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -116,10 +114,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_amrwbenc.c b/omx/gstomx_amrwbenc.c
index 3d95272..352b93f 100644
--- a/omx/gstomx_amrwbenc.c
+++ b/omx/gstomx_amrwbenc.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
enum
{
ARG_0,
@@ -181,10 +179,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_AMRTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_AMRTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m);
@@ -231,10 +226,7 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_audiosink.c b/omx/gstomx_audiosink.c
index 6c912f0..5f63d4c 100644
--- a/omx/gstomx_audiosink.c
+++ b/omx/gstomx_audiosink.c
@@ -22,8 +22,6 @@
#include "gstomx_audiosink.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxAudioSink, gst_omx_audiosink, GstOmxBaseSink, GST_OMX_BASE_SINK_TYPE);
static GstCaps *
@@ -109,10 +107,7 @@ setcaps (GstBaseSink *gst_sink,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = self->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 70bf617..487e4ee 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -23,7 +23,7 @@
#include "gstomx.h"
#include "gstomx_interface.h"
-#include <string.h> /* for memset, memcpy */
+#include <string.h> /* for memcpy */
enum
{
@@ -55,10 +55,7 @@ setup_ports (GstOmxBaseFilter *self)
core = self->gomx;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
/* Input port configuration. */
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index 5ea7c31..bc7e26b 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -26,7 +26,7 @@
#include "gstomx.h"
#include "gstomx_interface.h"
-#include <string.h> /* for memset, memcpy */
+#include <string.h> /* for memcpy */
static gboolean share_input_buffer;
@@ -43,10 +43,7 @@ setup_ports (GstOmxBaseSink *self)
core = self->gomx;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
/* Input port configuration. */
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 54f9032..ba6ad8e 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -22,7 +22,7 @@
#include "gstomx_base_src.h"
#include "gstomx.h"
-#include <string.h> /* for memset, memcpy */
+#include <string.h> /* for memcpy */
GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_SRC);
@@ -34,10 +34,7 @@ setup_ports (GstOmxBaseSrc *self)
core = self->gomx;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
/* Input port configuration. */
diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c
index 5c6d1e1..56b79d1 100644
--- a/omx/gstomx_base_videodec.c
+++ b/omx/gstomx_base_videodec.c
@@ -22,8 +22,6 @@
#include "gstomx_base_videodec.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxBaseVideoDec, gst_omx_base_videodec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -110,11 +108,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
-
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
@@ -197,10 +191,7 @@ sink_setcaps (GstPad *pad,
}
}
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
{
const GValue *codec_data;
@@ -243,10 +234,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
/* Input port configuration. */
{
diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c
index d243fbd..f469494 100644
--- a/omx/gstomx_base_videoenc.c
+++ b/omx/gstomx_base_videoenc.c
@@ -22,7 +22,7 @@
#include "gstomx_base_videoenc.h"
#include "gstomx.h"
-#include <string.h> /* for memset, strcmp */
+#include <string.h> /* for strcmp */
enum
{
@@ -215,10 +215,8 @@ sink_setcaps (GstPad *pad,
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+
+ G_OMX_INIT_PARAM (param);
/* Input port configuration. */
{
@@ -257,10 +255,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
/* Output port configuration. */
{
diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c
index bc2fb18..623101e 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset, strcmp */
+#include <string.h> /* for strcmp */
GSTOMX_BOILERPLATE (GstOmxG711Dec, gst_omx_g711dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
@@ -137,10 +137,7 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_g711enc.c b/omx/gstomx_g711enc.c
index ba8d297..003058e 100644
--- a/omx/gstomx_g711enc.c
+++ b/omx/gstomx_g711enc.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset, strcmp */
+#include <string.h> /* for strcmp */
GSTOMX_BOILERPLATE (GstOmxG711Enc, gst_omx_g711enc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
@@ -147,10 +147,7 @@ sink_setcaps (GstPad *pad,
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_g729enc.c b/omx/gstomx_g729enc.c
index 67f9b38..89d58db 100644
--- a/omx/gstomx_g729enc.c
+++ b/omx/gstomx_g729enc.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
#define DEFAULT_DTX TRUE
enum
@@ -225,10 +223,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_AUDIO_PARAM_G729TYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_G729TYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m);
diff --git a/omx/gstomx_h263enc.c b/omx/gstomx_h263enc.c
index 2d2a1a0..9caaff7 100644
--- a/omx/gstomx_h263enc.c
+++ b/omx/gstomx_h263enc.c
@@ -22,8 +22,6 @@
#include "gstomx_h263enc.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxH263Enc, gst_omx_h263enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
@@ -92,10 +90,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base_filter->out_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
diff --git a/omx/gstomx_h264enc.c b/omx/gstomx_h264enc.c
index 7d2c2b6..efc4092 100644
--- a/omx/gstomx_h264enc.c
+++ b/omx/gstomx_h264enc.c
@@ -22,8 +22,6 @@
#include "gstomx_h264enc.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxH264Enc, gst_omx_h264enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
@@ -91,10 +89,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base_filter->out_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
diff --git a/omx/gstomx_jpegenc.c b/omx/gstomx_jpegenc.c
index 63ff8fe..e34c3fc 100644
--- a/omx/gstomx_jpegenc.c
+++ b/omx/gstomx_jpegenc.c
@@ -206,10 +206,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
@@ -287,10 +284,7 @@ sink_setcaps (GstPad *pad,
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
/* Input port configuration. */
{
@@ -322,10 +316,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
/* Output port configuration. */
{
@@ -341,10 +332,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
{
OMX_IMAGE_PARAM_QFACTORTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_IMAGE_PARAM_QFACTORTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nQFactor = self->quality;
param.nPortIndex = omx_base->out_port->port_index;
diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c
index 6e78e5f..564e14c 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -119,10 +117,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c
index 3824a9d..a766689 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -119,10 +117,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_mpeg4enc.c b/omx/gstomx_mpeg4enc.c
index f365639..3f97fb0 100644
--- a/omx/gstomx_mpeg4enc.c
+++ b/omx/gstomx_mpeg4enc.c
@@ -22,8 +22,6 @@
#include "gstomx_mpeg4enc.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxMpeg4Enc, gst_omx_mpeg4enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
@@ -93,10 +91,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base_filter->out_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 404df8a..87a1f3f 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -195,4 +195,13 @@ GType type_as_function ## _get_type (void) \
GSTOMX_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \
__GST_DO_NOTHING)
+#include <string.h> /* for memset */
+#define G_OMX_INIT_PARAM(param) G_STMT_START { \
+ memset (&(param), 0, sizeof ((param))); \
+ (param).nSize = sizeof (param); \
+ (param).nVersion.s.nVersionMajor = 1; \
+ (param).nVersion.s.nVersionMinor = 1; \
+ } G_STMT_END
+
+
#endif /* GSTOMX_UTIL_H */
diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c
index 7c5849b..4cfc300 100644
--- a/omx/gstomx_videosink.c
+++ b/omx/gstomx_videosink.c
@@ -23,7 +23,7 @@
#include "gstomx_base_sink.h"
#include "gstomx.h"
-#include <string.h> /* for memset, strcmp */
+#include <string.h> /* for strcmp */
GSTOMX_BOILERPLATE (GstOmxVideoSink, gst_omx_videosink, GstOmxBaseSink, GST_OMX_BASE_SINK_TYPE);
@@ -161,10 +161,7 @@ setcaps (GstBaseSink *gst_sink,
{
OMX_PARAM_PORTDEFINITIONTYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
@@ -200,10 +197,7 @@ setcaps (GstBaseSink *gst_sink,
{
OMX_CONFIG_ROTATIONTYPE config;
- memset (&config, 0, sizeof (config));
- config.nSize = sizeof (OMX_CONFIG_ROTATIONTYPE);
- config.nVersion.s.nVersionMajor = 1;
- config.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (config);
config.nPortIndex = omx_base->in_port->port_index;
OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
@@ -216,10 +210,7 @@ setcaps (GstBaseSink *gst_sink,
{
OMX_CONFIG_SCALEFACTORTYPE config;
- memset (&config, 0, sizeof (config));
- config.nSize = sizeof (OMX_CONFIG_SCALEFACTORTYPE);
- config.nVersion.s.nVersionMajor = 1;
- config.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (config);
config.nPortIndex = omx_base->in_port->port_index;
OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
diff --git a/omx/gstomx_volume.c b/omx/gstomx_volume.c
index 91e116e..61c7f79 100644
--- a/omx/gstomx_volume.c
+++ b/omx/gstomx_volume.c
@@ -24,8 +24,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxVolume, gst_omx_volume, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -121,10 +119,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c
index aad896a..fa532df 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -23,8 +23,6 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-#include <string.h> /* for memset */
-
GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
@@ -114,10 +112,7 @@ settings_changed_cb (GOmxCore *core)
{
OMX_AUDIO_PARAM_PCMMODETYPE param;
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
+ G_OMX_INIT_PARAM (param);
param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:18:23
|
---
omx/gstomx_util.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index efe953d..b6633e4 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -157,6 +157,9 @@ imp_new (const gchar *name)
void *handle;
imp->dl_handle = handle = dlopen (name, RTLD_LAZY);
+
+ GST_DEBUG ("dlopen(%s) -> %p", name, handle);
+
if (!handle)
{
g_warning ("%s\n", dlerror ());
@@ -307,6 +310,9 @@ g_omx_core_init (GOmxCore *core)
if (core->omx_handle)
return;
+ GST_DEBUG_OBJECT (core->object, "loading: %s (%s)",
+ core->component_name, core->library_name);
+
core->imp = request_imp (core->library_name);
if (!core->imp)
@@ -316,6 +322,10 @@ g_omx_core_init (GOmxCore *core)
(char *) core->component_name,
core,
&callbacks);
+
+ GST_DEBUG_OBJECT (core->object, "OMX_GetHandle(&%p) -> %d",
+ core->omx_handle, core->omx_error);
+
if (!core->omx_error)
core->omx_state = OMX_StateLoaded;
}
@@ -332,6 +342,8 @@ g_omx_core_deinit (GOmxCore *core)
if (core->omx_handle)
{
core->omx_error = core->imp->sym_table.free_handle (core->omx_handle);
+ GST_DEBUG_OBJECT (core->object, "OMX_FreeHandle(%p) -> %d",
+ core->omx_handle, core->omx_error);
core->omx_handle = NULL;
}
}
@@ -530,6 +542,10 @@ g_omx_port_setup (GOmxPort *port,
port->num_buffers = omx_port->nBufferCountActual;
port->buffer_size = omx_port->nBufferSize;
+ GST_DEBUG_OBJECT (port->core->object,
+ "type=%d, num_buffers=%d, buffer_size=%ld, port_index=%d",
+ port->type, port->num_buffers, port->buffer_size, port->port_index);
+
g_free (port->buffers);
port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port->num_buffers);
}
@@ -862,6 +878,8 @@ EventHandler (OMX_HANDLETYPE omx_handle,
cmd = (OMX_COMMANDTYPE) data_1;
+ GST_DEBUG_OBJECT (core->object, "OMX_EventCmdComplete: %d", cmd);
+
switch (cmd)
{
case OMX_CommandStateSet:
@@ -880,6 +898,7 @@ EventHandler (OMX_HANDLETYPE omx_handle,
}
case OMX_EventBufferFlag:
{
+ GST_DEBUG_OBJECT (core->object, "OMX_EventBufferFlag");
if (data_2 & OMX_BUFFERFLAG_EOS)
{
g_omx_core_set_done (core);
@@ -888,6 +907,7 @@ EventHandler (OMX_HANDLETYPE omx_handle,
}
case OMX_EventPortSettingsChanged:
{
+ GST_DEBUG_OBJECT (core->object, "OMX_EventPortSettingsChanged");
/** @todo only on the relevant port. */
if (core->settings_changed_cb)
{
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:17:55
|
A method for GOmxCore object which can be called at any time to access OMX component handle. If the OMX component is not yet instantiated, this will
trigger OMX_GetHandle(). This makes it safe to use in places like get/set_property methods which could be called before the OMX component would otherwise
be instantiated.
---
omx/gstomx_util.c | 29 ++++++++++++++++++++++++++++-
omx/gstomx_util.h | 1 +
2 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index d8cc7f0..efe953d 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -287,6 +287,8 @@ g_omx_core_new (void *object)
void
g_omx_core_free (GOmxCore *core)
{
+ g_omx_core_deinit (core); /* just in case we didn't have a READY->NULL.. mainly for gst-inspect */
+
g_sem_free (core->port_sem);
g_sem_free (core->flush_sem);
g_sem_free (core->done_sem);
@@ -302,6 +304,9 @@ g_omx_core_free (GOmxCore *core)
void
g_omx_core_init (GOmxCore *core)
{
+ if (core->omx_handle)
+ return;
+
core->imp = request_imp (core->library_name);
if (!core->imp)
@@ -318,14 +323,21 @@ g_omx_core_init (GOmxCore *core)
void
g_omx_core_deinit (GOmxCore *core)
{
- if (!core->imp)
+ if (!core->imp || !core->omx_handle)
return;
if (core->omx_state == OMX_StateLoaded ||
core->omx_state == OMX_StateInvalid)
{
if (core->omx_handle)
+ {
core->omx_error = core->imp->sym_table.free_handle (core->omx_handle);
+ core->omx_handle = NULL;
+ }
+ }
+ else
+ {
+ GST_WARNING ("incorrect state: %s", omx_state_to_str (core->omx_state));
}
g_free (core->library_name);
@@ -445,6 +457,21 @@ g_omx_core_flush_stop (GOmxCore *core)
core_for_each_port (core, g_omx_port_resume);
}
+/**
+ * Accessor for OMX component handle. If the OMX component is not constructed
+ * yet, this will trigger it to be constructed (OMX_GetHandle()). This should
+ * at least be used in places where g_omx_core_init() might not have been
+ * called yet (such as setting/getting properties)
+ */
+OMX_HANDLETYPE
+g_omx_core_get_handle (GOmxCore *core)
+{
+ if (!core->omx_handle)
+ g_omx_core_init (core);
+ return core->omx_handle;
+}
+
+
/*
* Port
*/
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 060b042..404df8a 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -130,6 +130,7 @@ void g_omx_core_set_done (GOmxCore *core);
void g_omx_core_wait_for_done (GOmxCore *core);
void g_omx_core_flush_start (GOmxCore *core);
void g_omx_core_flush_stop (GOmxCore *core);
+OMX_HANDLETYPE g_omx_core_get_handle (GOmxCore *core);
GOmxPort *g_omx_core_get_port (GOmxCore *core, guint index);
GOmxPort *g_omx_port_new (GOmxCore *core, guint index);
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:17:30
|
This improves readability by keeping knowledge of numeric port-index value in only one place (in the element constructor), and makes it easier to later add
derived classes with different port indexes (for example GstOmxCamera subclassing GstOmxBaseSrc, but having GstOmxBaseSrc handling a port whose index != 0
while derived class handles port index 0 and others).
---
omx/gstomx_aacdec.c | 2 +-
omx/gstomx_aacenc.c | 8 ++++----
omx/gstomx_adpcmdec.c | 2 +-
omx/gstomx_adpcmenc.c | 4 ++--
omx/gstomx_amrnbdec.c | 2 +-
omx/gstomx_amrnbenc.c | 4 ++--
omx/gstomx_amrwbdec.c | 2 +-
omx/gstomx_amrwbenc.c | 4 ++--
omx/gstomx_audiosink.c | 2 +-
omx/gstomx_base_filter.c | 4 ++--
omx/gstomx_base_sink.c | 2 +-
omx/gstomx_base_src.c | 2 +-
omx/gstomx_base_videodec.c | 6 +++---
omx/gstomx_base_videoenc.c | 4 ++--
omx/gstomx_g711dec.c | 2 +-
omx/gstomx_g711enc.c | 2 +-
omx/gstomx_g729enc.c | 2 +-
omx/gstomx_h263enc.c | 2 +-
omx/gstomx_h264enc.c | 2 +-
omx/gstomx_jpegenc.c | 8 ++++----
omx/gstomx_mp2dec.c | 2 +-
omx/gstomx_mp3dec.c | 2 +-
omx/gstomx_mpeg4enc.c | 2 +-
omx/gstomx_videosink.c | 6 +++---
omx/gstomx_volume.c | 2 +-
omx/gstomx_vorbisdec.c | 2 +-
26 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index f72178d..1f22dd8 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -148,7 +148,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
diff --git a/omx/gstomx_aacenc.c b/omx/gstomx_aacenc.c
index 5882a31..565bc82 100644
--- a/omx/gstomx_aacenc.c
+++ b/omx/gstomx_aacenc.c
@@ -308,7 +308,7 @@ sink_setcaps (GstPad *pad,
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
@@ -356,7 +356,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
/* Output port configuration. */
{
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
GST_DEBUG_OBJECT (omx_base, "setting bitrate: %i", self->bitrate);
@@ -383,7 +383,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
@@ -398,7 +398,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, ¶m);
param.nSampleRate = rate;
diff --git a/omx/gstomx_adpcmdec.c b/omx/gstomx_adpcmdec.c
index ed77085..12ee81f 100644
--- a/omx/gstomx_adpcmdec.c
+++ b/omx/gstomx_adpcmdec.c
@@ -130,7 +130,7 @@ sink_setcaps (GstPad *pad,
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
diff --git a/omx/gstomx_adpcmenc.c b/omx/gstomx_adpcmenc.c
index ab5ce61..fea6bf4 100644
--- a/omx/gstomx_adpcmenc.c
+++ b/omx/gstomx_adpcmenc.c
@@ -121,7 +121,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAdpcm, ¶m);
rate = param.nSampleRate;
@@ -185,7 +185,7 @@ sink_setcaps (GstPad *pad,
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
diff --git a/omx/gstomx_amrnbdec.c b/omx/gstomx_amrnbdec.c
index a32f162..f32b15f 100644
--- a/omx/gstomx_amrnbdec.c
+++ b/omx/gstomx_amrnbdec.c
@@ -121,7 +121,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
diff --git a/omx/gstomx_amrnbenc.c b/omx/gstomx_amrnbenc.c
index e1c9b19..cc3486f 100644
--- a/omx/gstomx_amrnbenc.c
+++ b/omx/gstomx_amrnbenc.c
@@ -186,7 +186,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m);
channels = param.nChannels;
@@ -236,7 +236,7 @@ sink_setcaps (GstPad *pad,
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
diff --git a/omx/gstomx_amrwbdec.c b/omx/gstomx_amrwbdec.c
index 26e1692..20dddcb 100644
--- a/omx/gstomx_amrwbdec.c
+++ b/omx/gstomx_amrwbdec.c
@@ -121,7 +121,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
diff --git a/omx/gstomx_amrwbenc.c b/omx/gstomx_amrwbenc.c
index a19e670..3d95272 100644
--- a/omx/gstomx_amrwbenc.c
+++ b/omx/gstomx_amrwbenc.c
@@ -186,7 +186,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAmr, ¶m);
channels = param.nChannels;
@@ -236,7 +236,7 @@ sink_setcaps (GstPad *pad,
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
param.nSamplingRate = rate;
diff --git a/omx/gstomx_audiosink.c b/omx/gstomx_audiosink.c
index a05a7cd..6c912f0 100644
--- a/omx/gstomx_audiosink.c
+++ b/omx/gstomx_audiosink.c
@@ -114,7 +114,7 @@ setcaps (GstBaseSink *gst_sink,
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 0;
+ param.nPortIndex = self->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
param.nChannels = channels;
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index ddb480f..70bf617 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -62,14 +62,14 @@ setup_ports (GstOmxBaseFilter *self)
/* Input port configuration. */
- param.nPortIndex = 0;
+ param.nPortIndex = self->in_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
/* Output port configuration. */
- param.nPortIndex = 1;
+ param.nPortIndex = self->out_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->out_port, ¶m);
gst_pad_set_element_private (self->srcpad, self->out_port);
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index 1c7888c..5ea7c31 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -50,7 +50,7 @@ setup_ports (GstOmxBaseSink *self)
/* Input port configuration. */
- param.nPortIndex = 0;
+ param.nPortIndex = self->in_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index a19c08f..54f9032 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -41,7 +41,7 @@ setup_ports (GstOmxBaseSrc *self)
/* Input port configuration. */
- param.nPortIndex = 0;
+ param.nPortIndex = self->out_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
g_omx_port_setup (self->out_port, ¶m);
diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c
index 3ff2f44..5c6d1e1 100644
--- a/omx/gstomx_base_videodec.c
+++ b/omx/gstomx_base_videodec.c
@@ -116,7 +116,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
@@ -217,7 +217,7 @@ sink_setcaps (GstPad *pad,
/* Input port configuration. */
{
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
param.format.video.nFrameWidth = width;
@@ -250,7 +250,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
/* Input port configuration. */
{
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
param.format.video.eCompressionFormat = self->compression_format;
diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c
index 7c99a53..d243fbd 100644
--- a/omx/gstomx_base_videoenc.c
+++ b/omx/gstomx_base_videoenc.c
@@ -222,7 +222,7 @@ sink_setcaps (GstPad *pad,
/* Input port configuration. */
{
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
param.format.video.nFrameWidth = width;
@@ -264,7 +264,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
/* Output port configuration. */
{
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
param.format.video.eCompressionFormat = self->compression_format;
diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c
index 40cd64b..bc2fb18 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -142,7 +142,7 @@ sink_setcaps (GstPad *pad,
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
if (strcmp (mode, "audio/x-alaw") == 0)
diff --git a/omx/gstomx_g711enc.c b/omx/gstomx_g711enc.c
index 16d58aa..ba8d297 100644
--- a/omx/gstomx_g711enc.c
+++ b/omx/gstomx_g711enc.c
@@ -152,7 +152,7 @@ sink_setcaps (GstPad *pad,
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
if (strcmp (mode, "audio/x-alaw") == 0)
diff --git a/omx/gstomx_g729enc.c b/omx/gstomx_g729enc.c
index b6c41f0..67f9b38 100644
--- a/omx/gstomx_g729enc.c
+++ b/omx/gstomx_g729enc.c
@@ -230,7 +230,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioG729, ¶m);
param.bDTX = self->dtx;
diff --git a/omx/gstomx_h263enc.c b/omx/gstomx_h263enc.c
index 5f39029..2d2a1a0 100644
--- a/omx/gstomx_h263enc.c
+++ b/omx/gstomx_h263enc.c
@@ -97,7 +97,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base_filter->out_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
diff --git a/omx/gstomx_h264enc.c b/omx/gstomx_h264enc.c
index 336ea9a..7d2c2b6 100644
--- a/omx/gstomx_h264enc.c
+++ b/omx/gstomx_h264enc.c
@@ -96,7 +96,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base_filter->out_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
diff --git a/omx/gstomx_jpegenc.c b/omx/gstomx_jpegenc.c
index 2799521..63ff8fe 100644
--- a/omx/gstomx_jpegenc.c
+++ b/omx/gstomx_jpegenc.c
@@ -211,7 +211,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
width = param.format.image.nFrameWidth;
@@ -294,7 +294,7 @@ sink_setcaps (GstPad *pad,
/* Input port configuration. */
{
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
param.format.image.nFrameWidth = width;
@@ -329,7 +329,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
/* Output port configuration. */
{
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
param.format.image.eCompressionFormat = OMX_IMAGE_CodingJPEG;
@@ -347,7 +347,7 @@ omx_setup (GstOmxBaseFilter *omx_base)
param.nVersion.s.nVersionMinor = 1;
param.nQFactor = self->quality;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_SetParameter (gomx->omx_handle, OMX_IndexParamQFactor, ¶m);
}
diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c
index f6c2568..6e78e5f 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -124,7 +124,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c
index 08f1896..3824a9d 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -124,7 +124,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
diff --git a/omx/gstomx_mpeg4enc.c b/omx/gstomx_mpeg4enc.c
index 7a91c1c..f365639 100644
--- a/omx/gstomx_mpeg4enc.c
+++ b/omx/gstomx_mpeg4enc.c
@@ -98,7 +98,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base_filter->out_port->port_index;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
width = param.format.video.nFrameWidth;
diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c
index 683ee4c..7c5849b 100644
--- a/omx/gstomx_videosink.c
+++ b/omx/gstomx_videosink.c
@@ -166,7 +166,7 @@ setcaps (GstBaseSink *gst_sink,
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 0;
+ param.nPortIndex = omx_base->in_port->port_index;
OMX_GetParameter (gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
switch (color_format)
@@ -205,7 +205,7 @@ setcaps (GstBaseSink *gst_sink,
config.nVersion.s.nVersionMajor = 1;
config.nVersion.s.nVersionMinor = 1;
- config.nPortIndex = 0;
+ config.nPortIndex = omx_base->in_port->port_index;
OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
config.nRotation = self->rotation;
@@ -221,7 +221,7 @@ setcaps (GstBaseSink *gst_sink,
config.nVersion.s.nVersionMajor = 1;
config.nVersion.s.nVersionMinor = 1;
- config.nPortIndex = 0;
+ config.nPortIndex = omx_base->in_port->port_index;
OMX_GetConfig (gomx->omx_handle, OMX_IndexConfigCommonScale, &config);
config.xWidth = self->x_scale;
diff --git a/omx/gstomx_volume.c b/omx/gstomx_volume.c
index cd23103..91e116e 100644
--- a/omx/gstomx_volume.c
+++ b/omx/gstomx_volume.c
@@ -126,7 +126,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c
index 2adad9b..aad896a 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -119,7 +119,7 @@ settings_changed_cb (GOmxCore *core)
param.nVersion.s.nVersionMajor = 1;
param.nVersion.s.nVersionMinor = 1;
- param.nPortIndex = 1;
+ param.nPortIndex = omx_base->out_port->port_index;
OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
rate = param.nSamplingRate;
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:16:39
|
The port objects are constructed up front (so they are valid at any point in the element's lifecycle), and bound to a port_index at construction time.
This will be useful later to enable properties that directly set port params.
---
omx/gstomx_base_filter.c | 13 +++++------
omx/gstomx_base_sink.c | 10 +++-----
omx/gstomx_base_src.c | 10 +++-----
omx/gstomx_util.c | 47 +++++++++++++++++++--------------------------
omx/gstomx_util.h | 4 +-
5 files changed, 36 insertions(+), 48 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 44841c3..ddb480f 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -64,14 +64,14 @@ setup_ports (GstOmxBaseFilter *self)
param.nPortIndex = 0;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- self->in_port = g_omx_core_setup_port (core, ¶m);
+ g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
/* Output port configuration. */
param.nPortIndex = 1;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- self->out_port = g_omx_core_setup_port (core, ¶m);
+ g_omx_port_setup (self->out_port, ¶m);
gst_pad_set_element_private (self->srcpad, self->out_port);
if (g_getenv ("OMX_ALLOCATE_ON"))
@@ -877,11 +877,10 @@ type_instance_init (GTypeInstance *instance,
self->use_timestamps = TRUE;
/* GOmx */
- {
- GOmxCore *gomx;
- self->gomx = gomx = g_omx_core_new (self);
- gstomx_get_component_info (gomx, G_TYPE_FROM_CLASS (g_class));
- }
+ self->gomx = g_omx_core_new (self);
+ gstomx_get_component_info (self->gomx, G_TYPE_FROM_CLASS (g_class));
+ self->in_port = g_omx_core_get_port (self->gomx, 0);
+ self->out_port = g_omx_core_get_port (self->gomx, 1);
self->ready_lock = g_mutex_new ();
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index 6838f08..1c7888c 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -52,7 +52,7 @@ setup_ports (GstOmxBaseSink *self)
param.nPortIndex = 0;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- self->in_port = g_omx_core_setup_port (core, ¶m);
+ g_omx_port_setup (self->in_port, ¶m);
gst_pad_set_element_private (self->sinkpad, self->in_port);
}
@@ -417,11 +417,9 @@ type_instance_init (GTypeInstance *instance,
GST_LOG_OBJECT (self, "begin");
/* GOmx */
- {
- GOmxCore *gomx;
- self->gomx = gomx = g_omx_core_new (self);
- gstomx_get_component_info (gomx, G_TYPE_FROM_CLASS (g_class));
- }
+ self->gomx = g_omx_core_new (self);
+ gstomx_get_component_info (self->gomx, G_TYPE_FROM_CLASS (g_class));
+ self->in_port = g_omx_core_get_port (self->gomx, 0);
{
GstPad *sinkpad;
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index dd2be9e..a19c08f 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -43,7 +43,7 @@ setup_ports (GstOmxBaseSrc *self)
param.nPortIndex = 0;
OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- self->out_port = g_omx_core_setup_port (core, ¶m);
+ g_omx_port_setup (self->out_port, ¶m);
if (self->setup_ports)
{
@@ -402,11 +402,9 @@ type_instance_init (GTypeInstance *instance,
GST_LOG_OBJECT (self, "begin");
/* GOmx */
- {
- GOmxCore *gomx;
- self->gomx = gomx = g_omx_core_new (self);
- gstomx_get_component_info (gomx, G_TYPE_FROM_CLASS (g_class));
- }
+ self->gomx = g_omx_core_new (self);
+ gstomx_get_component_info (self->gomx, G_TYPE_FROM_CLASS (g_class));
+ self->out_port = g_omx_core_get_port (self->gomx, 1);
GST_LOG_OBJECT (self, "end");
}
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index b2a96c8..d8cc7f0 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -76,9 +76,7 @@ omx_state_to_str (OMX_STATETYPE omx_state);
static inline const char *
omx_error_to_str (OMX_ERRORTYPE omx_error);
-static inline GOmxPort *
-g_omx_core_get_port (GOmxCore *core,
- guint index);
+static inline GOmxPort * get_port (GOmxCore *core, guint index);
static inline void
port_free_buffers (GOmxPort *port);
@@ -133,7 +131,7 @@ core_for_each_port (GOmxCore *core,
{
GOmxPort *port;
- port = g_omx_core_get_port (core, index);
+ port = get_port (core, index);
if (port)
func (port);
@@ -396,37 +394,30 @@ g_omx_core_unload (GOmxCore *core)
g_ptr_array_clear (core->ports);
}
-GOmxPort *
-g_omx_core_setup_port (GOmxCore *core,
- OMX_PARAM_PORTDEFINITIONTYPE *omx_port)
+static inline GOmxPort *
+get_port (GOmxCore *core, guint index)
{
- GOmxPort *port;
- guint index;
-
- index = omx_port->nPortIndex;
- port = g_omx_core_get_port (core, index);
-
- if (!port)
+ if (G_LIKELY (index < core->ports->len))
{
- port = g_omx_port_new (core);
- g_ptr_array_insert (core->ports, index, port);
+ return g_ptr_array_index (core->ports, index);
}
- g_omx_port_setup (port, omx_port);
-
- return port;
+ return NULL;
}
-static inline GOmxPort *
+GOmxPort *
g_omx_core_get_port (GOmxCore *core,
guint index)
{
- if (G_LIKELY (index < core->ports->len))
+ GOmxPort *port = get_port (core, index);
+
+ if (!port)
{
- return g_ptr_array_index (core->ports, index);
+ port = g_omx_port_new (core, index);
+ g_ptr_array_insert (core->ports, index, port);
}
- return NULL;
+ return port;
}
void
@@ -459,12 +450,13 @@ g_omx_core_flush_stop (GOmxCore *core)
*/
GOmxPort *
-g_omx_port_new (GOmxCore *core)
+g_omx_port_new (GOmxCore *core, guint index)
{
GOmxPort *port;
port = g_new0 (GOmxPort, 1);
port->core = core;
+ port->port_index = index;
port->num_buffers = 0;
port->buffer_size = 0;
port->buffers = NULL;
@@ -492,6 +484,8 @@ g_omx_port_setup (GOmxPort *port,
{
GOmxPortType type = -1;
+ g_assert (port->port_index == omx_port->nPortIndex);
+
switch (omx_port->eDir)
{
case OMX_DirInput:
@@ -508,7 +502,6 @@ g_omx_port_setup (GOmxPort *port,
/** @todo should it be nBufferCountMin? */
port->num_buffers = omx_port->nBufferCountActual;
port->buffer_size = omx_port->nBufferSize;
- port->port_index = omx_port->nPortIndex;
g_free (port->buffers);
port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port->num_buffers);
@@ -904,7 +897,7 @@ EmptyBufferDone (OMX_HANDLETYPE omx_handle,
GOmxPort *port;
core = (GOmxCore*) app_data;
- port = g_omx_core_get_port (core, omx_buffer->nInputPortIndex);
+ port = get_port (core, omx_buffer->nInputPortIndex);
GST_CAT_LOG_OBJECT (gstomx_util_debug, core->object, "omx_buffer=%p", omx_buffer);
got_buffer (core, port, omx_buffer);
@@ -921,7 +914,7 @@ FillBufferDone (OMX_HANDLETYPE omx_handle,
GOmxPort *port;
core = (GOmxCore *) app_data;
- port = g_omx_core_get_port (core, omx_buffer->nOutputPortIndex);
+ port = get_port (core, omx_buffer->nOutputPortIndex);
GST_CAT_LOG_OBJECT (gstomx_util_debug, core->object, "omx_buffer=%p", omx_buffer);
got_buffer (core, port, omx_buffer);
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 6450c0d..060b042 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -130,9 +130,9 @@ void g_omx_core_set_done (GOmxCore *core);
void g_omx_core_wait_for_done (GOmxCore *core);
void g_omx_core_flush_start (GOmxCore *core);
void g_omx_core_flush_stop (GOmxCore *core);
-GOmxPort *g_omx_core_setup_port (GOmxCore *core, OMX_PARAM_PORTDEFINITIONTYPE *omx_port);
+GOmxPort *g_omx_core_get_port (GOmxCore *core, guint index);
-GOmxPort *g_omx_port_new (GOmxCore *core);
+GOmxPort *g_omx_port_new (GOmxCore *core, guint index);
void g_omx_port_free (GOmxPort *port);
void g_omx_port_setup (GOmxPort *port, OMX_PARAM_PORTDEFINITIONTYPE *omx_port);
void g_omx_port_push_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer);
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:15:42
|
rebased on top of 'boilerplate macros' patchset
Rob Clark (10):
construct GOmxPort objects in element constructor
don't hard-code port indexes
add accessor for OMX_HANDLE
add some debug traces
add G_OMX_INIT_PARAM utility macro
add g_omx_core_{get,set}_{config,param} helper functions
add input-buffers/output-buffers properties to the base classes
add some debug traces
add component-role support
Add GstOmxBaseAudioDec base class
omx/Makefile.am | 1 +
omx/gstomx.c | 14 +++-
omx/gstomx.h | 1 +
omx/gstomx_aacdec.c | 50 +------------
omx/gstomx_aacdec.h | 6 +-
omx/gstomx_aacenc.c | 44 ++++-------
omx/gstomx_adpcmdec.c | 14 +--
omx/gstomx_adpcmenc.c | 22 ++----
omx/gstomx_amrnbdec.c | 53 +-------------
omx/gstomx_amrnbdec.h | 6 +-
omx/gstomx_amrnbenc.c | 22 ++----
omx/gstomx_amrwbdec.c | 53 +-------------
omx/gstomx_amrwbdec.h | 6 +-
omx/gstomx_amrwbenc.c | 22 ++----
omx/gstomx_audiosink.c | 13 +--
omx/gstomx_base_audiodec.c | 97 +++++++++++++++++++++++
omx/gstomx_base_audiodec.h | 53 +++++++++++++
omx/gstomx_base_filter.c | 91 ++++++++++++++++++----
omx/gstomx_base_sink.c | 84 +++++++++++++++++---
omx/gstomx_base_src.c | 84 +++++++++++++++++---
omx/gstomx_base_videodec.c | 34 +++------
omx/gstomx_base_videoenc.c | 25 +++----
omx/gstomx_filereadersrc.c | 2 +-
omx/gstomx_g711dec.c | 14 ++--
omx/gstomx_g711enc.c | 13 +--
omx/gstomx_g729dec.c | 4 +-
omx/gstomx_g729dec.h | 6 +-
omx/gstomx_g729enc.c | 13 +--
omx/gstomx_h263enc.c | 11 +--
omx/gstomx_h264enc.c | 11 +--
omx/gstomx_ilbcdec.c | 1 +
omx/gstomx_jpegenc.c | 40 ++++------
omx/gstomx_mp2dec.c | 60 +--------------
omx/gstomx_mp2dec.h | 6 +-
omx/gstomx_mp3dec.c | 61 +--------------
omx/gstomx_mp3dec.h | 6 +-
omx/gstomx_mpeg4enc.c | 11 +--
omx/gstomx_util.c | 183 +++++++++++++++++++++++++++++++++++++-------
omx/gstomx_util.h | 21 +++++-
omx/gstomx_videosink.c | 35 +++-----
omx/gstomx_volume.c | 11 +--
omx/gstomx_vorbisdec.c | 50 +------------
omx/gstomx_vorbisdec.h | 6 +-
43 files changed, 706 insertions(+), 654 deletions(-)
create mode 100644 omx/gstomx_base_audiodec.c
create mode 100644 omx/gstomx_base_audiodec.h
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:03:59
|
Reading and writing an int is not sufficient synchronization without barrier instructions. Using g_once_init_enter() (which uses g_atomic_pointer_get()) provides SMP safety.
---
omx/gstomx_util.h | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 593b491..6450c0d 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -169,9 +169,12 @@ static void type_class_init_trampoline (gpointer g_class, gpointer class_data)\
} \
GType type_as_function ## _get_type (void) \
{ \
- static GType _type = 0; \
- if (G_UNLIKELY (_type == 0)) \
- { \
+ /* The typedef for GType may be gulong or gsize, depending on the \
+ * system and whether the compiler is c++ or not. The g_once_init_* \
+ * functions always take a gsize * though ... */ \
+ static volatile gsize gonce_data = 0; \
+ if (g_once_init_enter (&gonce_data)) { \
+ GType _type; \
GTypeInfo *type_info; \
type_info = g_new0 (GTypeInfo, 1); \
type_info->class_size = sizeof (type ## Class); \
@@ -182,9 +185,11 @@ GType type_as_function ## _get_type (void) \
_type = g_type_register_static (parent_type_macro, #type, type_info, 0);\
g_free (type_info); \
additional_initializations (_type); \
+ g_once_init_leave (&gonce_data, (gsize) _type); \
} \
- return _type; \
+ return (GType) gonce_data; \
}
+
#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)
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:02:52
|
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.
---
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 | 44 +++++++++++++++++++++++++++++++++++++
omx/gstomx_videosink.c | 28 +----------------------
omx/gstomx_volume.c | 27 +----------------------
omx/gstomx_vorbisdec.c | 28 +----------------------
omx/gstomx_wmvdec.c | 27 +----------------------
36 files changed, 121 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 400cf9c..44841c3 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -30,7 +30,8 @@ enum
ARG_USE_TIMESTAMPS = GSTOMX_LAST_COMMON_PROP,
};
-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,
@@ -232,6 +233,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -241,8 +247,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;
@@ -919,38 +923,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 3dbaba0..6838f08 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -32,7 +32,8 @@ static gboolean share_input_buffer;
static inline gboolean omx_init (GstOmxBaseSink *self);
-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)
@@ -298,6 +299,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -309,8 +315,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;
@@ -448,39 +452,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 9baae01..dd2be9e 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset, memcpy */
-static GstElementClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_SRC);
static void
setup_ports (GstOmxBaseSrc *self)
@@ -362,6 +362,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -371,8 +376,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;
@@ -407,26 +410,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;
-}
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-07 23:00:22
|
Rebased boilerplate macros on top of 'handle properties common to all gstomx base classes with helper functions' patch. Rob Clark (2): Add GSTOMX_BOILERPLATE macros SMP safety for _get_type() functions 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 | 49 +++++++++++++++++++++++++++++++++++++++++ omx/gstomx_videosink.c | 28 +---------------------- omx/gstomx_volume.c | 27 +---------------------- omx/gstomx_vorbisdec.c | 28 +---------------------- omx/gstomx_wmvdec.c | 27 +---------------------- 36 files changed, 126 insertions(+), 930 deletions(-) |
|
From: Rob C. <ro...@ti...> - 2010-03-06 21:04:33
|
This removes some common code from all base classes, and makes it easier to add new common properties.
For now (and the foreseeable future) all common properties are read-only, but a gstomx_set_property_helper() could be added later if needed.
---
omx/gstomx.c | 32 ++++++++++++++++++++++++++++++++
omx/gstomx.h | 11 +++++++++++
omx/gstomx_base_filter.c | 38 ++++++++++++--------------------------
omx/gstomx_base_sink.c | 34 ++++++++--------------------------
omx/gstomx_base_src.c | 34 ++++++++--------------------------
5 files changed, 71 insertions(+), 78 deletions(-)
diff --git a/omx/gstomx.c b/omx/gstomx.c
index cc8f3f8..e35ef3d 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -319,6 +319,38 @@ gstomx_get_component_info (void *core,
return TRUE;
}
+void
+gstomx_install_property_helper (GObjectClass *gobject_class)
+{
+
+ g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
+ g_param_spec_string ("component-name", "Component name",
+ "Name of the OpenMAX IL component to use",
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
+ g_param_spec_string ("library-name", "Library name",
+ "Name of the OpenMAX IL implementation library to use",
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+}
+
+gboolean
+gstomx_get_property_helper (void *core, guint prop_id, GValue *value)
+{
+ GOmxCore *gomx = core;
+ switch (prop_id)
+ {
+ case ARG_COMPONENT_NAME:
+ g_value_set_string (value, gomx->component_name);
+ return TRUE;
+ case ARG_LIBRARY_NAME:
+ g_value_set_string (value, gomx->library_name);
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"omx",
diff --git a/omx/gstomx.h b/omx/gstomx.h
index b62773c..7557fd4 100644
--- a/omx/gstomx.h
+++ b/omx/gstomx.h
@@ -30,9 +30,20 @@ GST_DEBUG_CATEGORY_EXTERN (gstomx_debug);
GST_DEBUG_CATEGORY_EXTERN (gstomx_util_debug);
#define GST_CAT_DEFAULT gstomx_debug
+enum
+{
+ GSTOMX_ARG_0,
+ ARG_COMPONENT_NAME,
+ ARG_LIBRARY_NAME,
+ GSTOMX_LAST_COMMON_PROP
+};
+
gboolean gstomx_get_component_info (void *core,
GType type);
+void gstomx_install_property_helper (GObjectClass *gobject_class);
+gboolean gstomx_get_property_helper (void *core, guint prop_id, GValue *value);
+
G_END_DECLS
#endif /* GSTOMX_H */
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 6ddfc85..400cf9c 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -27,10 +27,7 @@
enum
{
- ARG_0,
- ARG_COMPONENT_NAME,
- ARG_LIBRARY_NAME,
- ARG_USE_TIMESTAMPS,
+ ARG_USE_TIMESTAMPS = GSTOMX_LAST_COMMON_PROP,
};
static GstElementClass *parent_class;
@@ -220,20 +217,17 @@ get_property (GObject *obj,
self = GST_OMX_BASE_FILTER (obj);
- switch (prop_id)
+ if (! gstomx_get_property_helper (self->gomx, prop_id, value))
{
- case ARG_COMPONENT_NAME:
- g_value_set_string (value, self->gomx->component_name);
- break;
- case ARG_LIBRARY_NAME:
- g_value_set_string (value, self->gomx->library_name);
- break;
- case ARG_USE_TIMESTAMPS:
- g_value_set_boolean (value, self->use_timestamps);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
+ switch (prop_id)
+ {
+ case ARG_USE_TIMESTAMPS:
+ g_value_set_boolean (value, self->use_timestamps);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+ break;
+ }
}
}
@@ -257,15 +251,7 @@ type_class_init (gpointer g_class,
gobject_class->set_property = set_property;
gobject_class->get_property = get_property;
- g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
- g_param_spec_string ("component-name", "Component name",
- "Name of the OpenMAX IL component to use",
- NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
- g_param_spec_string ("library-name", "Library name",
- "Name of the OpenMAX IL implementation library to use",
- NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ gstomx_install_property_helper (gobject_class);
g_object_class_install_property (gobject_class, ARG_USE_TIMESTAMPS,
g_param_spec_boolean ("use-timestamps", "Use timestamps",
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index 560a0f1..3dbaba0 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -32,13 +32,6 @@ static gboolean share_input_buffer;
static inline gboolean omx_init (GstOmxBaseSink *self);
-enum
-{
- ARG_0,
- ARG_COMPONENT_NAME,
- ARG_LIBRARY_NAME,
-};
-
static GstElementClass *parent_class;
static void
@@ -293,17 +286,14 @@ get_property (GObject *obj,
self = GST_OMX_BASE_SINK (obj);
- switch (prop_id)
+ if (! gstomx_get_property_helper (self->gomx, prop_id, value))
{
- case ARG_COMPONENT_NAME:
- g_value_set_string (value, self->gomx->component_name);
- break;
- case ARG_LIBRARY_NAME:
- g_value_set_string (value, self->gomx->library_name);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+ break;
+ }
}
}
@@ -333,15 +323,7 @@ type_class_init (gpointer g_class,
{
gobject_class->get_property = get_property;
- g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
- g_param_spec_string ("component-name", "Component name",
- "Name of the OpenMAX IL component to use",
- NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
- g_param_spec_string ("library-name", "Library name",
- "Name of the OpenMAX IL implementation library to use",
- NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ gstomx_install_property_helper (gobject_class);
}
}
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index d09a8d2..9baae01 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -24,13 +24,6 @@
#include <string.h> /* for memset, memcpy */
-enum
-{
- ARG_0,
- ARG_COMPONENT_NAME,
- ARG_LIBRARY_NAME,
-};
-
static GstElementClass *parent_class;
static void
@@ -357,17 +350,14 @@ get_property (GObject *obj,
self = GST_OMX_BASE_SRC (obj);
- switch (prop_id)
+ if (! gstomx_get_property_helper (self->gomx, prop_id, value))
{
- case ARG_COMPONENT_NAME:
- g_value_set_string (value, self->gomx->component_name);
- break;
- case ARG_LIBRARY_NAME:
- g_value_set_string (value, self->gomx->library_name);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
- break;
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+ break;
+ }
}
}
@@ -394,15 +384,7 @@ type_class_init (gpointer g_class,
{
gobject_class->get_property = get_property;
- g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
- g_param_spec_string ("component-name", "Component name",
- "Name of the OpenMAX IL component to use",
- NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
- g_param_spec_string ("library-name", "Library name",
- "Name of the OpenMAX IL implementation library to use",
- NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ gstomx_install_property_helper (gobject_class);
}
}
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-06 21:04:11
|
as suggested by Stefan Kost
---
omx/gstomx_aacenc.c | 7 ++++---
omx/gstomx_amrnbenc.c | 3 ++-
omx/gstomx_amrwbenc.c | 3 ++-
omx/gstomx_base_filter.c | 6 +++---
omx/gstomx_base_sink.c | 4 ++--
omx/gstomx_base_src.c | 4 ++--
omx/gstomx_base_videoenc.c | 3 ++-
omx/gstomx_filereadersrc.c | 2 +-
omx/gstomx_g729enc.c | 2 +-
omx/gstomx_jpegenc.c | 3 ++-
omx/gstomx_videosink.c | 6 +++---
11 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/omx/gstomx_aacenc.c b/omx/gstomx_aacenc.c
index eabc855..ae870e3 100644
--- a/omx/gstomx_aacenc.c
+++ b/omx/gstomx_aacenc.c
@@ -261,20 +261,21 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_BITRATE,
g_param_spec_uint ("bitrate", "Bit-rate",
"Encoding bit-rate",
- 0, G_MAXUINT, DEFAULT_BITRATE, G_PARAM_READWRITE));
+ 0, G_MAXUINT, DEFAULT_BITRATE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_PROFILE,
g_param_spec_enum ("profile", "Enocding profile",
"OMX_AUDIO_AACPROFILETYPE of output",
GST_TYPE_OMX_AACENC_PROFILE,
DEFAULT_PROFILE,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_OUTPUT_FORMAT,
g_param_spec_enum ("output-format", "Output format",
"OMX_AUDIO_AACSTREAMFORMATTYPE of output",
GST_TYPE_OMX_AACENC_OUTPUT_FORMAT,
DEFAULT_OUTPUT_FORMAT,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_amrnbenc.c b/omx/gstomx_amrnbenc.c
index d8b921b..9cd3e7a 100644
--- a/omx/gstomx_amrnbenc.c
+++ b/omx/gstomx_amrnbenc.c
@@ -165,7 +165,8 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_BITRATE,
g_param_spec_uint ("bitrate", "Bit-rate",
"Encoding bit-rate",
- 0, G_MAXUINT, DEFAULT_BITRATE, G_PARAM_READWRITE));
+ 0, G_MAXUINT, DEFAULT_BITRATE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_amrwbenc.c b/omx/gstomx_amrwbenc.c
index 176ccb3..9a11f48 100644
--- a/omx/gstomx_amrwbenc.c
+++ b/omx/gstomx_amrwbenc.c
@@ -165,7 +165,8 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_BITRATE,
g_param_spec_uint ("bitrate", "Bit-rate",
"Encoding bit-rate",
- 0, G_MAXUINT, DEFAULT_BITRATE, G_PARAM_READWRITE));
+ 0, G_MAXUINT, DEFAULT_BITRATE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index da41b4d..6ddfc85 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -260,17 +260,17 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
g_param_spec_string ("component-name", "Component name",
"Name of the OpenMAX IL component to use",
- NULL, G_PARAM_READABLE));
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
g_param_spec_string ("library-name", "Library name",
"Name of the OpenMAX IL implementation library to use",
- NULL, G_PARAM_READABLE));
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_USE_TIMESTAMPS,
g_param_spec_boolean ("use-timestamps", "Use timestamps",
"Whether or not to use timestamps",
- TRUE, G_PARAM_READWRITE));
+ TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index 68c7ea7..560a0f1 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -336,12 +336,12 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
g_param_spec_string ("component-name", "Component name",
"Name of the OpenMAX IL component to use",
- NULL, G_PARAM_READABLE));
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
g_param_spec_string ("library-name", "Library name",
"Name of the OpenMAX IL implementation library to use",
- NULL, G_PARAM_READABLE));
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index bae9f55..d09a8d2 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -397,12 +397,12 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
g_param_spec_string ("component-name", "Component name",
"Name of the OpenMAX IL component to use",
- NULL, G_PARAM_READABLE));
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
g_param_spec_string ("library-name", "Library name",
"Name of the OpenMAX IL implementation library to use",
- NULL, G_PARAM_READABLE));
+ NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c
index f788817..6f21a48 100644
--- a/omx/gstomx_base_videoenc.c
+++ b/omx/gstomx_base_videoenc.c
@@ -156,7 +156,8 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_BITRATE,
g_param_spec_uint ("bitrate", "Bit-rate",
"Encoding bit-rate",
- 0, G_MAXUINT, DEFAULT_BITRATE, G_PARAM_READWRITE));
+ 0, G_MAXUINT, DEFAULT_BITRATE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_filereadersrc.c b/omx/gstomx_filereadersrc.c
index cea5ca9..a391b69 100644
--- a/omx/gstomx_filereadersrc.c
+++ b/omx/gstomx_filereadersrc.c
@@ -181,7 +181,7 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_FILE_NAME,
g_param_spec_string ("file-name", "File name",
"The input filename to use",
- NULL, G_PARAM_READWRITE));
+ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_g729enc.c b/omx/gstomx_g729enc.c
index 1a2c853..6a47c0f 100644
--- a/omx/gstomx_g729enc.c
+++ b/omx/gstomx_g729enc.c
@@ -170,7 +170,7 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_DTX,
g_param_spec_boolean ("dtx", "DTX",
"Enable DTX",
- DEFAULT_DTX, G_PARAM_READWRITE));
+ DEFAULT_DTX, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_jpegenc.c b/omx/gstomx_jpegenc.c
index e78b5b1..2c7c1a1 100644
--- a/omx/gstomx_jpegenc.c
+++ b/omx/gstomx_jpegenc.c
@@ -187,7 +187,8 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_QUALITY,
g_param_spec_uint ("quality", "Quality of image",
"Set the quality from 0 to 100",
- 0, 100, DEFAULT_QUALITY, G_PARAM_READWRITE));
+ 0, 100, DEFAULT_QUALITY,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
}
diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c
index 923b5ed..3a8cbaa 100644
--- a/omx/gstomx_videosink.c
+++ b/omx/gstomx_videosink.c
@@ -308,17 +308,17 @@ type_class_init (gpointer g_class,
g_object_class_install_property (gobject_class, ARG_X_SCALE,
g_param_spec_uint ("x-scale", "X Scale",
"How much to scale the image in the X axis (100 means nothing)",
- 0, G_MAXUINT, 100, G_PARAM_READWRITE));
+ 0, G_MAXUINT, 100, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_Y_SCALE,
g_param_spec_uint ("y-scale", "Y Scale",
"How much to scale the image in the Y axis (100 means nothing)",
- 0, G_MAXUINT, 100, G_PARAM_READWRITE));
+ 0, G_MAXUINT, 100, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, ARG_ROTATION,
g_param_spec_uint ("rotation", "Rotation",
"Rotation angle",
- 0, G_MAXUINT, 360, G_PARAM_READWRITE));
+ 0, G_MAXUINT, 360, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
static void
--
1.6.3.2
|
|
From: Clark, R. <ro...@ti...> - 2010-03-06 19:34:33
|
On Mar 4, 2010, at 7:36 AM, Felipe Contreras wrote:
> On Thu, Mar 04, 2010 at 12:38:26AM +0100, Rob Clark wrote:
>>
>> On Mar 3, 2010, at 4:51 PM, Felipe Contreras wrote:
>>
>>> @@ -234,10 +231,10 @@ get_property (GObject *obj,
>>> switch (prop_id)
>>> {
>>> case ARG_COMPONENT_NAME:
>>> - g_value_set_string (value, self->omx_component);
>>> + g_value_set_string (value, self->gomx->component_name);
>>> break;
>>> case ARG_LIBRARY_NAME:
>>> - g_value_set_string (value, self->omx_library);
>>> + g_value_set_string (value, self->gomx->library_name);
>>> break;
>>
>> one thought as I look at the patch (and something that I didn't think
>> of either when I made my original patch)..
>>
>> but the get_property() for component-name and library-name (and when I
>> send a later patch, component-role) are basically identical..
>>
>> what about adding a g_omx_core_get_property_helper() which could be
>> shared by all the base classes? This way, when I send the patch to
>> add component-role, it just changes GOmxCore and not the base classes
>> ;-)
>>
>> I can send the updated patch if you like the idea
>
> Yeah, I like the idea, but the g_omx_ is for util stuff that's not
> directly related to GStreamer (from the old GOmx library), it might make
> sense change this prefix in the future. Anyway, the rest of the stuff
> should have gstomx_.
>
> Or, even better, add the properties to the interface:
> http://library.gnome.org/devel/gobject/unstable/howto-interface-properties.html
>
> I'm not sure if that's what we want, but sounds like it.
It seems interface properties are limited to just that.. interface. The implementation of the part in get_property() (and set_property() if applicable) must remain.
So I lean more towards the helper functions idea. This makes it easier to add other common properties (like component-role) without touching each of the base classes.
Since gstomx.c already knows of the GOmxCore struct, I can add the helpers here for now. But I think perhaps it gets cleaner if we just change g_omx_* to gstomx_*..
BR,
-R
|
|
From: Clark, R. <ro...@ti...> - 2010-03-06 19:26:24
|
On Mar 6, 2010, at 12:25 PM, Clark, Rob wrote:
>
> On Mar 3, 2010, at 4:51 PM, Felipe Contreras wrote:
>
>> #endif /* GSTOMX_H */
>> diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
>> index 626f979..01ca10a 100644
>> --- a/omx/gstomx_base_filter.c
>> +++ b/omx/gstomx_base_filter.c
>> @@ -898,6 +898,7 @@ type_instance_init (GTypeInstance *instance,
>> {
>> GOmxCore *gomx;
>> self->gomx = gomx = g_omx_core_new (self);
>> + gstomx_get_component_info (gomx, G_TYPE_FROM_CLASS (g_class));
>> }
>>
>
> Any reason not to combine g_omx_core_new() and gomx_get_component_info()?
>
ahh, I get it.. you try to keep the "g_omx" stuff independent of the "gst" stuff..
I guess it is a topic for a different patch, but any objection to lifting this restriction? I think there is more stuff (such as copying between gst buffers and omx buffers, and handling the share_buffer cases) which could be refactored from the base classes into the utility classes if this separation is lifted.
(If you want to keep the separation.. perhaps we could have GstOmxCore and GstOmxPort subclasses of GOmxCore and GOmxPort.. but that does seem a bit like overkill.)
BR,
-R
|
|
From: Clark, R. <ro...@ti...> - 2010-03-06 18:25:29
|
On Mar 3, 2010, at 4:51 PM, Felipe Contreras wrote:
> #endif /* GSTOMX_H */
> diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
> index 626f979..01ca10a 100644
> --- a/omx/gstomx_base_filter.c
> +++ b/omx/gstomx_base_filter.c
> @@ -898,6 +898,7 @@ type_instance_init (GTypeInstance *instance,
> {
> GOmxCore *gomx;
> self->gomx = gomx = g_omx_core_new (self);
> + gstomx_get_component_info (gomx, G_TYPE_FROM_CLASS (g_class));
> }
>
Any reason not to combine g_omx_core_new() and gomx_get_component_info()?
BR,
-R
|
|
From: Rob C. <ro...@ti...> - 2010-03-06 18:20:57
|
Normally with autotools, you should be able to create a directory outside of the srctree, and then run something like: ../path/to/gst-openmax/configure .... make check install but a couple small tweaks were needed to make check work properly. Mainly replacing Makefile with a Makefile.in, and avoiding relative paths to files in the src tree. --- configure.ac | 1 + tests/Makefile.am | 2 +- tests/standalone/Makefile | 36 ------------------------------------ tests/standalone/Makefile.in | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 37 deletions(-) delete mode 100644 tests/standalone/Makefile create mode 100644 tests/standalone/Makefile.in diff --git a/configure.ac b/configure.ac index 22dcf7d..b6a1316 100644 --- a/configure.ac +++ b/configure.ac @@ -108,6 +108,7 @@ AC_CONFIG_FILES([Makefile \ omx/Makefile \ util/Makefile \ tests/Makefile \ + tests/standalone/Makefile \ m4/Makefile]) AC_OUTPUT diff --git a/tests/Makefile.am b/tests/Makefile.am index 94fa4ce..85dd362 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -9,7 +9,7 @@ CHECK_REGISTRY = $(top_builddir)/tests/test-registry.reg TESTS_ENVIRONMENT = GST_REGISTRY=$(CHECK_REGISTRY) \ LD_LIBRARY_PATH=$(builddir)/standalone \ GST_PLUGIN_PATH=$(top_builddir)/omx \ - OMX_CONFIG=gst-openmax.conf + OMX_CONFIG=$(srcdir)/gst-openmax.conf check_PROGRAMS = diff --git a/tests/standalone/Makefile b/tests/standalone/Makefile deleted file mode 100644 index e316d45..0000000 --- a/tests/standalone/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -noinst_LIBRARIES = libomxil-foo.so - -libomxil_foo_so_SOURCES = core.c -libomxil_foo_so_CFLAGS = -I$(top_srcdir)/omx/headers $(GTHREAD_CFLAGS) -I$(top_srcdir)/util -libomxil_foo_so_LIBADD = $(GTHREAD_LIBS) $(top_srcdir)/util/.libs/libutil.a - -# Manual stuff - -CFLAGS = -ggdb -top_srcdir = ../.. -srcdir = . -CC = gcc -LIBRARIES = $(noinst_LIBRARIES) -GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0` -GTHREAD_LIBS=`pkg-config --libs gthread-2.0` - -all: -check: $(LIBRARIES) - -libomxil-foo.so: $(patsubst %.c,%.o,$(libomxil_foo_so_SOURCES)) -libomxil-foo.so: CFLAGS := $(CFLAGS) -fPIC $(libomxil_foo_so_CFLAGS) -libomxil-foo.so: LIBS := $(libomxil_foo_so_LIBADD) - -%.so:: - $(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS) - -.PHONY: clean distclean install - -clean: - rm -rf *.o $(LIBRARIES) - -install: -distdir: - cp -pR $(srcdir)/core.c $(distdir) - cp -pR $(srcdir)/Makefile $(distdir) -distclean: clean diff --git a/tests/standalone/Makefile.in b/tests/standalone/Makefile.in new file mode 100644 index 0000000..f87ff6f --- /dev/null +++ b/tests/standalone/Makefile.in @@ -0,0 +1,38 @@ +VPATH = @srcdir@ + +noinst_LIBRARIES = libomxil-foo.so + +libomxil_foo_so_SOURCES = core.c +libomxil_foo_so_CFLAGS = -I$(top_srcdir)/omx/headers $(GTHREAD_CFLAGS) -I$(top_srcdir)/util +libomxil_foo_so_LIBADD = $(GTHREAD_LIBS) ../../util/.libs/libutil.a + +# Manual stuff + +CFLAGS = -ggdb +top_srcdir = @srcdir@/../.. +srcdir = @srcdir@ +CC = gcc +LIBRARIES = $(noinst_LIBRARIES) +GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0` +GTHREAD_LIBS=`pkg-config --libs gthread-2.0` + +all: +check: $(LIBRARIES) + +libomxil-foo.so: $(patsubst %.c,%.o,$(libomxil_foo_so_SOURCES)) +libomxil-foo.so: CFLAGS := $(CFLAGS) -fPIC $(libomxil_foo_so_CFLAGS) +libomxil-foo.so: LIBS := $(libomxil_foo_so_LIBADD) + +%.so:: + $(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS) + +.PHONY: clean distclean install + +clean: + rm -rf *.o $(LIBRARIES) + +install: +distdir: + cp -pR $(srcdir)/core.c $(distdir) + cp -pR $(srcdir)/Makefile $(distdir) +distclean: clean -- 1.6.3.2 |
|
From: Clark, R. <ro...@ti...> - 2010-03-06 18:19:35
|
opps, I realized this wasn't rebased after Felipe changed OMX_REGISTRY to OMX_CONFIG.. I'll just resend and updated patch momentarily On Mar 5, 2010, at 2:07 PM, Rob Clark wrote: > Normally with autotools, you should be able to create a directory outside of the srctree, and then run something like: > > ../path/to/gst-openmax/configure .... > make check install > > but a couple small tweaks were needed to make check work properly. Mainly replacing Makefile with a Makefile.in, and avoiding relative paths to files in the src tree. > --- > configure.ac | 1 + > tests/Makefile.am | 2 +- > tests/standalone/Makefile | 36 ------------------------------------ > tests/standalone/Makefile.in | 38 ++++++++++++++++++++++++++++++++++++++ > 4 files changed, 40 insertions(+), 37 deletions(-) > delete mode 100644 tests/standalone/Makefile > create mode 100644 tests/standalone/Makefile.in > > diff --git a/configure.ac b/configure.ac > index 22dcf7d..b6a1316 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -108,6 +108,7 @@ AC_CONFIG_FILES([Makefile \ > omx/Makefile \ > util/Makefile \ > tests/Makefile \ > + tests/standalone/Makefile \ > m4/Makefile]) > > AC_OUTPUT > diff --git a/tests/Makefile.am b/tests/Makefile.am > index f43098a..dff4f31 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -9,7 +9,7 @@ CHECK_REGISTRY = $(top_builddir)/tests/test-registry.reg > TESTS_ENVIRONMENT = GST_REGISTRY=$(CHECK_REGISTRY) \ > LD_LIBRARY_PATH=$(builddir)/standalone \ > GST_PLUGIN_PATH=$(top_builddir)/omx \ > - OMX_REGISTRY=gst-openmax.conf > + OMX_REGISTRY=$(srcdir)/gst-openmax.conf > > check_PROGRAMS = > > diff --git a/tests/standalone/Makefile b/tests/standalone/Makefile > deleted file mode 100644 > index e316d45..0000000 > --- a/tests/standalone/Makefile > +++ /dev/null > @@ -1,36 +0,0 @@ > -noinst_LIBRARIES = libomxil-foo.so > - > -libomxil_foo_so_SOURCES = core.c > -libomxil_foo_so_CFLAGS = -I$(top_srcdir)/omx/headers $(GTHREAD_CFLAGS) -I$(top_srcdir)/util > -libomxil_foo_so_LIBADD = $(GTHREAD_LIBS) $(top_srcdir)/util/.libs/libutil.a > - > -# Manual stuff > - > -CFLAGS = -ggdb > -top_srcdir = ../.. > -srcdir = . > -CC = gcc > -LIBRARIES = $(noinst_LIBRARIES) > -GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0` > -GTHREAD_LIBS=`pkg-config --libs gthread-2.0` > - > -all: > -check: $(LIBRARIES) > - > -libomxil-foo.so: $(patsubst %.c,%.o,$(libomxil_foo_so_SOURCES)) > -libomxil-foo.so: CFLAGS := $(CFLAGS) -fPIC $(libomxil_foo_so_CFLAGS) > -libomxil-foo.so: LIBS := $(libomxil_foo_so_LIBADD) > - > -%.so:: > - $(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS) > - > -.PHONY: clean distclean install > - > -clean: > - rm -rf *.o $(LIBRARIES) > - > -install: > -distdir: > - cp -pR $(srcdir)/core.c $(distdir) > - cp -pR $(srcdir)/Makefile $(distdir) > -distclean: clean > diff --git a/tests/standalone/Makefile.in b/tests/standalone/Makefile.in > new file mode 100644 > index 0000000..f87ff6f > --- /dev/null > +++ b/tests/standalone/Makefile.in > @@ -0,0 +1,38 @@ > +VPATH = @srcdir@ > + > +noinst_LIBRARIES = libomxil-foo.so > + > +libomxil_foo_so_SOURCES = core.c > +libomxil_foo_so_CFLAGS = -I$(top_srcdir)/omx/headers $(GTHREAD_CFLAGS) -I$(top_srcdir)/util > +libomxil_foo_so_LIBADD = $(GTHREAD_LIBS) ../../util/.libs/libutil.a > + > +# Manual stuff > + > +CFLAGS = -ggdb > +top_srcdir = @srcdir@/../.. > +srcdir = @srcdir@ > +CC = gcc > +LIBRARIES = $(noinst_LIBRARIES) > +GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0` > +GTHREAD_LIBS=`pkg-config --libs gthread-2.0` > + > +all: > +check: $(LIBRARIES) > + > +libomxil-foo.so: $(patsubst %.c,%.o,$(libomxil_foo_so_SOURCES)) > +libomxil-foo.so: CFLAGS := $(CFLAGS) -fPIC $(libomxil_foo_so_CFLAGS) > +libomxil-foo.so: LIBS := $(libomxil_foo_so_LIBADD) > + > +%.so:: > + $(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS) > + > +.PHONY: clean distclean install > + > +clean: > + rm -rf *.o $(LIBRARIES) > + > +install: > +distdir: > + cp -pR $(srcdir)/core.c $(distdir) > + cp -pR $(srcdir)/Makefile $(distdir) > +distclean: clean > -- > 1.6.3.2 > |
|
From: Rob C. <ro...@ti...> - 2010-03-05 20:07:24
|
Normally with autotools, you should be able to create a directory outside of the srctree, and then run something like: ../path/to/gst-openmax/configure .... make check install but a couple small tweaks were needed to make check work properly. Mainly replacing Makefile with a Makefile.in, and avoiding relative paths to files in the src tree. --- configure.ac | 1 + tests/Makefile.am | 2 +- tests/standalone/Makefile | 36 ------------------------------------ tests/standalone/Makefile.in | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 37 deletions(-) delete mode 100644 tests/standalone/Makefile create mode 100644 tests/standalone/Makefile.in diff --git a/configure.ac b/configure.ac index 22dcf7d..b6a1316 100644 --- a/configure.ac +++ b/configure.ac @@ -108,6 +108,7 @@ AC_CONFIG_FILES([Makefile \ omx/Makefile \ util/Makefile \ tests/Makefile \ + tests/standalone/Makefile \ m4/Makefile]) AC_OUTPUT diff --git a/tests/Makefile.am b/tests/Makefile.am index f43098a..dff4f31 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -9,7 +9,7 @@ CHECK_REGISTRY = $(top_builddir)/tests/test-registry.reg TESTS_ENVIRONMENT = GST_REGISTRY=$(CHECK_REGISTRY) \ LD_LIBRARY_PATH=$(builddir)/standalone \ GST_PLUGIN_PATH=$(top_builddir)/omx \ - OMX_REGISTRY=gst-openmax.conf + OMX_REGISTRY=$(srcdir)/gst-openmax.conf check_PROGRAMS = diff --git a/tests/standalone/Makefile b/tests/standalone/Makefile deleted file mode 100644 index e316d45..0000000 --- a/tests/standalone/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -noinst_LIBRARIES = libomxil-foo.so - -libomxil_foo_so_SOURCES = core.c -libomxil_foo_so_CFLAGS = -I$(top_srcdir)/omx/headers $(GTHREAD_CFLAGS) -I$(top_srcdir)/util -libomxil_foo_so_LIBADD = $(GTHREAD_LIBS) $(top_srcdir)/util/.libs/libutil.a - -# Manual stuff - -CFLAGS = -ggdb -top_srcdir = ../.. -srcdir = . -CC = gcc -LIBRARIES = $(noinst_LIBRARIES) -GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0` -GTHREAD_LIBS=`pkg-config --libs gthread-2.0` - -all: -check: $(LIBRARIES) - -libomxil-foo.so: $(patsubst %.c,%.o,$(libomxil_foo_so_SOURCES)) -libomxil-foo.so: CFLAGS := $(CFLAGS) -fPIC $(libomxil_foo_so_CFLAGS) -libomxil-foo.so: LIBS := $(libomxil_foo_so_LIBADD) - -%.so:: - $(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS) - -.PHONY: clean distclean install - -clean: - rm -rf *.o $(LIBRARIES) - -install: -distdir: - cp -pR $(srcdir)/core.c $(distdir) - cp -pR $(srcdir)/Makefile $(distdir) -distclean: clean diff --git a/tests/standalone/Makefile.in b/tests/standalone/Makefile.in new file mode 100644 index 0000000..f87ff6f --- /dev/null +++ b/tests/standalone/Makefile.in @@ -0,0 +1,38 @@ +VPATH = @srcdir@ + +noinst_LIBRARIES = libomxil-foo.so + +libomxil_foo_so_SOURCES = core.c +libomxil_foo_so_CFLAGS = -I$(top_srcdir)/omx/headers $(GTHREAD_CFLAGS) -I$(top_srcdir)/util +libomxil_foo_so_LIBADD = $(GTHREAD_LIBS) ../../util/.libs/libutil.a + +# Manual stuff + +CFLAGS = -ggdb +top_srcdir = @srcdir@/../.. +srcdir = @srcdir@ +CC = gcc +LIBRARIES = $(noinst_LIBRARIES) +GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0` +GTHREAD_LIBS=`pkg-config --libs gthread-2.0` + +all: +check: $(LIBRARIES) + +libomxil-foo.so: $(patsubst %.c,%.o,$(libomxil_foo_so_SOURCES)) +libomxil-foo.so: CFLAGS := $(CFLAGS) -fPIC $(libomxil_foo_so_CFLAGS) +libomxil-foo.so: LIBS := $(libomxil_foo_so_LIBADD) + +%.so:: + $(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS) + +.PHONY: clean distclean install + +clean: + rm -rf *.o $(LIBRARIES) + +install: +distdir: + cp -pR $(srcdir)/core.c $(distdir) + cp -pR $(srcdir)/Makefile $(distdir) +distclean: clean -- 1.6.3.2 |
|
From: Felipe C. <fel...@gm...> - 2010-03-05 15:19:15
|
On Thu, Mar 4, 2010 at 12:43 AM, Felipe Contreras
<fel...@no...> wrote:
> From: Rob Clark <ro...@ti...>
>
> Configurable mapping between gst-openmax elements and OMX library-name
> and component-name via config file. The config file may even create
> multiple different elements with unique names using the same gst-openmax
> class but different OMX library-name and/or component-name.
>
> In the simple case, of one OMX component per gst-openmax class, specify
> the gst-openmax class as the 'type', and the 'library-name' and
> 'compnent-name' of the OMX component, and optionally the 'rank'
> (defaults to 0 or GST_RANK_NONE):
>
> ----
> omx_h264dec,
> type=GstOmxH264Dec,
> library-name=libomxil-bellagio.so.0,
> component-name=OMX.st.video_decoder.avc,
> rank=256;
> ----
>
> Or in the advanced case of multiple OMX components per gst-openmax
> class, specify the gst-openmax class as the 'parent-type' and a
> dynamically created sub-class for the 'type':
>
> ----
> omx_mp3dec_ti,
> parent-type=GstOmxMp3Dec,
> type=GstOmxMp3DecTi
> library-name=libOMX_Core.so.0,
> component-name=OMX.TI.AUDIO.DECODE,
> component-role=audio_decode.dsp.mp3,
> rank=256;
>
> omx_mp3dec_nokia,
> parent-type=GstOmxMp3Dec,
> type=GstOmxMp3DecNokia
> library-name=libomxil_bellagio.so.0,
> component-name=OMX.nokia.audio_decode.mp3,
> rank=128;
> ----
>
> By default, the config file is stored in $HOME/.config/gst-openmax.conf,
> although if none is found a default config will be created.
>
> Modified by Felipe Contreras to keep using the library and component
> names through qdata. Plus a bunch of cleanups and reorganization.
>
> Signed-off-by: Felipe Contreras <fel...@no...>
[...]
> + path = g_strdup (g_getenv ("OMX_REGISTRY"));
One final change: s/OMX_REGISTRY/OMX_CONFIG/
And patches pushed. Thanks.
--
Felipe Contreras
|
|
From: Stefan K. <en...@ho...> - 2010-03-04 20:13:58
|
Am 04.03.2010 20:15, schrieb Felipe Contreras:
> On Thu, Mar 04, 2010 at 09:18:23AM +0100, ext Stefan Kost wrote:
>> Felipe Contreras wrote:
>>> As suggested by Rob Clark.
>>>
>>> Signed-off-by: Felipe Contreras <fel...@no...>
>>> ---
>>> omx/gstomx_base_filter.c | 12 ++----------
>>> omx/gstomx_base_sink.c | 12 ++----------
>>> omx/gstomx_base_src.c | 12 ++----------
>>> 3 files changed, 6 insertions(+), 30 deletions(-)
>>>
>>> diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
>>> index 01ca10a..da41b4d 100644
>>> --- a/omx/gstomx_base_filter.c
>>> +++ b/omx/gstomx_base_filter.c
>>> @@ -201,14 +201,6 @@ set_property (GObject *obj,
>>>
>>> switch (prop_id)
>>> {
>>> - case ARG_COMPONENT_NAME:
>>> - g_free (self->gomx->component_name);
>>> - self->gomx->component_name = g_value_dup_string (value);
>>> - break;
>>> - case ARG_LIBRARY_NAME:
>>> - g_free (self->gomx->library_name);
>>> - self->gomx->library_name = g_value_dup_string (value);
>>> - break;
>>> case ARG_USE_TIMESTAMPS:
>>> self->use_timestamps = g_value_get_boolean (value);
>>> break;
>>> @@ -268,12 +260,12 @@ type_class_init (gpointer g_class,
>>> g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
>>> g_param_spec_string ("component-name", "Component name",
>>> "Name of the OpenMAX IL component to use",
>>> - NULL, G_PARAM_READWRITE));
>>> + NULL, G_PARAM_READABLE));
>>>
>>> g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
>>> g_param_spec_string ("library-name", "Library name",
>>> "Name of the OpenMAX IL implementation library to use",
>>> - NULL, G_PARAM_READWRITE));
>>> + NULL, G_PARAM_READABLE));
>>>
>>> g_object_class_install_property (gobject_class, ARG_USE_TIMESTAMPS,
>>> g_param_spec_boolean ("use-timestamps", "Use timestamps",
>>> diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
>>> index ac32799..b042f33 100644
>>> --- a/omx/gstomx_base_sink.c
>>> +++ b/omx/gstomx_base_sink.c
>>> @@ -295,14 +295,6 @@ set_property (GObject *obj,
>>>
>>> switch (prop_id)
>>> {
>>> - case ARG_COMPONENT_NAME:
>>> - g_free (self->gomx->component_name);
>>> - self->gomx->component_name = g_value_dup_string (value);
>>> - break;
>>> - case ARG_LIBRARY_NAME:
>>> - g_free (self->gomx->library_name);
>>> - self->gomx->library_name = g_value_dup_string (value);
>>> - break;
>>> default:
>>> G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
>>> break;
>>> @@ -363,12 +355,12 @@ type_class_init (gpointer g_class,
>>> g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
>>> g_param_spec_string ("component-name", "Component name",
>>> "Name of the OpenMAX IL component to use",
>>> - NULL, G_PARAM_READWRITE));
>>> + NULL, G_PARAM_READABLE));
>>>
>>> g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
>>> g_param_spec_string ("library-name", "Library name",
>>> "Name of the OpenMAX IL implementation library to use",
>>> - NULL, G_PARAM_READWRITE));
>>> + NULL, G_PARAM_READABLE));
>>> }
>>> }
>>>
>>> diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
>>> index 51aa189..bd25c6d 100644
>>> --- a/omx/gstomx_base_src.c
>>> +++ b/omx/gstomx_base_src.c
>>> @@ -359,14 +359,6 @@ set_property (GObject *obj,
>>>
>>> switch (prop_id)
>>> {
>>> - case ARG_COMPONENT_NAME:
>>> - g_free (self->gomx->component_name);
>>> - self->gomx->component_name = g_value_dup_string (value);
>>> - break;
>>> - case ARG_LIBRARY_NAME:
>>> - g_free (self->gomx->library_name);
>>> - self->gomx->library_name = g_value_dup_string (value);
>>> - break;
>>> default:
>>> G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
>>> break;
>>> @@ -424,12 +416,12 @@ type_class_init (gpointer g_class,
>>> g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
>>> g_param_spec_string ("component-name", "Component name",
>>> "Name of the OpenMAX IL component to use",
>>> - NULL, G_PARAM_READWRITE));
>>> + NULL, G_PARAM_READABLE));
>>>
>>> g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
>>> g_param_spec_string ("library-name", "Library name",
>>> "Name of the OpenMAX IL implementation library to use",
>>> - NULL, G_PARAM_READWRITE));
>>> + NULL, G_PARAM_READABLE));
>>> }
>>> }
>>>
>>>
>>
>> As a minor optimization I'd suggest to use G_PARAM_STATIC_STRINGS in
>> addition. This avoids copying the ("library-name", "Library name", "Name
>> of the OpenMAX IL implementation library to use") stings. There is a
>> flag for each string, if only some are static.
>
> Thanks, we should do that, but that's unrelated to this patch. We can do
> the change before or after it.
>
> Cheers.
>
Yes of course separately. Just wanted to point that out as I saw it.
Stefan
|
|
From: Felipe C. <fel...@no...> - 2010-03-04 18:15:51
|
On Thu, Mar 04, 2010 at 09:18:23AM +0100, ext Stefan Kost wrote:
> Felipe Contreras wrote:
> > As suggested by Rob Clark.
> >
> > Signed-off-by: Felipe Contreras <fel...@no...>
> > ---
> > omx/gstomx_base_filter.c | 12 ++----------
> > omx/gstomx_base_sink.c | 12 ++----------
> > omx/gstomx_base_src.c | 12 ++----------
> > 3 files changed, 6 insertions(+), 30 deletions(-)
> >
> > diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
> > index 01ca10a..da41b4d 100644
> > --- a/omx/gstomx_base_filter.c
> > +++ b/omx/gstomx_base_filter.c
> > @@ -201,14 +201,6 @@ set_property (GObject *obj,
> >
> > switch (prop_id)
> > {
> > - case ARG_COMPONENT_NAME:
> > - g_free (self->gomx->component_name);
> > - self->gomx->component_name = g_value_dup_string (value);
> > - break;
> > - case ARG_LIBRARY_NAME:
> > - g_free (self->gomx->library_name);
> > - self->gomx->library_name = g_value_dup_string (value);
> > - break;
> > case ARG_USE_TIMESTAMPS:
> > self->use_timestamps = g_value_get_boolean (value);
> > break;
> > @@ -268,12 +260,12 @@ type_class_init (gpointer g_class,
> > g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
> > g_param_spec_string ("component-name", "Component name",
> > "Name of the OpenMAX IL component to use",
> > - NULL, G_PARAM_READWRITE));
> > + NULL, G_PARAM_READABLE));
> >
> > g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
> > g_param_spec_string ("library-name", "Library name",
> > "Name of the OpenMAX IL implementation library to use",
> > - NULL, G_PARAM_READWRITE));
> > + NULL, G_PARAM_READABLE));
> >
> > g_object_class_install_property (gobject_class, ARG_USE_TIMESTAMPS,
> > g_param_spec_boolean ("use-timestamps", "Use timestamps",
> > diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
> > index ac32799..b042f33 100644
> > --- a/omx/gstomx_base_sink.c
> > +++ b/omx/gstomx_base_sink.c
> > @@ -295,14 +295,6 @@ set_property (GObject *obj,
> >
> > switch (prop_id)
> > {
> > - case ARG_COMPONENT_NAME:
> > - g_free (self->gomx->component_name);
> > - self->gomx->component_name = g_value_dup_string (value);
> > - break;
> > - case ARG_LIBRARY_NAME:
> > - g_free (self->gomx->library_name);
> > - self->gomx->library_name = g_value_dup_string (value);
> > - break;
> > default:
> > G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
> > break;
> > @@ -363,12 +355,12 @@ type_class_init (gpointer g_class,
> > g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
> > g_param_spec_string ("component-name", "Component name",
> > "Name of the OpenMAX IL component to use",
> > - NULL, G_PARAM_READWRITE));
> > + NULL, G_PARAM_READABLE));
> >
> > g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
> > g_param_spec_string ("library-name", "Library name",
> > "Name of the OpenMAX IL implementation library to use",
> > - NULL, G_PARAM_READWRITE));
> > + NULL, G_PARAM_READABLE));
> > }
> > }
> >
> > diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
> > index 51aa189..bd25c6d 100644
> > --- a/omx/gstomx_base_src.c
> > +++ b/omx/gstomx_base_src.c
> > @@ -359,14 +359,6 @@ set_property (GObject *obj,
> >
> > switch (prop_id)
> > {
> > - case ARG_COMPONENT_NAME:
> > - g_free (self->gomx->component_name);
> > - self->gomx->component_name = g_value_dup_string (value);
> > - break;
> > - case ARG_LIBRARY_NAME:
> > - g_free (self->gomx->library_name);
> > - self->gomx->library_name = g_value_dup_string (value);
> > - break;
> > default:
> > G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
> > break;
> > @@ -424,12 +416,12 @@ type_class_init (gpointer g_class,
> > g_object_class_install_property (gobject_class, ARG_COMPONENT_NAME,
> > g_param_spec_string ("component-name", "Component name",
> > "Name of the OpenMAX IL component to use",
> > - NULL, G_PARAM_READWRITE));
> > + NULL, G_PARAM_READABLE));
> >
> > g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
> > g_param_spec_string ("library-name", "Library name",
> > "Name of the OpenMAX IL implementation library to use",
> > - NULL, G_PARAM_READWRITE));
> > + NULL, G_PARAM_READABLE));
> > }
> > }
> >
> >
>
> As a minor optimization I'd suggest to use G_PARAM_STATIC_STRINGS in
> addition. This avoids copying the ("library-name", "Library name", "Name
> of the OpenMAX IL implementation library to use") stings. There is a
> flag for each string, if only some are static.
Thanks, we should do that, but that's unrelated to this patch. We can do
the change before or after it.
Cheers.
--
Felipe Contreras
|
|
From: Clark, R. <ro...@ti...> - 2010-03-04 13:47:47
|
On Mar 4, 2010, at 7:28 AM, Felipe Contreras wrote:
> On Thu, Mar 04, 2010 at 12:04:50AM +0100, Rob Clark wrote:
>> not a comment on current patch (which looks fine to me, btw), but a
>> note about what I'm thinking for future evolution of config file..
>>
>> since we are using a GstStructure as the the config file syntax, it
>> would be really simple to start adding element specific fields. For
>> example, anything that subclasses GstOmxBaseVideoDec could have an
>> optional output-formats list. Like:
>>
>> ----
>> omx_h264dec,
>> type=GstOmxH264Dec,
>> library-name=libomxil-bellagio.so.0,
>> component-name=OMX.st.video_decoder.avc,
>> srcpad-formats=(fourcc){I420, YUY2, NV12},
>> rank=256;
>> ----
>>
>> or audio decoder could have fields for supported # of channels or
>> rates, etc, etc.
>>
>> It should be really easy to add an API to take an element and field
>> name as parameter, and return a GValue which could be dropped into the
>> caps.
>>
>> At that point, it might make sense to move the library and component
>> name strings out of the element.. I'm not sure. But that can come as
>> a later patch.
>
> I don't see what one thing has to do with the other. What an API to
> fetch fields from the config has to do with element properties?
Well, the could perhaps share a common API, and this way all config parameters could be handled basically the same way..
although you are right, there is no requirement to do it this way.. I'm only thinking out-loud (in email form) here..
BR,
-R
>
>> (Oh, and I want to make those library-name and component-name
>> properties as read-only too.. but also another patch)
>
> I already sent the patches for that.
>
> --
> Felipe Contreras
|
|
From: Felipe C. <fel...@no...> - 2010-03-04 13:36:50
|
On Thu, Mar 04, 2010 at 12:38:26AM +0100, Rob Clark wrote:
>
> On Mar 3, 2010, at 4:51 PM, Felipe Contreras wrote:
>
> > @@ -234,10 +231,10 @@ get_property (GObject *obj,
> > switch (prop_id)
> > {
> > case ARG_COMPONENT_NAME:
> > - g_value_set_string (value, self->omx_component);
> > + g_value_set_string (value, self->gomx->component_name);
> > break;
> > case ARG_LIBRARY_NAME:
> > - g_value_set_string (value, self->omx_library);
> > + g_value_set_string (value, self->gomx->library_name);
> > break;
>
> one thought as I look at the patch (and something that I didn't think
> of either when I made my original patch)..
>
> but the get_property() for component-name and library-name (and when I
> send a later patch, component-role) are basically identical..
>
> what about adding a g_omx_core_get_property_helper() which could be
> shared by all the base classes? This way, when I send the patch to
> add component-role, it just changes GOmxCore and not the base classes
> ;-)
>
> I can send the updated patch if you like the idea
Yeah, I like the idea, but the g_omx_ is for util stuff that's not
directly related to GStreamer (from the old GOmx library), it might make
sense change this prefix in the future. Anyway, the rest of the stuff
should have gstomx_.
Or, even better, add the properties to the interface:
http://library.gnome.org/devel/gobject/unstable/howto-interface-properties.html
I'm not sure if that's what we want, but sounds like it.
Cheers.
--
Felipe Contreras
|
|
From: Felipe C. <fel...@no...> - 2010-03-04 13:29:07
|
On Thu, Mar 04, 2010 at 12:04:50AM +0100, Rob Clark wrote:
> not a comment on current patch (which looks fine to me, btw), but a
> note about what I'm thinking for future evolution of config file..
>
> since we are using a GstStructure as the the config file syntax, it
> would be really simple to start adding element specific fields. For
> example, anything that subclasses GstOmxBaseVideoDec could have an
> optional output-formats list. Like:
>
> ----
> omx_h264dec,
> type=GstOmxH264Dec,
> library-name=libomxil-bellagio.so.0,
> component-name=OMX.st.video_decoder.avc,
> srcpad-formats=(fourcc){I420, YUY2, NV12},
> rank=256;
> ----
>
> or audio decoder could have fields for supported # of channels or
> rates, etc, etc.
>
> It should be really easy to add an API to take an element and field
> name as parameter, and return a GValue which could be dropped into the
> caps.
>
> At that point, it might make sense to move the library and component
> name strings out of the element.. I'm not sure. But that can come as
> a later patch.
I don't see what one thing has to do with the other. What an API to
fetch fields from the config has to do with element properties?
> (Oh, and I want to make those library-name and component-name
> properties as read-only too.. but also another patch)
I already sent the patches for that.
--
Felipe Contreras
|