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: Felipe C. <fel...@gm...> - 2010-03-23 21:55:04
|
On Tue, Mar 9, 2010 at 6:15 AM, Rob Clark <ro...@ti...> wrote: > On Mar 8, 2010, at 10:09 AM, Felipe Contreras wrote: >> I think I already said this before; if the core needs to be initialized >> before; it should be initialized before, manually, and visibly. I think >> that was the point of the config stuff; so that we can initialize the >> core sooner. > > hmm, I didn't think a lazy initializer getter function was such a strange design pattern. It's not about familiarity, it's about "goodness"... you can argue that it's an anti-pattern :) > but, that said, we could do GetHandle() when GOmxCore is constructed, and FreeHandle() when it is free'd.. but I have some worries that this would make things more prone to problems if the application (or playbin, etc) doesn't release the reference to the element. I think discussed this offline after this mail was sent and the consensus was that if this is indeed an issue it should be handled either in the driver release() function, or on the library destructor function. After all a process can be killed any time. -- Felipe Contreras |
|
From: Rob C. <ro...@ti...> - 2010-03-17 23:59:00
|
Refactor some common functionality, in particular the settings_changed_cb,
into an abstract base class.
---
omx/Makefile.am | 1 +
omx/gstomx_aacdec.c | 45 +--------------------
omx/gstomx_aacdec.h | 6 +-
omx/gstomx_adpcmdec.c | 1 +
omx/gstomx_amrnbdec.c | 48 +---------------------
omx/gstomx_amrnbdec.h | 6 +-
omx/gstomx_amrwbdec.c | 48 +---------------------
omx/gstomx_amrwbdec.h | 6 +-
omx/gstomx_base_audiodec.c | 97 ++++++++++++++++++++++++++++++++++++++++++++
omx/gstomx_base_audiodec.h | 53 ++++++++++++++++++++++++
omx/gstomx_g711dec.c | 1 +
omx/gstomx_g729dec.c | 4 +-
omx/gstomx_g729dec.h | 6 +-
omx/gstomx_ilbcdec.c | 1 +
omx/gstomx_mp2dec.c | 55 +------------------------
omx/gstomx_mp2dec.h | 6 +-
omx/gstomx_mp3dec.c | 56 +-------------------------
omx/gstomx_mp3dec.h | 6 +-
omx/gstomx_vorbisdec.c | 45 +--------------------
omx/gstomx_vorbisdec.h | 6 +-
20 files changed, 183 insertions(+), 314 deletions(-)
create mode 100644 omx/gstomx_base_audiodec.c
create mode 100644 omx/gstomx_base_audiodec.h
diff --git a/omx/Makefile.am b/omx/Makefile.am
index 80e7d9a..7e9f81f 100644
--- a/omx/Makefile.am
+++ b/omx/Makefile.am
@@ -6,6 +6,7 @@ libgstomx_la_SOURCES = gstomx.c gstomx.h \
gstomx_base_filter.c gstomx_base_filter.h \
gstomx_base_videodec.c gstomx_base_videodec.h \
gstomx_base_videoenc.c gstomx_base_videoenc.h \
+ gstomx_base_audiodec.c gstomx_base_audiodec.h \
gstomx_dummy.c gstomx_dummy.h \
gstomx_volume.c gstomx_volume.h \
gstomx_mpeg4dec.c gstomx_mpeg4dec.h \
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index b8f0fb2..1916216 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -20,10 +20,9 @@
*/
#include "gstomx_aacdec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
-GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -127,46 +126,6 @@ type_class_init (gpointer g_class,
{
}
-static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_INIT_PARAM (param);
-
- param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
static gboolean
sink_setcaps (GstPad *pad,
GstCaps *caps)
@@ -204,7 +163,5 @@ type_instance_init (GTypeInstance *instance,
omx_base = GST_OMX_BASE_FILTER (instance);
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
-
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
diff --git a/omx/gstomx_aacdec.h b/omx/gstomx_aacdec.h
index b53b030..1b431fd 100644
--- a/omx/gstomx_aacdec.h
+++ b/omx/gstomx_aacdec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxAacDec GstOmxAacDec;
typedef struct GstOmxAacDecClass GstOmxAacDecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxAacDec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxAacDecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_aacdec_get_type (void);
diff --git a/omx/gstomx_adpcmdec.c b/omx/gstomx_adpcmdec.c
index 63151d9..d33de1a 100644
--- a/omx/gstomx_adpcmdec.c
+++ b/omx/gstomx_adpcmdec.c
@@ -23,6 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
+/* should this class extend GstOmxBaseAudioDec? */
GSTOMX_BOILERPLATE (GstOmxAdpcmDec, gst_omx_adpcmdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
diff --git a/omx/gstomx_amrnbdec.c b/omx/gstomx_amrnbdec.c
index 6d0cbaf..0362731 100644
--- a/omx/gstomx_amrnbdec.c
+++ b/omx/gstomx_amrnbdec.c
@@ -20,10 +20,9 @@
*/
#include "gstomx_amrnbdec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
-GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -101,52 +100,7 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_INIT_PARAM (param);
-
- param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
- GstOmxBaseFilter *omx_base;
-
- omx_base = GST_OMX_BASE_FILTER (instance);
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_amrnbdec.h b/omx/gstomx_amrnbdec.h
index 3ec66c2..781e4ed 100644
--- a/omx/gstomx_amrnbdec.h
+++ b/omx/gstomx_amrnbdec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxAmrNbDec GstOmxAmrNbDec;
typedef struct GstOmxAmrNbDecClass GstOmxAmrNbDecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxAmrNbDec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxAmrNbDecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_amrnbdec_get_type (void);
diff --git a/omx/gstomx_amrwbdec.c b/omx/gstomx_amrwbdec.c
index cb41789..581b3da 100644
--- a/omx/gstomx_amrwbdec.c
+++ b/omx/gstomx_amrwbdec.c
@@ -20,10 +20,9 @@
*/
#include "gstomx_amrwbdec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
-GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -101,52 +100,7 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_INIT_PARAM (param);
-
- param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
- GstOmxBaseFilter *omx_base;
-
- omx_base = GST_OMX_BASE_FILTER (instance);
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_amrwbdec.h b/omx/gstomx_amrwbdec.h
index ae0a2cf..61870b8 100644
--- a/omx/gstomx_amrwbdec.h
+++ b/omx/gstomx_amrwbdec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxAmrWbDec GstOmxAmrWbDec;
typedef struct GstOmxAmrWbDecClass GstOmxAmrWbDecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxAmrWbDec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxAmrWbDecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_amrwbdec_get_type (void);
diff --git a/omx/gstomx_base_audiodec.c b/omx/gstomx_base_audiodec.c
new file mode 100644
index 0000000..8dc37d7
--- /dev/null
+++ b/omx/gstomx_base_audiodec.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/
+ *
+ * Description: Base audio decoder element
+ * Created on: Aug 2, 2009
+ * Author: Rob Clark <ro...@ti...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "gstomx_base_audiodec.h"
+#include "gstomx.h"
+
+GSTOMX_BOILERPLATE (GstOmxBaseAudioDec, gst_omx_base_audiodec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+
+static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
+type_class_init (gpointer g_class,
+ gpointer class_data)
+{
+}
+
+static void
+settings_changed_cb (GOmxCore *core)
+{
+ GstOmxBaseFilter *omx_base;
+ guint rate;
+ guint channels;
+
+ omx_base = core->object;
+
+ GST_DEBUG_OBJECT (omx_base, "settings changed");
+
+ {
+ OMX_AUDIO_PARAM_PCMMODETYPE param;
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = omx_base->out_port->port_index;
+ OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
+
+ rate = param.nSamplingRate;
+ channels = param.nChannels;
+ if (rate == 0)
+ {
+ /** @todo: this shouldn't happen. */
+ GST_WARNING_OBJECT (omx_base, "Bad samplerate");
+ rate = 44100;
+ }
+ }
+
+ {
+ GstCaps *new_caps;
+
+ new_caps = gst_caps_new_simple ("audio/x-raw-int",
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "rate", G_TYPE_INT, rate,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "channels", G_TYPE_INT, channels,
+ NULL);
+
+ GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
+ gst_pad_set_caps (omx_base->srcpad, new_caps);
+ }
+}
+
+static void
+type_instance_init (GTypeInstance *instance,
+ gpointer g_class)
+{
+ GstOmxBaseFilter *omx_base;
+
+ omx_base = GST_OMX_BASE_FILTER (instance);
+
+ GST_DEBUG_OBJECT (omx_base, "start");
+
+ omx_base->gomx->settings_changed_cb = settings_changed_cb;
+}
diff --git a/omx/gstomx_base_audiodec.h b/omx/gstomx_base_audiodec.h
new file mode 100644
index 0000000..83472e6
--- /dev/null
+++ b/omx/gstomx_base_audiodec.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/
+ *
+ * Description: Base audio decoder element
+ * Created on: Aug 2, 2009
+ * Author: Rob Clark <ro...@ti...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GSTOMX_BASE_AUDIODEC_H
+#define GSTOMX_BASE_AUDIODEC_H
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_OMX_BASE_AUDIODEC(obj) (GstOmxBaseAudioDec *) (obj)
+#define GST_OMX_BASE_AUDIODEC_TYPE (gst_omx_base_audiodec_get_type ())
+
+typedef struct GstOmxBaseAudioDec GstOmxBaseAudioDec;
+typedef struct GstOmxBaseAudioDecClass GstOmxBaseAudioDecClass;
+
+#include "gstomx_base_filter.h"
+
+struct GstOmxBaseAudioDec
+{
+ GstOmxBaseFilter omx_base;
+};
+
+struct GstOmxBaseAudioDecClass
+{
+ GstOmxBaseFilterClass parent_class;
+};
+
+GType gst_omx_base_audiodec_get_type (void);
+
+G_END_DECLS
+
+#endif /* GSTOMX_BASE_AUDIODEC_H */
diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c
index 623101e..2067953 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -25,6 +25,7 @@
#include <string.h> /* for strcmp */
+/* should this class extend GstOmxBaseAudioDec? */
GSTOMX_BOILERPLATE (GstOmxG711Dec, gst_omx_g711dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
diff --git a/omx/gstomx_g729dec.c b/omx/gstomx_g729dec.c
index 666d5ab..a558011 100644
--- a/omx/gstomx_g729dec.c
+++ b/omx/gstomx_g729dec.c
@@ -20,10 +20,9 @@
*/
#include "gstomx_g729dec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
-GSTOMX_BOILERPLATE (GstOmxG729Dec, gst_omx_g729dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxG729Dec, gst_omx_g729dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -105,6 +104,7 @@ type_class_init (gpointer g_class,
{
}
+/* should we be overriding the settings_changed_cb from parent class like this?? */
static void
settings_changed_cb (GOmxCore *core)
{
diff --git a/omx/gstomx_g729dec.h b/omx/gstomx_g729dec.h
index abe5504..49e525f 100644
--- a/omx/gstomx_g729dec.h
+++ b/omx/gstomx_g729dec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxG729Dec GstOmxG729Dec;
typedef struct GstOmxG729DecClass GstOmxG729DecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxG729Dec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxG729DecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_g729dec_get_type (void);
diff --git a/omx/gstomx_ilbcdec.c b/omx/gstomx_ilbcdec.c
index 9d03f01..ff899ac 100644
--- a/omx/gstomx_ilbcdec.c
+++ b/omx/gstomx_ilbcdec.c
@@ -23,6 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
+/* should this class extend GstOmxBaseAudioDec? */
GSTOMX_BOILERPLATE (GstOmxIlbcDec, gst_omx_ilbcdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c
index 564e14c..319ef8e 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -104,60 +104,7 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_INIT_PARAM (param);
-
- param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- if (rate == 0)
- {
- /** @todo: this shouldn't happen. */
- GST_WARNING_OBJECT (omx_base, "Bad samplerate");
- rate = 44100;
- }
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
- GstOmxBaseFilter *omx_base;
-
- omx_base = GST_OMX_BASE_FILTER (instance);
-
- GST_DEBUG_OBJECT (omx_base, "start");
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_mp2dec.h b/omx/gstomx_mp2dec.h
index 877d3c5..c6c517e 100644
--- a/omx/gstomx_mp2dec.h
+++ b/omx/gstomx_mp2dec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxMp2Dec GstOmxMp2Dec;
typedef struct GstOmxMp2DecClass GstOmxMp2DecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxMp2Dec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxMp2DecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_mp2dec_get_type (void);
diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c
index a766689..8a1f465 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -20,10 +20,9 @@
*/
#include "gstomx_mp3dec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
-GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -104,60 +103,7 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_INIT_PARAM (param);
-
- param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- if (rate == 0)
- {
- /** @todo: this shouldn't happen. */
- GST_WARNING_OBJECT (omx_base, "Bad samplerate");
- rate = 44100;
- }
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "channels", G_TYPE_INT, channels,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
- GstOmxBaseFilter *omx_base;
-
- omx_base = GST_OMX_BASE_FILTER (instance);
-
- GST_DEBUG_OBJECT (omx_base, "start");
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_mp3dec.h b/omx/gstomx_mp3dec.h
index f353ee5..c0a7d78 100644
--- a/omx/gstomx_mp3dec.h
+++ b/omx/gstomx_mp3dec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxMp3Dec GstOmxMp3Dec;
typedef struct GstOmxMp3DecClass GstOmxMp3DecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxMp3Dec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxMp3DecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_mp3dec_get_type (void);
diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c
index fa532df..afd53fd 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -20,10 +20,9 @@
*/
#include "gstomx_vorbisdec.h"
-#include "gstomx_base_filter.h"
#include "gstomx.h"
-GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
+GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -99,46 +98,6 @@ type_class_init (gpointer g_class,
}
static void
-settings_changed_cb (GOmxCore *core)
-{
- GstOmxBaseFilter *omx_base;
- guint rate;
- guint channels;
-
- omx_base = core->object;
-
- GST_DEBUG_OBJECT (omx_base, "settings changed");
-
- {
- OMX_AUDIO_PARAM_PCMMODETYPE param;
-
- G_OMX_INIT_PARAM (param);
-
- param.nPortIndex = omx_base->out_port->port_index;
- OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m);
-
- rate = param.nSamplingRate;
- channels = param.nChannels;
- }
-
- {
- GstCaps *new_caps;
-
- new_caps = gst_caps_new_simple ("audio/x-raw-int",
- "rate", G_TYPE_INT, rate,
- "signed", G_TYPE_BOOLEAN, TRUE,
- "channels", G_TYPE_INT, channels,
- "endianness", G_TYPE_INT, G_BYTE_ORDER,
- "width", G_TYPE_INT, 16,
- "depth", G_TYPE_INT, 16,
- NULL);
-
- GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
- gst_pad_set_caps (omx_base->srcpad, new_caps);
- }
-}
-
-static void
type_instance_init (GTypeInstance *instance,
gpointer g_class)
{
@@ -149,6 +108,4 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
omx_base->use_timestamps = FALSE;
-
- omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
diff --git a/omx/gstomx_vorbisdec.h b/omx/gstomx_vorbisdec.h
index 05ce070..c7737a3 100644
--- a/omx/gstomx_vorbisdec.h
+++ b/omx/gstomx_vorbisdec.h
@@ -32,16 +32,16 @@ G_BEGIN_DECLS
typedef struct GstOmxVorbisDec GstOmxVorbisDec;
typedef struct GstOmxVorbisDecClass GstOmxVorbisDecClass;
-#include "gstomx_base_filter.h"
+#include "gstomx_base_audiodec.h"
struct GstOmxVorbisDec
{
- GstOmxBaseFilter omx_base;
+ GstOmxBaseAudioDec omx_base;
};
struct GstOmxVorbisDecClass
{
- GstOmxBaseFilterClass parent_class;
+ GstOmxBaseAudioDecClass parent_class;
};
GType gst_omx_vorbisdec_get_type (void);
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-17 23:58:56
|
---
omx/gstomx_base_filter.c | 12 ++++++++++++
omx/gstomx_util.c | 2 ++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 76ec085..3f6677f 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -63,6 +63,7 @@ setup_ports (GstOmxBaseFilter *self)
/* @todo: read from config file: */
if (g_getenv ("OMX_ALLOCATE_ON"))
{
+ GST_DEBUG_OBJECT (self, "OMX_ALLOCATE_ON");
self->in_port->omx_allocate = TRUE;
self->out_port->omx_allocate = TRUE;
self->share_input_buffer = FALSE;
@@ -70,14 +71,25 @@ setup_ports (GstOmxBaseFilter *self)
}
else if (g_getenv ("OMX_SHARE_HACK_ON"))
{
+ GST_DEBUG_OBJECT (self, "OMX_SHARE_HACK_ON");
self->share_input_buffer = TRUE;
self->share_output_buffer = TRUE;
}
else if (g_getenv ("OMX_SHARE_HACK_OFF"))
{
+ GST_DEBUG_OBJECT (self, "OMX_SHARE_HACK_OFF");
self->share_input_buffer = FALSE;
self->share_output_buffer = FALSE;
}
+ else
+ {
+ GST_DEBUG_OBJECT (self, "default sharing and allocation");
+ }
+
+ GST_DEBUG_OBJECT (self, "omx_allocate: in: %d, out: %d",
+ self->in_port->omx_allocate, self->out_port->omx_allocate);
+ GST_DEBUG_OBJECT (self, "share_buffer: in: %d, out: %d",
+ self->share_input_buffer, self->share_output_buffer);
}
static GstStateChangeReturn
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index 103c919..1fe0722 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -586,6 +586,7 @@ port_allocate_buffers (GOmxPort *port)
{
if (port->omx_allocate)
{
+ GST_DEBUG_OBJECT (port->core->object, "%d: OMX_AllocateBuffer(), size=%"G_GSIZE_FORMAT, i, size);
OMX_AllocateBuffer (port->core->omx_handle,
&port->buffers[i],
port->port_index,
@@ -596,6 +597,7 @@ port_allocate_buffers (GOmxPort *port)
{
gpointer buffer_data;
buffer_data = g_malloc (size);
+ GST_DEBUG_OBJECT (port->core->object, "%d: OMX_UseBuffer(), size=%"G_GSIZE_FORMAT, i, size);
OMX_UseBuffer (port->core->omx_handle,
&port->buffers[i],
port->port_index,
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-17 23:58:53
|
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 | 24 +++++-------------------
omx/gstomx_base_sink.c | 26 ++++----------------------
omx/gstomx_base_src.c | 26 ++++----------------------
5 files changed, 56 insertions(+), 63 deletions(-)
diff --git a/omx/gstomx.c b/omx/gstomx.c
index ff232b0..86db3c3 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -333,6 +333,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..20414cb 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_NUM_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 7c388b5..98b40d5 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_NUM_COMMON_PROP,
};
static void init_interfaces (GType type);
@@ -201,14 +198,11 @@ get_property (GObject *obj,
self = GST_OMX_BASE_FILTER (obj);
+ if (gstomx_get_property_helper (self->gomx, prop_id, value))
+ return;
+
switch (prop_id)
{
- 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;
@@ -241,15 +235,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 20c9ab7..7fd61d5 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 void init_interfaces (GType type);
GSTOMX_BOILERPLATE_FULL (GstOmxBaseSink, gst_omx_base_sink, GstBaseSink, GST_TYPE_BASE_SINK, init_interfaces);
@@ -281,14 +274,11 @@ get_property (GObject *obj,
self = GST_OMX_BASE_SINK (obj);
+ if (gstomx_get_property_helper (self->gomx, prop_id, value))
+ return;
+
switch (prop_id)
{
- 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;
@@ -324,15 +314,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 2c3fe11..00d27b6 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -24,13 +24,6 @@
#include <string.h> /* for memcpy */
-enum
-{
- ARG_0,
- ARG_COMPONENT_NAME,
- ARG_LIBRARY_NAME,
-};
-
GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_SRC);
static void
@@ -342,14 +335,11 @@ get_property (GObject *obj,
self = GST_OMX_BASE_SRC (obj);
+ if (gstomx_get_property_helper (self->gomx, prop_id, value))
+ return;
+
switch (prop_id)
{
- 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;
@@ -382,15 +372,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-17 23:58:53
|
---
omx/gstomx_base_filter.c | 62 ++++++++++++++++++++++++++++++++++++++
omx/gstomx_base_sink.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
omx/gstomx_base_src.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 210 insertions(+), 0 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 98b40d5..76ec085 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -28,6 +28,8 @@
enum
{
ARG_USE_TIMESTAMPS = GSTOMX_NUM_COMMON_PROP,
+ ARG_NUM_INPUT_BUFFERS,
+ ARG_NUM_OUTPUT_BUFFERS,
};
static void init_interfaces (GType type);
@@ -182,6 +184,36 @@ 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:
+ if (G_LIKELY (self->gomx->omx_handle))
+ {
+ 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;
+ OMX_GetParameter (self->gomx->omx_handle, 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;
+
+ OMX_SetParameter (self->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ }
+ else
+ {
+ GST_WARNING_OBJECT (self, "no component");
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -206,6 +238,27 @@ 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:
+ if (G_LIKELY (self->gomx->omx_handle))
+ {
+ 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;
+ OMX_GetParameter (self->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+
+ g_value_set_uint (value, param.nBufferCountActual);
+ }
+ else
+ {
+ GST_WARNING_OBJECT (self, "no component");
+ g_value_set_uint (value, 0);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -241,6 +294,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 7fd61d5..ce70df8 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_NUM_COMMON_PROP,
+};
+
static gboolean share_input_buffer;
static inline gboolean omx_init (GstOmxBaseSink *self);
@@ -265,6 +270,51 @@ 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:
+ if (G_LIKELY (self->gomx->omx_handle))
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+ OMX_U32 nBufferCountActual = g_value_get_uint (value);
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = self->in_port->port_index;
+ OMX_GetParameter (self->gomx->omx_handle, 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;
+
+ OMX_SetParameter (self->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ }
+ else
+ {
+ GST_WARNING_OBJECT (self, "no component");
+ }
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+ break;
+ }
+}
+
+static void
get_property (GObject *obj,
guint prop_id,
GValue *value,
@@ -279,6 +329,24 @@ get_property (GObject *obj,
switch (prop_id)
{
+ case ARG_NUM_INPUT_BUFFERS:
+ if (G_LIKELY (self->gomx->omx_handle))
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = self->in_port->port_index;
+ OMX_GetParameter (self->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+
+ g_value_set_uint (value, param.nBufferCountActual);
+ }
+ else
+ {
+ GST_WARNING_OBJECT (self, "no component");
+ g_value_set_uint (value, 0);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -312,9 +380,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 00d27b6..66ed11d 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_NUM_COMMON_PROP,
+};
+
GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_SRC);
static void
@@ -326,6 +331,51 @@ 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:
+ if (G_LIKELY (self->gomx->omx_handle))
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+ OMX_U32 nBufferCountActual = g_value_get_uint (value);
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = self->out_port->port_index;
+ OMX_GetParameter (self->gomx->omx_handle, 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;
+
+ OMX_SetParameter (self->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+ }
+ else
+ {
+ GST_WARNING_OBJECT (self, "no component");
+ }
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+ break;
+ }
+}
+
+static void
get_property (GObject *obj,
guint prop_id,
GValue *value,
@@ -340,6 +390,24 @@ get_property (GObject *obj,
switch (prop_id)
{
+ case ARG_NUM_OUTPUT_BUFFERS:
+ if (G_LIKELY (self->gomx->omx_handle))
+ {
+ OMX_PARAM_PORTDEFINITIONTYPE param;
+
+ G_OMX_INIT_PARAM (param);
+
+ param.nPortIndex = self->out_port->port_index;
+ OMX_GetParameter (self->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+
+ g_value_set_uint (value, param.nBufferCountActual);
+ }
+ else
+ {
+ GST_WARNING_OBJECT (self, "no component");
+ g_value_set_uint (value, 0);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
break;
@@ -370,9 +438,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-17 23:58:51
|
---
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 | 2 +-
omx/gstomx_base_sink.c | 2 +-
omx/gstomx_base_src.c | 2 +-
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.c | 6 +-----
omx/gstomx_util.h | 9 +++++++++
omx/gstomx_videosink.c | 17 ++++-------------
omx/gstomx_volume.c | 7 +------
omx/gstomx_vorbisdec.c | 7 +------
28 files changed, 55 insertions(+), 197 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 871c395..7c388b5 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
{
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index e78db32..20c9ab7 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;
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 888a447..2c3fe11 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 */
enum
{
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.c b/omx/gstomx_util.c
index f14cc86..bbf699b 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -22,7 +22,6 @@
#include "gstomx_util.h"
#include <dlfcn.h>
-#include <string.h> /* for memset */
#include "gstomx.h"
@@ -526,10 +525,7 @@ g_omx_port_setup (GOmxPort *port)
GOmxPortType type = -1;
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 = port->port_index;
OMX_GetParameter (port->core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index d373193..8608a66 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -192,4 +192,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-17 23:58:50
|
---
omx/gstomx_util.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index 115ca84..f14cc86 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -160,7 +160,12 @@ imp_new (const gchar *name)
{
void *handle;
+ GST_DEBUG ("loading: %s", name);
+
imp->dl_handle = handle = dlopen (name, RTLD_LAZY);
+
+ GST_DEBUG ("dlopen(%s) -> %p", name, handle);
+
if (!handle)
{
g_warning ("%s\n", dlerror ());
@@ -316,6 +321,9 @@ g_omx_core_free (GOmxCore *core)
static void
core_init (GOmxCore *core)
{
+ GST_DEBUG_OBJECT (core->object, "loading: %s (%s)",
+ core->component_name, core->library_name);
+
core->imp = request_imp (core->library_name);
if (!core->imp)
@@ -325,6 +333,10 @@ 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;
}
@@ -339,7 +351,16 @@ core_deinit (GOmxCore *core)
core->omx_state == OMX_StateInvalid)
{
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);
+ }
+ }
+ else
+ {
+ GST_WARNING_OBJECT (core->object, "Incorrect state: %s",
+ omx_state_to_str (core->omx_state));
}
g_free (core->library_name);
@@ -530,6 +551,10 @@ g_omx_port_setup (GOmxPort *port)
port->num_buffers = param.nBufferCountActual;
port->buffer_size = param.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 +887,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 +907,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 +916,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-17 23:58:50
|
---
omx/gstomx.c | 14 +++++++++++++-
omx/gstomx.h | 1 +
omx/gstomx_util.c | 23 +++++++++++++++++++++--
omx/gstomx_util.h | 1 +
4 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 86db3c3..70a789f 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -247,7 +247,7 @@ plugin_init (GstPlugin *plugin)
const gchar *element_name = gst_structure_nth_field_name (element_table, i);
GstStructure *element = get_element_entry (element_name);
const gchar *type_name, *parent_type_name;
- const gchar *component_name, *library_name;
+ const gchar *component_name, *component_role, *library_name;
GType type;
gint rank;
@@ -256,6 +256,7 @@ plugin_init (GstPlugin *plugin)
parent_type_name = gst_structure_get_string (element, "parent-type");
type_name = gst_structure_get_string (element, "type");
component_name = gst_structure_get_string (element, "component-name");
+ component_role = gst_structure_get_string (element, "component-role");
library_name = gst_structure_get_string (element, "library-name");
if (!type_name || !component_name || !library_name)
@@ -330,6 +331,9 @@ gstomx_get_component_info (void *core,
str = gst_structure_get_string (element, "component-name");
rcore->component_name = g_strdup (str);
+ str = gst_structure_get_string (element, "component-role");
+ rcore->component_role = g_strdup (str);
+
return TRUE;
}
@@ -342,6 +346,11 @@ gstomx_install_property_helper (GObjectClass *gobject_class)
"Name of the OpenMAX IL component to use",
NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, ARG_COMPONENT_ROLE,
+ g_param_spec_string ("component-role", "Component role",
+ "Role of the OpenMAX IL component",
+ 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",
@@ -357,6 +366,9 @@ gstomx_get_property_helper (void *core, guint prop_id, GValue *value)
case ARG_COMPONENT_NAME:
g_value_set_string (value, gomx->component_name);
return TRUE;
+ case ARG_COMPONENT_ROLE:
+ g_value_set_string (value, gomx->component_role);
+ return TRUE;
case ARG_LIBRARY_NAME:
g_value_set_string (value, gomx->library_name);
return TRUE;
diff --git a/omx/gstomx.h b/omx/gstomx.h
index 20414cb..1ef73f2 100644
--- a/omx/gstomx.h
+++ b/omx/gstomx.h
@@ -34,6 +34,7 @@ enum
{
GSTOMX_ARG_0,
ARG_COMPONENT_NAME,
+ ARG_COMPONENT_ROLE,
ARG_LIBRARY_NAME,
GSTOMX_NUM_COMMON_PROP
};
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index bbf699b..103c919 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -320,8 +320,10 @@ g_omx_core_free (GOmxCore *core)
static void
core_init (GOmxCore *core)
{
- GST_DEBUG_OBJECT (core->object, "loading: %s (%s)",
- core->component_name, core->library_name);
+ GST_DEBUG_OBJECT (core->object, "loading: %s %s (%s)",
+ core->component_name,
+ core->component_role ? core->component_role : "",
+ core->library_name);
core->imp = request_imp (core->library_name);
@@ -337,7 +339,23 @@ core_init (GOmxCore *core)
core->omx_handle, core->omx_error);
if (!core->omx_error)
+ {
core->omx_state = OMX_StateLoaded;
+
+ if (core->component_role)
+ {
+ OMX_PARAM_COMPONENTROLETYPE param;
+
+ GST_DEBUG_OBJECT (core->object, "setting component role: %s",
+ core->component_role);
+
+ G_OMX_INIT_PARAM (param);
+
+ strcpy((char*)param.cRole, core->component_role);
+
+ OMX_SetParameter (core->omx_handle, OMX_IndexParamStandardComponentRole, ¶m);
+ }
+ }
}
static void
@@ -364,6 +382,7 @@ core_deinit (GOmxCore *core)
g_free (core->library_name);
g_free (core->component_name);
+ g_free (core->component_role);
release_imp (core->imp);
core->imp = NULL;
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 8608a66..19047da 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -94,6 +94,7 @@ struct GOmxCore
gchar *library_name;
gchar *component_name;
+ gchar *component_role;
};
struct GOmxPort
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-17 23:58:45
|
This way omx_handle is always valid, and can be used in get/set_property
methods.
---
omx/gstomx_base_filter.c | 8 +-------
omx/gstomx_base_sink.c | 5 +----
omx/gstomx_base_src.c | 5 +----
omx/gstomx_util.c | 23 ++++++++++++++++++-----
omx/gstomx_util.h | 4 +---
5 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index e12fcd2..871c395 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -101,7 +101,6 @@ change_state (GstElement *element,
switch (transition)
{
case GST_STATE_CHANGE_NULL_TO_READY:
- g_omx_core_init (core);
if (core->omx_state != OMX_StateLoaded)
{
ret = GST_STATE_CHANGE_FAILURE;
@@ -141,10 +140,6 @@ change_state (GstElement *element,
}
break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- g_omx_core_deinit (core);
- break;
-
default:
break;
}
@@ -875,8 +870,7 @@ type_instance_init (GTypeInstance *instance,
self->use_timestamps = TRUE;
- self->gomx = g_omx_core_new (self);
- gstomx_get_component_info (self->gomx, G_TYPE_FROM_CLASS (g_class));
+ self->gomx = g_omx_core_new (self, g_class);
self->in_port = g_omx_core_new_port (self->gomx, 0);
self->out_port = g_omx_core_new_port (self->gomx, 1);
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index b6a8955..e78db32 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -381,8 +381,6 @@ activate_push (GstPad *pad,
static inline gboolean
omx_init (GstOmxBaseSink *self)
{
- g_omx_core_init (self->gomx);
-
if (self->gomx->omx_error)
return FALSE;
@@ -421,8 +419,7 @@ type_instance_init (GTypeInstance *instance,
GST_LOG_OBJECT (self, "begin");
- self->gomx = g_omx_core_new (self);
- gstomx_get_component_info (self->gomx, G_TYPE_FROM_CLASS (g_class));
+ self->gomx = g_omx_core_new (self, g_class);
self->in_port = g_omx_core_new_port (self->gomx, 0);
{
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index fea7631..888a447 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -54,7 +54,6 @@ start (GstBaseSrc *gst_base)
GST_LOG_OBJECT (self, "begin");
- g_omx_core_init (self->gomx);
if (self->gomx->omx_error)
return GST_STATE_CHANGE_FAILURE;
@@ -74,7 +73,6 @@ stop (GstBaseSrc *gst_base)
g_omx_core_stop (self->gomx);
g_omx_core_unload (self->gomx);
- g_omx_core_deinit (self->gomx);
if (self->gomx->omx_error)
return GST_STATE_CHANGE_FAILURE;
@@ -406,8 +404,7 @@ type_instance_init (GTypeInstance *instance,
GST_LOG_OBJECT (self, "begin");
- self->gomx = g_omx_core_new (self);
- gstomx_get_component_info (self->gomx, G_TYPE_FROM_CLASS (g_class));
+ self->gomx = g_omx_core_new (self, g_class);
self->out_port = g_omx_core_new_port (self->gomx, 1);
GST_LOG_OBJECT (self, "end");
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index b1c869a..115ca84 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -79,6 +79,9 @@ omx_error_to_str (OMX_ERRORTYPE omx_error);
static inline GOmxPort * get_port (GOmxCore *core, guint index);
+static void core_init (GOmxCore *core);
+static void core_deinit (GOmxCore *core);
+
static inline void
port_free_buffers (GOmxPort *port);
@@ -264,7 +267,7 @@ g_omx_deinit (void)
*/
GOmxCore *
-g_omx_core_new (void *object)
+g_omx_core_new (void *object, gpointer g_class)
{
GOmxCore *core;
@@ -282,12 +285,22 @@ g_omx_core_new (void *object)
core->omx_state = OMX_StateInvalid;
+ /* it is a bit awkward to have to pass the element's g_class to
+ * g_omx_core_new(), but since this is called from type_inistance_init
+ * function, we can't rely on G_OBJECT_TYPE()..
+ */
+ gstomx_get_component_info (core, G_TYPE_FROM_CLASS (g_class));
+
+ core_init (core);
+
return core;
}
void
g_omx_core_free (GOmxCore *core)
{
+ core_deinit (core);
+
g_sem_free (core->port_sem);
g_sem_free (core->flush_sem);
g_sem_free (core->done_sem);
@@ -300,8 +313,8 @@ g_omx_core_free (GOmxCore *core)
g_free (core);
}
-void
-g_omx_core_init (GOmxCore *core)
+static void
+core_init (GOmxCore *core)
{
core->imp = request_imp (core->library_name);
@@ -316,8 +329,8 @@ g_omx_core_init (GOmxCore *core)
core->omx_state = OMX_StateLoaded;
}
-void
-g_omx_core_deinit (GOmxCore *core)
+static void
+core_deinit (GOmxCore *core)
{
if (!core->imp)
return;
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 456f9a8..d373193 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -117,10 +117,8 @@ struct GOmxPort
void g_omx_init (void);
void g_omx_deinit (void);
-GOmxCore *g_omx_core_new (void *object);
+GOmxCore *g_omx_core_new (void *object, gpointer g_class);
void g_omx_core_free (GOmxCore *core);
-void g_omx_core_init (GOmxCore *core);
-void g_omx_core_deinit (GOmxCore *core);
void g_omx_core_prepare (GOmxCore *core);
void g_omx_core_start (GOmxCore *core);
void g_omx_core_pause (GOmxCore *core);
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-17 23:58:45
|
Rebased on top of 'port cleanups' patchset.
Now, OMX component is instantiated when GOmxCore is constructed. So the
patchset no longer includes the g_omx_core_{get,set}_{config,param} helper
functions as these were not needed as much anymore. (Although it might be
nice to add them later, so at least there is a common place to put an error
traces if any of the OMX_{Get,Set}{Config,Param}() calls returns an error.)
Rob Clark (8):
core: call OMX_GetHandle in g_omx_core_new
Add some debug traces
Add G_OMX_INIT_PARAM utility macro
Handle properties common to all gstomx base classes with helper
functions
Add component-role support
Add input-buffers/output-buffers properties to the base classes
Add some debug traces
Add GstOmxBaseAudioDec base class
omx/Makefile.am | 1 +
omx/gstomx.c | 46 ++++++++++++++++++-
omx/gstomx.h | 12 +++++
omx/gstomx_aacdec.c | 50 +--------------------
omx/gstomx_aacdec.h | 6 +-
omx/gstomx_aacenc.c | 22 ++-------
omx/gstomx_adpcmdec.c | 8 +---
omx/gstomx_adpcmenc.c | 12 +----
omx/gstomx_amrnbdec.c | 53 +---------------------
omx/gstomx_amrnbdec.h | 6 +-
omx/gstomx_amrnbenc.c | 12 +----
omx/gstomx_amrwbdec.c | 53 +---------------------
omx/gstomx_amrwbdec.h | 6 +-
omx/gstomx_amrwbenc.c | 12 +----
omx/gstomx_audiosink.c | 7 +---
omx/gstomx_base_audiodec.c | 97 +++++++++++++++++++++++++++++++++++++++
omx/gstomx_base_audiodec.h | 53 +++++++++++++++++++++
omx/gstomx_base_filter.c | 108 +++++++++++++++++++++++++++++++++-----------
omx/gstomx_base_sink.c | 103 +++++++++++++++++++++++++++++++----------
omx/gstomx_base_src.c | 95 ++++++++++++++++++++++++++++++---------
omx/gstomx_base_videodec.c | 18 +------
omx/gstomx_base_videoenc.c | 13 ++----
omx/gstomx_g711dec.c | 8 +--
omx/gstomx_g711enc.c | 7 +--
omx/gstomx_g729dec.c | 4 +-
omx/gstomx_g729dec.h | 6 +-
omx/gstomx_g729enc.c | 7 +---
omx/gstomx_h263enc.c | 7 +---
omx/gstomx_h264enc.c | 7 +---
omx/gstomx_ilbcdec.c | 1 +
omx/gstomx_jpegenc.c | 20 ++-------
omx/gstomx_mp2dec.c | 60 +------------------------
omx/gstomx_mp2dec.h | 6 +-
omx/gstomx_mp3dec.c | 61 +------------------------
omx/gstomx_mp3dec.h | 6 +-
omx/gstomx_mpeg4enc.c | 7 +---
omx/gstomx_util.c | 79 ++++++++++++++++++++++++++++----
omx/gstomx_util.h | 14 +++++-
omx/gstomx_videosink.c | 17 ++-----
omx/gstomx_volume.c | 7 +---
omx/gstomx_vorbisdec.c | 50 +--------------------
omx/gstomx_vorbisdec.h | 6 +-
42 files changed, 589 insertions(+), 584 deletions(-)
create mode 100644 omx/gstomx_base_audiodec.c
create mode 100644 omx/gstomx_base_audiodec.h
|
|
From: Rob C. <ro...@ti...> - 2010-03-17 22:50:23
|
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_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 +-
23 files changed, 37 insertions(+), 37 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_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-17 22:50:20
|
Do OMX_GetParameter(PortDefinition) inside g_omx_port_setup(), rather than
duplicating same code in each caller.
---
omx/gstomx_base_filter.c | 20 ++------------------
omx/gstomx_base_sink.c | 15 +--------------
omx/gstomx_base_src.c | 15 +--------------
omx/gstomx_util.c | 19 +++++++++++++------
omx/gstomx_util.h | 2 +-
5 files changed, 18 insertions(+), 53 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index edbb11e..e12fcd2 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -53,28 +53,12 @@ log_buffer (GstOmxBaseFilter *self,
static void
setup_ports (GstOmxBaseFilter *self)
{
- GOmxCore *core;
- OMX_PARAM_PORTDEFINITIONTYPE param;
-
- core = self->gomx;
-
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Input port configuration. */
-
- param.nPortIndex = 0;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- g_omx_port_setup (self->in_port, ¶m);
+ g_omx_port_setup (self->in_port);
gst_pad_set_element_private (self->sinkpad, self->in_port);
/* Output port configuration. */
-
- param.nPortIndex = 1;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- g_omx_port_setup (self->out_port, ¶m);
+ g_omx_port_setup (self->out_port);
gst_pad_set_element_private (self->srcpad, self->out_port);
/* @todo: read from config file: */
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index f946874..b6a8955 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -45,21 +45,8 @@ GSTOMX_BOILERPLATE_FULL (GstOmxBaseSink, gst_omx_base_sink, GstBaseSink, GST_TYP
static void
setup_ports (GstOmxBaseSink *self)
{
- GOmxCore *core;
- OMX_PARAM_PORTDEFINITIONTYPE param;
-
- core = self->gomx;
-
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Input port configuration. */
-
- param.nPortIndex = 0;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- g_omx_port_setup (self->in_port, ¶m);
+ g_omx_port_setup (self->in_port);
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 0741aab..fea7631 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -36,21 +36,8 @@ GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_S
static void
setup_ports (GstOmxBaseSrc *self)
{
- GOmxCore *core;
- OMX_PARAM_PORTDEFINITIONTYPE param;
-
- core = self->gomx;
-
- memset (¶m, 0, sizeof (param));
- param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
- param.nVersion.s.nVersionMajor = 1;
- param.nVersion.s.nVersionMinor = 1;
-
/* Input port configuration. */
-
- param.nPortIndex = 0;
- OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
- g_omx_port_setup (self->out_port, ¶m);
+ g_omx_port_setup (self->out_port);
if (self->setup_ports)
{
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index e1060da..b1c869a 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -22,6 +22,7 @@
#include "gstomx_util.h"
#include <dlfcn.h>
+#include <string.h> /* for memset */
#include "gstomx.h"
@@ -486,14 +487,20 @@ g_omx_port_free (GOmxPort *port)
}
void
-g_omx_port_setup (GOmxPort *port,
- OMX_PARAM_PORTDEFINITIONTYPE *omx_port)
+g_omx_port_setup (GOmxPort *port)
{
GOmxPortType type = -1;
+ OMX_PARAM_PORTDEFINITIONTYPE param;
- g_assert (port->port_index == omx_port->nPortIndex);
+ memset (¶m, 0, sizeof (param));
+ param.nSize = sizeof (OMX_PARAM_PORTDEFINITIONTYPE);
+ param.nVersion.s.nVersionMajor = 1;
+ param.nVersion.s.nVersionMinor = 1;
- switch (omx_port->eDir)
+ param.nPortIndex = port->port_index;
+ OMX_GetParameter (port->core->omx_handle, OMX_IndexParamPortDefinition, ¶m);
+
+ switch (param.eDir)
{
case OMX_DirInput:
type = GOMX_PORT_INPUT;
@@ -507,8 +514,8 @@ g_omx_port_setup (GOmxPort *port,
port->type = type;
/** @todo should it be nBufferCountMin? */
- port->num_buffers = omx_port->nBufferCountActual;
- port->buffer_size = omx_port->nBufferSize;
+ port->num_buffers = param.nBufferCountActual;
+ port->buffer_size = param.nBufferSize;
g_free (port->buffers);
port->buffers = g_new0 (OMX_BUFFERHEADERTYPE *, port->num_buffers);
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index f763618..456f9a8 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -134,7 +134,7 @@ GOmxPort *g_omx_core_new_port (GOmxCore *core, guint index);
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_setup (GOmxPort *port);
void g_omx_port_push_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer);
OMX_BUFFERHEADERTYPE *g_omx_port_request_buffer (GOmxPort *port);
void g_omx_port_release_buffer (GOmxPort *port, OMX_BUFFERHEADERTYPE *omx_buffer);
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-17 22:50:17
|
The port objects are constructed up in element constructor (so they are
valid at any point in the element's lifecycle), and bound to a port_index
at construction time, rather than getting constructed in setup_ports.
This will be useful later to enable properties that directly set port
params.
---
omx/gstomx_base_filter.c | 7 ++++-
omx/gstomx_base_sink.c | 3 +-
omx/gstomx_base_src.c | 3 +-
omx/gstomx_util.c | 56 +++++++++++++++++++++++-----------------------
omx/gstomx_util.h | 4 +-
5 files changed, 39 insertions(+), 34 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index cbded8b..edbb11e 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -67,16 +67,17 @@ 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);
+ /* @todo: read from config file: */
if (g_getenv ("OMX_ALLOCATE_ON"))
{
self->in_port->omx_allocate = TRUE;
@@ -892,6 +893,8 @@ type_instance_init (GTypeInstance *instance,
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_new_port (self->gomx, 0);
+ self->out_port = g_omx_core_new_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 97200b0..f946874 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -59,7 +59,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);
}
@@ -436,6 +436,7 @@ type_instance_init (GTypeInstance *instance,
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_new_port (self->gomx, 0);
{
GstPad *sinkpad;
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index ee04e78..0741aab 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -50,7 +50,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)
{
@@ -421,6 +421,7 @@ type_instance_init (GTypeInstance *instance,
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_new_port (self->gomx, 1);
GST_LOG_OBJECT (self, "end");
}
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index b2a96c8..e1060da 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,33 @@ 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 *
-g_omx_core_get_port (GOmxCore *core,
+GOmxPort *
+g_omx_core_new_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);
+ GST_WARNING_OBJECT (core->object, "port %d already exists", index);
+ return port;
}
- return NULL;
+ port = g_omx_port_new (core, index);
+ g_ptr_array_insert (core->ports, index, port);
+
+ return port;
}
void
@@ -458,13 +452,18 @@ g_omx_core_flush_stop (GOmxCore *core)
* Port
*/
+/**
+ * note: this is not intended to be called directly by elements (which should
+ * instead use g_omx_core_new_port())
+ */
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 +491,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 +509,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 +904,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 +921,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..f763618 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_new_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-17 22:50:15
|
These apply on top of the last patchset ('rebased boilerplate reduction
macros')
Rob Clark (3):
Construct GOmxPort objects in element constructor
Simplify g_omx_port_setup()
Don't hard-code port indexes
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 | 23 +++-----------
omx/gstomx_base_sink.c | 16 +--------
omx/gstomx_base_src.c | 16 +--------
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_util.c | 73 ++++++++++++++++++++++++--------------------
omx/gstomx_util.h | 6 ++--
omx/gstomx_videosink.c | 6 ++--
omx/gstomx_volume.c | 2 +-
omx/gstomx_vorbisdec.c | 2 +-
28 files changed, 89 insertions(+), 119 deletions(-)
|
|
From: Felipe C. <fel...@gm...> - 2010-03-16 00:29:46
|
On Mon, Mar 15, 2010 at 12:51 PM, Joseph, Arun <aru...@ti...> wrote: > Still I am getting error message > > "timebase not supported by mpeg4 standard" According to Google that's an FFmpeg error, so my guess is that bellagio needs to be updated. -- Felipe Contreras |
|
From: Rob C. <ro...@ti...> - 2010-03-15 22:29:47
|
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-15 22:29:44
|
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 7ebc52d..cbded8b 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -33,7 +33,8 @@ enum
ARG_USE_TIMESTAMPS,
};
-static GstElementClass *parent_class;
+static void init_interfaces (GType type);
+GSTOMX_BOILERPLATE_FULL (GstOmxBaseFilter, gst_omx_base_filter, GstElement, GST_TYPE_ELEMENT, init_interfaces);
static inline void
log_buffer (GstOmxBaseFilter *self,
@@ -238,6 +239,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -247,8 +253,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
gstelement_class = GST_ELEMENT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
gobject_class->finalize = finalize;
gstelement_class->change_state = change_state;
@@ -929,38 +933,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 4062146..97200b0 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -39,7 +39,8 @@ enum
ARG_LIBRARY_NAME,
};
-static GstElementClass *parent_class;
+static void init_interfaces (GType type);
+GSTOMX_BOILERPLATE_FULL (GstOmxBaseSink, gst_omx_base_sink, GstBaseSink, GST_TYPE_BASE_SINK, init_interfaces);
static void
setup_ports (GstOmxBaseSink *self)
@@ -308,6 +309,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -319,8 +325,6 @@ type_class_init (gpointer g_class,
gst_base_sink_class = GST_BASE_SINK_CLASS (g_class);
gstelement_class = GST_ELEMENT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
gobject_class->finalize = finalize;
gstelement_class->change_state = change_state;
@@ -462,39 +466,21 @@ interface_init (GstImplementsInterfaceClass *klass)
{
klass->supported = interface_supported;
}
-
-GType
-gst_omx_base_sink_get_type (void)
+static void
+init_interfaces (GType type)
{
- static GType type = 0;
+ GInterfaceInfo *iface_info;
+ GInterfaceInfo *omx_info;
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
- GInterfaceInfo *iface_info;
- GInterfaceInfo *omx_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseSinkClass);
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseSink);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_TYPE_BASE_SINK, "GstOmxBaseSink", type_info, 0);
- g_free (type_info);
+ iface_info = g_new0 (GInterfaceInfo, 1);
+ iface_info->interface_init = (GInterfaceInitFunc) interface_init;
- iface_info = g_new0 (GInterfaceInfo, 1);
- iface_info->interface_init = (GInterfaceInitFunc) interface_init;
+ g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
+ g_free (iface_info);
- g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, iface_info);
- g_free (iface_info);
-
- omx_info = g_new0 (GInterfaceInfo, 1);
- omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
-
- g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
- g_free (omx_info);
- }
+ omx_info = g_new0 (GInterfaceInfo, 1);
+ omx_info->interface_init = (GInterfaceInitFunc) omx_interface_init;
- return type;
+ g_type_add_interface_static (type, GST_TYPE_OMX, omx_info);
+ g_free (omx_info);
}
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 70888e7..ee04e78 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -31,7 +31,7 @@ enum
ARG_LIBRARY_NAME,
};
-static GstElementClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseSrc, gst_omx_base_src, GstBaseSrc, GST_TYPE_BASE_SRC);
static void
setup_ports (GstOmxBaseSrc *self)
@@ -372,6 +372,11 @@ get_property (GObject *obj,
}
static void
+type_base_init (gpointer g_class)
+{
+}
+
+static void
type_class_init (gpointer g_class,
gpointer class_data)
{
@@ -381,8 +386,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
gst_base_src_class = GST_BASE_SRC_CLASS (g_class);
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
gobject_class->finalize = finalize;
gst_base_src_class->start = start;
@@ -421,26 +424,3 @@ type_instance_init (GTypeInstance *instance,
GST_LOG_OBJECT (self, "end");
}
-
-GType
-gst_omx_base_src_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseSrcClass);
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseSrc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_TYPE_BASE_SRC, "GstOmxBaseSrc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_base_videodec.c b/omx/gstomx_base_videodec.c
index c6dd364..3ff2f44 100644
--- a/omx/gstomx_base_videodec.c
+++ b/omx/gstomx_base_videodec.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseVideoDec, gst_omx_base_videodec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -91,7 +91,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -277,27 +276,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_base_videodec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseVideoDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseVideoDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxBaseVideoDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_base_videoenc.c b/omx/gstomx_base_videoenc.c
index 6f21a48..7c99a53 100644
--- a/omx/gstomx_base_videoenc.c
+++ b/omx/gstomx_base_videoenc.c
@@ -32,7 +32,7 @@ enum
#define DEFAULT_BITRATE 0
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxBaseVideoEnc, gst_omx_base_videoenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -146,8 +146,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -297,27 +295,3 @@ type_instance_init (GTypeInstance *instance,
self->bitrate = DEFAULT_BITRATE;
}
-
-GType
-gst_omx_base_videoenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxBaseVideoEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxBaseVideoEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxBaseVideoEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_dummy.c b/omx/gstomx_dummy.c
index 63fde61..03ebc41 100644
--- a/omx/gstomx_dummy.c
+++ b/omx/gstomx_dummy.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxDummy, gst_omx_dummy, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -88,7 +88,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -101,27 +100,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
}
-
-GType
-gst_omx_dummy_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxDummyClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxDummy);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxDummy", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_filereadersrc.c b/omx/gstomx_filereadersrc.c
index a391b69..f6c8dd1 100644
--- a/omx/gstomx_filereadersrc.c
+++ b/omx/gstomx_filereadersrc.c
@@ -29,7 +29,7 @@ enum
ARG_FILE_NAME,
};
-static GstOmxBaseSrcClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxFilereaderSrc, gst_omx_filereadersrc, GstOmxBaseSrc, GST_OMX_BASE_SRC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -167,7 +167,6 @@ type_class_init (gpointer g_class,
GstBaseSrcClass *gst_base_src_class;
GObjectClass *gobject_class;
- parent_class = g_type_class_ref (GST_OMX_BASE_SRC_TYPE);
gst_base_src_class = GST_BASE_SRC_CLASS (g_class);
gobject_class = G_OBJECT_CLASS (g_class);
@@ -201,27 +200,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "end");
}
-
-GType
-gst_omx_filereadersrc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxFilereaderSrcClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxFilereaderSrc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_SRC_TYPE, "GstOmxFilereaderSrc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g711dec.c b/omx/gstomx_g711dec.c
index f2b5e73..40cd64b 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset, strcmp */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG711Dec, gst_omx_g711dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -112,7 +112,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -188,27 +187,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_g711dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG711DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG711Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG711Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g711enc.c b/omx/gstomx_g711enc.c
index 440f3f4..16d58aa 100644
--- a/omx/gstomx_g711enc.c
+++ b/omx/gstomx_g711enc.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset, strcmp */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG711Enc, gst_omx_g711enc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -112,7 +112,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -202,27 +201,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_g711enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG711EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG711Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG711Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g729dec.c b/omx/gstomx_g729dec.c
index 1aefa60..666d5ab 100644
--- a/omx/gstomx_g729dec.c
+++ b/omx/gstomx_g729dec.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG729Dec, gst_omx_g729dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -142,27 +141,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_g729dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG729DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG729Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG729Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_g729enc.c b/omx/gstomx_g729enc.c
index 6a47c0f..b6c41f0 100644
--- a/omx/gstomx_g729enc.c
+++ b/omx/gstomx_g729enc.c
@@ -33,7 +33,7 @@ enum
ARG_DTX,
};
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxG729Enc, gst_omx_g729enc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -160,8 +160,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -259,27 +257,3 @@ type_instance_init (GTypeInstance *instance,
self->dtx = DEFAULT_DTX;
}
-
-GType
-gst_omx_g729enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxG729EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxG729Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxG729Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h263dec.c b/omx/gstomx_h263dec.c
index 14d65b7..233e041 100644
--- a/omx/gstomx_h263dec.c
+++ b/omx/gstomx_h263dec.c
@@ -22,7 +22,7 @@
#include "gstomx_h263dec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH263Dec, gst_omx_h263dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -77,7 +77,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -90,27 +89,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingH263;
}
-
-GType
-gst_omx_h263dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH263DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH263Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxH263Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h263enc.c b/omx/gstomx_h263enc.c
index 90237e4..5f39029 100644
--- a/omx/gstomx_h263enc.c
+++ b/omx/gstomx_h263enc.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH263Enc, gst_omx_h263enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -74,7 +74,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -135,27 +134,3 @@ type_instance_init (GTypeInstance *instance,
omx_base_filter->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_h263enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH263EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH263Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEOENC_TYPE, "GstOmxH263Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h264dec.c b/omx/gstomx_h264dec.c
index bf13966..4f950df 100644
--- a/omx/gstomx_h264dec.c
+++ b/omx/gstomx_h264dec.c
@@ -22,7 +22,7 @@
#include "gstomx_h264dec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH264Dec, gst_omx_h264dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -76,7 +76,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -89,27 +88,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingAVC;
}
-
-GType
-gst_omx_h264dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH264DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH264Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxH264Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_h264enc.c b/omx/gstomx_h264enc.c
index 3dbf245..336ea9a 100644
--- a/omx/gstomx_h264enc.c
+++ b/omx/gstomx_h264enc.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxH264Enc, gst_omx_h264enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -73,7 +73,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -133,27 +132,3 @@ type_instance_init (GTypeInstance *instance,
omx_base_filter->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_h264enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxH264EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxH264Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEOENC_TYPE, "GstOmxH264Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_ilbcdec.c b/omx/gstomx_ilbcdec.c
index 0547768..9d03f01 100644
--- a/omx/gstomx_ilbcdec.c
+++ b/omx/gstomx_ilbcdec.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxIlbcDec, gst_omx_ilbcdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -122,7 +122,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -167,27 +166,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_ilbcdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxIlbcDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxIlbcDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxIlbcDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_ilbcenc.c b/omx/gstomx_ilbcenc.c
index 789c381..1da2c53 100644
--- a/omx/gstomx_ilbcenc.c
+++ b/omx/gstomx_ilbcenc.c
@@ -23,7 +23,7 @@
#include "gstomx_base_filter.h"
#include "gstomx.h"
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxIlbcEnc, gst_omx_ilbcenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -122,7 +122,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static gboolean
@@ -167,27 +166,3 @@ type_instance_init (GTypeInstance *instance,
gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps);
}
-
-GType
-gst_omx_ilbcenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxIlbcEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxIlbcEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxIlbcEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_jpegenc.c b/omx/gstomx_jpegenc.c
index 2c7c1a1..2799521 100644
--- a/omx/gstomx_jpegenc.c
+++ b/omx/gstomx_jpegenc.c
@@ -34,7 +34,7 @@ enum
#define DEFAULT_QUALITY 90
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxJpegEnc, gst_omx_jpegenc, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -177,8 +177,6 @@ type_class_init (gpointer g_class,
gobject_class = G_OBJECT_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
-
/* Properties stuff */
{
gobject_class->set_property = set_property;
@@ -377,27 +375,3 @@ type_instance_init (GTypeInstance *instance,
self->framerate_denom = 1;
self->quality = DEFAULT_QUALITY;
}
-
-GType
-gst_omx_jpegenc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxJpegEncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxJpegEnc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxJpegEnc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mp2dec.c b/omx/gstomx_mp2dec.c
index 90dcb7f..f6c2568 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -167,27 +166,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_mp2dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMp2DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMp2Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxMp2Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mp3dec.c b/omx/gstomx_mp3dec.c
index ad53d29..08f1896 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -167,27 +166,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_mp3dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMp3DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMp3Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxMp3Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mpeg4dec.c b/omx/gstomx_mpeg4dec.c
index 614daf6..a23fef0 100644
--- a/omx/gstomx_mpeg4dec.c
+++ b/omx/gstomx_mpeg4dec.c
@@ -22,7 +22,7 @@
#include "gstomx_mpeg4dec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMpeg4Dec, gst_omx_mpeg4dec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -103,7 +103,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -116,27 +115,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingMPEG4;
}
-
-GType
-gst_omx_mpeg4dec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMpeg4DecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMpeg4Dec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxMpeg4Dec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_mpeg4enc.c b/omx/gstomx_mpeg4enc.c
index 8f40da1..7a91c1c 100644
--- a/omx/gstomx_mpeg4enc.c
+++ b/omx/gstomx_mpeg4enc.c
@@ -24,7 +24,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxMpeg4Enc, gst_omx_mpeg4enc, GstOmxBaseVideoEnc, GST_OMX_BASE_VIDEOENC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -75,7 +75,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -137,27 +136,3 @@ type_instance_init (GTypeInstance *instance,
omx_base_filter->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_mpeg4enc_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxMpeg4EncClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxMpeg4Enc);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEOENC_TYPE, "GstOmxMpeg4Enc", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index ce0156c..593b491 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -145,4 +145,48 @@ void g_omx_port_enable (GOmxPort *port);
void g_omx_port_disable (GOmxPort *port);
void g_omx_port_finish (GOmxPort *port);
+/* Utility Macros */
+
+/**
+ * Basically like GST_BOILERPLATE / GST_BOILERPLATE_FULL, but follows the
+ * init fxn naming conventions used by gst-openmax. It expects the following
+ * functions to be defined in the same src file following this macro
+ * <ul>
+ * <li> type_base_init(gpointer g_class)
+ * <li> type_class_init(gpointer g_class, gpointer class_data)
+ * <li> type_instance_init(GTypeInstance *instance, gpointer g_class)
+ * </ul>
+ */
+#define GSTOMX_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations) \
+static void type_base_init (gpointer g_class); \
+static void type_class_init (gpointer g_class, gpointer class_data); \
+static void type_instance_init (GTypeInstance *instance, gpointer g_class); \
+static parent_type ## Class *parent_class; \
+static void type_class_init_trampoline (gpointer g_class, gpointer class_data)\
+{ \
+ parent_class = g_type_class_ref (parent_type_macro); \
+ type_class_init (g_class, class_data); \
+} \
+GType type_as_function ## _get_type (void) \
+{ \
+ static GType _type = 0; \
+ if (G_UNLIKELY (_type == 0)) \
+ { \
+ GTypeInfo *type_info; \
+ type_info = g_new0 (GTypeInfo, 1); \
+ type_info->class_size = sizeof (type ## Class); \
+ type_info->base_init = type_base_init; \
+ type_info->class_init = type_class_init_trampoline; \
+ type_info->instance_size = sizeof (type); \
+ type_info->instance_init = type_instance_init; \
+ _type = g_type_register_static (parent_type_macro, #type, type_info, 0);\
+ g_free (type_info); \
+ additional_initializations (_type); \
+ } \
+ return _type; \
+}
+#define GSTOMX_BOILERPLATE(type,type_as_function,parent_type,parent_type_macro) \
+ GSTOMX_BOILERPLATE_FULL (type, type_as_function, parent_type, parent_type_macro, \
+ __GST_DO_NOTHING)
+
#endif /* GSTOMX_UTIL_H */
diff --git a/omx/gstomx_videosink.c b/omx/gstomx_videosink.c
index 3a8cbaa..683ee4c 100644
--- a/omx/gstomx_videosink.c
+++ b/omx/gstomx_videosink.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset, strcmp */
-static GstOmxBaseSinkClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxVideoSink, gst_omx_videosink, GstOmxBaseSink, GST_OMX_BASE_SINK_TYPE);
enum
{
@@ -298,8 +298,6 @@ type_class_init (gpointer g_class,
gobject_class = (GObjectClass *) g_class;
gst_base_sink_class = GST_BASE_SINK_CLASS (g_class);
- parent_class = g_type_class_ref (GST_OMX_BASE_SINK_TYPE);
-
gst_base_sink_class->set_caps = setcaps;
gobject_class->set_property = set_property;
@@ -331,27 +329,3 @@ type_instance_init (GTypeInstance *instance,
GST_DEBUG_OBJECT (omx_base, "start");
}
-
-GType
-gst_omx_videosink_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxVideoSinkClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxVideoSink);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_SINK_TYPE, "GstOmxVideoSink", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_volume.c b/omx/gstomx_volume.c
index 3fbc4e9..cd23103 100644
--- a/omx/gstomx_volume.c
+++ b/omx/gstomx_volume.c
@@ -26,7 +26,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxVolume, gst_omx_volume, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -105,7 +105,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -169,27 +168,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_volume_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxVolumeClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxVolume);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxVolume", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_vorbisdec.c b/omx/gstomx_vorbisdec.c
index 437dc90..2adad9b 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-static GstOmxBaseFilterClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseFilter, GST_OMX_BASE_FILTER_TYPE);
static GstCaps *
generate_src_template (void)
@@ -98,7 +98,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE);
}
static void
@@ -158,28 +157,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->gomx->settings_changed_cb = settings_changed_cb;
}
-
-GType
-gst_omx_vorbisdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
-
- type_info->class_size = sizeof (GstOmxVorbisDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxVorbisDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_FILTER_TYPE, "GstOmxVorbisDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
diff --git a/omx/gstomx_wmvdec.c b/omx/gstomx_wmvdec.c
index 7c12336..b16fd88 100644
--- a/omx/gstomx_wmvdec.c
+++ b/omx/gstomx_wmvdec.c
@@ -22,7 +22,7 @@
#include "gstomx_wmvdec.h"
#include "gstomx.h"
-static GstOmxBaseVideoDecClass *parent_class;
+GSTOMX_BOILERPLATE (GstOmxWmvDec, gst_omx_wmvdec, GstOmxBaseVideoDec, GST_OMX_BASE_VIDEODEC_TYPE);
static GstCaps *
generate_sink_template (void)
@@ -76,7 +76,6 @@ static void
type_class_init (gpointer g_class,
gpointer class_data)
{
- parent_class = g_type_class_ref (GST_OMX_BASE_VIDEODEC_TYPE);
}
static void
@@ -89,27 +88,3 @@ type_instance_init (GTypeInstance *instance,
omx_base->compression_format = OMX_VIDEO_CodingWMV;
}
-
-GType
-gst_omx_wmvdec_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0))
- {
- GTypeInfo *type_info;
-
- type_info = g_new0 (GTypeInfo, 1);
- type_info->class_size = sizeof (GstOmxWmvDecClass);
- type_info->base_init = type_base_init;
- type_info->class_init = type_class_init;
- type_info->instance_size = sizeof (GstOmxWmvDec);
- type_info->instance_init = type_instance_init;
-
- type = g_type_register_static (GST_OMX_BASE_VIDEODEC_TYPE, "GstOmxWmvDec", type_info, 0);
-
- g_free (type_info);
- }
-
- return type;
-}
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-15 22:29:37
|
---
omx/gstomx_base_filter.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index 2d93f5c..7ebc52d 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -716,7 +716,7 @@ out_flushing:
if (error_msg)
{
- GST_ELEMENT_ERROR (self, STREAM, FAILED, (NULL), (error_msg));
+ GST_ELEMENT_ERROR (self, STREAM, FAILED, (NULL), ("%s", error_msg));
ret = GST_FLOW_ERROR;
}
--
1.6.3.2
|
|
From: Rob C. <ro...@ti...> - 2010-03-15 22:29:30
|
Boilerplate macros rebased on latest gst-openmax from fd.o (and also a fix for small compile error that started when I pulled latest gstreamer and/or common) Rob Clark (3): A small fix for compile error with latest gstreamer 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 | 53 +++++++++++++++++-------------------------- 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, 127 insertions(+), 931 deletions(-) |
|
From: Joseph, A. <aru...@ti...> - 2010-03-15 10:51:37
|
Hi, Thanks for your reply. I tried this pipeline gst-launch-0.10 filesrc location=akiyo_qcif.yuv ! videoparse width=176 height=144 framerate=30/1 format="I420" ! omx_mpeg4enc ! filesink location=testoutput.mpeg4 Still I am getting error message "timebase not supported by mpeg4 standard" I varied different combinations of arguments to videoparse; still I was getting the same error. Please help me with your suggestions. Thanks, Arun -----Original Message----- Date: Sat, 13 Mar 2010 11:13:32 +0000 From: Tim-Philipp M?ller <t....@ze...> Subject: Re: [Gstreamer-openmax] Element omx_mpeg4enc help To: gst...@li... Message-ID: <1268478812.19970.2.camel@zingle> Content-Type: text/plain; charset="UTF-8" On Sat, 2010-03-13 at 13:44 +0530, Joseph, Arun wrote: Hi, > I was trying to encode a raw yuv file using omx_mpeg4enc. I used the > Bellagio omx component based on ffmpeg. I tried the below pipeline to > encode a qcif stream. > > gst-launch-0.10 filesrc location= akiyo_qcif.yuv ! omx_mpeg4enc ! filesink location=testoutput.mpeg4 > > I am able to get an encoded stream but the output resolution and output color format was incorrect. > > Then I tried a different pipeline > > gst-launch-0.10 filesrc location= akiyo_qcif.yuv ! "video/x-raw-yuv, > height=144, width=176, framerate=(fraction)30/1, format=(fourcc)I420" > ! omx_mpeg4enc ! filesink location=testoutput.mpeg4 You need a videoparse element (from gst-plugins-bad) after filesrc, with the properties set correctly to match your yuv format. Cheers -Tim -----Original Message----- From: Joseph, Arun Sent: Saturday, March 13, 2010 1:45 PM To: 'gst...@li...' Subject: Element omx_mpeg4enc help Hi, I was trying to encode a raw yuv file using omx_mpeg4enc. I used the Bellagio omx component based on ffmpeg. I tried the below pipeline to encode a qcif stream. gst-launch-0.10 filesrc location= akiyo_qcif.yuv ! omx_mpeg4enc ! filesink location=testoutput.mpeg4 I am able to get an encoded stream but the output resolution and output color format was incorrect. Then I tried a different pipeline gst-launch-0.10 filesrc location= akiyo_qcif.yuv ! "video/x-raw-yuv, height=144, width=176, framerate=(fraction)30/1, format=(fourcc)I420" ! omx_mpeg4enc ! filesink location=testoutput.mpeg4 Then gstreamer was not able to encode the stream, saying "timebase not supported by mpeg4 standard" So please help me by suggesting a working pipeline for mpeg4 encode using omx_mpeg4enc gstreamer element. Thanks, Arun |
|
From: Tim-Philipp M. <t....@ze...> - 2010-03-13 11:15:17
|
On Sat, 2010-03-13 at 13:44 +0530, Joseph, Arun wrote: Hi, > I was trying to encode a raw yuv file using omx_mpeg4enc. I used the > Bellagio omx component based on ffmpeg. I tried the below pipeline to > encode a qcif stream. > > gst-launch-0.10 filesrc location= akiyo_qcif.yuv ! omx_mpeg4enc ! filesink location=testoutput.mpeg4 > > I am able to get an encoded stream but the output resolution and output color format was incorrect. > > Then I tried a different pipeline > > gst-launch-0.10 filesrc location= akiyo_qcif.yuv ! "video/x-raw-yuv, > height=144, width=176, framerate=(fraction)30/1, format=(fourcc)I420" > ! omx_mpeg4enc ! filesink location=testoutput.mpeg4 You need a videoparse element (from gst-plugins-bad) after filesrc, with the properties set correctly to match your yuv format. Cheers -Tim |
|
From: Joseph, A. <aru...@ti...> - 2010-03-13 08:14:52
|
Hi, I was trying to encode a raw yuv file using omx_mpeg4enc. I used the Bellagio omx component based on ffmpeg. I tried the below pipeline to encode a qcif stream. gst-launch-0.10 filesrc location= akiyo_qcif.yuv ! omx_mpeg4enc ! filesink location=testoutput.mpeg4 I am able to get an encoded stream but the output resolution and output color format was incorrect. Then I tried a different pipeline gst-launch-0.10 filesrc location= akiyo_qcif.yuv ! "video/x-raw-yuv, height=144, width=176, framerate=(fraction)30/1, format=(fourcc)I420" ! omx_mpeg4enc ! filesink location=testoutput.mpeg4 Then gstreamer was not able to encode the stream, saying "timebase not supported by mpeg4 standard" So please help me by suggesting a working pipeline for mpeg4 encode using omx_mpeg4enc gstreamer element. Thanks, Arun |
|
From: Felipe C. <fel...@gm...> - 2010-03-09 13:01:11
|
On Tue, Mar 9, 2010 at 3:57 AM, Conrad Parker <co...@me...> wrote: > Is it ok to expect this will never be built with a C++ compiler? I > recall words like new, delete, class etc. being avoided in various > bits of g* code for some form of portability (where systems like > Windows don't have a proper C compiler). No idea, but Rob already mentioned this, and I'll change it to 'tmp' although 'new' is already used in other parts of the code. -- Felipe Contreras |
|
From: Rob C. <ro...@ti...> - 2010-03-09 04:16:02
|
On Mar 8, 2010, at 10:09 AM, Felipe Contreras wrote: > On Mon, Mar 08, 2010 at 12:14:50AM +0100, Rob Clark wrote: >> 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. >> --- > > NAK! I like self-documenting code, and a g_omx_core_get_handle() that > also initializes stuff is not really a 'get'; if anything it's > g_omx_core_get_and_initialize_if_not_initialized_handle(), and nedless > to say, that doesn't look nice. > > I think I already said this before; if the core needs to be initialized > before; it should be initialized before, manually, and visibly. I think > that was the point of the config stuff; so that we can initialize the > core sooner. hmm, I didn't think a lazy initializer getter function was such a strange design pattern. but, that said, we could do GetHandle() when GOmxCore is constructed, and FreeHandle() when it is free'd.. but I have some worries that this would make things more prone to problems if the application (or playbin, etc) doesn't release the reference to the element. BR, -R |
|
From: Conrad P. <co...@me...> - 2010-03-09 01:57:10
|
On 9 March 2010 08:26, Felipe Contreras <fel...@no...> wrote:
> @@ -141,7 +141,7 @@ fetch_element_table (void)
> {
> gchar *path;
> gchar *config, *s;
> - GstStructure *element;
> + GstStructure *new, *element;
>
> path = get_config_path ();
>
> @@ -155,21 +155,23 @@ fetch_element_table (void)
>
> GST_DEBUG ("parsing config:\n%s", config);
>
> - element_table = gst_structure_empty_new ("element_table");
> + new = gst_structure_empty_new ("element_table");
>
Is it ok to expect this will never be built with a C++ compiler? I
recall words like new, delete, class etc. being avoided in various
bits of g* code for some form of portability (where systems like
Windows don't have a proper C compiler).
Conrad.
|