Esempio n. 1
0
/**
 * @name   DomxTunnelMgr_unRegisterHandle
 * @brief  UnResgiter a component handle
 * @param  hComponentHandle           : Handle to component to be unregistered
 * @return none
 */
Void DomxTunnelMgr_unRegisterHandle (OmxTypes_OMX_HANDLETYPE hComponentHandle)
{
  OMX_CONFIG_DOMXPROXYCOMPINFO sDomxProxyInfo;
  OMX_ERRORTYPE eError;
  Int nCompIdx;
  IArg key;

  DOMX_UTL_TRACE_FUNCTION_ENTRY_LEVEL1 ();
  nCompIdx = domxtmgr_get_component_registry_index (hComponentHandle);
  if (-1 == nCompIdx)
  {
    eError = OMX_GetConfig (hComponentHandle, (OMX_INDEXTYPE)
                            OMX_TI_IndexConfigGetDomxCompInfo, &sDomxProxyInfo);
    if (OMX_ErrorNone == eError)
    {
      nCompIdx =
        domxtmgr_get_component_registry_index (sDomxProxyInfo.hCompRealHandle);
      DOMX_UTL_TRACE_FUNCTION_ASSERT ((-1 != nCompIdx),
                                      "Component handle not found");
    }
    else
    {
      DOMX_UTL_TRACE_FUNCTION_ASSERT ((OMX_ErrorNone == eError),
                                      "OMX_GetConfig returned error");
    }
  }
  domxtmgr_delete_proxylite_connections (hComponentHandle);
  key = Gate_enterModule ();
  domxtmgr_unregister_component (nCompIdx);
  Gate_leaveModule (key);

  DOMX_UTL_TRACE_FUNCTION_EXIT_LEVEL1 (eError);

  return;
}
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;
}
Esempio n. 3
0
status_t OMXNodeInstance::getConfig(
        OMX_INDEXTYPE index, void *params, size_t size) {
    Mutex::Autolock autoLock(mLock);

    OMX_ERRORTYPE err = OMX_GetConfig(mHandle, index, params);
    return StatusFromOMXError(err);
}
OMX_ERRORTYPE VideoRender::ProcessDataBuffer()
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;
    OMX_BUFFERHEADERTYPE *pBufferHdr = NULL;

    if(ports[IN_PORT]->BufferNum() == 0)
        return OMX_ErrorNoMore;

    if(pSyncFrame != NULL)
        return OMX_ErrorNoMore;

    ports[IN_PORT]->GetBuffer(&pBufferHdr);

    if(nFrameCnt == 0 && ports[CLK_PORT]->IsEnabled() == OMX_TRUE) {
        OMX_TIME_CONFIG_CLOCKSTATETYPE sState;
        OMX_INIT_STRUCT(&sState, OMX_TIME_CONFIG_CLOCKSTATETYPE);
        ports[CLK_PORT]->GetTunneledInfo(&hClock);
        OMX_GetConfig(hClock.hTunneledComp, OMX_IndexConfigTimeClockState, &sState);
        ClockState = sState.eState;
    }

    nFrameCnt ++;

    LOG_DEBUG("VideoRender get bufer: %p:%lld:%x\n", 
            pBufferHdr->pBuffer, pBufferHdr->nTimeStamp, pBufferHdr->nFlags);

    if(ports[CLK_PORT]->IsEnabled() == OMX_TRUE)
        ret = SyncFrame(pBufferHdr);
    else
        ret = RenderFrame(pBufferHdr);

    return ret;
}
status_t OMXCameraAdapter::getFocusMode(OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE &focusMode)
{;
    OMX_ERRORTYPE eError = OMX_ErrorNone;

    LOG_FUNCTION_NAME;

    if ( OMX_StateInvalid == mComponentState ) {
        CAMHAL_LOGEA("OMX component is in invalid state");
        return NO_INIT;
    }

    OMX_INIT_STRUCT_PTR (&focusMode, OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE);
    focusMode.nPortIndex = mCameraAdapterParameters.mPrevPortIndex;

    eError =  OMX_GetConfig(mCameraAdapterParameters.mHandleComp,
                            OMX_IndexConfigFocusControl,
                            &focusMode);

    if ( OMX_ErrorNone != eError ) {
        CAMHAL_LOGEB("Error while retrieving focus mode 0x%x", eError);
    }

    LOG_FUNCTION_NAME_EXIT;

    return ErrorUtils::omxToAndroidError(eError);
}
Esempio n. 6
0
status_t OMXCameraAdapter::getCaps(CameraProperties::Properties* params, OMX_HANDLETYPE handle) {
    status_t ret = NO_ERROR;
    int caps_size = 0;
    OMX_ERRORTYPE eError = OMX_ErrorNone;
    OMX_TI_CAPTYPE** caps = NULL;;
    OMX_TI_CONFIG_SHAREDBUFFER sharedBuffer;
    MemoryManager memMgr;

    LOG_FUNCTION_NAME;

    // allocate tiler (or ion) buffer for caps (size is always a multiple of 4K)
    caps_size = ((sizeof(OMX_TI_CAPTYPE)+4095)/4096)*4096;
    caps = (OMX_TI_CAPTYPE**) memMgr.allocateBuffer(0, 0, NULL, caps_size, 1);

    if (!caps) {
        CAMHAL_LOGEB("Error allocating buffer for caps %d", eError);
        ret = -ENOMEM;
        goto EXIT;
    }

    // initialize structures to be passed to OMX Camera
    OMX_INIT_STRUCT_PTR (caps[0], OMX_TI_CAPTYPE);
    caps[0]->nPortIndex = OMX_ALL;

    OMX_INIT_STRUCT_PTR (&sharedBuffer, OMX_TI_CONFIG_SHAREDBUFFER);
    sharedBuffer.nPortIndex = OMX_ALL;
    sharedBuffer.nSharedBuffSize = caps_size;
    sharedBuffer.pSharedBuff = (OMX_U8 *) caps[0];

    // Get capabilities from OMX Camera
    CAMHAL_LOGEB("Calling OMX_GetConfig() for OMX_TI_IndexConfigCamCapabilities %d", 0);
    /* FIXME-HASH: Fix this */
    eError =  OMX_GetConfig(handle, (OMX_INDEXTYPE) OMX_TI_IndexConfigCamCapabilities, &sharedBuffer);
    if ( OMX_ErrorNone != eError ) {
        CAMHAL_LOGEB("Error during capabilities query 0x%x", eError);
        /* FIXME-HASH: Removed the query as it will fail for GB syslink */
        // ret = UNKNOWN_ERROR;
        // goto EXIT;
    } else {
        CAMHAL_LOGDA("OMX capability query success");
    }

    // Translate and insert Ducati capabilities to CameraProperties
    if ( NO_ERROR == ret ) {
        ret = insertCapabilities(params, *caps[0]);
    }

    CAMHAL_LOGDB("sen mount id=%u", (unsigned int)caps[0]->tSenMounting.nSenId);


 EXIT:
    if (caps) {
        memMgr.freeBuffer((void*) caps);
        caps = NULL;
    }

    LOG_FUNCTION_NAME_EXIT;
    return ret;
}
OMX_ERRORTYPE ofxRPiCameraVideoGrabber::setFlickerCancellation(OMX_COMMONFLICKERCANCELTYPE eFlickerCancel)
{
    
    OMX_ERRORTYPE error = OMX_GetConfig(camera, OMX_IndexConfigCommonFlickerCancellation, &flickerCancelConfig);
    OMX_TRACE(error);
    if(error == OMX_ErrorNone) 
    {
        switch (flickerCancelConfig.eFlickerCancel) 
        {
            case OMX_COMMONFLICKERCANCEL_OFF:
            {
                ofLogVerbose(__func__) << "OMX_COMMONFLICKERCANCEL_OFF";
                break;
            }
            case OMX_COMMONFLICKERCANCEL_AUTO:
            {
                ofLogVerbose(__func__) << "OMX_COMMONFLICKERCANCEL_AUTO";
                break;
            }
            case OMX_COMMONFLICKERCANCEL_50:
            {
                ofLogVerbose(__func__) << "OMX_COMMONFLICKERCANCEL_50";
                break;
            }
            case OMX_COMMONFLICKERCANCEL_60:
            {
                ofLogVerbose(__func__) << "OMX_COMMONFLICKERCANCEL_60";
                break;
            }
            default:
                break;
        }
        flickerCancelConfig.eFlickerCancel = eFlickerCancel;
        error = OMX_SetConfig(camera, OMX_IndexConfigCommonFlickerCancellation, &flickerCancelConfig);
        if(error == OMX_ErrorNone)
        {
            if(flickerCancelConfig.eFlickerCancel == OMX_COMMONFLICKERCANCEL_OFF)
            {
                flickerCancellation = false;
            }else
            {
                flickerCancellation = true;
            }
        }else
        {
            //error so assume it's not working
            flickerCancellation = false;
        }
        OMX_TRACE(error);
    }
    else
    {
        //error so assume it's not working
        flickerCancellation = false;
    }
    
    return error;
}
OMX_ERRORTYPE do_seek(HTEST *hTest,OMX_U32 nSeekPos, OMX_TIME_SEEKMODETYPE mode )
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;
    OMX_TIME_CONFIG_TIMESTAMPTYPE timeStamp;
    OMX_INIT_STRUCT(&timeStamp, OMX_TIME_CONFIG_TIMESTAMPTYPE);

    OMX_TIME_CONFIG_SEEKMODETYPE seek_mode;
    OMX_INIT_STRUCT(&seek_mode, OMX_TIME_CONFIG_SEEKMODETYPE);
    seek_mode.eType = mode;
    ret = OMX_SetConfig(hTest->hComponent,OMX_IndexConfigTimeSeekMode, &seek_mode);
    if (ret != OMX_ErrorNone)
        return ret;

    timeStamp.nPortIndex = hTest->nAudioTrackNum;
    ret = OMX_GetConfig(hTest->hComponent,OMX_IndexConfigTimePosition, &timeStamp);
    if (ret != OMX_ErrorNone)
        return ret;
    printf("%s,%d,before seek, audio pos %lld.\n",__FUNCTION__,__LINE__,timeStamp.nTimestamp);

    timeStamp.nPortIndex = hTest->nVideoTrackNum;
    ret = OMX_GetConfig(hTest->hComponent,OMX_IndexConfigTimePosition, &timeStamp);
    if (ret != OMX_ErrorNone)
        return ret;
    printf("%s,%d,before seek, video pos %lld.\n",__FUNCTION__,__LINE__,timeStamp.nTimestamp);


    timeStamp.nPortIndex = OMX_ALL;
    timeStamp.nTimestamp = nSeekPos*OMX_TICKS_PER_SECOND;
    ret = OMX_SetConfig(hTest->hComponent,OMX_IndexConfigTimePosition, &timeStamp);

    timeStamp.nPortIndex = hTest->nAudioTrackNum;
    ret = OMX_GetConfig(hTest->hComponent,OMX_IndexConfigTimePosition, &timeStamp);
    if (ret != OMX_ErrorNone)
        return ret;
    printf("%s,%d,seek result audio %lld.\n",__FUNCTION__,__LINE__,timeStamp.nTimestamp);

    timeStamp.nPortIndex = hTest->nVideoTrackNum;
    ret = OMX_GetConfig(hTest->hComponent,OMX_IndexConfigTimePosition, &timeStamp);
    if (ret != OMX_ErrorNone)
        return ret;
    printf("%s,%d,seek result video %lld.\n",__FUNCTION__,__LINE__,timeStamp.nTimestamp);

    return ret;
}
Esempio n. 9
0
OMX_ERRORTYPE Component::getConfig(OMX_INDEXTYPE configIndex, OMX_PTR configStruct)
{
	lock();

	OMX_ERRORTYPE error = OMX_GetConfig(handle, configIndex, configStruct);
    OMX_TRACE(error);
    
	unlock();
	return error;
}
Esempio n. 10
0
//sets the preview res of the camera
void setPreviewRes(COMPONENT_T *camera, int width, int height, int framerate)
{
  //needs to check width and height to see if compatible with rpi
  printf("in setPreviewRes\n");

  OMX_PARAM_PORTDEFINITIONTYPE port_params;
  OMX_ERRORTYPE OMXstatus;

  memset(&port_params, 0, sizeof(port_params));
  port_params.nVersion.nVersion = OMX_VERSION;
  port_params.nSize = sizeof(port_params);
  port_params.nPortIndex = 70;
  //prepopulate structure
  OMXstatus = OMX_GetConfig(ilclient_get_handle(camera), OMX_IndexParamPortDefinition, &port_params);
  if (OMXstatus != OMX_ErrorNone)
    printf("Error Getting Parameter In setPreviewRes. Error = %s\n", err2str(OMXstatus));
  //change needed params
  port_params.format.video.eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar;
  port_params.format.video.nFrameWidth = width;
  port_params.format.video.nFrameHeight = height;
  port_params.format.video.nStride = width;
  port_params.format.video.nSliceHeight = height;
  port_params.format.video.xFramerate = framerate << 16;
  //set changes
  OMXstatus = OMX_SetConfig(ilclient_get_handle(camera), OMX_IndexParamPortDefinition, &port_params);
  if (OMXstatus != OMX_ErrorNone)
    printf("Error Setting Parameter In setPreviewRes. Error = %s\n", err2str(OMXstatus));


  //print current config
  memset(&port_params, 0, sizeof(port_params));
  port_params.nVersion.nVersion = OMX_VERSION;
  port_params.nSize = sizeof(port_params);
  port_params.nPortIndex = 70;

  OMXstatus = OMX_GetConfig(ilclient_get_handle(camera), OMX_IndexParamPortDefinition, &port_params);
  if (OMXstatus != OMX_ErrorNone)
    printf("Error Getting Parameter (2) In setPreviewRes. Error = %s\n", err2str(OMXstatus));

  print_OMX_PARAM_PORTDEFINITIONTYPE(port_params);

}
Esempio n. 11
0
OMX_ERRORTYPE omxil_comp::GetConfig(OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure) const
{
	OMX_ERRORTYPE result;

	result = OMX_GetConfig(comp, nIndex, pComponentConfigStructure);
	if (result != OMX_ErrorNone) {
		fprintf(stderr, "OMX_GetConfig failed.\n");
	}

	return result;
}
Esempio n. 12
0
File: omx.c Progetto: Ezio-PS/movian
int64_t
omx_get_media_time(omx_component_t *oc)
{
  OMX_TIME_CONFIG_TIMESTAMPTYPE ts;
  OMX_INIT_STRUCTURE(ts);

  omxchk(OMX_GetConfig(oc->oc_handle,
		       OMX_IndexConfigTimeCurrentMediaTime,
		       &ts));
  return omx_ticks_to_s64(ts.nTimestamp);
 
}
OMX_ERRORTYPE AudioSource::ClockGetConfig(OMX_INDEXTYPE nParamIndex, OMX_PTR pStructure)
{
	OMX_ERRORTYPE ret = OMX_ErrorNone;

    if(ports[CLK_PORT]->IsEnabled() != OMX_TRUE)
	{
		return ret;
	}

	TUNNEL_INFO TunnelInfo;
    ports[CLK_PORT]->GetTunneledInfo(&TunnelInfo);
	OMX_COMPONENTTYPE *hClockComp = (OMX_COMPONENTTYPE *)TunnelInfo.hTunneledComp;
    if(hClockComp == NULL)
	{
				return ret;
	}

	switch (nParamIndex) {
		case OMX_IndexConfigTimeClockState:
			{
				OMX_TIME_CONFIG_CLOCKSTATETYPE *pClockState = (OMX_TIME_CONFIG_CLOCKSTATETYPE *)pStructure;
				ret = OMX_GetConfig(hClockComp, OMX_IndexConfigTimeClockState, pClockState);
			}
			break;
		case OMX_IndexConfigTimeCurrentMediaTime:
			{
				OMX_TIME_CONFIG_TIMESTAMPTYPE *pCur = (OMX_TIME_CONFIG_TIMESTAMPTYPE *)pStructure;
				pCur->nPortIndex = TunnelInfo.nTunneledPort;
				ret = OMX_GetConfig(hClockComp, OMX_IndexConfigTimeCurrentMediaTime, pCur);
			}
			break;
		default :
			ret = OMX_ErrorUnsupportedIndex;
			break;
	}

	return ret;
}
Esempio n. 14
0
uint32_t audio_get_latency() {
   OMX_PARAM_U32TYPE param;
   OMX_ERRORTYPE error;

   memset(&param, 0, sizeof(OMX_PARAM_U32TYPE));
   param.nSize = sizeof(OMX_PARAM_U32TYPE);
   param.nVersion.nVersion = OMX_VERSION;
   param.nPortIndex = 100;

   error = OMX_GetConfig(ILC_GET_HANDLE(audio_render), OMX_IndexConfigAudioRenderingLatency, &param);
   assert(error == OMX_ErrorNone);

   return param.nU32;
}
Esempio n. 15
0
uint32_t ilctts_get_latency(TTSRENDER_STATE_T *st) {
	OMX_PARAM_U32TYPE param;
	OMX_ERRORTYPE omx_err;
	OMX_INIT_STRUCTURE(param);
	param.nPortIndex = 100;

	omx_err = OMX_GetConfig(ILC_GET_HANDLE(st->audio_render), OMX_IndexConfigAudioRenderingLatency, &param);
	if (omx_err != OMX_ErrorNone) {
		ERROR("OMX_GetConfig returned error in ilctts_get_latency: %d", omx_err);
		return -1;
	}

	return param.nU32;
} // end ilctts_get_latency
static u32 omx_get_latency()
{
	OMX_PARAM_U32TYPE param;
	memset(&param, 0, sizeof(OMX_PARAM_U32TYPE));
	param.nSize = sizeof(OMX_PARAM_U32TYPE);
	param.nVersion.nVersion = OMX_VERSION;
	param.nPortIndex = PORT_INDEX;

	OMX_ERRORTYPE error = OMX_GetConfig(omx_handle, OMX_IndexConfigAudioRenderingLatency, &param);
	if(error != OMX_ErrorNone)
		fprintf(stderr, "OMX: failed to get OMX configuration (OMX_IndexConfigAudioRenderingLatency). Error 0x%X\n", error);

	return param.nU32 * 1000 / OUTPUT_FREQ;
}
Esempio n. 17
0
ret_code_t ilcore_get_config(ilcore_comp_h h, OMX_INDEXTYPE index, OMX_PTR data)
{
    OMX_ERRORTYPE err;
    ilcore_comp_ctx_t  *ctx = (ilcore_comp_ctx_t *)h;

    err = OMX_GetConfig(ctx->handle, index, data);
    if(err != OMX_ErrorNone) 
	{
		DBG_E("%s: %s failed with err = 0x%x\n", __FUNCTION__, ctx->name, err);
        return L_FAILED;
	}

    return L_OK;
}
OMX_ERRORTYPE ofxRPiCameraVideoGrabber::setISO(int ISO_)
{
    OMX_ERRORTYPE error = OMX_GetConfig(camera, OMX_IndexConfigCommonExposureValue, &exposureConfig);
    OMX_TRACE(error);
    if(error == OMX_ErrorNone) 
    {
        exposureConfig.nSensitivity	= ISO_;
        error =  applyExposure(__func__);
        
        if(error == OMX_ErrorNone)
        {
            ISO = getISO();
        }
    }
    return error;
}
OMX_ERRORTYPE ofxRPiCameraVideoGrabber::setShutterSpeed(int shutterSpeedMicroSeconds_)
{
   
    OMX_ERRORTYPE error = OMX_GetConfig(camera, OMX_IndexConfigCommonExposureValue, &exposureConfig);
    OMX_TRACE(error);
    exposureConfig.nShutterSpeedMsec = shutterSpeedMicroSeconds_;
    error =  applyExposure(__func__);
    OMX_TRACE(error);
    if(error == OMX_ErrorNone)
    {
        shutterSpeed = getShutterSpeed();
    }
    ofLogVerbose(__func__) << "POST getShutterSpeed(): " << getShutterSpeed();
    return error;
    
}
status_t OMXCameraAdapter::checkFocus(OMX_PARAM_FOCUSSTATUSTYPE *eFocusStatus)
{
    status_t ret = NO_ERROR;
    OMX_ERRORTYPE eError = OMX_ErrorNone;

    LOG_FUNCTION_NAME;

    if ( NULL == eFocusStatus )
        {
        CAMHAL_LOGEA("Invalid focus status");
        ret = -EINVAL;
        }

    if ( OMX_StateInvalid == mComponentState )
      {
        CAMHAL_LOGEA("OMX component in Invalid state");
        ret = -EINVAL;
      }

    if ( OMX_StateExecuting != mComponentState )
        {
        CAMHAL_LOGEA("OMX component not in executing state");
        ret = NO_ERROR;
        }

    if ( NO_ERROR == ret )
        {
        OMX_INIT_STRUCT_PTR (eFocusStatus, OMX_PARAM_FOCUSSTATUSTYPE);
        eError = OMX_GetConfig(mCameraAdapterParameters.mHandleComp,
                               OMX_IndexConfigCommonFocusStatus,
                               eFocusStatus);
        if ( OMX_ErrorNone != eError )
            {
            CAMHAL_LOGEB("Error while retrieving focus status: 0x%x", eError);
            ret = -1;
            }
        }

    if ( NO_ERROR == ret )
        {
        CAMHAL_LOGDB("Focus Status: %d", eFocusStatus->eFocusStatus);
        }

    LOG_FUNCTION_NAME_EXIT;

    return ret;
}
Esempio n. 21
0
OMX_ERRORTYPE COMXCoreComponent::GetConfig(OMX_INDEXTYPE configIndex, OMX_PTR configStruct)
{
  Lock();

  OMX_ERRORTYPE omx_err;

  omx_err = OMX_GetConfig(m_handle, configIndex, configStruct);
  if(omx_err != OMX_ErrorNone) 
  {
    CLog::Log(LOGERROR, "COMXCoreComponent::GetConfig - %s failed with omx_err(0x%x)\n", 
              m_componentName.c_str(), omx_err);
  }

  UnLock();

  return omx_err;
}
Esempio n. 22
0
//sets the capture resolution of the camera (any camera)
void setCaptureRes2(COMPONENT_T *camera, int width, int height)
{
  //needs to check width and height to see if compatible with rpi
  printf("in setCapture\n");

  OMX_PARAM_PORTDEFINITIONTYPE port_params;
  OMX_ERRORTYPE OMXstatus;

  memset(&port_params, 0, sizeof(port_params));
  port_params.nVersion.nVersion = OMX_VERSION;
  port_params.nSize = sizeof(port_params);
  port_params.nPortIndex = 341;

  OMXstatus = OMX_GetParameter(ilclient_get_handle(camera), OMX_IndexParamPortDefinition, &port_params);
  if(OMXstatus != OMX_ErrorNone)
    printf("Error Getting Parameter In setCaptureRes. Error = %s\n", err2str(OMXstatus));
  //change needed params
  //port_params.nBufferCountActual = 1;
  //port_params.nBufferCountMin = 1;
  
  port_params.format.image.nFrameWidth = width;
  port_params.format.image.nFrameHeight = height;
  port_params.format.image.nStride = 0; //width + (width % 16); //needed! set to 0 to recalculate
  port_params.format.image.nSliceHeight = 0; // height + (height % 16);  //notneeded?

  port_params.format.image.eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar;
  
  //set changes
  OMXstatus = OMX_SetParameter(ilclient_get_handle(camera), OMX_IndexParamPortDefinition, &port_params);
  if(OMXstatus != OMX_ErrorNone)
    printf("Error Setting Parameter In setCaptureRes. Error = %s\n", err2str(OMXstatus));

  
  //print current config
  memset(&port_params, 0, sizeof(port_params));
  port_params.nVersion.nVersion = OMX_VERSION;
  port_params.nSize = sizeof(port_params);
  port_params.nPortIndex = 341;

  OMXstatus = OMX_GetConfig(ilclient_get_handle(camera), OMX_IndexParamPortDefinition, &port_params);
  if (OMXstatus != OMX_ErrorNone)
    printf("Error Getting Parameter (2) In setCaptureRes. Error = %s\n", err2str(OMXstatus));

  print_OMX_PARAM_PORTDEFINITIONTYPE(port_params);
  
}
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 ofxRPiCameraVideoGrabber::setSoftwareSharpening(bool state)
{
    OMX_ERRORTYPE error = OMX_GetConfig(camera, OMX_IndexParamSWSharpenDisable, &disableSoftwareSharpenConfig);
    OMX_TRACE(error);
    if(error == OMX_ErrorNone) 
    {
        disableSoftwareSharpenConfig.bEnabled = toOMXBool(state);
        
        error = OMX_SetConfig(camera, OMX_IndexParamSWSharpenDisable, &disableSoftwareSharpenConfig);
        OMX_TRACE(error);   
        if(error == OMX_ErrorNone)
        {
            doDisableSoftwareSharpen = state;
            ofLogVerbose() << "doDisableSoftwareSharpen: " << doDisableSoftwareSharpen;
        }
    }
    return error;
}
OMX_ERRORTYPE ofxRPiCameraVideoGrabber::setAutoISO(bool doAutoISO)
{
    OMX_ERRORTYPE error = OMX_GetConfig(camera, OMX_IndexConfigCommonExposureValue, &exposureConfig);
    OMX_TRACE(error);
    if(error == OMX_ErrorNone) 
    {
        if(doAutoISO)
        {
            exposureConfig.bAutoSensitivity = OMX_TRUE; 
        }else
        {
            exposureConfig.bAutoSensitivity = OMX_FALSE; 
        }
        error = applyExposure(__func__);
        OMX_TRACE(error);
      
    }
    return error;
}
OMX_ERRORTYPE graph::gmusicops::dump_metadata_item (const OMX_U32 index)
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  OMX_CONFIG_METADATAITEMTYPE *p_meta = NULL;
  size_t metadata_len = 0;
  size_t value_len = 0;

  value_len = OMX_MAX_STRINGNAME_SIZE;
  metadata_len = sizeof(OMX_CONFIG_METADATAITEMTYPE) + value_len;

  if (NULL == (p_meta = (OMX_CONFIG_METADATAITEMTYPE *)tiz_mem_calloc (
                   1, metadata_len)))
  {
    rc = OMX_ErrorInsufficientResources;
  }
  else
  {
    p_meta->nSize = metadata_len;
    p_meta->nVersion.nVersion = OMX_VERSION;
    p_meta->eScopeMode = OMX_MetadataScopeAllLevels;
    p_meta->nScopeSpecifier = 0;
    p_meta->nMetadataItemIndex = index;
    p_meta->eSearchMode = OMX_MetadataSearchValueSizeByIndex;
    p_meta->eKeyCharset = OMX_MetadataCharsetASCII;
    p_meta->eValueCharset = OMX_MetadataCharsetASCII;
    p_meta->nKeySizeUsed = 0;
    p_meta->nValue[0] = '\0';
    p_meta->nValueMaxSize = OMX_MAX_STRINGNAME_SIZE;
    p_meta->nValueSizeUsed = 0;

    rc = OMX_GetConfig (handles_[0], OMX_IndexConfigMetadataItem, p_meta);
    if (OMX_ErrorNone == rc)
    {
      TIZ_PRINTF_CYN ("   %s%s : %s\n", index ? "  " : "", p_meta->nKey,
                      p_meta->nValue);
    }

    tiz_mem_free (p_meta);
    p_meta = NULL;
  }
  return rc;
}
Esempio n. 27
0
/**
 * @name domxtmgr_get_component_connection_info
 * @brief Get connection info for a component handle
 * @param  hComponentHandle      : Component Handle
 * @param  pDomxProxyInfo        : Pointer to ProxyInfo structure
 * @param  pCompIdx              : Pointer to connection table component entry index
 * @param  pCompCoreId           : Pointer to component coreID
 * @param  eb                    : Error Block to be used for Error raise
 * @return none
 */
