コード例 #1
0
/**
@brief Called when the processing is ready to be stopped
*/
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::stop()
//*************************************************************************************************************
{// Call Deinstantiation of component
	IN0("\n");
	m_pNmfProcWrp->stop();
#if 0
	//ER355733 Try to fix ens bug that doesn't reset bufferSupplier type 
	PortVideo* pPort;
	for (unsigned int Index=0; Index< mENSComponent.getPortCount(); ++Index)
	{
		pPort = (PortVideo*)mENSComponent.getPort(Index);
		if (pPort->getBufferSupplier() !=OMX_BufferSupplyUnspecified)
		{
			MSG3("wwwwwwwwwwwwwwwwwwwwwwwwwwww    %s.port[%d] reset state(%d) to OMX_BufferSupplyUnspecified\n", GetComponentName(), Index, pPort->getBufferSupplier());
			pPort->setBufferSupplier(OMX_BufferSupplyUnspecified);
		}
	}
#endif
	OUT0("\n");
	return OMX_ErrorNone;
}
コード例 #2
0
/** 
brief Instantiate the nmf component and bind interfaces
Called during Loaded to Idle transition
*/
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::instantiate()
//*************************************************************************************************************
{ //binding all interfaces
	OMX_ERRORTYPE omx_error=OMX_ErrorNone;
	IN0("\n");
	// Init Components
	// Bind of arm nmf components
	MSG1("OpenMax_Proxy(%s) Instantiating arm nmf component\n", GetComponentName());
	openmax_processor *pProcessor=NULL;
	if (m_pProcessor != NULL)
		pProcessor = m_pProcessor;
	else if (m_fnCreateNmfComponent !=NULL)
	{ 
		m_pProcessor= m_fnCreateNmfComponent();
		pProcessor  = m_pProcessor;
	}

	m_pNmfProcWrp = openmax_processor_wrpCreate(pProcessor);

	m_pNmfProcWrp->priority = m_nmfPriority;

	if (m_pNmfProcWrp->construct() != NMF_OK)
		NMF_PANIC("PANIC - Construct Error\n") ;

	t_nmf_error error ;
	// bindFromUser --> Asynchronous
	// getInterface --> Synchronous

	error = m_pNmfProcWrp->bindFromUser("sendcommand", 2, &mIsendCommand) ;
	if (error != NMF_OK)
		NMF_PANIC("PANIC - bindFromUser sendCommand\n") ;
#if (SYNCHRONOUS ==0)
	error = m_pNmfProcWrp->bindFromUser("Param", 2*mENSComponent.getPortCount()+1, &m_IParam) ; // One setparam per port + 1
	if (error != NMF_OK)
		NMF_PANIC("PANIC - bindFromUser Param\n") ;

	error = m_pNmfProcWrp->bindFromUser("Config", 2*mENSComponent.getPortCount()+1, &m_IConfig) ; // One setparam per port + 1
	if (error != NMF_OK)
		NMF_PANIC("PANIC - bindFromUser Config\n") ;
#else //Bind synchronous interfaces
	//interfaces are binded in a synchronous way
	error = m_pNmfProcWrp->getInterface("Param", &m_IParam);
	if (error != NMF_OK)
		NMF_PANIC("PANIC - getInterface Param\n") ;

	error = m_pNmfProcWrp->getInterface("Config", &m_IConfig);
	if (error != NMF_OK)
		NMF_PANIC("PANIC - getInterface Config\n") ;
#endif
	error = m_pNmfProcWrp->bindFromUser("fsminit", 1 , &mIfsmInit);
	if (error != NMF_OK)
		NMF_PANIC("Error: unable to bind fsminit!...\n");

	error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(), m_pNmfProcWrp, "proxy", getEventHandlerCB(), 8);
	if (error != NMF_OK)
		NMF_PANIC("Error: unable to bind proxy!...\n");

	error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(), m_pNmfProcWrp, "ToOMXComponent", mConfigCB, 1);
	if (error != NMF_OK)
		NMF_PANIC("Error: unable to bind ToOMXComponent!...\n");

	char name[20]; //reserve some char for formatting callback name
	size_t iNbInput =0;
	size_t iNbOutput=0;
	PortVideo* pPort;
	for (unsigned int Index=0; Index< mENSComponent.getPortCount(); ++Index)
	{
		pPort = (PortVideo*)mENSComponent.getPort(Index);
		MSG3("\n %s Port %d : direction =%d\n", GetComponentName(), Index, pPort->getDirection());
		//reset port info at this point 
		//NO it's too late!
#if 0
		if (pPort->getBufferSupplier() !=OMX_BufferSupplyUnspecified)
		{
			printf("wwwwwwwwwwwwwwwwwwwwwwwwwwww    %s.port[%d] reset state(%d) to OMX_BufferSupplyUnspecified\n", GetComponentName(), Index, pPort->getBufferSupplier());
			pPort->setBufferSupplier(OMX_BufferSupplyUnspecified);
		}
#endif
		switch(pPort->getDirection())
		{
		case OMX_DirInput: //bind emptythisbuffer, emptybufferdone for each input port
			if (iNbInput < MAX_PORTS_COUNT)
			{
				sprintf(name, "emptythisbuffer[%d]", Index);
				error = m_pNmfProcWrp->bindFromUser(name, pPort->getBufferCountActual(), &mIemptyThisBuffer[Index]);
				if (error != NMF_OK)
					NMF_PANIC("PANIC %s->bindFromUser %s\n", GetComponentName(), name) ;

				sprintf(name, "emptybufferdone[%d]", Index);
				error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(),
					m_pNmfProcWrp,
					name ,
					this->getEmptyBufferDoneCB(),
					pPort->getBufferCountActual());

				if (error != NMF_OK)
					NMF_PANIC("PANIC %s->bindToUser %s\n", GetComponentName(), name) ;

				++iNbInput;
			}
			else
			{
				// ReportError(
			}
			break;
		case OMX_DirOutput://bind fillthisbuffer, fillbufferdone for each output port
			if (iNbOutput < MAX_PORTS_COUNT)
			{
				sprintf(name, "fillthisbuffer[%d]", Index);
				error = m_pNmfProcWrp->bindFromUser(name, pPort->getBufferCountActual(), &mIfillThisBuffer[Index]);
				if (error != NMF_OK)
					NMF_PANIC("PANIC %s->bindFromUser %s\n", GetComponentName(), name) ;

				sprintf(name, "fillbufferdone[%d]", Index);
				error = EnsWrapper_bindToUser(mENSComponent.getOMXHandle(),
					m_pNmfProcWrp,
					name,
					this->getFillBufferDoneCB(),
					pPort->getBufferCountActual());
				if (error != NMF_OK)
					NMF_PANIC("PANIC %s->bindToUser %s\n", GetComponentName(), name) ;
				++iNbOutput;
			}
			else
			{
				// ReportError(
			}

			break;
		default:
			break;
		}
	}
	// Configure the number of ports
	m_IConfig.setTargetComponent(mENSComponent.getPortCount() , &mENSComponent);
	OUTR(" ", (omx_error));
	return omx_error;
}