OMX_ERRORTYPE IpulibRender::InitRenderComponent()
{
	if(E_FSL_OSAL_SUCCESS != fsl_osal_mutex_init(&lock, fsl_osal_mutex_normal))
	{
		LOG_ERROR("Create mutex for v4l device failed.\n");
		return OMX_ErrorInsufficientResources;
	}

	return OMX_ErrorNone;
}
Exemplo n.º 2
0
OMX_ERRORTYPE PlatformResourceMgr::Init()
{
    PlatformDataList = NULL;
    PlatformDataList = FSL_NEW(List<PLATFORM_DATA>, ());
    if(PlatformDataList == NULL)
        return OMX_ErrorInsufficientResources;

    lock = NULL;
    if(E_FSL_OSAL_SUCCESS != fsl_osal_mutex_init(&lock, fsl_osal_mutex_normal)) {
        DeInit();
        return OMX_ErrorInsufficientResources;
    }

    return OMX_ErrorNone;
}
Exemplo n.º 3
0
OMX_ERRORTYPE Clock::InitComponent()
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;
    OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
    OMX_BUFFERSUPPLIERTYPE SupplierType;
    OMX_U32 i;

    OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
    sPortDef.eDir = OMX_DirOutput;
    sPortDef.eDomain = OMX_PortDomainOther;
    sPortDef.format.other.eFormat = OMX_OTHER_FormatTime;
    sPortDef.bPopulated = OMX_FALSE;
    sPortDef.bEnabled = OMX_FALSE;
    sPortDef.nBufferCountMin = 1;
    sPortDef.nBufferCountActual = 5;
    sPortDef.nBufferSize = sizeof(OMX_TIME_MEDIATIMETYPE);

    SupplierType = OMX_BufferSupplyOutput;

    for(i=0; i<PORT_NUM; i++) {
        sPortDef.nPortIndex = i;
        ports[i]->SetPortDefinition(&sPortDef);
        ports[i]->SetSupplierType(SupplierType);
    }

    if(E_FSL_OSAL_SUCCESS != fsl_osal_mutex_init(&lock, fsl_osal_mutex_normal)) {
        LOG_ERROR("Create mutext for clock failed.\n");
        return OMX_ErrorInsufficientResources;
    }

    if(E_FSL_OSAL_SUCCESS != fsl_osal_cond_create(&Cond)) {
        LOG_ERROR("Create condition variable for clock failed.\n");
        return OMX_ErrorInsufficientResources;
    }

    OMX_INIT_STRUCT(&sState, OMX_TIME_CONFIG_CLOCKSTATETYPE);
    sState.eState = CurState = OMX_TIME_ClockStateStopped;
    RefClock = OMX_TIME_RefClockNone;
    SegmentStartTime = -1L;
    bPaused = OMX_FALSE;

    return ret;
}
Exemplo n.º 4
0
QUEUE_ERRORTYPE Queue::Create(
        fsl_osal_u32 maxQSize,
        fsl_osal_u32 msgSize,
        efsl_osal_bool block)
{
    QUEUE_ERRORTYPE ret = QUEUE_SUCCESS;
    fsl_osal_u32 i, aligned_msg_size;
    fsl_osal_ptr ptr = NULL;
    QNODE *pQNode = NULL;
    fsl_osal_u8 *pMsg = NULL;

    pQNodeMem = pQMsgMem = NULL;
    pFreeNodes = pHead = pTail = NULL;
    nQSize = 0;
    lock = usedNodesSem = freeNodesSem = NULL;

    nMaxQSize = maxQSize;
    nMsgSize = msgSize;
    bBlocking = block;

    /* allocate for queue nodes */
    ptr = FSL_MALLOC(sizeof(QNODE) * nMaxQSize);
    if(ptr == NULL) {
        LOG_ERROR("Failed to allocate memory for queue node.\n");
        ret = QUEUE_INSUFFICIENT_RESOURCES;
        goto err;
    }
    pQNodeMem = ptr;
    pQNode = (QNODE*)ptr;

    /* alloate for node messages */
    aligned_msg_size = (nMsgSize + 3)/4*4;
    ptr = FSL_MALLOC(nMaxQSize * aligned_msg_size);
    if(ptr == NULL) {
        LOG_ERROR("Failed to allocate memory for queue node message.\n");
        ret = QUEUE_INSUFFICIENT_RESOURCES;
        goto err;
    }
    pQMsgMem = ptr;
    pMsg = (fsl_osal_u8*)ptr;

    for(i=0; i<nMaxQSize-1; i++) {
        pQNode[i].NextNode = &(pQNode[i+1]);
        pQNode[i].pMsg = pMsg;
        pMsg += aligned_msg_size;
    }
    pQNode[nMaxQSize-1].NextNode = NULL;
    pQNode[nMaxQSize-1].pMsg = pMsg;
    pFreeNodes = pQNode;

    if(fsl_osal_mutex_init(&lock, fsl_osal_mutex_normal) != E_FSL_OSAL_SUCCESS) {
        LOG_ERROR("Failed to create mutex for queue.\n");
        ret = QUEUE_INSUFFICIENT_RESOURCES;
        goto err;
    }

    if(fsl_osal_sem_init(&usedNodesSem, 0, 0) != E_FSL_OSAL_SUCCESS) {
        LOG_ERROR("Failed to create mutex for used nodes.\n");
        ret = QUEUE_INSUFFICIENT_RESOURCES;
        goto err;
    }

    if(fsl_osal_sem_init(&freeNodesSem, 0, nMaxQSize) != E_FSL_OSAL_SUCCESS) {
        LOG_ERROR("Failed to create mutex for free nodes.\n");
        ret = QUEUE_INSUFFICIENT_RESOURCES;
        goto err;
    }

    return ret;

err:
    Free();
    return ret;
}