diff options
author | Chong Zhang <chz@google.com> | 2014-10-12 22:28:11 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2014-10-13 11:16:03 -0700 |
commit | 10d023beb0544591d0f5ff556f7f67356f0d9189 (patch) | |
tree | 7ef6da05b041ec7f0ea8783013260c6b4e90e0d9 /media | |
parent | 380757ba5c927015d403e3b97cc418413330453e (diff) | |
download | frameworks_av-10d023beb0544591d0f5ff556f7f67356f0d9189.zip frameworks_av-10d023beb0544591d0f5ff556f7f67356f0d9189.tar.gz frameworks_av-10d023beb0544591d0f5ff556f7f67356f0d9189.tar.bz2 |
handle case OMX_AUDIO_CodingG711 in ACodec::getPortFormat
Bug: 17935293
Change-Id: Id09190ae813aa9e00a3c1ef6fb8a1bd3021deb6e
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 26 | ||||
-rw-r--r-- | media/libstagefright/codecs/g711/dec/SoftG711.cpp | 9 |
2 files changed, 34 insertions, 1 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index b693625..bf4ecdf 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -3458,6 +3458,32 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> ¬ify) { break; } + case OMX_AUDIO_CodingG711: + { + OMX_AUDIO_PARAM_PCMMODETYPE params; + InitOMXParams(¶ms); + params.nPortIndex = portIndex; + + CHECK_EQ((status_t)OK, mOMX->getParameter( + mNode, + (OMX_INDEXTYPE)OMX_IndexParamAudioPcm, + ¶ms, + sizeof(params))); + + const char *mime = NULL; + if (params.ePCMMode == OMX_AUDIO_PCMModeMULaw) { + mime = MEDIA_MIMETYPE_AUDIO_G711_MLAW; + } else if (params.ePCMMode == OMX_AUDIO_PCMModeALaw) { + mime = MEDIA_MIMETYPE_AUDIO_G711_ALAW; + } else { // params.ePCMMode == OMX_AUDIO_PCMModeLinear + mime = MEDIA_MIMETYPE_AUDIO_RAW; + } + notify->setString("mime", mime); + notify->setInt32("channel-count", params.nChannels); + notify->setInt32("sample-rate", params.nSamplingRate); + break; + } + default: ALOGE("UNKNOWN AUDIO CODING: %d\n", audioDef->eEncoding); TRESPASS(); diff --git a/media/libstagefright/codecs/g711/dec/SoftG711.cpp b/media/libstagefright/codecs/g711/dec/SoftG711.cpp index 240c0c1..3a69095 100644 --- a/media/libstagefright/codecs/g711/dec/SoftG711.cpp +++ b/media/libstagefright/codecs/g711/dec/SoftG711.cpp @@ -117,7 +117,14 @@ OMX_ERRORTYPE SoftG711::internalGetParameter( pcmParams->eEndian = OMX_EndianBig; pcmParams->bInterleaved = OMX_TRUE; pcmParams->nBitPerSample = 16; - pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear; + if (pcmParams->nPortIndex == 0) { + // input port + pcmParams->ePCMMode = mIsMLaw ? OMX_AUDIO_PCMModeMULaw + : OMX_AUDIO_PCMModeALaw; + } else { + // output port + pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear; + } pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF; pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF; |