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"
28 ARG_USE_STATETUNING, /* STATE_TUNING */
31 GSTOMX_BOILERPLATE (GstOmxBaseAudioDec, gst_omx_base_audiodec, GstOmxBaseFilter,
32 GST_OMX_BASE_FILTER_TYPE);
35 type_base_init (gpointer g_class)
39 /* MODIFICATION: add state tuning property */
41 set_property (GObject * obj,
42 guint prop_id, const GValue * value, GParamSpec * pspec)
44 GstOmxBaseAudioDec *self;
46 self = GST_OMX_BASE_AUDIODEC (obj);
50 case ARG_USE_STATETUNING:
51 self->omx_base.use_state_tuning = g_value_get_boolean(value);
54 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
60 get_property (GObject * obj, guint prop_id, GValue * value, GParamSpec * pspec)
62 GstOmxBaseAudioDec *self;
64 self = GST_OMX_BASE_AUDIODEC (obj);
68 case ARG_USE_STATETUNING:
69 g_value_set_boolean(value, self->omx_base.use_state_tuning);
72 G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
78 type_class_init (gpointer g_class, gpointer class_data)
80 GObjectClass *gobject_class;
81 // GstOmxBaseFilterClass *basefilter_class;
83 gobject_class = G_OBJECT_CLASS (g_class);
84 // basefilter_class = GST_OMX_BASE_FILTER_CLASS (g_class);
86 /* Properties stuff */
88 gobject_class->set_property = set_property;
89 gobject_class->get_property = get_property;
92 g_object_class_install_property (gobject_class, ARG_USE_STATETUNING,
93 g_param_spec_boolean ("state-tuning", "start omx component in gst paused state",
94 "Whether or not to use state-tuning feature",
95 FALSE, G_PARAM_READWRITE));
100 settings_changed_cb (GOmxCore * core)
102 GstOmxBaseFilter *omx_base;
106 omx_base = core->object;
108 GST_DEBUG_OBJECT (omx_base, "settings changed");
111 OMX_AUDIO_PARAM_PCMMODETYPE param;
113 G_OMX_INIT_PARAM (param);
115 param.nPortIndex = omx_base->out_port->port_index;
116 OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm,
119 rate = param.nSamplingRate;
120 channels = param.nChannels;
122 /** @todo: this shouldn't happen. */
123 GST_WARNING_OBJECT (omx_base, "Bad samplerate");
131 new_caps = gst_caps_new_simple ("audio/x-raw-int",
132 "width", G_TYPE_INT, 16,
133 "depth", G_TYPE_INT, 16,
134 "rate", G_TYPE_INT, rate,
135 "signed", G_TYPE_BOOLEAN, TRUE,
136 "endianness", G_TYPE_INT, G_BYTE_ORDER,
137 "channels", G_TYPE_INT, channels, NULL);
139 GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps);
140 gst_pad_set_caps (omx_base->srcpad, new_caps);
145 type_instance_init (GTypeInstance * instance, gpointer g_class)
147 GstOmxBaseFilter *omx_base;
149 omx_base = GST_OMX_BASE_FILTER (instance);
151 GST_DEBUG_OBJECT (omx_base, "start");
153 omx_base->gomx->settings_changed_cb = settings_changed_cb;