2 * Copyright (C) 2009 Texas Instruments, Inc.
4 * Author: Rob Clark <rob@ti.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include "gstomx_base_audiodec.h"
25 GSTOMX_BOILERPLATE (GstOmxBaseAudioDec, gst_omx_base_audiodec, GstOmxBaseFilter,
26 GST_OMX_BASE_FILTER_TYPE);
29 type_base_init (gpointer g_class)
34 type_class_init (gpointer g_class, gpointer class_data)
39 settings_changed_cb (GOmxCore * core)
41 GstOmxBaseFilter *omx_base;
45 omx_base = core->object;
47 GST_DEBUG_OBJECT (omx_base, "settings changed");
50 OMX_AUDIO_PARAM_PCMMODETYPE param;
52 G_OMX_INIT_PARAM (param);
54 param.nPortIndex = omx_base->out_port->port_index;
55 OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm,
58 rate = param.nSamplingRate;
59 channels = param.nChannels;
61 /** @todo: this shouldn't happen. */
62 GST_WARNING_OBJECT (omx_base, "Bad samplerate");
70 new_caps = gst_caps_new_simple ("audio/x-raw-int",
71 "width", G_TYPE_INT, 16,
72 "depth", G_TYPE_INT, 16,
73 "rate", G_TYPE_INT, rate,
74 "signed", G_TYPE_BOOLEAN, TRUE,
75 "endianness", G_TYPE_INT, G_BYTE_ORDER,
76 "channels", G_TYPE_INT, channels, NULL);
78 GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
79 gst_pad_set_caps (omx_base->srcpad, new_caps);
84 type_instance_init (GTypeInstance * instance, gpointer g_class)
86 GstOmxBaseFilter *omx_base;
88 omx_base = GST_OMX_BASE_FILTER (instance);
90 GST_DEBUG_OBJECT (omx_base, "start");
92 omx_base->gomx->settings_changed_cb = settings_changed_cb;