[Gstreamer-openmax] [PATCH] Add GstOmxBaseAudioDec base class
Rob Clark
rob at ti.com
Tue Nov 3 18:26:54 PST 2009
Refactor some common functionality, in particular the settings_changed_cb, into an abstract base class.
Signed-off-by: Rob Clark <rob at ti.com>
---
omx/Makefile.am | 1 +
omx/gstomx_aacdec.c | 42 +-------------------
omx/gstomx_aacdec.h | 6 +-
omx/gstomx_adpcmdec.c | 1 +
omx/gstomx_amrnbdec.c | 45 +--------------------
omx/gstomx_amrnbdec.h | 6 +-
omx/gstomx_amrwbdec.c | 45 +--------------------
omx/gstomx_amrwbdec.h | 6 +-
omx/gstomx_base_audiodec.c | 96 ++++++++++++++++++++++++++++++++++++++++++++
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 | 52 +-----------------------
omx/gstomx_mp2dec.h | 6 +-
omx/gstomx_mp3dec.c | 53 +------------------------
omx/gstomx_mp3dec.h | 6 +-
omx/gstomx_vorbisdec.c | 43 +-------------------
omx/gstomx_vorbisdec.h | 6 +-
20 files changed, 182 insertions(+), 297 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 4a3fbf9..f5b2ffc 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 4f20370..8b9129f 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_aacdec.h"
-#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);
+GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -129,43 +128,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_PORT_GET_PARAM (omx_base->out_port, 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)
@@ -203,7 +165,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 61b0d20..ec3d54e 100644
--- a/omx/gstomx_adpcmdec.c
+++ b/omx/gstomx_adpcmdec.c
@@ -25,6 +25,7 @@
#include <string.h> /* for memset */
+/* 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 f481e6d..27d5eef 100644
--- a/omx/gstomx_amrnbdec.c
+++ b/omx/gstomx_amrnbdec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_amrnbdec.h"
-#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);
+GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,49 +102,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_PORT_GET_PARAM (omx_base->out_port, 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 cee5334..5ddd605 100644
--- a/omx/gstomx_amrwbdec.c
+++ b/omx/gstomx_amrwbdec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_amrwbdec.h"
-#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);
+GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -103,49 +102,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_PORT_GET_PARAM (omx_base->out_port, 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..de4defb
--- /dev/null
+++ b/omx/gstomx_base_audiodec.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/
+ *
+ * Description: Base audio decoder element
+ * Created on: Aug 2, 2009
+ * Author: Rob Clark <rob at ti.com>
+ *
+ * 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"
+
+#include <string.h> /* for memset */
+
+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_PORT_GET_PARAM (omx_base->out_port, 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 <rob at ti.com>
+ *
+ * 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 14edf5d..c1e64a9 100644
--- a/omx/gstomx_g711dec.c
+++ b/omx/gstomx_g711dec.c
@@ -25,6 +25,7 @@
#include <string.h> /* for memset, 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 8160c53..984b142 100644
--- a/omx/gstomx_mp2dec.c
+++ b/omx/gstomx_mp2dec.c
@@ -25,7 +25,7 @@
#include <string.h> /* for memset */
-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)
@@ -106,57 +106,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_PORT_GET_PARAM (omx_base->out_port, 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 facf03f..ee7fdd4 100644
--- a/omx/gstomx_mp3dec.c
+++ b/omx/gstomx_mp3dec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_mp3dec.h"
-#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);
+GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -106,57 +105,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_PORT_GET_PARAM (omx_base->out_port, 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 b906e67..a5f9b4f 100644
--- a/omx/gstomx_vorbisdec.c
+++ b/omx/gstomx_vorbisdec.c
@@ -20,12 +20,11 @@
*/
#include "gstomx_vorbisdec.h"
-#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);
+GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseAudioDec, GST_OMX_BASE_AUDIODEC_TYPE);
static GstCaps *
generate_src_template (void)
@@ -101,44 +100,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_PORT_GET_PARAM (omx_base->out_port, 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 +110,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
More information about the Gstreamer-openmax
mailing list