Commit 010dc8cd authored by Martin Storsjö's avatar Martin Storsjö

omxil: Set an AMR band mode based on the AMR variant

This requires passing the original VLC codec id to the function,
since both variants are mapped to OMX_AUDIO_CodingAMR.

We don't set the actual correct band mode (since we don't know
what bitrate mode is used for each frame, since it can vary), but
we set mode 0. We could in principle set it more accurately based
on bitrate, but since it can vary from frame to frame, this should
be enough anyway.

This is required for OMX.SEC.amr.dec, which is one single codec
supporting both AMR variant roles, and this seems to be the way of
signalling what AMR variant it is. If setting
OMX_AUDIO_AMRBandModeUnused, the codec fails to initialize.

A codec can get this info either by having two separate OMX codecs,
such as OMX.google.amrnb.decoder vs OMX.google.amrwb.decoder, by
checking what the caller set via OMX_IndexParamStandardComponentRole
or via the band mode parameter - the samsung decoder seems to use
the band mode.
Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent 203d06bd
...@@ -413,6 +413,7 @@ static OMX_ERRORTYPE SetPortDefinition(decoder_t *p_dec, OmxPort *p_port, ...@@ -413,6 +413,7 @@ static OMX_ERRORTYPE SetPortDefinition(decoder_t *p_dec, OmxPort *p_port,
omx_error = SetAudioParameters(p_port->omx_handle, omx_error = SetAudioParameters(p_port->omx_handle,
&p_port->format_param, def->nPortIndex, &p_port->format_param, def->nPortIndex,
def->format.audio.eEncoding, def->format.audio.eEncoding,
p_fmt->i_codec,
p_fmt->audio.i_channels, p_fmt->audio.i_channels,
p_fmt->audio.i_rate, p_fmt->audio.i_rate,
p_fmt->i_bitrate, p_fmt->i_bitrate,
......
...@@ -192,8 +192,8 @@ int GetVlcChromaSizes( vlc_fourcc_t i_fourcc, ...@@ -192,8 +192,8 @@ int GetVlcChromaSizes( vlc_fourcc_t i_fourcc,
*****************************************************************************/ *****************************************************************************/
OMX_ERRORTYPE SetAudioParameters(OMX_HANDLETYPE handle, OMX_ERRORTYPE SetAudioParameters(OMX_HANDLETYPE handle,
OmxFormatParam *param, OMX_U32 i_port, OMX_AUDIO_CODINGTYPE encoding, OmxFormatParam *param, OMX_U32 i_port, OMX_AUDIO_CODINGTYPE encoding,
uint8_t i_channels, unsigned int i_samplerate, unsigned int i_bitrate, vlc_fourcc_t i_codec, uint8_t i_channels, unsigned int i_samplerate,
unsigned int i_bps, unsigned int i_blocksize); unsigned int i_bitrate, unsigned int i_bps, unsigned int i_blocksize);
OMX_ERRORTYPE GetAudioParameters(OMX_HANDLETYPE handle, OMX_ERRORTYPE GetAudioParameters(OMX_HANDLETYPE handle,
OmxFormatParam *param, OMX_U32 i_port, OMX_AUDIO_CODINGTYPE encoding, OmxFormatParam *param, OMX_U32 i_port, OMX_AUDIO_CODINGTYPE encoding,
uint8_t *pi_channels, unsigned int *pi_samplerate, uint8_t *pi_channels, unsigned int *pi_samplerate,
......
...@@ -623,8 +623,8 @@ unsigned int GetAudioParamSize(OMX_INDEXTYPE index) ...@@ -623,8 +623,8 @@ unsigned int GetAudioParamSize(OMX_INDEXTYPE index)
OMX_ERRORTYPE SetAudioParameters(OMX_HANDLETYPE handle, OMX_ERRORTYPE SetAudioParameters(OMX_HANDLETYPE handle,
OmxFormatParam *param, OMX_U32 i_port, OMX_AUDIO_CODINGTYPE encoding, OmxFormatParam *param, OMX_U32 i_port, OMX_AUDIO_CODINGTYPE encoding,
uint8_t i_channels, unsigned int i_samplerate, unsigned int i_bitrate, vlc_fourcc_t i_codec, uint8_t i_channels, unsigned int i_samplerate,
unsigned int i_bps, unsigned int i_blocksize) unsigned int i_bitrate, unsigned int i_bps, unsigned int i_blocksize)
{ {
OMX_INDEXTYPE index; OMX_INDEXTYPE index;
...@@ -657,7 +657,10 @@ OMX_ERRORTYPE SetAudioParameters(OMX_HANDLETYPE handle, ...@@ -657,7 +657,10 @@ OMX_ERRORTYPE SetAudioParameters(OMX_HANDLETYPE handle,
OMX_INIT_STRUCTURE(param->amr); OMX_INIT_STRUCTURE(param->amr);
param->amr.nChannels = i_channels; param->amr.nChannels = i_channels;
param->amr.nBitRate = i_bitrate; param->amr.nBitRate = i_bitrate;
param->amr.eAMRBandMode = OMX_AUDIO_AMRBandModeUnused; if (i_codec == VLC_CODEC_AMR_WB)
param->amr.eAMRBandMode = OMX_AUDIO_AMRBandModeWB0;
else
param->amr.eAMRBandMode = OMX_AUDIO_AMRBandModeNB0;
param->amr.eAMRDTXMode = OMX_AUDIO_AMRDTXModeOff; param->amr.eAMRDTXMode = OMX_AUDIO_AMRDTXModeOff;
param->amr.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF; param->amr.eAMRFrameFormat = OMX_AUDIO_AMRFrameFormatFSF;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment