[HTC Wildfire S] scottrix:
More information in these posts:

http://www.modaco.com/topic/354020-zte-n880e-first-zte-ics-update/page__st__20

http://xdaforums.com/archive/index.php/t-1588599-p-2.html

http://newsandeducationblog.blogspot.com/2012/05/android-developers-video-videoview.html

http://xdaforums.com/archive/index.php/t-1664335.html

---------- Post added at 09:01 PM ---------- Previous post was at 08:53 PM ----------

For get_config the debug output:

W/QCvdec ( 2751): get_config: unknown param 117440527

117440527 is 0x700000F, which from frameworks/base/include/media/stagefright/openmax/OMX_Index.h

/* Image & Video common Configurations */

OMX_IndexCommonStartUnused = 0x07000000,

OMX_IndexParamCommonDeblocking, /**< reference: OMX_PARAM_DEBLOCKINGTYPE */

OMX_IndexParamCommonSensorMode, /**< reference: OMX_PARAM_SENSORMODETYPE */

OMX_IndexParamCommonInterleave, /**< reference: OMX_PARAM_INTERLEAVETYPE */

OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */

OMX_IndexConfigCommonScale, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */

OMX_IndexConfigCommonImageFilter, /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */

OMX_IndexConfigCommonColorEnhancement, /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */

OMX_IndexConfigCommonColorKey, /**< reference: OMX_CONFIG_COLORKEYTYPE */

OMX_IndexConfigCommonColorBlend, /**< reference: OMX_CONFIG_COLORBLENDTYPE */

OMX_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */

OMX_IndexConfigCommonRotate, /**< reference: OMX_CONFIG_ROTATIONTYPE */

OMX_IndexConfigCommonMirror, /**< reference: OMX_CONFIG_MIRRORTYPE */

OMX_IndexConfigCommonOutputPosition, /**< reference: OMX_CONFIG_POINTTYPE */

OMX_IndexConfigCommonInputCrop, /**< reference: OMX_CONFIG_RECTTYPE */

OMX_IndexConfigCommonOutputCrop, /**< reference: OMX_CONFIG_RECTTYPE */

OMX_IndexConfigCommonDigitalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */

Is OMX_IndexConfigCommonOutputCrop, so the hardware mpeg4 decoder doesn't understand this index. Going from the source code that calls this, if the call fails then it does something else and carries on

./frameworks/base/media/libstagefright/ACodec.cpp:

if (mOMX->getConfig(

mNode, OMX_IndexConfigCommonOutputCrop,

&rect, sizeof(rect)) != OK) {

rect.nLeft = 0;

rect.nTop = 0;

rect.nWidth = videoDef->nFrameWidth;

rect.nHeight = videoDef->nFrameHeight;

}

CHECK_GE(rect.nLeft, 0);

CHECK_GE(rect.nTop, 0);

CHECK_GE(rect.nWidth, 0u);

CHECK_GE(rect.nHeight, 0u);

CHECK_LE(rect.nLeft + rect.nWidth - 1, videoDef->nFrameWidth);

CHECK_LE(rect.nTop + rect.nHeight - 1, videoDef->nFrameHeight);

./frameworks/base/media/libstagefright/OMXCodec.cpp:

status_t err =

mOMX->getConfig(

mNode, OMX_IndexConfigCommonOutputCrop,

&rect, sizeof(rect));

CODEC_LOGI(

"video dimensions are %ld x %ld",

video_def->nFrameWidth, video_def->nFrameHeight);

if (err == OK) {

#ifdef SAMSUNG_CODEC_SUPPORT

/* Hack GetConfig */

rect.nLeft = 0;

rect.nTop = 0;

rect.nWidth = video_def->nFrameWidth;

rect.nHeight = video_def->nFrameHeight;

#endif

CHECK_GE(rect.nLeft, 0);

CHECK_GE(rect.nTop, 0);

CHECK_GE(rect.nWidth, 0u);

CHECK_GE(rect.nHeight, 0u);

CHECK_LE(rect.nLeft + rect.nWidth - 1, video_def->nFrameWidth);

CHECK_LE(rect.nTop + rect.nHeight - 1, video_def->nFrameHeight);

mOutputFormat->setRect(

kKeyCropRect,

rect.nLeft,

rect.nTop,

rect.nLeft + rect.nWidth - 1,

rect.nTop + rect.nHeight - 1);

CODEC_LOGI(

"Crop rect is %ld x %ld @ (%ld, %ld)",

rect.nWidth, rect.nHeight, rect.nLeft, rect.nTop);

} else {

mOutputFormat->setRect(

kKeyCropRect,

0, 0,

video_def->nFrameWidth - 1,

video_def->nFrameHeight - 1);

}

I think we can safely ignore this failure for now.

---------- Post added at 09:30 PM ---------- Previous post was at 09:01 PM ----------

get_extension_index might be a little more tricky. The file vendor/qcom/opensource/omx/mm-video/vidc/vdec/src/omx_vdec.cpp is a video decoder and the code for the get_extension_index is:

OMX_ERRORTYPE omx_vdec::get_extension_index(OMX_IN OMX_HANDLETYPE hComp,

OMX_IN OMX_STRING paramName,

OMX_OUT OMX_INDEXTYPE* indexType)

