From 53f30099f701ef110ad7f16c4bec0c26eff9457a Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Wed, 2 Dec 2015 10:04:24 -0800 Subject: stagefright: More HW codec support w/ FFMPEGExtractor * Support QC DiVX codec Change-Id: I5591b4544a8f92a7cc309b45a8de009f572217b7 --- media/libstagefright/FFMPEGSoftCodec.cpp | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'media/libstagefright') diff --git a/media/libstagefright/FFMPEGSoftCodec.cpp b/media/libstagefright/FFMPEGSoftCodec.cpp index 2af53b3..3e51322 100644 --- a/media/libstagefright/FFMPEGSoftCodec.cpp +++ b/media/libstagefright/FFMPEGSoftCodec.cpp @@ -73,6 +73,7 @@ static const MetaKeyEntry MetaKeyTable[] { {kKeyWMAVersion , "wma-version" , INT32}, // int32_t {kKeyWMVVersion , "wmv-version" , INT32}, {kKeyPCMFormat , "pcm-format" , INT32}, + {kKeyDivXVersion , "divx-version" , INT32}, }; const char* FFMPEGSoftCodec::getMsgKey(int key) { @@ -277,6 +278,14 @@ status_t FFMPEGSoftCodec::setVideoFormat( if (err != BAD_TYPE && (strncmp(componentName, "OMX.qcom.", 9) == 0)) { 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; portFmt.nPortIndex = kPortIndexInput; @@ -295,6 +304,8 @@ status_t FFMPEGSoftCodec::setVideoFormat( ALOGW("Failed to set frame packing format on component"); } + 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 bool tsReorder = false; @@ -344,6 +355,46 @@ status_t FFMPEGSoftCodec::setVideoFormat( return err; } +status_t FFMPEGSoftCodec::setQCDIVXFormat( + const sp &msg, const char* mime, sp OMXhandle, + IOMX::node_id nodeID, int port_index) { + status_t err = OK; +#ifdef QCOM_HARDWARE + 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)) { + 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; + } + paramDivX.eProfile = (QOMX_VIDEO_DIVXPROFILETYPE)0; //Not used for now. + + err = OMXhandle->setParameter(nodeID, + (OMX_INDEXTYPE)OMX_QcomIndexParamVideoDivx, + ¶mDivX, sizeof(paramDivX)); + } +#endif + return err; +} + status_t FFMPEGSoftCodec::getVideoPortFormat(OMX_U32 portIndex, int coding, sp ¬ify, sp OMXHandle, IOMX::node_id nodeId) { -- cgit v1.1