summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng Wei <feng.wei@linaro.org>2011-05-20 16:31:13 +0300
committerFelipe Contreras <felipe.contreras@gmail.com>2011-05-20 16:33:00 +0300
commit6150457caa29b3ac511e695c93daf727b1aa0d0c (patch)
tree65d1f75935da5332c674d9b7f4d5eba32162863d
parent14031b34a07b26cb31a53c96a8b51f22eda2988b (diff)
aacdec: forward gst caps to omx params
aacparse or qtdemux will parse out aac channels and sample rate and stream type, but gstomx_aacdec don't set them to omx aacdec commponent, which will cause some implementation(like bellagio) fault. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
-rw-r--r--omx/gstomx.conf.in2
-rw-r--r--omx/gstomx_aacdec.c33
2 files changed, 34 insertions, 1 deletions
diff --git a/omx/gstomx.conf.in b/omx/gstomx.conf.in
index d59adec..88023bf 100644
--- a/omx/gstomx.conf.in
+++ b/omx/gstomx.conf.in
@@ -170,7 +170,7 @@ omx_aacdec,
type=GstOmxAacDec,
library-name=libomxil-bellagio.so.0,
component-name=OMX.st.audio_decoder.aac,
- sink="audio/mpeg, mpegversion=(int){2,4}, rate=(int)[8000, 96000], channels=(int)[1, 6], framed=true;",
+ sink="audio/mpeg, mpegversion=(int){2,4}, rate=(int)[8000, 96000], channels=(int)[1, 6], stream-type={raw,adts,adif}, framed=true;",
src=RAW_AUDIO_CAPS("[8000, 96000]", "[1, 6]"),
rank=256;
diff --git a/omx/gstomx_aacdec.c b/omx/gstomx_aacdec.c
index 70ba3c7..cb5465d 100644
--- a/omx/gstomx_aacdec.c
+++ b/omx/gstomx_aacdec.c
@@ -56,6 +56,12 @@ sink_setcaps (GstPad * pad, GstCaps * caps)
{
GstStructure *structure;
GstOmxBaseFilter *omx_base;
+ OMX_AUDIO_PARAM_AACPROFILETYPE param;
+ gint channels = 0;
+ gint sample_rate = 0;
+ gint mpegversion = 0;
+ const gchar *stream_format;
+ G_OMX_INIT_PARAM (param);
omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad));
@@ -75,6 +81,33 @@ sink_setcaps (GstPad * pad, GstCaps * caps)
}
}
+ gst_structure_get_int(structure, "mpegversion", &mpegversion);
+ gst_structure_get_int(structure, "channels", &channels);
+ gst_structure_get_int(structure, "rate", &sample_rate);
+ stream_format = gst_structure_get_string(structure, "stream-format");
+
+ /* retrieve current in port params */
+ param.nPortIndex = omx_base->in_port->port_index;
+ OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, &param);
+
+ if(channels > 0)
+ param.nChannels = (OMX_U32)channels;
+ if(sample_rate > 0)
+ param.nSampleRate = (OMX_U32)sample_rate;
+ if(!g_strcmp0(stream_format, "adif")) {
+ param.eAACStreamFormat = OMX_AUDIO_AACStreamFormatADIF;
+ }
+ else if(!g_strcmp0(stream_format, "raw")) {
+ param.eAACStreamFormat = OMX_AUDIO_AACStreamFormatRAW;
+ }
+ else if(!g_strcmp0(stream_format, "adts")) {
+ if(mpegversion == 2)
+ param.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP2ADTS;
+ else if(mpegversion == 4)
+ param.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4ADTS;
+ }
+ OMX_SetParameter(omx_base->gomx->omx_handle, OMX_IndexParamAudioAac, &param);
+
return gst_pad_set_caps (pad, caps);
}