Loading media/libstagefright/ACodec.cpp +53 −10 Original line number Diff line number Diff line Loading @@ -55,6 +55,10 @@ namespace android { enum { kMaxIndicesToCheck = 32, // used when enumerating supported formats and profiles }; // OMX errors are directly mapped into status_t range if // there is no corresponding MediaError status code. // Use the statusFromOMXError(int32_t omxError) function. Loading Loading @@ -2380,9 +2384,8 @@ status_t ACodec::selectAudioPortFormat( InitOMXParams(&format); format.nPortIndex = portIndex; for (OMX_U32 index = 0;; ++index) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { format.nIndex = index; status_t err = mOMX->getParameter( mNode, OMX_IndexParamAudioPortFormat, &format, sizeof(format)); Loading @@ -2394,6 +2397,13 @@ status_t ACodec::selectAudioPortFormat( if (format.eEncoding == desiredFormat) { break; } if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking formats after %u: %s(%x)", mComponentName.c_str(), index, asString(format.eEncoding), format.eEncoding); return ERROR_UNSUPPORTED; } } return mOMX->setParameter( Loading Loading @@ -2813,8 +2823,7 @@ status_t ACodec::setVideoPortFormatType( format.nIndex = 0; bool found = false; OMX_U32 index = 0; for (;;) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { format.nIndex = index; status_t err = mOMX->getParameter( mNode, OMX_IndexParamVideoPortFormat, Loading Loading @@ -2859,7 +2868,12 @@ status_t ACodec::setVideoPortFormatType( break; } ++index; if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking formats after %u: %s(%x)/%s(%x)", mComponentName.c_str(), index, asString(format.eCompressionFormat), format.eCompressionFormat, asString(format.eColorFormat), format.eColorFormat); } } if (!found) { Loading Loading @@ -3744,7 +3758,8 @@ status_t ACodec::verifySupportForProfileAndLevel( InitOMXParams(¶ms); params.nPortIndex = kPortIndexOutput; for (params.nProfileIndex = 0;; ++params.nProfileIndex) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { params.nProfileIndex = index; status_t err = mOMX->getParameter( mNode, OMX_IndexParamVideoProfileLevelQuerySupported, Loading @@ -3761,8 +3776,15 @@ status_t ACodec::verifySupportForProfileAndLevel( if (profile == supportedProfile && level <= supportedLevel) { return OK; } if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking profiles after %u: %x/%x", mComponentName.c_str(), index, params.eProfile, params.eLevel); } } return ERROR_UNSUPPORTED; } status_t ACodec::configureBitrate( int32_t bitrate, OMX_VIDEO_CONTROLRATETYPE bitrateMode) { Loading Loading @@ -7051,7 +7073,8 @@ status_t ACodec::queryCapabilities( InitOMXParams(¶m); param.nPortIndex = isEncoder ? kPortIndexOutput : kPortIndexInput; for (param.nProfileIndex = 0;; ++param.nProfileIndex) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { param.nProfileIndex = index; status_t err = omx->getParameter( node, OMX_IndexParamVideoProfileLevelQuerySupported, ¶m, sizeof(param)); Loading @@ -7059,6 +7082,12 @@ status_t ACodec::queryCapabilities( break; } builder->addProfileLevel(param.eProfile, param.eLevel); if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking profiles after %u: %x/%x", name.c_str(), index, param.eProfile, param.eLevel); } } // Color format query Loading @@ -7066,9 +7095,10 @@ status_t ACodec::queryCapabilities( // prefix "flexible" standard ones with the flexible equivalent OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat; InitOMXParams(&portFormat); portFormat.nPortIndex = isEncoder ? kPortIndexInput : kPortIndexOutput; param.nPortIndex = isEncoder ? kPortIndexInput : kPortIndexOutput; Vector<uint32_t> supportedColors; // shadow copy to check for duplicates for (portFormat.nIndex = 0;; ++portFormat.nIndex) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { portFormat.nIndex = index; status_t err = omx->getParameter( node, OMX_IndexParamVideoPortFormat, &portFormat, sizeof(portFormat)); Loading @@ -7094,13 +7124,20 @@ status_t ACodec::queryCapabilities( } supportedColors.push(portFormat.eColorFormat); builder->addColorFormat(portFormat.eColorFormat); if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking formats after %u: %s(%x)", name.c_str(), index, asString(portFormat.eColorFormat), portFormat.eColorFormat); } } } else if (mime.equalsIgnoreCase(MEDIA_MIMETYPE_AUDIO_AAC)) { // More audio codecs if they have profiles. OMX_AUDIO_PARAM_ANDROID_PROFILETYPE param; InitOMXParams(¶m); param.nPortIndex = isEncoder ? kPortIndexOutput : kPortIndexInput; for (param.nProfileIndex = 0;; ++param.nProfileIndex) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { param.nProfileIndex = index; status_t err = omx->getParameter( node, (OMX_INDEXTYPE)OMX_IndexParamAudioProfileQuerySupported, ¶m, sizeof(param)); Loading @@ -7109,6 +7146,12 @@ status_t ACodec::queryCapabilities( } // For audio, level is ignored. builder->addProfileLevel(param.eProfile, 0 /* level */); if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking profiles after %u: %x", name.c_str(), index, param.eProfile); } } // NOTE: Without Android extensions, OMX does not provide a way to query Loading Loading
media/libstagefright/ACodec.cpp +53 −10 Original line number Diff line number Diff line Loading @@ -55,6 +55,10 @@ namespace android { enum { kMaxIndicesToCheck = 32, // used when enumerating supported formats and profiles }; // OMX errors are directly mapped into status_t range if // there is no corresponding MediaError status code. // Use the statusFromOMXError(int32_t omxError) function. Loading Loading @@ -2380,9 +2384,8 @@ status_t ACodec::selectAudioPortFormat( InitOMXParams(&format); format.nPortIndex = portIndex; for (OMX_U32 index = 0;; ++index) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { format.nIndex = index; status_t err = mOMX->getParameter( mNode, OMX_IndexParamAudioPortFormat, &format, sizeof(format)); Loading @@ -2394,6 +2397,13 @@ status_t ACodec::selectAudioPortFormat( if (format.eEncoding == desiredFormat) { break; } if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking formats after %u: %s(%x)", mComponentName.c_str(), index, asString(format.eEncoding), format.eEncoding); return ERROR_UNSUPPORTED; } } return mOMX->setParameter( Loading Loading @@ -2813,8 +2823,7 @@ status_t ACodec::setVideoPortFormatType( format.nIndex = 0; bool found = false; OMX_U32 index = 0; for (;;) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { format.nIndex = index; status_t err = mOMX->getParameter( mNode, OMX_IndexParamVideoPortFormat, Loading Loading @@ -2859,7 +2868,12 @@ status_t ACodec::setVideoPortFormatType( break; } ++index; if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking formats after %u: %s(%x)/%s(%x)", mComponentName.c_str(), index, asString(format.eCompressionFormat), format.eCompressionFormat, asString(format.eColorFormat), format.eColorFormat); } } if (!found) { Loading Loading @@ -3744,7 +3758,8 @@ status_t ACodec::verifySupportForProfileAndLevel( InitOMXParams(¶ms); params.nPortIndex = kPortIndexOutput; for (params.nProfileIndex = 0;; ++params.nProfileIndex) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { params.nProfileIndex = index; status_t err = mOMX->getParameter( mNode, OMX_IndexParamVideoProfileLevelQuerySupported, Loading @@ -3761,8 +3776,15 @@ status_t ACodec::verifySupportForProfileAndLevel( if (profile == supportedProfile && level <= supportedLevel) { return OK; } if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking profiles after %u: %x/%x", mComponentName.c_str(), index, params.eProfile, params.eLevel); } } return ERROR_UNSUPPORTED; } status_t ACodec::configureBitrate( int32_t bitrate, OMX_VIDEO_CONTROLRATETYPE bitrateMode) { Loading Loading @@ -7051,7 +7073,8 @@ status_t ACodec::queryCapabilities( InitOMXParams(¶m); param.nPortIndex = isEncoder ? kPortIndexOutput : kPortIndexInput; for (param.nProfileIndex = 0;; ++param.nProfileIndex) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { param.nProfileIndex = index; status_t err = omx->getParameter( node, OMX_IndexParamVideoProfileLevelQuerySupported, ¶m, sizeof(param)); Loading @@ -7059,6 +7082,12 @@ status_t ACodec::queryCapabilities( break; } builder->addProfileLevel(param.eProfile, param.eLevel); if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking profiles after %u: %x/%x", name.c_str(), index, param.eProfile, param.eLevel); } } // Color format query Loading @@ -7066,9 +7095,10 @@ status_t ACodec::queryCapabilities( // prefix "flexible" standard ones with the flexible equivalent OMX_VIDEO_PARAM_PORTFORMATTYPE portFormat; InitOMXParams(&portFormat); portFormat.nPortIndex = isEncoder ? kPortIndexInput : kPortIndexOutput; param.nPortIndex = isEncoder ? kPortIndexInput : kPortIndexOutput; Vector<uint32_t> supportedColors; // shadow copy to check for duplicates for (portFormat.nIndex = 0;; ++portFormat.nIndex) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { portFormat.nIndex = index; status_t err = omx->getParameter( node, OMX_IndexParamVideoPortFormat, &portFormat, sizeof(portFormat)); Loading @@ -7094,13 +7124,20 @@ status_t ACodec::queryCapabilities( } supportedColors.push(portFormat.eColorFormat); builder->addColorFormat(portFormat.eColorFormat); if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking formats after %u: %s(%x)", name.c_str(), index, asString(portFormat.eColorFormat), portFormat.eColorFormat); } } } else if (mime.equalsIgnoreCase(MEDIA_MIMETYPE_AUDIO_AAC)) { // More audio codecs if they have profiles. OMX_AUDIO_PARAM_ANDROID_PROFILETYPE param; InitOMXParams(¶m); param.nPortIndex = isEncoder ? kPortIndexOutput : kPortIndexInput; for (param.nProfileIndex = 0;; ++param.nProfileIndex) { for (OMX_U32 index = 0; index <= kMaxIndicesToCheck; ++index) { param.nProfileIndex = index; status_t err = omx->getParameter( node, (OMX_INDEXTYPE)OMX_IndexParamAudioProfileQuerySupported, ¶m, sizeof(param)); Loading @@ -7109,6 +7146,12 @@ status_t ACodec::queryCapabilities( } // For audio, level is ignored. builder->addProfileLevel(param.eProfile, 0 /* level */); if (index == kMaxIndicesToCheck) { ALOGW("[%s] stopping checking profiles after %u: %x", name.c_str(), index, param.eProfile); } } // NOTE: Without Android extensions, OMX does not provide a way to query Loading