{

if(m_state == OMX_StateInvalid)

{

DEBUG_PRINT_ERROR("Get Extension Index in Invalid State\n");

return OMX_ErrorInvalidState;

}

else if (!strncmp(paramName, "OMX.QCOM.index.param.video.SyncFrameDecodingMode",sizeof("OMX.QCOM.index.param.video.SyncFrameDecodingMode") - 1)) {

*indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamVideoSyncFrameDecodingMode;

}

#ifdef MAX_RES_1080P

else if (!strncmp(paramName, "OMX.QCOM.index.param.IndexExtraData",sizeof("OMX.QCOM.index.param.IndexExtraData") - 1))

{

*indexType = (OMX_INDEXTYPE)OMX_QcomIndexParamIndexExtraDataType;

}

#endif

#if defined (_ANDROID_HONEYCOMB_) || defined (_ANDROID_ICS_)

else if(!strncmp(paramName,"OMX.google.android.index.enableAndroidNativeBuffers", sizeof("OMX.google.android.index.enableAndroidNativeBuffers") - 1)) {

*indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexEnableAndroidNativeBuffers;

}

else if(!strncmp(paramName,"OMX.google.android.index.useAndroidNativeBuffer2", sizeof("OMX.google.android.index.enableAndroidNativeBuffer2") - 1)) {

*indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexUseAndroidNativeBuffer2;

}

else if(!strncmp(paramName,"OMX.google.android.index.useAndroidNativeBuffer", sizeof("OMX.google.android.index.enableAndroidNativeBuffer") - 1)) {

DEBUG_PRINT_ERROR("Extension: %s is supported\n", paramName);

*indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexUseAndroidNativeBuffer;

}

else if(!strncmp(paramName,"OMX.google.android.index.getAndroidNativeBufferUsage", sizeof("OMX.google.android.index.getAndroidNativeBufferUsage") - 1)) {

*indexType = (OMX_INDEXTYPE)OMX_GoogleAndroidIndexGetAndroidNativeBufferUsage;

}

#endif

else {

DEBUG_PRINT_ERROR("Extension: %s not implemented\n", paramName);

return OMX_ErrorNotImplemented;

}

return OMX_ErrorNone;

}

In the debug output the message "OMX_GetExtensionIndex failed" comes from frameworks/base/media/libstagefright/omx/OMXNodeInstance.cpp:

status_t OMXNodeInstance::enableGraphicBuffers(

OMX_U32 portIndex, OMX_BOOL enable) {

Mutex::Autolock autoLock(mLock);

OMX_INDEXTYPE index;

OMX_ERRORTYPE err = OMX_GetExtensionIndex(

mHandle,

const_cast<OMX_STRING>("OMX.google.android.index.enableAndroidNativeBuffers"),

&index);

if (err != OMX_ErrorNone) {

LOGE("OMX_GetExtensionIndex failed");

return StatusFromOMXError(err);

}

OMX_VERSIONTYPE ver;

ver.s.nVersionMajor = 1;

ver.s.nVersionMinor = 0;

ver.s.nRevision = 0;

ver.s.nStep = 0;

EnableAndroidNativeBuffersParams params = {

sizeof(EnableAndroidNativeBuffersParams), ver, portIndex, enable,

};

err = OMX_SetParameter(mHandle, index, &params);

if (err != OMX_ErrorNone) {

LOGE("OMX_EnableAndroidNativeBuffers failed with error %d (0x%08x)",

err, err);

return UNKNOWN_ERROR;

}

return OK;

}

So the OMX.google.android.index.enableAndroidNativeBuffers extension is the one we are missing, from the code snippet above this, we can see an

#if defined (_ANDROID_HONEYCOMB_) || defined (_ANDROID_ICS_)

#endif

around the check for this extension, so it has been added since Gingerbread, a diff with the cm7 source tells us that the enableGraphicsBuffers has also been added since gingerbread. The header file /frameworks/base/include/media/stagefright/HardwareAPI.h contains the following:

// A pointer to this struct is passed to the OMX_SetParameter when the extension

// index for the 'OMX.google.android.index.enableAndroidNativeBuffers' extension

// is given.

//

// When Android native buffer use is disabled for a port (the default state),

// the OMX node should operate as normal, and expect UseBuffer calls to set its

// buffers. This is the mode that will be used when CPU access to the buffer is

// required.

//

// When Android native buffer use has been enabled for a given port, the video

// color format for the port is to be interpreted as an Android pixel format

// rather than an OMX color format. The node should then expect to receive

// UseAndroidNativeBuffer calls (via OMX_SetParameter) rather than UseBuffer

// calls for that port.

struct EnableAndroidNativeBuffersParams {

OMX_U32 nSize;

OMX_VERSIONTYPE nVersion;

OMX_U32 nPortIndex;

OMX_BOOL enable;

};

I doubt the gb codec that we do have has support for the Android pixel format.

Question is can we change the stagefright sources to support both, i.e. if the extension OMX.google.android.index.enableAndroidNativeBuffers isn't supported then do what was done in gb. I'm sure it is possible and it might still be possible to get a codec wrapper working, however, it will take a lot more digging in the code.