omxil/omxilcomponentcommon/src/common/omxilportmanager.cpp
branchOpenMAX-IL_SHAI
changeset 16 eedf2dcd43c6
parent 0 40261b775718
equal deleted inserted replaced
15:c1e808730d6c 16:eedf2dcd43c6
    23 #include "omxilportmanager.h"
    23 #include "omxilportmanager.h"
    24 #include "omxilprocessingfunction.h"
    24 #include "omxilprocessingfunction.h"
    25 #include "omxilcallbackmanager.h"
    25 #include "omxilcallbackmanager.h"
    26 #include "omxilutil.h"
    26 #include "omxilutil.h"
    27 
    27 
       
    28 	/**
       
    29 	   Static NewL for two-phase construction
       
    30 
       
    31 	   @param   aProcessingFunction The component's processing function
       
    32 
       
    33 	   @param   aCallbacks The component's callback manager
       
    34 
       
    35 	   @param   aOmxVersion The IL Spec version in use
       
    36 
       
    37 	   @param   aNumberOfAudioPorts Number of audio ports in the component
       
    38 
       
    39 	   @param   aStartAudioPortNumber The start index for audio ports
       
    40 
       
    41 	   @param   aNumberOfImagePorts Number of image ports in the component
       
    42 
       
    43 	   @param   aStartImagePortNumber The start index for image ports
       
    44 
       
    45 	   @param   aNumberOfVideoPorts Number of video ports in the component
       
    46 
       
    47 	   @param   aStartVideoPortNumber The start index for video ports
       
    48 
       
    49 	   @param   aNumberOfOtherPorts Number of other ports in the component
       
    50 
       
    51 	   @param   aStartOtherPortNumber The start index for other ports
       
    52 
       
    53 	   @param aImmediateReturnTimeBuffer This only applies to components with a
       
    54 	   clock client port. Indicates whether the Port Manager must forward an
       
    55 	   arriving clock buffer to the Callback Manager (ETrue) or to the
       
    56 	   Processing Function (EFalse) . If the clock buffer is to be forwarded to
       
    57 	   the Processing Function, this will happen using the BufferIndication
       
    58 	   function of the component's PF. Otherwise, PF's MediaTimeIndication is
       
    59 	   used instead.
       
    60 	*/
    28 EXPORT_C COmxILPortManager*
    61 EXPORT_C COmxILPortManager*
    29 COmxILPortManager::NewL(
    62 COmxILPortManager::NewL(
    30 	COmxILProcessingFunction& aProcessingFunction,
    63 	COmxILProcessingFunction& aProcessingFunction,
    31 	MOmxILCallbackManagerIf& aCallbacks,
    64 	MOmxILCallbackManagerIf& aCallbacks,
    32 	const OMX_VERSIONTYPE& aOmxVersion,
    65 	const OMX_VERSIONTYPE& aOmxVersion,
    43     DEBUG_PRINTF(_L8("COmxILPortManager::NewL"));
    76     DEBUG_PRINTF(_L8("COmxILPortManager::NewL"));
    44 
    77 
    45 	COmxILPortManager* self =
    78 	COmxILPortManager* self =
    46 		new (ELeave)COmxILPortManager(
    79 		new (ELeave)COmxILPortManager(
    47 			aProcessingFunction,
    80 			aProcessingFunction,
    48 			aCallbacks,
    81 			aCallbacks);
    49 			aOmxVersion,
       
    50 			aNumberOfAudioPorts,
       
    51 			aStartAudioPortNumber,
       
    52 			aNumberOfImagePorts,
       
    53 			aStartImagePortNumber,
       
    54 			aNumberOfVideoPorts,
       
    55 			aStartVideoPortNumber,
       
    56 			aNumberOfOtherPorts,
       
    57 			aStartOtherPortNumber,
       
    58 			aImmediateReturnTimeBuffer);
       
    59 
    82 
    60 	CleanupStack::PushL(self);
    83 	CleanupStack::PushL(self);
    61 	self->ConstructL();
    84 	self->ConstructL(aProcessingFunction,
       
    85 					 aCallbacks,
       
    86 					 aOmxVersion,
       
    87 					 aNumberOfAudioPorts,
       
    88 					 aStartAudioPortNumber,
       
    89 					 aNumberOfImagePorts,
       
    90 					 aStartImagePortNumber,
       
    91 					 aNumberOfVideoPorts,
       
    92 					 aStartVideoPortNumber,
       
    93 					 aNumberOfOtherPorts,
       
    94 					 aStartOtherPortNumber,
       
    95 					 aImmediateReturnTimeBuffer);
    62 	CleanupStack::Pop(self);
    96 	CleanupStack::Pop(self);
    63 	return self;
    97 	return self;
    64 	}
    98 	}
    65 
    99 
    66 void
   100 void
    67 COmxILPortManager::ConstructL()
   101 COmxILPortManager::ConstructL(
    68 	{
   102 	COmxILProcessingFunction& /* aProcessingFunction */,
    69     DEBUG_PRINTF(_L8("COmxILPortManager::ConstructL"));
   103 	MOmxILCallbackManagerIf& /* aCallbacks */,
    70 
       
    71 	InsertParamIndexL(OMX_IndexParamAudioInit);
       
    72 	InsertParamIndexL(OMX_IndexParamImageInit);
       
    73 	InsertParamIndexL(OMX_IndexParamVideoInit);
       
    74 	InsertParamIndexL(OMX_IndexParamOtherInit);
       
    75 
       
    76 
       
    77 	if(iAudioParamInit.nStartPortNumber != 0)
       
    78 		{
       
    79 		User::Leave(KErrArgument);
       
    80 		}
       
    81 
       
    82 	if (iImageParamInit.nPorts > 0)
       
    83 		{
       
    84 		if (iAudioParamInit.nPorts !=
       
    85 			iImageParamInit.nStartPortNumber)
       
    86 			{
       
    87 			User::Leave(KErrArgument);
       
    88 			}
       
    89 		}
       
    90 
       
    91 	if (iVideoParamInit.nPorts > 0)
       
    92 		{
       
    93 		if ((iAudioParamInit.nPorts +
       
    94 			 iImageParamInit.nPorts)  !=
       
    95 			iVideoParamInit.nStartPortNumber)
       
    96 			{
       
    97 			User::Leave(KErrArgument);
       
    98 			}
       
    99 		}
       
   100 
       
   101 	if (iOtherParamInit.nPorts > 0)
       
   102 		{
       
   103 		if ((iAudioParamInit.nPorts +
       
   104 			 iImageParamInit.nPorts +
       
   105 			 iVideoParamInit.nPorts)  !=
       
   106 			iOtherParamInit.nStartPortNumber)
       
   107 			{
       
   108 			User::Leave(KErrArgument);
       
   109 			}
       
   110 		}
       
   111 
       
   112 	}
       
   113 
       
   114 COmxILPortManager::COmxILPortManager(
       
   115 	COmxILProcessingFunction& aProcessingFunction,
       
   116 	MOmxILCallbackManagerIf& aCallbacks,
       
   117 	const OMX_VERSIONTYPE& aOmxVersion,
   104 	const OMX_VERSIONTYPE& aOmxVersion,
   118 	OMX_U32 aNumberOfAudioPorts,
   105 	OMX_U32 aNumberOfAudioPorts,
   119 	OMX_U32 aStartAudioPortNumber,
   106 	OMX_U32 aStartAudioPortNumber,
   120 	OMX_U32 aNumberOfImagePorts,
   107 	OMX_U32 aNumberOfImagePorts,
   121 	OMX_U32 aStartImagePortNumber,
   108 	OMX_U32 aStartImagePortNumber,
   122 	OMX_U32 aNumberOfVideoPorts,
   109 	OMX_U32 aNumberOfVideoPorts,
   123 	OMX_U32 aStartVideoPortNumber,
   110 	OMX_U32 aStartVideoPortNumber,
   124 	OMX_U32 aNumberOfOtherPorts,
   111 	OMX_U32 aNumberOfOtherPorts,
   125 	OMX_U32 aStartOtherPortNumber,
   112 	OMX_U32 aStartOtherPortNumber,
   126 	OMX_BOOL aImmediateReturnTimeBuffer)
   113 	OMX_BOOL aImmediateReturnTimeBuffer)
   127 	:
   114 	{
   128 	iProcessingFunction(aProcessingFunction),
   115     DEBUG_PRINTF(_L8("COmxILPortManager::ConstructL"));
   129 	iCallbacks(aCallbacks),
   116 
   130 	iAllPorts(),
   117 	iImmediateReturnTimeBuffer = aImmediateReturnTimeBuffer;
   131 	iImmediateReturnTimeBuffer(aImmediateReturnTimeBuffer)
       
   132 	{
       
   133     DEBUG_PRINTF(_L8("COmxILPortManager::COmxILPortManager"));
       
   134 
   118 
   135 	iAudioParamInit.nSize			 = sizeof(OMX_PORT_PARAM_TYPE);
   119 	iAudioParamInit.nSize			 = sizeof(OMX_PORT_PARAM_TYPE);
   136 	iAudioParamInit.nVersion		 = aOmxVersion;
   120 	iAudioParamInit.nVersion		 = aOmxVersion;
   137 	iAudioParamInit.nPorts			 = aNumberOfAudioPorts;
   121 	iAudioParamInit.nPorts			 = aNumberOfAudioPorts;
   138 	iAudioParamInit.nStartPortNumber = aStartAudioPortNumber;
   122 	iAudioParamInit.nStartPortNumber = aStartAudioPortNumber;
   149 
   133 
   150 	iOtherParamInit.nSize			 = sizeof(OMX_PORT_PARAM_TYPE);
   134 	iOtherParamInit.nSize			 = sizeof(OMX_PORT_PARAM_TYPE);
   151 	iOtherParamInit.nVersion		 = aOmxVersion;
   135 	iOtherParamInit.nVersion		 = aOmxVersion;
   152 	iOtherParamInit.nPorts			 = aNumberOfOtherPorts;
   136 	iOtherParamInit.nPorts			 = aNumberOfOtherPorts;
   153 	iOtherParamInit.nStartPortNumber = aStartOtherPortNumber;
   137 	iOtherParamInit.nStartPortNumber = aStartOtherPortNumber;
       
   138 
       
   139 
       
   140 	InsertParamIndexL(OMX_IndexParamAudioInit);
       
   141 	InsertParamIndexL(OMX_IndexParamImageInit);
       
   142 	InsertParamIndexL(OMX_IndexParamVideoInit);
       
   143 	InsertParamIndexL(OMX_IndexParamOtherInit);
       
   144 
       
   145 
       
   146 	if(iAudioParamInit.nStartPortNumber != 0)
       
   147 		{
       
   148 		User::Leave(KErrArgument);
       
   149 		}
       
   150 
       
   151 	if (iImageParamInit.nPorts > 0)
       
   152 		{
       
   153 		if (iAudioParamInit.nPorts !=
       
   154 			iImageParamInit.nStartPortNumber)
       
   155 			{
       
   156 			User::Leave(KErrArgument);
       
   157 			}
       
   158 		}
       
   159 
       
   160 	if (iVideoParamInit.nPorts > 0)
       
   161 		{
       
   162 		if ((iAudioParamInit.nPorts +
       
   163 			 iImageParamInit.nPorts)  !=
       
   164 			iVideoParamInit.nStartPortNumber)
       
   165 			{
       
   166 			User::Leave(KErrArgument);
       
   167 			}
       
   168 		}
       
   169 
       
   170 	if (iOtherParamInit.nPorts > 0)
       
   171 		{
       
   172 		if ((iAudioParamInit.nPorts +
       
   173 			 iImageParamInit.nPorts +
       
   174 			 iVideoParamInit.nPorts)  !=
       
   175 			iOtherParamInit.nStartPortNumber)
       
   176 			{
       
   177 			User::Leave(KErrArgument);
       
   178 			}
       
   179 		}
       
   180 
       
   181 	}
       
   182 
       
   183 COmxILPortManager::COmxILPortManager(
       
   184 	COmxILProcessingFunction& aProcessingFunction,
       
   185 	MOmxILCallbackManagerIf& aCallbacks)
       
   186 	:
       
   187 	iProcessingFunction(aProcessingFunction),
       
   188 	iCallbacks(aCallbacks),
       
   189 	iAllPorts()
       
   190 	{
       
   191     DEBUG_PRINTF(_L8("COmxILPortManager::COmxILPortManager"));
   154 
   192 
   155 	}
   193 	}
   156 
   194 
   157 COmxILPortManager::~COmxILPortManager()
   195 COmxILPortManager::~COmxILPortManager()
   158 	{
   196 	{
   512 			portIndex))
   550 			portIndex))
   513 		{
   551 		{
   514 		return OMX_ErrorBadPortIndex;
   552 		return OMX_ErrorBadPortIndex;
   515 		}
   553 		}
   516 
   554 
       
   555     DEBUG_PRINTF2(_L8("COmxILPortManager::SetParameter : PORT[%u]"), portIndex);
       
   556 
   517 	// Grab the port here...
   557 	// Grab the port here...
   518 	COmxILPort* pPort = iAllPorts[portIndex];
   558 	COmxILPort* pPort = iAllPorts[portIndex];
   519 
   559 
   520 	if (OMX_TRUE == aPortIsDisabled &&
   560 	if (OMX_TRUE == aPortIsDisabled &&
   521 		pPort->IsEnabled() &&
   561 		pPort->IsEnabled() &&
   592 
   632 
   593 OMX_ERRORTYPE
   633 OMX_ERRORTYPE
   594 COmxILPortManager::SetConfig(OMX_INDEXTYPE aConfigIndex,
   634 COmxILPortManager::SetConfig(OMX_INDEXTYPE aConfigIndex,
   595 							 const TAny* apComponentConfigStructure)
   635 							 const TAny* apComponentConfigStructure)
   596 	{
   636 	{
   597     DEBUG_PRINTF(_L8("COmxILPortManager::SetConfig"));
   637 	DEBUG_PRINTF(_L8("COmxILPortManager::SetConfig"));
   598 
   638 
   599 	TInt index = FindConfigIndex(aConfigIndex);
   639 	TInt index = FindConfigIndex(aConfigIndex);
   600 	if (KErrNotFound == index)
   640 	if (KErrNotFound == index)
   601 		{
   641 		{
   602 		return OMX_ErrorUnsupportedIndex;
   642 		return OMX_ErrorUnsupportedIndex;
   607 	if (OMX_ErrorNone != GetPortIndexFromOmxStruct(apComponentConfigStructure,
   647 	if (OMX_ErrorNone != GetPortIndexFromOmxStruct(apComponentConfigStructure,
   608 												   portIndex))
   648 												   portIndex))
   609 		{
   649 		{
   610 		return OMX_ErrorBadPortIndex;
   650 		return OMX_ErrorBadPortIndex;
   611 		}
   651 		}
       
   652 
       
   653     DEBUG_PRINTF2(_L8("COmxILPortManager::SetConfig : PORT[%u]"), portIndex);
   612 
   654 
   613 	TBool updateProcessingFunction = EFalse;
   655 	TBool updateProcessingFunction = EFalse;
   614 	OMX_ERRORTYPE omxRetValue =
   656 	OMX_ERRORTYPE omxRetValue =
   615 		iAllPorts[portIndex]->SetConfig(
   657 		iAllPorts[portIndex]->SetConfig(
   616 			aConfigIndex,
   658 			aConfigIndex,
   725 COmxILPortManager::FreeBuffer(OMX_U32 aPortIndex,
   767 COmxILPortManager::FreeBuffer(OMX_U32 aPortIndex,
   726 							  OMX_BUFFERHEADERTYPE* apBufferHeader,
   768 							  OMX_BUFFERHEADERTYPE* apBufferHeader,
   727 							  TBool& portDepopulationCompleted,
   769 							  TBool& portDepopulationCompleted,
   728 							  OMX_BOOL aPortIsDisabled /* = OMX_FALSE */)
   770 							  OMX_BOOL aPortIsDisabled /* = OMX_FALSE */)
   729 	{
   771 	{
   730     DEBUG_PRINTF2(_L8("COmxILPortManager::FreeBuffer : BUFFER [%X]"), apBufferHeader);
   772     DEBUG_PRINTF3(_L8("COmxILPortManager::FreeBuffer : PORT[%u] BUFFER [%X]"), aPortIndex, apBufferHeader);
   731 
   773 
   732 	// Check the index of the port..
   774 	// Check the index of the port..
   733 	if (CheckPortIndex(aPortIndex) != OMX_ErrorNone)
   775 	if (CheckPortIndex(aPortIndex) != OMX_ErrorNone)
   734 		{
   776 		{
   735 		return OMX_ErrorBadPortIndex;
   777 		return OMX_ErrorBadPortIndex;
  1053 	return OMX_ErrorNone;
  1095 	return OMX_ErrorNone;
  1054 
  1096 
  1055 	}
  1097 	}
  1056 
  1098 
  1057 OMX_ERRORTYPE
  1099 OMX_ERRORTYPE
  1058 COmxILPortManager::InitiateTunnellingDataFlow(OMX_U32 aPortIndex /* = OMX_ALL */)
  1100 COmxILPortManager::InitiateTunnellingDataFlow(
       
  1101 	OMX_U32 aPortIndex /* = OMX_ALL */,
       
  1102 	OMX_BOOL aSuppliersAndNonSuppliers /* = OMX_FALSE */)
  1059 	{
  1103 	{
  1060     DEBUG_PRINTF2(_L8("COmxILPortManager::InitiateTunnellingDataFlow : PORT[%d]"), aPortIndex);
  1104     DEBUG_PRINTF2(_L8("COmxILPortManager::InitiateTunnellingDataFlow : PORT[%d]"), aPortIndex);
  1061 
  1105 
  1062 	// Check the index of the port..
  1106 	// Check the index of the port..
  1063 	if ((OMX_ALL != aPortIndex) && (CheckPortIndex(aPortIndex) != OMX_ErrorNone))
  1107 	if ((OMX_ALL != aPortIndex) && (CheckPortIndex(aPortIndex) != OMX_ErrorNone))
  1084 			{
  1128 			{
  1085 			pPort = iAllPorts[i];
  1129 			pPort = iAllPorts[i];
  1086 			portIndex = pPort->Index();
  1130 			portIndex = pPort->Index();
  1087 			}
  1131 			}
  1088 
  1132 
  1089 		if (pPort->IsEnabled() && pPort->IsTunnelledAndBufferSupplier())
  1133 		if (pPort->IsEnabled() &&
       
  1134 			((OMX_TRUE == aSuppliersAndNonSuppliers) ||
       
  1135 			 pPort->IsTunnelledAndBufferSupplier()))
  1090 			{
  1136 			{
  1091 			const TInt headerCount = pPort->Count();
  1137 			const TInt headerCount = pPort->Count();
  1092 			OMX_BUFFERHEADERTYPE* pHeader = 0;
  1138 			OMX_BUFFERHEADERTYPE* pHeader = 0;
  1093 			OMX_DIRTYPE portDir = OMX_DirMax;
  1139 			OMX_DIRTYPE portDir = OMX_DirMax;
  1094 			OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
  1140 			OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
  1177 
  1223 
  1178 OMX_ERRORTYPE
  1224 OMX_ERRORTYPE
  1179 COmxILPortManager::BufferIndication(
  1225 COmxILPortManager::BufferIndication(
  1180 	OMX_BUFFERHEADERTYPE* apBufferHeader,
  1226 	OMX_BUFFERHEADERTYPE* apBufferHeader,
  1181 	OMX_DIRTYPE aDirection,
  1227 	OMX_DIRTYPE aDirection,
  1182 	OMX_BOOL aPortIsDisabled /* = OMX_FALSE */)
  1228 	OMX_BOOL /* aPortIsDisabled = OMX_FALSE */)
  1183 	{
  1229 	{
  1184     DEBUG_PRINTF2(_L8("COmxILPortManager::BufferIndication : BUFFER [%X]"), apBufferHeader);
       
  1185 
  1230 
  1186 	OMX_U32 portIndex = aDirection == OMX_DirInput ?
  1231 	OMX_U32 portIndex = aDirection == OMX_DirInput ?
  1187 		apBufferHeader->nInputPortIndex : apBufferHeader->nOutputPortIndex;
  1232 		apBufferHeader->nInputPortIndex : apBufferHeader->nOutputPortIndex;
  1188 
  1233 
       
  1234     DEBUG_PRINTF3(_L8("COmxILPortManager::BufferIndication : PORT[%u] BUFFER [%X] "),
       
  1235 				  portIndex, apBufferHeader);
       
  1236 
  1189 	// Check the index of the port..
  1237 	// Check the index of the port..
  1190 	if (CheckPortIndex(portIndex) != OMX_ErrorNone)
  1238 	if (CheckPortIndex(portIndex) != OMX_ErrorNone)
  1191 		{
  1239 		{
  1192 		return OMX_ErrorBadPortIndex;
  1240 		return OMX_ErrorBadPortIndex;
  1193 		}
  1241 		}
  1197 
  1245 
  1198 	// Check that port direction is the correct one...
  1246 	// Check that port direction is the correct one...
  1199 	if (pPort->Direction() != aDirection)
  1247 	if (pPort->Direction() != aDirection)
  1200 		{
  1248 		{
  1201 		return OMX_ErrorBadPortIndex;
  1249 		return OMX_ErrorBadPortIndex;
  1202 		}
       
  1203 
       
  1204 	if (!pPort->IsEnabled() &&
       
  1205 		!pPort->IsTransitioningToDisabled() &&
       
  1206 		!pPort->IsTransitioningToEnabled())
       
  1207 		{
       
  1208 		return OMX_ErrorIncorrectStateOperation;
       
  1209 		}
       
  1210 
       
  1211 	// Check port enabled property...
       
  1212 	if (OMX_TRUE == aPortIsDisabled &&
       
  1213 		pPort->IsEnabled())
       
  1214 		{
       
  1215 		// There is an indication from the FSM that the port must be disabled,
       
  1216 		// otherwise, the buffer indication is not allowed in the current
       
  1217 		// state.
       
  1218 		return OMX_ErrorIncorrectStateOperation;
       
  1219 		}
  1250 		}
  1220 
  1251 
  1221 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
  1252 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
  1222 	// Check whether this port is a buffer supplier...
  1253 	// Check whether this port is a buffer supplier...
  1223 	if (pPort->IsTunnelledAndBufferSupplier() &&
  1254 	if (pPort->IsTunnelledAndBufferSupplier() &&
  1261 
  1292 
  1262 		// ... we are done.. no need to send the buffer to the
  1293 		// ... we are done.. no need to send the buffer to the
  1263 		// processing function...
  1294 		// processing function...
  1264 		return OMX_ErrorNone;
  1295 		return OMX_ErrorNone;
  1265 
  1296 
  1266 		} // if (pPort->IsTransitioningToDisabled())
  1297 		} // if ((pPort->IsTunnelledAndBufferSupplier() && pPort->IsTransitioningToDisabled())
  1267 
       
  1268 
  1298 
  1269 	// Inform the port that one of its buffers is going to be sent to the
  1299 	// Inform the port that one of its buffers is going to be sent to the
  1270 	// processing function (exception applies to OMX_PortDomainOther ports) ... 
  1300 	// processing function (exception applies to OMX_PortDomainOther ports) ... 
  1271 	// The port will also mark this buffer if the port
  1301 	// The port will also mark this buffer if the port
  1272 	// has pending marks to be signalled... The buffer marks are finally
  1302 	// has pending marks to be signalled... The buffer marks are finally
  1335 COmxILPortManager::BufferReturnIndication(
  1365 COmxILPortManager::BufferReturnIndication(
  1336 	OMX_BUFFERHEADERTYPE* apBufferHeader,
  1366 	OMX_BUFFERHEADERTYPE* apBufferHeader,
  1337 	OMX_DIRTYPE aDirection,
  1367 	OMX_DIRTYPE aDirection,
  1338 	TBool& aAllBuffersReturned)
  1368 	TBool& aAllBuffersReturned)
  1339 	{
  1369 	{
  1340     DEBUG_PRINTF2(_L8("COmxILPortManager::BufferReturnIndication : [%X]"), apBufferHeader);
       
  1341 
  1370 
  1342 	aAllBuffersReturned = EFalse;
  1371 	aAllBuffersReturned = EFalse;
  1343 
  1372 
  1344 	OMX_U32 portIndex = aDirection == OMX_DirInput ?
  1373 	OMX_U32 portIndex = aDirection == OMX_DirInput ?
  1345 		apBufferHeader->nInputPortIndex : apBufferHeader->nOutputPortIndex;
  1374 		apBufferHeader->nInputPortIndex : apBufferHeader->nOutputPortIndex;
       
  1375 
       
  1376     DEBUG_PRINTF3(_L8("COmxILPortManager::BufferReturnIndication : PORT[%u] BUFFER [%X]"),
       
  1377 				  portIndex, apBufferHeader);
  1346 
  1378 
  1347 	// Check the index of the port..
  1379 	// Check the index of the port..
  1348 	if (CheckPortIndex(portIndex) != OMX_ErrorNone)
  1380 	if (CheckPortIndex(portIndex) != OMX_ErrorNone)
  1349 		{
  1381 		{
  1350 		return OMX_ErrorBadPortIndex;
  1382 		return OMX_ErrorBadPortIndex;
  1392 
  1424 
  1393 OMX_ERRORTYPE
  1425 OMX_ERRORTYPE
  1394 COmxILPortManager::BufferFlushIndicationFlushCommand(
  1426 COmxILPortManager::BufferFlushIndicationFlushCommand(
  1395 	TUint32 aPortIndex, TBool aEjectBuffers /* = ETrue */)
  1427 	TUint32 aPortIndex, TBool aEjectBuffers /* = ETrue */)
  1396 	{
  1428 	{
  1397     DEBUG_PRINTF2(_L8("COmxILPortManager::BufferFlushIndicationFlushCommand PORT[%d]"), aPortIndex);
  1429     DEBUG_PRINTF2(_L8("COmxILPortManager::BufferFlushIndicationFlushCommand : PORT[%u]"), aPortIndex);
  1398 
  1430 
  1399 	// Check the index of the port..
  1431 	// Check the index of the port..
  1400 	if ((OMX_ALL != aPortIndex) && (CheckPortIndex(aPortIndex) != OMX_ErrorNone))
  1432 	if ((OMX_ALL != aPortIndex) && (CheckPortIndex(aPortIndex) != OMX_ErrorNone))
  1401 		{
  1433 		{
  1402 		return OMX_ErrorBadPortIndex;
  1434 		return OMX_ErrorBadPortIndex;
  1422 			pPort = iAllPorts[i];
  1454 			pPort = iAllPorts[i];
  1423 			}
  1455 			}
  1424 
  1456 
  1425 		if (pPort->IsEnabled() && pPort->Count())
  1457 		if (pPort->IsEnabled() && pPort->Count())
  1426 			{
  1458 			{
  1427 			if (pPort->IsTunnelledAndBufferSupplier() &&
  1459 			// If port is tunnelled:
  1428 				!pPort->HasAllBuffersAtHome())
  1460 			//
       
  1461 			// - Output ports buffers are sent to the processing function when
       
  1462 			// flushed
       
  1463 			//
       
  1464 			// - Input ports buffers are sent upstream.
       
  1465 			//
       
  1466 			// If port is non-tunnelled:
       
  1467 			// - Buffers are ejected always...
       
  1468 			if (pPort->IsTunnelled())
  1429 				{
  1469 				{
  1430 				// Remove buffers from PF only...
  1470 				// Remove buffers from PF only...
  1431 				RemoveBuffersFromPfOrCm(pPort, OMX_TRUE);
  1471 				RemoveBuffersFromPfOrCm(pPort, OMX_TRUE);
  1432 
  1472 
  1433 				if (aEjectBuffers)
  1473 				if (aEjectBuffers)
  1434 					{
  1474 					{
  1435 					// Now we need to send input buffers upstream and ouput
  1475 					// Now we need to send input buffers upstream and ouput
  1436 					// buffers to the PF...
  1476 					// buffers to the PF... this is done by
  1437 					if ((omxRetValue = InitiateTunnellingDataFlow())
  1477 					// InitiateTunnellingDataFlow
  1438 						!= OMX_ErrorNone)
  1478 					if ((omxRetValue = InitiateTunnellingDataFlow(
       
  1479 							 pPort->Index(), OMX_TRUE)) != OMX_ErrorNone)
  1439 						{
  1480 						{
  1440 						// The flush has failed, we need to notify the IL Cient
  1481 						// The flush has failed, we need to notify the IL Cient
  1441 						// via EventHandler...
  1482 						// via EventHandler...
  1442 						iCallbacks.ErrorEventNotification(omxRetValue);
  1483 						iCallbacks.ErrorEventNotification(omxRetValue);
  1443 						flushSuccessful = EFalse;
  1484 						flushSuccessful = EFalse;
  1444 						}
  1485 						}
  1445 					}
  1486 					}
  1446 
       
  1447 				}
  1487 				}
  1448 			else
  1488 			else
  1449 				{
  1489 				{
       
  1490 				// All other ports are simply flushed...
  1450 				portsToFlush.Append(pPort);
  1491 				portsToFlush.Append(pPort);
  1451 				}
  1492 				}
  1452 			}
  1493 			}
  1453 		// Notify flushing completed, even if there was nothing to
  1494 		// Notify flushing completed, even if there was nothing to
  1454 		// flush...
  1495 		// flush...
  1511 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
  1552 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
  1512 	for (TInt i=0; i<portCount; ++i)
  1553 	for (TInt i=0; i<portCount; ++i)
  1513 		{
  1554 		{
  1514 		pPort = iAllPorts[i];
  1555 		pPort = iAllPorts[i];
  1515 
  1556 
  1516 		if (pPort->IsEnabled() && pPort->Count())
  1557 		if (pPort->Count())
  1517 			{
  1558 			{
  1518 			if (pPort->IsTunnelledAndBufferSupplier() &&
  1559 			if (pPort->IsTunnelledAndBufferSupplier() &&
  1519 				!pPort->HasAllBuffersAtHome())
  1560 				!pPort->HasAllBuffersAtHome())
  1520 				{
  1561 				{
  1521 				if (!RemoveBuffersFromPfOrCm(pPort))
  1562 				if (!RemoveBuffersFromPfOrCm(pPort))
  1524 					// returned by the tunnelled port...
  1565 					// returned by the tunnelled port...
  1525 					foundBufferSupplierThatNeedsToWait = ETrue;
  1566 					foundBufferSupplierThatNeedsToWait = ETrue;
  1526 					}
  1567 					}
  1527 				continue;
  1568 				continue;
  1528 				}
  1569 				}
  1529 
       
  1530 			if (OMX_ErrorNone !=
  1570 			if (OMX_ErrorNone !=
  1531 				(omxRetValue = iProcessingFunction.BufferFlushingIndication(
  1571 				(omxRetValue = iProcessingFunction.BufferFlushingIndication(
  1532 					pPort->Index(),
  1572 					pPort->Index(),
  1533 					pPort->Direction())))
  1573 					pPort->Direction())))
  1534 				{
  1574 				{
  1549 OMX_ERRORTYPE
  1589 OMX_ERRORTYPE
  1550 COmxILPortManager::PortEnableIndication(
  1590 COmxILPortManager::PortEnableIndication(
  1551 	TUint32 aPortIndex,
  1591 	TUint32 aPortIndex,
  1552 	TBool aIndicationIsFinal)
  1592 	TBool aIndicationIsFinal)
  1553 	{
  1593 	{
  1554     DEBUG_PRINTF3(_L8("COmxILPortManager::PortEnableIndication: PORT[%d] TRANSITIONISFINAL[%d]"), aPortIndex, aIndicationIsFinal);
  1594     DEBUG_PRINTF3(_L8("COmxILPortManager::PortEnableIndication: PORT[%u] TRANSITIONISFINAL[%d]"), aPortIndex, aIndicationIsFinal);
  1555 
  1595 
  1556 	// Check the index of the port..
  1596 	// Check the index of the port..
  1557 	if ((OMX_ALL != aPortIndex) && (CheckPortIndex(aPortIndex) != OMX_ErrorNone))
  1597 	if ((OMX_ALL != aPortIndex) && (CheckPortIndex(aPortIndex) != OMX_ErrorNone))
  1558 		{
  1598 		{
  1559 		return OMX_ErrorBadPortIndex;
  1599 		return OMX_ErrorBadPortIndex;
  1655 
  1695 
  1656 OMX_ERRORTYPE
  1696 OMX_ERRORTYPE
  1657 COmxILPortManager::PortDisableIndication(
  1697 COmxILPortManager::PortDisableIndication(
  1658 	TUint32 aPortIndex)
  1698 	TUint32 aPortIndex)
  1659 	{
  1699 	{
  1660     DEBUG_PRINTF2(_L8("COmxILPortManager::PortDisableIndication: PORT[%d] "), aPortIndex);
  1700     DEBUG_PRINTF2(_L8("COmxILPortManager::PortDisableIndication: PORT[%u] "), aPortIndex);
  1661 
  1701 
  1662 	// Check the index of the port..
  1702 	// Check the index of the port..
  1663 	if ((OMX_ALL != aPortIndex) && (CheckPortIndex(aPortIndex) != OMX_ErrorNone))
  1703 	if ((OMX_ALL != aPortIndex) && (CheckPortIndex(aPortIndex) != OMX_ErrorNone))
  1664 		{
  1704 		{
  1665 		return OMX_ErrorBadPortIndex;
  1705 		return OMX_ErrorBadPortIndex;
  1818 OMX_ERRORTYPE
  1858 OMX_ERRORTYPE
  1819 COmxILPortManager::BufferMarkIndication(
  1859 COmxILPortManager::BufferMarkIndication(
  1820 	TUint32 aPortIndex,
  1860 	TUint32 aPortIndex,
  1821 	OMX_PTR ipMarkData)
  1861 	OMX_PTR ipMarkData)
  1822 	{
  1862 	{
  1823     DEBUG_PRINTF2(_L8("COmxILPortManager::BufferMarkIndication: PORT[%d] "), aPortIndex);
  1863     DEBUG_PRINTF2(_L8("COmxILPortManager::BufferMarkIndication: PORT[%u] "), aPortIndex);
  1824 
  1864 
  1825 	// Check the index of the port..
  1865 	// Check the index of the port..
  1826 	if (CheckPortIndex(aPortIndex) != OMX_ErrorNone)
  1866 	if (CheckPortIndex(aPortIndex) != OMX_ErrorNone)
  1827 		{
  1867 		{
  1828 		return OMX_ErrorBadPortIndex;
  1868 		return OMX_ErrorBadPortIndex;
  1842 	}
  1882 	}
  1843 
  1883 
  1844 OMX_ERRORTYPE
  1884 OMX_ERRORTYPE
  1845 COmxILPortManager::ComponentRoleIndication(TUint aComponentRoleIndex)
  1885 COmxILPortManager::ComponentRoleIndication(TUint aComponentRoleIndex)
  1846 	{
  1886 	{
  1847     DEBUG_PRINTF2(_L8("COmxILPortManager::ComponentRoleIndication : aComponentRoleIndex[%d]"), aComponentRoleIndex);
  1887     DEBUG_PRINTF2(_L8("COmxILPortManager::ComponentRoleIndication : aComponentRoleIndex[%u]"), aComponentRoleIndex);
  1848 
  1888 
  1849 	// At this point, the IL Client wants to set the default role that the
  1889 	// At this point, the IL Client wants to set the default role that the
  1850 	// standard component is assuming. Therefore, the role defaults need to be
  1890 	// standard component is assuming. Therefore, the role defaults need to be
  1851 	// reloaded into all ports and the processing function object.
  1891 	// reloaded into all ports and the processing function object.
  1852 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
  1892 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
  1869 COmxILPortManager::PortSettingsChangeIndication(OMX_U32 aPortIndex,
  1909 COmxILPortManager::PortSettingsChangeIndication(OMX_U32 aPortIndex,
  1870 												TUint aPortSettingsIndex,
  1910 												TUint aPortSettingsIndex,
  1871 												const TDesC8& aPortSettings,
  1911 												const TDesC8& aPortSettings,
  1872 												OMX_EVENTTYPE& aEventForILClient)
  1912 												OMX_EVENTTYPE& aEventForILClient)
  1873 	{
  1913 	{
  1874     DEBUG_PRINTF2(_L8("COmxILPortManager::PortSettingsChangeIndication: PORT[%d] "), aPortIndex);
  1914     DEBUG_PRINTF2(_L8("COmxILPortManager::PortSettingsChangeIndication: PORT[%u] "), aPortIndex);
  1875 
  1915 
  1876 	// Check the index of the port..
  1916 	// Check the index of the port..
  1877 	if (CheckPortIndex(aPortIndex) != OMX_ErrorNone)
  1917 	if (CheckPortIndex(aPortIndex) != OMX_ErrorNone)
  1878 		{
  1918 		{
  1879 		return OMX_ErrorBadPortIndex;
  1919 		return OMX_ErrorBadPortIndex;