diff options
author | Rob Clark <rob@ti.com> | 2010-04-18 23:32:09 -0500 |
---|---|---|
committer | Felipe Contreras <felipe.contreras@nokia.com> | 2010-04-28 23:57:54 +0300 |
commit | ee8b91c3789d836c80a14f6b04b524b5f44af331 (patch) | |
tree | 005ef692920fd6ef800c36de272f40acf2e3736e | |
parent | 6bb6df7ffa6b4eeb23d40ec18720e1f75ebd7c09 (diff) |
Add GstOmxBaseAudioDec base class
Refactor some common functionality, in particular the settings_changed_cb,
into an abstract base class.
Signed-off-by: Felipe Contreras <felipe.contreras@nokia.com>
-rw-r--r-- | omx/Makefile.am | 1 | ||||
-rw-r--r-- | omx/gstomx_aacdec.c | 45 | ||||
-rw-r--r-- | omx/gstomx_aacdec.h | 6 | ||||
-rw-r--r-- | omx/gstomx_adpcmdec.c | 1 | ||||
-rw-r--r-- | omx/gstomx_amrnbdec.c | 48 | ||||
-rw-r--r-- | omx/gstomx_amrnbdec.h | 6 | ||||
-rw-r--r-- | omx/gstomx_amrwbdec.c | 48 | ||||
-rw-r--r-- | omx/gstomx_amrwbdec.h | 6 | ||||
-rw-r--r-- | omx/gstomx_base_audiodec.c | 95 | ||||
-rw-r--r-- | omx/gstomx_base_audiodec.h | 51 | ||||
-rw-r--r-- | omx/gstomx_g711dec.c | 1 | ||||
-rw-r--r-- | omx/gstomx_g729dec.c | 4 | ||||
-rw-r--r-- | omx/gstomx_g729dec.h | 6 | ||||
-rw-r--r-- | omx/gstomx_ilbcdec.c | 1 | ||||
-rw-r--r-- | omx/gstomx_mp2dec.c | 55 | ||||
-rw-r--r-- | omx/gstomx_mp2dec.h | 6 | ||||
-rw-r--r-- | omx/gstomx_mp3dec.c | 56 | ||||
-rw-r--r-- | omx/gstomx_mp3dec.h | 6 | ||||
-rw-r--r-- | omx/gstomx_vorbisdec.c | 45 | ||||
-rw-r--r-- | omx/gstomx_vorbisdec.h | 6 |
20 files changed, 179 insertions, 314 deletions
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..25f19cb --- /dev/null +++ b/omx/gstomx_base_audiodec.c @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2009 Texas Instruments, Inc. + * + * Author: Rob Clark <rob@ti.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation + * version 2.1 of the License. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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..a5f924e --- /dev/null +++ b/omx/gstomx_base_audiodec.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2009 Texas Instruments, Inc. + * + * Author: Rob Clark <rob@ti.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation + * version 2.1 of the License. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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); |