static Void domxtmgr_get_component_connection_info (OmxTypes_OMX_HANDLETYPE
                                                      hComponentHandle,
                                                    OMX_CONFIG_DOMXPROXYCOMPINFO
                                                      *pDomxProxyInfo,
                                                    Int32 *pCompIdx,
                                                    DomxTypes_coreType
                                                      *pCompCoreId,
                                                    Error_Block * eb)
{
  Int32 nCompIdx;
  OMX_ERRORTYPE eError;

  DOMX_UTL_TRACE_FUNCTION_ENTRY_LEVEL1 ();

  nCompIdx = domxtmgr_get_component_registry_index (hComponentHandle);
  if (-1 == nCompIdx)
  {
    eError = OMX_GetConfig (hComponentHandle, (OMX_INDEXTYPE)
                            OMX_TI_IndexConfigGetDomxCompInfo, pDomxProxyInfo);
    DOMX_UTL_TRACE_FUNCTION_ERROR ((eError == OMX_ErrorNone),
                                   "OMX_GetConfig returned error");
    if (OMX_ErrorNone == eError)
    {
      nCompIdx =
        domxtmgr_get_component_registry_index (pDomxProxyInfo->hCompRealHandle);
      DOMX_UTL_TRACE_FUNCTION_ASSERT ((-1 != nCompIdx),
                                      "Invalid compIndex");
    }
    else
    {
      DOMX_UTL_TRACE_FUNCTION_ASSERT ((OMX_ErrorNone == eError),
                                      "OMX_GetConfig returned error");
    }
  }
  *pCompIdx = nCompIdx;
  if (FALSE == Error_check (eb))
  {
    *pCompCoreId =
      DomxTunnelMgr_module->connectionInfoTbl.elem[nCompIdx][0].eCompCoreId;
  }
  DOMX_UTL_TRACE_FUNCTION_EXIT_LEVEL1 (OMX_ErrorNone);
}
status_t OMXCameraAdapter::getFocusDistances(OMX_U32 &near,OMX_U32 &optimal, OMX_U32 &far)
{
    status_t ret = NO_ERROR;
    OMX_ERRORTYPE eError;

    OMX_TI_CONFIG_FOCUSDISTANCETYPE focusDist;

    LOG_FUNCTION_NAME;

    if ( OMX_StateInvalid == mComponentState )
        {
        CAMHAL_LOGEA("OMX component is in invalid state");
        ret = UNKNOWN_ERROR;
        }

    if ( NO_ERROR == ret )
        {
        OMX_INIT_STRUCT_PTR(&focusDist, OMX_TI_CONFIG_FOCUSDISTANCETYPE);
        focusDist.nPortIndex = mCameraAdapterParameters.mPrevPortIndex;

        eError = OMX_GetConfig(mCameraAdapterParameters.mHandleComp,
                               ( OMX_INDEXTYPE ) OMX_TI_IndexConfigFocusDistance,
                               &focusDist);
        if ( OMX_ErrorNone != eError )
            {
            CAMHAL_LOGEB("Error while querying focus distances 0x%x", eError);
            ret = UNKNOWN_ERROR;
            }

        }

    if ( NO_ERROR == ret )
        {
        near = focusDist.nFocusDistanceNear;
        optimal = focusDist.nFocusDistanceOptimal;
        far = focusDist.nFocusDistanceFar;
        }

    LOG_FUNCTION_NAME_EXIT;

    return ret;
}
OMX_ERRORTYPE FocusHandler::getFocusStatus()
{
    DBGT_PROLOG("");

    OMX_ERRORTYPE err = OMX_ErrorNone;

    if(OMX_IMAGE_FocusControlOff != g_STECamFocusProp[mFocusModeIndex].eFocusType)
        err = OMX_GetConfig(mSTECamera->mCam, mSTECamera->mOmxILExtIndex->getIndex(OmxILExtIndex::EFocusStatus), &mExtFocusStatus.mFocusStatus);
    else
        DBGT_PINFO("Autofocus not done in this mode: OMX_IMAGE_FocusControlOff");

    if(OMX_ErrorNone != err) {
        DBGT_CRITICAL("OMX_GetConfig failed err = %d", err);
        DBGT_EPILOG("");
        return err;
    }

    DBGT_EPILOG("");
    return err;
}
void ofxRPiCameraVideoGrabber::setBurstMode(bool doBurstMode)
{
    OMX_ERRORTYPE error = OMX_GetConfig(camera, OMX_IndexConfigBurstCapture, &burstModeConfig);
    OMX_TRACE(error);
    if(doBurstMode)
    {
        burstModeConfig.bEnabled = OMX_TRUE;  
    }else
    {
        burstModeConfig.bEnabled = OMX_FALSE;  

    }
    error = OMX_SetConfig(camera, OMX_IndexConfigBurstCapture, &burstModeConfig);
    OMX_TRACE(error);
    if(error == OMX_ErrorNone)
    {
        burstModeEnabled = doBurstMode;
    }
    ofLogVerbose() << "burstModeEnabled: " << burstModeEnabled;
}