OMX_ERRORTYPE EnableDataFlow::freeHandles() { DBGT_PROLOG(""); OMX_ERRORTYPE err = OMX_ErrorNone; DBGT_ASSERT(NULL != mArmIvProc, "mArmIvProc is NULL"); DBGT_ASSERT(NULL != mSwJpegEnc, "mSwJpegEnc is NULL"); DBGT_PTRACE("Sending ArmIv to unloaded State"); err = mOmxUtils.interface()->GetpOMX_FreeHandle()(mArmIvProc); if(OMX_ErrorNone != err) { DBGT_CRITICAL("GetpOMX_FreeHandle ArmIVProc failed err = %d", err); DBGT_EPILOG(""); return err; } mArmIvProc = NULL ; DBGT_PTRACE("Sending SwJpegEnc to unloaded State"); err = mOmxUtils.interface()->GetpOMX_FreeHandle()(mSwJpegEnc); if(OMX_ErrorNone != err) { DBGT_CRITICAL("GetpOMX_FreeHandle SwJpegenc failed err = %d", err); DBGT_EPILOG(""); return err; } mSwJpegEnc = NULL ; DBGT_EPILOG(""); return err; }
OMX_ERRORTYPE STEOMXCodecsPlugin::getRolesOfComponent( const char *name, Vector<String8> *roles) { DBGT_PROLOG("%s", name); roles->clear(); OMX_U32 numRoles; OMX_ERRORTYPE err = (mInterface->GetpOMX_GetRolesOfComponent())( const_cast<char *>(name), &numRoles, NULL); if (err != OMX_ErrorNone) { /*DBGT_CRITICAL("GetpOMX_GetRolesOfComponent failed, err=%s", OMX_TYPE_TO_STR(OMX_ERRORTYPE, err));*/ goto error; } if (numRoles > 0) { OMX_U8 **array = new OMX_U8 *[numRoles]; for (OMX_U32 i = 0; i < numRoles; ++i) { array[i] = new OMX_U8[OMX_MAX_STRINGNAME_SIZE]; } OMX_U32 numRoles2=numRoles; err = (mInterface->GetpOMX_GetRolesOfComponent())( const_cast<char *>(name), &numRoles2, array); DBGT_ASSERT(err == OMX_ErrorNone/*, "GetpOMX_GetRolesOfComponent failed for %s, err=%s" , name, OMX_TYPE_TO_STR(OMX_ERRORTYPE, err)*/); DBGT_ASSERT(numRoles == numRoles2/*, "GetpOMX_GetRolesOfComponent failed for %s, err=%s" , name, OMX_TYPE_TO_STR(OMX_ERRORTYPE, err)*/); for (OMX_U32 i = 0; i < numRoles; ++i) { String8 s((const char *)array[i]); roles->push(s); DBGT_PTRACE("%s: role=%s", name, (const char *)array[i]); delete[] array[i]; array[i] = NULL; } delete[] array; array = NULL; } DBGT_EPILOG(); return OMX_ErrorNone; error: /*DBGT_EPILOG("err=%s", OMX_TYPE_TO_STR(OMX_ERRORTYPE, err));*/ return err; }
void ExifRotation::doUpdateExtraDataOrientation(OMX_SYMBIAN_CAPTUREPARAMETERSTYPE *aCaptureParameters, char *aExifParameters) { DBGT_PROLOG("aCaptureParameters->eSceneOrientation: %d", aCaptureParameters->eSceneOrientation); DBGT_ASSERT(NULL != aCaptureParameters, "pCaptureParameters is null"); DBGT_ASSERT(NULL != aExifParameters, "aExifParameters is null"); updateExifParamsOrientation(aExifParameters, aCaptureParameters->eSceneOrientation); DBGT_EPILOG(""); }
void DeviceSwRotation::doUpdateExtraDataOrientation(OMX_SYMBIAN_CAPTUREPARAMETERSTYPE *pCaptureParameters, char *pExifParameters) { DBGT_PROLOG("pCaptureParameters->eSceneOrientation: %d", pCaptureParameters->eSceneOrientation); DBGT_ASSERT(NULL != pCaptureParameters, "pCaptureParameters is null"); DBGT_ASSERT(NULL != pExifParameters, "pExifParameters is null"); pCaptureParameters->eSceneOrientation = OMX_SYMBIAN_OrientationRowTopColumnLeft; updateExifParamsOrientation(pExifParameters, pCaptureParameters->eSceneOrientation); DBGT_EPILOG(""); }
void ImageRotHandler::updateExifParamsOrientation(char *aBuffer, int aOrientation) { DBGT_PROLOG("aBuffer: %p aOrientation: %d", aBuffer, aOrientation); DBGT_ASSERT(NULL != aBuffer, "aBuffer is NULL"); /* CPU endianness retrieval */ OMX_U16 val = 0xAABB; bool bigEndian = ((char*)&val)[0] == 0xAA; uint32_t exif_data_size = 0; uint32_t ifd0_off = 0; uint32_t ifd0_field_off = 0; uint16_t ifd0_items = 0; IFDfield_t ifd0_field; uint16_t temp = 0; /* get the ifd0 offset*/ memcpy(&ifd0_off, &aBuffer[EXIF_SIZE_HEADER_SIZE + EXIF_APP_HEADER_SIZE + EXIF_TIFF_HEADER_SIZE - sizeof(OMX_U32)], sizeof(OMX_U32)); if (!bigEndian) ENDIANCONVERT32(ifd0_off); ifd0_off += (EXIF_SIZE_HEADER_SIZE + EXIF_APP_HEADER_SIZE); /* get no of fields in the ifd0 directory*/ memcpy(&ifd0_items, &aBuffer[ifd0_off], sizeof(OMX_U16)); if (!bigEndian) ENDIANCONVERT16(ifd0_items); ifd0_field_off = ifd0_off + sizeof(OMX_U16); /*locate orientation tag*/ while (ifd0_items--) { memcpy(&temp, &aBuffer[ifd0_field_off], sizeof(OMX_U16)); if (!bigEndian) ENDIANCONVERT16(temp); if (IFDtag_Orientation == temp) { break; } ifd0_field_off += sizeof(IFDfield_t); } DBGT_ASSERT(IFDtag_Orientation == temp, "Could not found Orientation Tag"); /*update orientation tag*/ memcpy(&ifd0_field, &aBuffer[ifd0_field_off], sizeof(IFDfield_t)); ifd0_field.valueOffset = aOrientation; memcpy(&aBuffer[ifd0_field_off], &ifd0_field, sizeof(IFDfield_t)); DBGT_EPILOG(""); }
OMX_ERRORTYPE ArmIVEmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_PTR pAppData, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer) { DBGT_PROLOG("Handle: %p, AppData: %p, BuffHeader: %p", hComponent, pAppData, pBuffer); //NULL checking DBGT_ASSERT(NULL != hComponent, "Invalid handle"); DBGT_ASSERT(NULL != pBuffer, "Invalid buffer"); DBGT_PTRACE("ArmIVEmptyBufferDone empty buffer done \n"); DBGT_EPILOG(""); return OMX_ErrorNone; }
OMX_ERRORTYPE FixedFocusHandler::setUpFocus(const char* const aFocus) { DBGT_PROLOG("Focus: %s", aFocus); DBGT_ASSERT(NULL != aFocus, "Focus is NULL"); OMX_ERRORTYPE err = OMX_ErrorNone; //Setting Focus Control OmxUtils::StructContainer<OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE> focusControl; focusControl.ptr()->nPortIndex = OMX_ALL; err = OMX_GetConfig(mSTECamera->mCam, (OMX_INDEXTYPE)(OMX_IndexConfigFocusControl), focusControl.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_GetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } focusControl.ptr()->eFocusControl = OMX_IMAGE_FocusControlOff; focusControl.ptr()->nFocusStepIndex = 0; focusControl.ptr()->nFocusSteps = 100; DBGT_PTRACE("Setting Control %u", focusControl.ptr()->eFocusControl); err = OMX_SetConfig(mSTECamera->mCam, (OMX_INDEXTYPE)(OMX_IndexConfigFocusControl), focusControl.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_SetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } DBGT_EPILOG(""); return err; }
OMX_ERRORTYPE DeviceHwRotation::setupRotationProcessing() { DBGT_PROLOG(""); DBGT_ASSERT(NULL != mSTECamera->mCam, "Camera Handle is Null"); int rotation = mSTECamera->mPictureInfo.getRotation(); DBGT_ASSERT(180 != rotation, "Invalid rotation for Hw Processing"); OMX_ERRORTYPE err = OMX_ErrorNone; /*Setup Hardware Processing*/ OmxUtils::StructContainer<OMX_SYMBIAN_CONFIG_ORIENTATIONTYPE> stillOrientationConfig; stillOrientationConfig.ptr()->nPortIndex = paramPortVPB1.nPortIndex; err = OMX_GetConfig(mSTECamera->mCam, mSTECamera->mOmxILExtIndex->getIndex(OmxILExtIndex::EOrientationScene), stillOrientationConfig.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Orientation Scene OMX_GetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } if (0 == rotation) { stillOrientationConfig.ptr()->eOrientation = OMX_SYMBIAN_OrientationRowTopColumnLeft; } else if (90 == rotation) { /*< Frame is 90 degrees CW rotated */ stillOrientationConfig.ptr()->eOrientation = OMX_SYMBIAN_OrientationRowRightColumnTop; } else if (270 == rotation) { /*< Frame is 270 degrees CW rotated */ stillOrientationConfig.ptr()->eOrientation = OMX_SYMBIAN_OrientationRowLeftColumnBottom; } else DBGT_CRITICAL("Cant Happen"); err = OMX_SetConfig(mSTECamera->mCam, mSTECamera->mOmxILExtIndex->getIndex(OmxILExtIndex::EOrientationScene), stillOrientationConfig.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Orientation Scene OMX_SetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } /*Setup Software Processing*/ mSTECamera->mISPImageOmxBuffInfo.mSwRotation = NULL; DBGT_EPILOG(""); return err; }
OMX_ERRORTYPE EnableDataFlow::setAutoRotate(OMX_BOOL aEnaleAutoRotate) { DBGT_PROLOG("aEnaleAutoRotate: %d", aEnaleAutoRotate); DBGT_ASSERT(NULL != mArmIvProc, "mArmIvProc is NULL"); DBGT_ASSERT(1 == mParamArmIvOutput.nPortIndex, "mParamArmIvOutput.nPortIndex is invalid"); OMX_ERRORTYPE err = OMX_ErrorNone; OMX_INDEXTYPE index; OmxUtils::StructContainer<OMX_SYMBIAN_CONFIG_BOOLEANTYPE> autoRotate; err = OMX_GetExtensionIndex(mArmIvProc, (char *)OMX_SYMBIAN_INDEX_CONFIG_COMMON_AUTOROTATIONCONTROL_NAME, &index); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Still Auto Rotation OMX_GetExtensionIndex failed err = %d", err); DBGT_EPILOG(""); return err; } autoRotate.ptr()->nPortIndex = mParamArmIvOutput.nPortIndex; err = OMX_GetConfig(mArmIvProc, index, autoRotate.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Auto Rotation OMX_GetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } autoRotate.ptr()->bEnabled = aEnaleAutoRotate; err = OMX_SetConfig(mArmIvProc, index, autoRotate.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Auto Rotation OMX_SetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } DBGT_EPILOG(""); return err; }
OMX_ERRORTYPE DeviceSwRotation::setupRotationProcessing() { DBGT_PROLOG(""); DBGT_ASSERT(NULL != mSTECamera->mCam, "Camera Handle is Null"); int rotation = mSTECamera->mPictureInfo.getRotation(); DBGT_ASSERT(rotation == 180, "Invalid rotation for Sw Processing"); OMX_ERRORTYPE err = OMX_ErrorNone; /*Setup Hardware Processing*/ OmxUtils::StructContainer<OMX_SYMBIAN_CONFIG_ORIENTATIONTYPE> stillOrientationConfig; stillOrientationConfig.ptr()->nPortIndex = paramPortVPB1.nPortIndex; err = OMX_GetConfig(mSTECamera->mCam, mSTECamera->mOmxILExtIndex->getIndex(OmxILExtIndex::EOrientationScene), stillOrientationConfig.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Orientation Scene OMX_GetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } stillOrientationConfig.ptr()->eOrientation = OMX_SYMBIAN_OrientationRowBottomColumnRight; err = OMX_SetConfig(mSTECamera->mCam, mSTECamera->mOmxILExtIndex->getIndex(OmxILExtIndex::EOrientationScene), stillOrientationConfig.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Orientation Scene OMX_SetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } /*Setup Software Processing*/ mSTECamera->mISPImageOmxBuffInfo.mSwRotation = CamSwRoutines::YUV420MB_180_rotation_inplace; DBGT_EPILOG(""); return err; }
int FocusHandler::getFocusModeIndex(const char * const aFocus) { DBGT_PROLOG("Focus: %s", aFocus); DBGT_ASSERT(NULL != aFocus, "Focus is NULL"); int i = 0, value; do { value = strcmp(g_STECamFocusProp[i].focus, aFocus); if (!value) break; else i++; } while (g_STECamFocusProp[i - 1].iMarkendofdata != 1); if (value != 0) i = kInvalidIndex; DBGT_EPILOG("i = %d", i); return i; }
OMX_ERRORTYPE FocusHandler::doFocus() { DBGT_PROLOG(""); mSTECamera->mAutoFocusThreadData->mEnabled = OMX_TRUE; OmxUtils::StructContainer<OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE> focusControl; focusControl.ptr()->nPortIndex = OMX_ALL; DBGT_ASSERT(OMX_IMAGE_FocusControlOff != g_STECamFocusProp[mFocusModeIndex].eFocusType, "Focussing not permitted in this mode"); OMX_ERRORTYPE err = OMX_ErrorNone; err = mSTECamera->mOmxReqCbHandler.enable(OmxReqCbHandler::EAutoFocusLock); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Enable reqcb failed err = %d", err); DBGT_EPILOG(""); return err; } err = OMX_GetConfig(mSTECamera->mCam, (OMX_INDEXTYPE)(OMX_IndexConfigFocusControl), focusControl.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_GetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } focusControl.ptr()->eFocusControl = OMX_IMAGE_FocusControlOn; err = OMX_SetConfig(mSTECamera->mCam, (OMX_INDEXTYPE)(OMX_IndexConfigFocusControl), focusControl.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_SetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } DBGT_EPILOG(""); return err; }
OMX_ERRORTYPE ImageRotHandler::setAutoRotate(OMX_HANDLETYPE aHandle, int aPort, OMX_BOOL aEnaleAutoRotate) { DBGT_PROLOG("aHandle: %p aPort: %d aEnaleAutoRotate: %d", aHandle, aPort, aEnaleAutoRotate); DBGT_ASSERT(NULL != aHandle, "aHandle is NULL"); OMX_ERRORTYPE err = OMX_ErrorNone; OMX_INDEXTYPE index; OmxUtils::StructContainer<OMX_SYMBIAN_CONFIG_BOOLEANTYPE> autoRotate; err = OMX_GetExtensionIndex(aHandle, (char *)OMX_SYMBIAN_INDEX_CONFIG_COMMON_AUTOROTATIONCONTROL_NAME, &index); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Still Auto Rotation OMX_GetExtensionIndex failed err = %d", err); DBGT_EPILOG(""); return err; } autoRotate.ptr()->nPortIndex = aPort; err = OMX_GetConfig(aHandle, index, autoRotate.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Auto Rotation OMX_GetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } autoRotate.ptr()->bEnabled = aEnaleAutoRotate; err = OMX_SetConfig(aHandle, index, autoRotate.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Auto Rotation OMX_SetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } DBGT_EPILOG(""); return err; }
OMX_ERRORTYPE EnableDataFlow::useBuffer() { DBGT_PROLOG(""); OMX_ERRORTYPE err = OMX_ErrorNone; DBGT_PTRACE("\n Calling OMX_SetConfig before OMX_UseBuffer ArmIV Chunk\n"); err = OMX_SetConfig(mArmIvProc, (OMX_INDEXTYPE)OMX_OsiIndexConfigSharedChunkMetadata, &mChunkData_ArmIvProc); if (err != OMX_ErrorNone) { DBGT_PTRACE("OMX_SetConfig Failed \n"); } mArmIvInBuffer = NULL; DBGT_PTRACE("usebuffer mArmIvProc "); err = OMX_UseBuffer(mArmIvProc, // hComponent &mArmIvInBuffer, // address where ptr to buffer header will be stored 0, // port index (for port for which buffer is provided) (void *)(&mArmIvOmxBuffInfo), // App. private data = pointer to beginning of allocated data // to have a context when component returns with a callback (i.e. to know // what to free etc. (OMX_U32)(mParamArmIvInput.nBufferSize), // buffer size (OMX_U8 *)(mArmIvOmxBuffInfo.mMMHwBufferInfo.iLogAddr) // buffer data ptr ); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_UseBuffer failed for mArmIvProc port 0 failed err = %d", err); DBGT_EPILOG(""); return err; } DBGT_ASSERT(NULL != mArmIvInBuffer->pBuffer, "Buffer is NULL"); mArmIvOmxBuffInfo.mCamMemoryBase.get()->setOmxBufferHeaderType(mArmIvInBuffer); DBGT_EPILOG(""); return err; }
OMX_ERRORTYPE EnableDataFlow::configPorts(const ImageInfo &aThumbnailInfo, const ImageInfo &aPreviewInfo) { DBGT_PROLOG("Thumbnail Width: %d Height: %d \nPreview Width: %d Heidht: %d\n", aThumbnailInfo.getWidth(), aThumbnailInfo.getHeight(), aPreviewInfo.getAlignedWidth(), aPreviewInfo.getAlignedHeight()); DBGT_ASSERT(0 != aThumbnailInfo.getWidth(), "invalid width"); DBGT_ASSERT(0 != aThumbnailInfo.getHeight(), "invalid height"); DBGT_ASSERT(0 != aPreviewInfo.getAlignedWidth(), "invalid Preview Width"); DBGT_ASSERT(0 != aPreviewInfo.getAlignedHeight(), "invalid Preview Height"); OMX_ERRORTYPE err = OMX_ErrorNone; /****************************************************************************/ // Initialize ARM IV input /****************************************************************************/ err = OMX_GetParameter(mArmIvProc, OMX_IndexParamPortDefinition, &mParamArmIvInput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter OMX_IndexParamPortDefinition for mArmIvProc port0 failed err = %d", err); DBGT_EPILOG(""); return err; } mParamArmIvInput.nBufferCountActual = 1; // the index of the input port. Should be modified. //Here, the min number of buffers to be used is retrieved OMX_VIDEO_PORTDEFINITIONTYPE *pt_armivinput = &(mParamArmIvInput.format.video); pt_armivinput->cMIMEType = (OMX_STRING)""; pt_armivinput->pNativeRender = (OMX_NATIVE_DEVICETYPE)NULL; pt_armivinput->nFrameWidth = (OMX_U32)aPreviewInfo.getAlignedWidth(); pt_armivinput->nFrameHeight = (OMX_U32)aPreviewInfo.getAlignedHeight(); pt_armivinput->nStride = (OMX_U32)(2 * aPreviewInfo.getAlignedWidth()); pt_armivinput->nSliceHeight = (OMX_U32)aPreviewInfo.getAlignedHeight(); pt_armivinput->bFlagErrorConcealment = (OMX_BOOL)OMX_FALSE; pt_armivinput->eCompressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_IMAGE_CodingUnused; pt_armivinput->eColorFormat = mPreviewOmxColorFormat; pt_armivinput->pNativeWindow = (OMX_NATIVE_DEVICETYPE)NULL; err = OMX_SetParameter(mArmIvProc, OMX_IndexParamPortDefinition, &mParamArmIvInput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Setparameter OMX_IndexParamPortDefinition for mArmIvProc port0 failed err = %d", err); DBGT_EPILOG(""); return err; } err = OMX_GetParameter(mArmIvProc, OMX_IndexParamPortDefinition, &mParamArmIvInput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter OMX_IndexParamPortDefinition for mArmIvProc port0 failed err = %d", err); DBGT_EPILOG(""); return err; } //dump DBGT_PTRACE("Dumping params for ARM IV input"); OmxUtils::dump(mParamArmIvInput); //***********Set Rotation value in ARMIVPRoc if((aThumbnailInfo.getRotation() == 90)||(aThumbnailInfo.getRotation() == 270)){ OmxUtils::StructContainer<OMX_CONFIG_ROTATIONTYPE> rfactor; rfactor.ptr()->nPortIndex = 1; rfactor.ptr()->nRotation = (aThumbnailInfo.getRotation()+180)%360; err = OMX_SetConfig(mArmIvProc, OMX_IndexConfigCommonRotate, rfactor.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("SetConfig for mArmIvProc port1 failed err = %d", err); DBGT_EPILOG(""); return err; } } //*********** /****************************************************************************/ // Initialize ARM IV output /****************************************************************************/ err = OMX_GetParameter(mArmIvProc, OMX_IndexParamPortDefinition, &mParamArmIvOutput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter OMX_IndexParamPortDefinition for mArmIvProc port1 failed err = %d", err); DBGT_EPILOG(""); return err; } mParamArmIvOutput.nBufferCountActual = 1; OMX_VIDEO_PORTDEFINITIONTYPE *pt_armivoutput = &(mParamArmIvOutput.format.video); pt_armivoutput->cMIMEType = (OMX_STRING)""; pt_armivoutput->pNativeRender = (OMX_NATIVE_DEVICETYPE)NULL; pt_armivoutput->nFrameWidth = (OMX_U32) aThumbnailInfo.getAlignedWidth(); pt_armivoutput->nFrameHeight = (OMX_U32)aThumbnailInfo.getAlignedHeight(); pt_armivoutput->nSliceHeight = (OMX_U32)aThumbnailInfo.getAlignedHeight(); pt_armivoutput->nStride = 0; pt_armivoutput->bFlagErrorConcealment = (OMX_BOOL)OMX_FALSE; pt_armivoutput->eCompressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_IMAGE_CodingUnused; pt_armivoutput->eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_COLOR_FormatCbYCrY; pt_armivoutput->pNativeWindow = (OMX_NATIVE_DEVICETYPE)NULL; err = OMX_SetParameter(mArmIvProc, OMX_IndexParamPortDefinition, &mParamArmIvOutput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Setparameter OMX_IndexParamPortDefinition for mArmIvProc port1 failed err = %d", err); DBGT_EPILOG(""); return err; } err = OMX_GetParameter(mArmIvProc, OMX_IndexParamPortDefinition, &mParamArmIvOutput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter OMX_IndexParamPortDefinition for mArmIvProc port1 failed err = %d", err); DBGT_EPILOG(""); return err; } //dump DBGT_PTRACE("Dumping params for ARM IV output"); OmxUtils::dump(mParamArmIvOutput); /****************************************************************************/ // Initialize SW JPEG Encoder Input for DCF thumbnail /****************************************************************************/ err = OMX_GetParameter(mSwJpegEnc, OMX_IndexParamPortDefinition, &mParamSwJpegInput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter OMX_IndexParamPortDefinition for mSwJpegEnc port0 failed err = %d", err); DBGT_EPILOG(""); return err; } mParamSwJpegInput.nBufferCountActual = 1; // the index of the input port. Should be modified. OMX_IMAGE_PORTDEFINITIONTYPE *pt_swjpeginput = &(mParamSwJpegInput.format.image); pt_swjpeginput->cMIMEType = (OMX_STRING)""; pt_swjpeginput->pNativeRender = (OMX_NATIVE_DEVICETYPE)NULL; pt_swjpeginput->nFrameWidth = (OMX_U32) aThumbnailInfo.getAlignedWidth(); pt_swjpeginput->nFrameHeight = (OMX_U32)aThumbnailInfo.getAlignedHeight(); pt_swjpeginput->nStride = (OMX_U32) (aThumbnailInfo.getAlignedWidth() * 3 / 2); pt_swjpeginput->nSliceHeight = (OMX_U32)aThumbnailInfo.getAlignedHeight(); pt_swjpeginput->bFlagErrorConcealment = (OMX_BOOL)OMX_FALSE; pt_swjpeginput->eCompressionFormat = (OMX_IMAGE_CODINGTYPE)OMX_IMAGE_CodingUnused; pt_swjpeginput->eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_COLOR_FormatCbYCrY; pt_swjpeginput->pNativeWindow = (OMX_NATIVE_DEVICETYPE)NULL; err = OMX_SetParameter(mSwJpegEnc, OMX_IndexParamPortDefinition, &mParamSwJpegInput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Setparameter OMX_IndexParamPortDefinition for mSwJpegEnc port0 failed err = %d", err); DBGT_EPILOG(""); return err; } err = OMX_GetParameter(mSwJpegEnc, OMX_IndexParamPortDefinition, &mParamSwJpegInput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter OMX_IndexParamPortDefinition for mSwJpegEnc port0 failed err = %d", err); DBGT_EPILOG(""); return err; } //dump DBGT_PTRACE("Dumping params for mParamSwJpegInput"); OmxUtils::dump(mParamSwJpegInput); /****************************************************************************/ // Initialize SW JPEG Encoder Ouput for DCF thumbnail /****************************************************************************/ if (aThumbnailInfo.invalidQuality() != aThumbnailInfo.getQuality()) { //setup thumbnail quality OmxUtils::StructContainer<OMX_IMAGE_PARAM_QFACTORTYPE> qfactor; qfactor.ptr()->nPortIndex = 1; qfactor.ptr()->nQFactor = aThumbnailInfo.getQuality(); DBGT_PTRACE("Setting JPEG Thumbnail Quality: %lu ", qfactor.ptr()->nQFactor); err = OMX_SetConfig(mSwJpegEnc, OMX_IndexParamQFactor, qfactor.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("SetConfig mSwJpegEnc port1 failed err = %d", err); DBGT_EPILOG(""); return err; } } err = OMX_GetParameter(mSwJpegEnc, OMX_IndexParamPortDefinition, &mParamSwJpegOutput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter OMX_IndexParamPortDefinition for mSwJpegEnc port1 failed err = %d", err); DBGT_EPILOG(""); return err; } mParamSwJpegOutput.nBufferCountActual = 1; // the index of the input port. Should be modified. OMX_IMAGE_PORTDEFINITIONTYPE *pt_swjpegoutput = &(mParamSwJpegOutput.format.image); pt_swjpegoutput->cMIMEType = (OMX_STRING)""; pt_swjpegoutput->pNativeRender = (OMX_NATIVE_DEVICETYPE)NULL; pt_swjpegoutput->nFrameWidth = (OMX_U32)aThumbnailInfo.getWidth(); pt_swjpegoutput->nFrameHeight = (OMX_U32)aThumbnailInfo.getHeight(); pt_swjpegoutput->nStride = (OMX_U32)(aThumbnailInfo.getWidth() * 3 / 2); pt_swjpegoutput->nSliceHeight = (OMX_U32)aThumbnailInfo.getHeight(); pt_swjpegoutput->bFlagErrorConcealment = (OMX_BOOL)OMX_FALSE; pt_swjpegoutput->eCompressionFormat = (OMX_IMAGE_CODINGTYPE)OMX_IMAGE_CodingJPEG; pt_swjpegoutput->eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_COLOR_FormatUnused; pt_swjpegoutput->pNativeWindow = (OMX_NATIVE_DEVICETYPE)NULL; err = OMX_SetParameter(mSwJpegEnc, OMX_IndexParamPortDefinition, &mParamSwJpegOutput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Setparameter OMX_IndexParamPortDefinition for mSwJpegEnc port1 failed err = %d", err); DBGT_EPILOG(""); return err; } err = STECamera::cropOutputSize(mSwJpegEnc, aThumbnailInfo.getWidth(), aThumbnailInfo.getHeight()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("cropOutputSize for mSwJpegEnc failed err = %d", err); DBGT_EPILOG(""); return err; } err = OMX_GetParameter(mSwJpegEnc, OMX_IndexParamPortDefinition, &mParamSwJpegOutput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter OMX_IndexParamPortDefinition for mSwJpegEnc port1 failed err = %d", err); DBGT_EPILOG(""); return err; } DBGT_PTRACE("Dumping params for mParamSwJpegOutput"); OmxUtils::dump(mParamSwJpegOutput); /****************************************************************************/ // Reconfigure ExifMixer port 0 /****************************************************************************/ err = OMX_GetParameter(mExifMixer, OMX_IndexParamPortDefinition, &mParamExifInput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter mExifMixer port 0 failed err = %d", err); DBGT_EPILOG(""); return err; } mParamExifInput.nBufferCountActual = 1; // the index of the input port. Should be modified. OMX_IMAGE_PORTDEFINITIONTYPE *pt_exifinput1 = &(mParamExifInput.format.image); pt_exifinput1->cMIMEType = (OMX_STRING)""; pt_exifinput1->pNativeRender = (OMX_NATIVE_DEVICETYPE)NULL; pt_exifinput1->nFrameWidth = (OMX_U32)aThumbnailInfo.getWidth(); pt_exifinput1->nFrameHeight = (OMX_U32)aThumbnailInfo.getHeight(); pt_exifinput1->nStride = (OMX_U32)(aThumbnailInfo.getWidth() * 3 / 2); pt_exifinput1->bFlagErrorConcealment = (OMX_BOOL)OMX_FALSE; pt_exifinput1->eCompressionFormat = (OMX_IMAGE_CODINGTYPE)OMX_IMAGE_CodingJPEG; pt_exifinput1->eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_COLOR_FormatUnused; pt_exifinput1->pNativeWindow = (OMX_NATIVE_DEVICETYPE)NULL; err = OMX_SetParameter(mExifMixer, OMX_IndexParamPortDefinition, &mParamExifInput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Setparameter mExifMixer port 0 failed err = %d", err); DBGT_EPILOG(""); return err; } //dump err = OMX_GetParameter(mExifMixer, OMX_IndexParamPortDefinition, &mParamExifInput); if(OMX_ErrorNone != err) { DBGT_CRITICAL("Getparameter mExifMixer port 0 failed err = %d", err); DBGT_EPILOG(""); return err; } DBGT_PTRACE("Dumping params for mParamExifInput"); OmxUtils::dump(mParamExifInput); DBGT_EPILOG(""); return err; }
OMX_ERRORTYPE SWJpegEventHandler(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent, OMX_U32 nData1, OMX_U32 nData2, OMX_PTR pEventData) { DBGT_PROLOG("Handle: %p AppData: %p", hComponent, pAppData); DBGT_PTRACE("Event: %s(%d) Data1: %lu Data2: %lu EventData: %p", OmxUtils::name(eEvent), eEvent, nData1, nData2, pEventData); //NULL checking DBGT_ASSERT(NULL != hComponent, "Invalid handle" ); EnableDataFlow *parent = static_cast<EnableDataFlow *>(pAppData); switch (eEvent) { case OMX_EventCmdComplete: { OMX_COMMANDTYPE cmd = (OMX_COMMANDTYPE) nData1; DBGT_PTRACE("Cmd: %s(%d)", OmxUtils::name(cmd), cmd); if (cmd == OMX_CommandStateSet) { OMX_STATETYPE newState = (OMX_STATETYPE) nData2; DBGT_PTRACE("State: %s(%d)", OmxUtils::name(newState), newState); switch (newState) { case OMX_StateLoaded: parent->mStateSWJpegSem.signal(); break; case OMX_StateIdle: parent->mStateSWJpegSem.signal(); break; case OMX_StateExecuting: parent->mStateSWJpegSem.signal(); break; case OMX_StatePause: DBGT_PTRACE("OMX_StatePause"); break; case OMX_StateInvalid: DBGT_CRITICAL("OMX_StateInvalid"); break; default: break; } } else if (OMX_CommandPortDisable == cmd) parent->mStateSWJpegSem.signal(); else if (OMX_CommandPortEnable == cmd) parent->mStateSWJpegSem.signal(); break; } case OMX_EventError: DBGT_CRITICAL("Error detected by OMX event handler : %d (0x%x) - %d (0x%x) ", (OMX_ERRORTYPE) nData1, (OMX_ERRORTYPE) nData1, (OMX_ERRORTYPE) nData2, (OMX_ERRORTYPE) nData2); break; case OMX_EventBufferFlag: { if ((nData1 == 1 ) ) { parent->mSwJpegEosSem.signal(); parent->mPerfManager.logAndDump(PerfManager::ESwJpegEOS); } break; } default: DBGT_PTRACE("Unknown event: %d", eEvent); } DBGT_EPILOG(""); return OMX_ErrorNone; }
/** Configures a given focus mode. While configuring a focus mode, it configures * 1. Range Control * 2. Focus Control * 3. Optionally, Focus Lock, if ENABLE_LOCK is enabled. */ OMX_ERRORTYPE FocusHandler::setUpFocus(const char* const aFocus) { DBGT_PROLOG("Focus: %s", aFocus); DBGT_ASSERT(NULL != aFocus, "Focus is NULL"); OMX_ERRORTYPE err = OMX_ErrorNone; mFocusModeIndex = getFocusModeIndex(aFocus); if (kInvalidIndex == mFocusModeIndex) { DBGT_EPILOG("OMX_ErrorBadParameter"); return OMX_ErrorBadParameter; } //Setting Focus Range OmxUtils::StructContainer<OMX_SYMBIAN_CONFIG_FOCUSRANGETYPE> rangeControl; rangeControl.ptr()->nPortIndex = OMX_ALL; err = OMX_GetConfig(mSTECamera->mCam, mSTECamera->mOmxILExtIndex->getIndex(OmxILExtIndex::EFocusRange), rangeControl.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_GetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } rangeControl.ptr()->eFocusRange = g_STECamFocusProp[mFocusModeIndex].eRangeType; DBGT_PTRACE("Setting Range %s",OmxUtils::name ((OMX_SYMBIAN_FOCUSRANGETYPE)rangeControl.ptr()->eFocusRange)); err = OMX_SetConfig(mSTECamera->mCam, mSTECamera->mOmxILExtIndex->getIndex(OmxILExtIndex::EFocusRange), rangeControl.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_SetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } //Setting Focus lock #ifdef ENABLE_LOCK OmxUtils::StructContainer<OMX_SYMBIAN_CONFIG_LOCKTYPE> focuslock; focuslock.ptr()->nPortIndex=OMX_ALL; #ifndef DISABLE_GET_CONFIG_LOCK //Remove this workaround when ER 351601 is resolved err = OMX_GetConfig(mSTECamera->mCam, mSTECamera->mOmxILExtIndex->getIndex(OmxILExtIndex::EFocusLock), focuslock.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_GetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } #endif //DISABLE_GET_CONFIG_LOCK focuslock.ptr()->eImageLock = getLockType(); DBGT_PTRACE("Setting Lock %s",OmxUtils::name((OMX_SYMBIAN_LOCKTYPE) focuslock.ptr()->eImageLock)); err = OMX_SetConfig(mSTECamera->mCam, mSTECamera->mOmxILExtIndex->getIndex(OmxILExtIndex::EFocusLock), focuslock.ptr() ); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_SetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } #endif //ENABLE_LOCK //Setting Focus Control OmxUtils::StructContainer<OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE> focusControl; focusControl.ptr()->nPortIndex = OMX_ALL; err = OMX_GetConfig(mSTECamera->mCam, (OMX_INDEXTYPE)(OMX_IndexConfigFocusControl), focusControl.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_GetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } focusControl.ptr()->eFocusControl = g_STECamFocusProp[mFocusModeIndex].eFocusType; DBGT_PTRACE("Setting Control %u", focusControl.ptr()->eFocusControl); err = OMX_SetConfig(mSTECamera->mCam, (OMX_INDEXTYPE)(OMX_IndexConfigFocusControl), focusControl.ptr()); if(OMX_ErrorNone != err) { DBGT_CRITICAL("OMX_SetConfig failed err = %d", err); DBGT_EPILOG(""); return err; } DBGT_EPILOG(""); return err; }
OMX_ERRORTYPE ImageRotHandler::updateExtraDataOrientation(const OMX_BUFFERHEADERTYPE* const aOmxBuffHdr) { DBGT_PROLOG("aOmxBuffHdr: %p", aOmxBuffHdr); DBGT_ASSERT(NULL != aOmxBuffHdr, "aOmxBuffHdr is null"); DBGT_ASSERT(NULL != aOmxBuffHdr->pBuffer, "aOmxBuffHdr->pBuffer is null"); DBGT_ASSERT(0 != aOmxBuffHdr->nFilledLen, "aOmxBuffHdr->nFilledLen is 0"); OMX_SYMBIAN_CAPTUREPARAMETERSTYPE *pCaptureParameters = NULL; char *pExifParameters = NULL; /* get extradata start pointer */ OMX_U8* pCur = aOmxBuffHdr->pBuffer + aOmxBuffHdr->nOffset + aOmxBuffHdr->nFilledLen; OMX_OTHER_EXTRADATATYPE* pCurExtra = (OMX_OTHER_EXTRADATATYPE*)(((OMX_U32)pCur + 3) & ~0x3); /* check that there is enough space for an extradata header*/ if(((OMX_U8*)aOmxBuffHdr->pBuffer + aOmxBuffHdr->nAllocLen) <= ((OMX_U8*)pCurExtra + sizeof(OMX_OTHER_EXTRADATATYPE))) { DBGT_CRITICAL("not enough space for xtradata header OMX_ErrorUndefined"); DBGT_EPILOG(""); return OMX_ErrorUndefined; } /* search if field already exists */ while (OMX_ExtraDataNone != pCurExtra->eType) { /* if we have found our capture parameters field*/ if (OMX_SYMBIAN_CameraExtraDataCaptureParameters == (OMX_SYMBIAN_CAMERA_EXTRADATATYPE)pCurExtra->eType) { /* check that there is enough space for data*/ if(((OMX_U8*)aOmxBuffHdr->pBuffer + aOmxBuffHdr->nAllocLen) <= (((OMX_U8*)pCurExtra + sizeof(OMX_OTHER_EXTRADATATYPE)) + (sizeof(OMX_SYMBIAN_CAPTUREPARAMETERSTYPE) - sizeof(OMX_U8)))) { DBGT_CRITICAL("not enough space for data OMX_ErrorUndefined"); DBGT_EPILOG(""); return OMX_ErrorUndefined; } pCaptureParameters = (OMX_SYMBIAN_CAPTUREPARAMETERSTYPE *)pCurExtra->data; /* if we have found our exif parameters field*/ } else if (OMX_SYMBIAN_CameraExtraDataEXIFAppMarker == (OMX_SYMBIAN_CAMERA_EXTRADATATYPE)pCurExtra->eType) { /* check that there is enough space for data*/ if(((OMX_U8*)aOmxBuffHdr->pBuffer + aOmxBuffHdr->nAllocLen) <= ((OMX_U8*)pCurExtra + sizeof(OMX_OTHER_EXTRADATATYPE) + pCurExtra->nDataSize - sizeof(OMX_U8))) { DBGT_CRITICAL("not enough space for data OMX_ErrorUndefined"); DBGT_EPILOG(""); return OMX_ErrorUndefined; } pExifParameters = (char *)pCurExtra->data; break; } /* check that there is enough space for an other extradata header */ if(((OMX_U8*)aOmxBuffHdr->pBuffer + aOmxBuffHdr->nAllocLen) <= ((OMX_U8*)pCurExtra + sizeof(OMX_OTHER_EXTRADATATYPE) + pCurExtra->nSize)) { DBGT_CRITICAL("not enough space for xtradata header OMX_ErrorUndefined"); DBGT_EPILOG(""); return OMX_ErrorUndefined; } pCurExtra = (OMX_OTHER_EXTRADATATYPE*)((OMX_U8*)pCurExtra + pCurExtra->nSize); } DBGT_ASSERT(NULL != pCaptureParameters, "pCaptureParameters is null"); DBGT_ASSERT(NULL != pExifParameters, "pExifParameters is null"); doUpdateExtraDataOrientation(pCaptureParameters, pExifParameters); DBGT_EPILOG(""); return OMX_ErrorNone; }