omxil/omxilcomponentcommon/src/common/omxilport.cpp
branchOpenMAX-IL_SHAI
changeset 16 eedf2dcd43c6
parent 0 40261b775718
equal deleted inserted replaced
15:c1e808730d6c 16:eedf2dcd43c6
    65 	iTunnelledPort(0),
    65 	iTunnelledPort(0),
    66 	iBufferHeaders(),
    66 	iBufferHeaders(),
    67 	iBufferMarks(_FOFF(TBufferMarkInfo, iLink)),
    67 	iBufferMarks(_FOFF(TBufferMarkInfo, iLink)),
    68 	iTransitionState(EPortNotTransitioning),
    68 	iTransitionState(EPortNotTransitioning),
    69 	iBufferMarkPropagationPortIndex(
    69 	iBufferMarkPropagationPortIndex(
    70 		aCommonPortData.iBufferMarkPropagationPortIndex)
    70 		aCommonPortData.iBufferMarkPropagationPortIndex),
       
    71 	aFirstUseBufferHasBeenReceived(OMX_FALSE)
    71 	{
    72 	{
    72     DEBUG_PRINTF(_L8("COmxILPort::COmxILPort"));
    73     DEBUG_PRINTF(_L8("COmxILPort::COmxILPort"));
    73 
    74 
    74 	__ASSERT_DEBUG(aCommonPortData.iDirection == OMX_DirInput ||
    75 	__ASSERT_DEBUG(aCommonPortData.iDirection == OMX_DirInput ||
    75 				   aCommonPortData.iDirection == OMX_DirOutput,
    76 				   aCommonPortData.iDirection == OMX_DirOutput,
   224 	{
   225 	{
   225     DEBUG_PRINTF(_L8("COmxILPort::SetParameter"));
   226     DEBUG_PRINTF(_L8("COmxILPort::SetParameter"));
   226 
   227 
   227 	aUpdateProcessingFunction = EFalse;
   228 	aUpdateProcessingFunction = EFalse;
   228 
   229 
       
   230 
       
   231 	if (OMX_TRUE == aFirstUseBufferHasBeenReceived)
       
   232 		{
       
   233 		DEBUG_PRINTF2(_L8("COmxILPort::SetParameter : PORT [%u] WARNING : port population already initiated, returning OMX_ErrorIncorrectStateOperation"), Index());
       
   234 		// SetParameter is not allowed after the first OMX_UseBuffer has been
       
   235 		// received in the port, that is, the population of the port has
       
   236 		// already been initiated...
       
   237 		return OMX_ErrorIncorrectStateOperation;
       
   238 		}
       
   239 
   229 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
   240 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
       
   241 
   230 	switch(aParamIndex)
   242 	switch(aParamIndex)
   231 		{
   243 		{
   232 	case OMX_IndexParamPortDefinition:
   244 	case OMX_IndexParamPortDefinition:
   233 		{
   245 		{
   234 		if (OMX_ErrorNone != (omxRetValue =
   246 		if (OMX_ErrorNone != (omxRetValue =
   260 			if (pPortDefinition->nBufferCountActual <
   272 			if (pPortDefinition->nBufferCountActual <
   261 				iParamPortDefinition.nBufferCountMin)
   273 				iParamPortDefinition.nBufferCountMin)
   262 				{
   274 				{
   263 				return OMX_ErrorBadParameter;
   275 				return OMX_ErrorBadParameter;
   264 				}
   276 				}
       
   277 			DEBUG_PRINTF3(_L8("COmxILPort::SetParameter : old.nBufferCountActual [%u] new.nBufferCountActual [%u]"),
       
   278 						  iParamPortDefinition.nBufferCountActual, pPortDefinition->nBufferCountActual);
   265 			iParamPortDefinition.nBufferCountActual =
   279 			iParamPortDefinition.nBufferCountActual =
   266 				pPortDefinition->nBufferCountActual;
   280 				pPortDefinition->nBufferCountActual;
   267 			aUpdateProcessingFunction = ETrue;
   281 			aUpdateProcessingFunction = ETrue;
   268 			}
   282 			}
   269 
   283 
   313 									  &bufferSupplierType)) )
   327 									  &bufferSupplierType)) )
   314 					{
   328 					{
   315 					return retValue;
   329 					return retValue;
   316 					}
   330 					}
   317 				}
   331 				}
       
   332 			DEBUG_PRINTF3(_L8("COmxILPort::SetParameter : old.eBufferSupplier [%u] new.eBufferSupplier [%u]"),
       
   333 						  iParamCompBufferSupplier.eBufferSupplier, pBufferSupplier->eBufferSupplier);
   318 			iParamCompBufferSupplier.eBufferSupplier =
   334 			iParamCompBufferSupplier.eBufferSupplier =
   319 				pBufferSupplier->eBufferSupplier;
   335 				pBufferSupplier->eBufferSupplier;
   320 			}
   336 			}
   321 
   337 
   322 		}
   338 		}
   363 						   const OMX_PTR apAppPrivate,
   379 						   const OMX_PTR apAppPrivate,
   364 						   OMX_U32 aSizeBytes,
   380 						   OMX_U32 aSizeBytes,
   365 						   OMX_U8* apBuffer,
   381 						   OMX_U8* apBuffer,
   366 						   TBool& portPopulationCompleted)
   382 						   TBool& portPopulationCompleted)
   367 	{
   383 	{
   368     DEBUG_PRINTF(_L8("COmxILPort::PopulateBuffer"));
   384     DEBUG_PRINTF3(_L8("COmxILPort::PopulateBuffer : pBuffer[%X] PORT[%u]"), apBuffer, iParamPortDefinition.nPortIndex);
   369 
   385 
   370 	portPopulationCompleted = EFalse;
   386 	portPopulationCompleted = EFalse;
   371 
   387 
   372 	if(aSizeBytes < iParamPortDefinition.nBufferSize)
   388 	if(aSizeBytes < iParamPortDefinition.nBufferSize)
   373 		{
   389 		{
   379 	*appBufferHdr = pHeader;
   395 	*appBufferHdr = pHeader;
   380 	if (!pHeader)
   396 	if (!pHeader)
   381 		{
   397 		{
   382 		return OMX_ErrorInsufficientResources;
   398 		return OMX_ErrorInsufficientResources;
   383 		}
   399 		}
       
   400 
       
   401     DEBUG_PRINTF3(_L8("COmxILPort::PopulateBuffer : BUFFER[%X] PORT[%u]"), pHeader, iParamPortDefinition.nPortIndex);
   384 
   402 
   385 	// Here, lets discriminate between apBuffer == 0 (AllocateBuffer) and
   403 	// Here, lets discriminate between apBuffer == 0 (AllocateBuffer) and
   386 	// apBuffer != 0 (UseBuffer)
   404 	// apBuffer != 0 (UseBuffer)
   387 	TUint8* pPortSpecificBuffer = 0;
   405 	TUint8* pPortSpecificBuffer = 0;
   388 	OMX_PTR pPortPrivate = 0;
   406 	OMX_PTR pPortPrivate = 0;
   395 		portSpecificErr = DoBufferWrapping(aSizeBytes,
   413 		portSpecificErr = DoBufferWrapping(aSizeBytes,
   396 										   apBuffer,
   414 										   apBuffer,
   397 										   pPortPrivate,
   415 										   pPortPrivate,
   398 										   pPlatformPrivate,
   416 										   pPlatformPrivate,
   399 										   apAppPrivate);
   417 										   apAppPrivate);
       
   418 
       
   419 		aFirstUseBufferHasBeenReceived = OMX_TRUE;
   400 		}
   420 		}
   401 	else
   421 	else
   402 		{
   422 		{
   403 		// ... (AllocateBuffer) Do the port-specific buffer allocation ...
   423 		// ... (AllocateBuffer) Do the port-specific buffer allocation ...
   404 		portSpecificErr = DoBufferAllocation(aSizeBytes,
   424 		portSpecificErr = DoBufferAllocation(aSizeBytes,
   545 		}
   565 		}
   546 
   566 
   547 	if (0 == iBufferHeaders.Count())
   567 	if (0 == iBufferHeaders.Count())
   548 		{
   568 		{
   549 		portDepopulationCompleted = ETrue;
   569 		portDepopulationCompleted = ETrue;
       
   570 		aFirstUseBufferHasBeenReceived = OMX_FALSE;
   550 		}
   571 		}
   551 
   572 
   552 	return OMX_ErrorNone;
   573 	return OMX_ErrorNone;
   553 
   574 
   554 	}
   575 	}
  1273    the port.
  1294    the port.
  1274 
  1295 
  1275    @param [OUT] apPortPrivate A pointer that refers to an optional
  1296    @param [OUT] apPortPrivate A pointer that refers to an optional
  1276    port-specific structure.
  1297    port-specific structure.
  1277 
  1298 
  1278    @param apPlatformPrivate[OUT] A pointer to an optional platform-specific
  1299    @apPlatformPrivate[OUT] A pointer to an optional platform-specific
  1279    structure.
  1300    structure.
  1280 
  1301 
  1281    @param apAppPrivate A pointer that refers to a buffer supplier-specific
  1302    @param apAppPrivate A pointer that refers to a buffer supplier-specific
  1282    structure.
  1303    structure.
  1283 
  1304 
  1432    @param apPortPrivate pPortPrivate pointer as returned by DoBufferAllocation
  1453    @param apPortPrivate pPortPrivate pointer as returned by DoBufferAllocation
  1433 
  1454 
  1434    @param apPlatformPrivate pPlatformPrivate pointer as returned by
  1455    @param apPlatformPrivate pPlatformPrivate pointer as returned by
  1435    DoBufferAllocation
  1456    DoBufferAllocation
  1436 
  1457 
  1437    @param aSizeBytes The size in bytes of the to be allocated buffer
  1458    @aSizeBytes The size in bytes of the to be allocated buffer
  1438 
  1459 
  1439    @param apBuffer A pointer to the allocated buffer
  1460    @apBuffer A pointer to the allocated buffer
  1440 
  1461 
  1441    @return OMX_ERRORTYPE
  1462    @return OMX_ERRORTYPE
  1442 
  1463 
  1443 */
  1464 */
  1444 EXPORT_C OMX_ERRORTYPE
  1465 EXPORT_C OMX_ERRORTYPE