diff options
-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 b8d5c7b..9b11ded 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; |