diff options
author | Keith Mok <kmok@cyngn.com> | 2015-12-03 09:45:42 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2015-12-04 19:33:23 -0800 |
commit | 89fdc5b26a76c89af6b46665510b184cefd5ab0b (patch) | |
tree | 69d2946ad6b672c7ddefdd180d89a90a63a9e232 /media/libstagefright/FFMPEGSoftCodec.cpp | |
parent | 65890a73d53a25b0809b22e41cdee19e3f4aa68d (diff) | |
download | frameworks_av-89fdc5b26a76c89af6b46665510b184cefd5ab0b.zip frameworks_av-89fdc5b26a76c89af6b46665510b184cefd5ab0b.tar.gz frameworks_av-89fdc5b26a76c89af6b46665510b184cefd5ab0b.tar.bz2 |
stagefright: Fix Divx version key
If mime type is MEDIA_MIMETYPE_VIDEO_DIVX4 or MEDIA_MIMETYPE_VIDEO_DIVX311,
the qcom specific portion of code is skipped, since err = BAD_TYPE.
Fix it by checking mimetype div4 and div311 before the qcom
specific code.
Change-Id: Id1a4f43541ef2b0f4d3ab84425965f30be17b7e4
Diffstat (limited to 'media/libstagefright/FFMPEGSoftCodec.cpp')
-rw-r--r-- | media/libstagefright/FFMPEGSoftCodec.cpp | 88 |
1 files changed, 51 insertions, 37 deletions
diff --git a/media/libstagefright/FFMPEGSoftCodec.cpp b/media/libstagefright/FFMPEGSoftCodec.cpp index 101d765..d899351 100644 --- a/media/libstagefright/FFMPEGSoftCodec.cpp +++ b/media/libstagefright/FFMPEGSoftCodec.cpp @@ -255,6 +255,13 @@ status_t FFMPEGSoftCodec::setVideoFormat( *compressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingFLV1; } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX, mime)) { *compressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingDIVX; +#ifdef QCOM_HARDWARE + // compressionFormat will be override later + } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX4, mime)) { + *compressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingDIVX; + } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX311, mime)) { + *compressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingDIVX; +#endif } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_HEVC, mime)) { *compressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingHEVC; } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_FFMPEG, mime)) { @@ -275,16 +282,9 @@ status_t FFMPEGSoftCodec::setVideoFormat( // from the CAF L release. It was unfortunately moved to a proprietary // blob and an architecture which is hellish for OEMs who wish to // customize the platform. - if (err != BAD_TYPE && (strncmp(componentName, "OMX.qcom.", 9) == 0)) { + if (err != BAD_TYPE && (!strncmp(componentName, "OMX.qcom.", 9))) { status_t xerr = OK; - if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX, mime)) { - *compressionFormat= (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingDivx; - } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX4, mime)) { - *compressionFormat= (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingDivx; - } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX311, mime)) { - *compressionFormat= (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingDivx; - } int32_t mode = 0; OMX_QCOM_PARAM_PORTDEFINITIONTYPE portFmt; @@ -304,7 +304,13 @@ status_t FFMPEGSoftCodec::setVideoFormat( ALOGW("Failed to set frame packing format on component"); } - setQCDIVXFormat(msg, mime, OMXhandle, nodeID, kPortIndexOutput); + if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX, mime) || + !strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX4, mime) || + !strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX311, mime)) { + // Override with QCOM specific compressionFormat + *compressionFormat = (OMX_VIDEO_CODINGTYPE)QOMX_VIDEO_CodingDivx; + setQCDIVXFormat(msg, mime, OMXhandle, nodeID, kPortIndexOutput); + } // Enable timestamp reordering for mpeg4 and vc1 codec types, the AVI file // type, and hevc content in the ts container @@ -360,37 +366,45 @@ status_t FFMPEGSoftCodec::setQCDIVXFormat( const sp<AMessage> &msg, const char* mime, sp<IOMX> OMXhandle, IOMX::node_id nodeID, int port_index) { status_t err = OK; - if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX, mime) || - !strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX4, mime) || - !strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX311, mime)) { - ALOGV("Setting the QOMX_VIDEO_PARAM_DIVXTYPE params "); - QOMX_VIDEO_PARAM_DIVXTYPE paramDivX; - InitOMXParams(¶mDivX); - paramDivX.nPortIndex = port_index; - int32_t DivxVersion = 0; - if (!msg->findInt32(getMsgKey(kKeyDivXVersion), &DivxVersion)) { + ALOGV("Setting the QOMX_VIDEO_PARAM_DIVXTYPE params "); + QOMX_VIDEO_PARAM_DIVXTYPE paramDivX; + InitOMXParams(¶mDivX); + paramDivX.nPortIndex = port_index; + int32_t DivxVersion = 0; + if (!msg->findInt32(getMsgKey(kKeyDivXVersion), &DivxVersion)) { + // Cannot find the key, the caller is skipping the container + // and use codec directly, let determine divx version from + // mime type + DivxVersion = kTypeDivXVer_4; + const char *v; + if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX, mime) || + !strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX4, mime)) { DivxVersion = kTypeDivXVer_4; - ALOGW("Divx version key missing, initializing the version to %d", DivxVersion); - } - ALOGV("Divx Version Type %d", DivxVersion); - - if (DivxVersion == kTypeDivXVer_4) { - paramDivX.eFormat = QOMX_VIDEO_DIVXFormat4; - } else if (DivxVersion == kTypeDivXVer_5) { - paramDivX.eFormat = QOMX_VIDEO_DIVXFormat5; - } else if (DivxVersion == kTypeDivXVer_6) { - paramDivX.eFormat = QOMX_VIDEO_DIVXFormat6; - } else if (DivxVersion == kTypeDivXVer_3_11 ) { - paramDivX.eFormat = QOMX_VIDEO_DIVXFormat311; - } else { - paramDivX.eFormat = QOMX_VIDEO_DIVXFormatUnused; + v = "4"; + } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_DIVX311, mime)) { + DivxVersion = kTypeDivXVer_3_11; + v = "3.11"; } - paramDivX.eProfile = (QOMX_VIDEO_DIVXPROFILETYPE)0; //Not used for now. - - err = OMXhandle->setParameter(nodeID, - (OMX_INDEXTYPE)OMX_QcomIndexParamVideoDivx, - ¶mDivX, sizeof(paramDivX)); + ALOGW("Divx version key missing, initializing the version to %s", v); } + ALOGV("Divx Version Type %d", DivxVersion); + + if (DivxVersion == kTypeDivXVer_4) { + paramDivX.eFormat = QOMX_VIDEO_DIVXFormat4; + } else if (DivxVersion == kTypeDivXVer_5) { + paramDivX.eFormat = QOMX_VIDEO_DIVXFormat5; + } else if (DivxVersion == kTypeDivXVer_6) { + paramDivX.eFormat = QOMX_VIDEO_DIVXFormat6; + } else if (DivxVersion == kTypeDivXVer_3_11 ) { + paramDivX.eFormat = QOMX_VIDEO_DIVXFormat311; + } else { + paramDivX.eFormat = QOMX_VIDEO_DIVXFormatUnused; + } + paramDivX.eProfile = (QOMX_VIDEO_DIVXPROFILETYPE)0; //Not used for now. + + err = OMXhandle->setParameter(nodeID, + (OMX_INDEXTYPE)OMX_QcomIndexParamVideoDivx, + ¶mDivX, sizeof(paramDivX)); return err; } #endif |