Exemplo n.º 1
0
/******************************Public*Routine******************************\
* OMX_Init()
*
* Description:This method will initialize the OMX Core.  It is the
* responsibility of the application to call OMX_Init to ensure the proper
* set up of core resources.
*
* Returns:    OMX_NOERROR          Successful
*
* Note
*
\************************************************************************/
OMX_ERRORTYPE OMX_Init()
{
	OMX_ERRORTYPE eError = OMX_ErrorNone;

	DEBUG_PRINT("%s :: enter!\n", __func__);

	if(pthread_mutex_lock(&g_Mutex) != 0)
	{
		DEBUG_PRINT_ERROR("%s :: Core: Error in Mutex lock\n",__func__);
		return OMX_ErrorUndefined;
	}

	g_InitCount++;

	if (g_InitCount == 1)
	{
		eError = OMX_BuildComponentTable();
	}

	if(pthread_mutex_unlock(&g_Mutex) != 0)
	{
		DEBUG_PRINT_ERROR("%s :: Core: Error in Mutex unlock\n",__func__);
		return OMX_ErrorUndefined;
	}

	DEBUG_PRINT("%s :: exit!\n", __func__);
	return eError;
}
/*
* OMX_Init()
*
* Description:This method will initialize the OMX Core.  It is the
* responsibility of the application to call OMX_Init to ensure the proper
* set up of core resources.
*
* Returns:    OMX_NOERROR          Successful
*
* Note
*/
OMX_ERRORTYPE OMX_Init()
{
    OMX_ERRORTYPE eError = OMX_ErrorNone;
    OSAL_ERROR  eOsalError = OSAL_ErrNone;

    eOsalError = OSAL_ObtainMutex(pCoreInitMutex, OSAL_SUSPEND);
    CORE_assert(eOsalError == OSAL_ErrNone, OMX_ErrorInsufficientResources, "Mutex lock failed");
    count++;
    if( count == 1 ) {
        pthread_mutex_init(&mutex, NULL);
        eError = OMX_BuildComponentTable();
    }

    eOsalError = OSAL_ReleaseMutex(pCoreInitMutex);
    CORE_assert(eOsalError == OSAL_ErrNone, OMX_ErrorInsufficientResources, "Mutex release failed");
EXIT:
    return (eError);
}
Exemplo n.º 3
0
/******************************Public*Routine******************************\
* OMX_Init()
*
* Description:This method will initialize the OMX Core.  It is the
* responsibility of the application to call OMX_Init to ensure the proper
* set up of core resources.
*
* Returns:    OMX_NOERROR          Successful
*
* Note
*
\**************************************************************************/
OMX_ERRORTYPE OMX_Init()
{
	OMX_ERRORTYPE eError = OMX_ErrorNone;
	TIMM_OSAL_ERRORTYPE eOsalError = TIMM_OSAL_ERR_NONE;

	eOsalError = TIMM_OSAL_MutexObtain(pCoreInitMutex, TIMM_OSAL_SUSPEND);
	CORE_assert(eOsalError == TIMM_OSAL_ERR_NONE,
	    OMX_ErrorInsufficientResources, "Mutex lock failed");

	count++;

	if (count == 1)
	{
		pthread_mutex_init(&mutex, NULL);
		eError = OMX_BuildComponentTable();
	}

	eOsalError = TIMM_OSAL_MutexRelease(pCoreInitMutex);
	CORE_assert(eOsalError == TIMM_OSAL_ERR_NONE,
	    OMX_ErrorInsufficientResources, "Mutex release failed");
      EXIT:
	return eError;
}