omxil_generic/omxilcomplib/src/omxilcallbackmanager.cpp
changeset 0 0e4a32b9112d
child 5 fb6faddbb212
equal deleted inserted replaced
-1:000000000000 0:0e4a32b9112d
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 /**
       
    18  @file
       
    19  @internalComponent
       
    20 */
       
    21 
       
    22 #include "log.h"
       
    23 #include "omxilcallbackmanager.h"
       
    24 #include "omxilfsm.h"
       
    25 #include <openmax/il/common/omxilstatedefs.h>
       
    26 #include <openmax/il/common/omxilutil.h>
       
    27 #include "omxilportmanagerif.h"
       
    28 
       
    29 const TInt COmxILCallbackManager::KMaxMsgQueueEntries;
       
    30 
       
    31 
       
    32 COmxILCallbackManager*
       
    33 COmxILCallbackManager::NewL(
       
    34 	OMX_HANDLETYPE apComponentHandle,
       
    35 	OMX_PTR apAppData,
       
    36 	OMX_CALLBACKTYPE* apCallbacks)
       
    37 	{
       
    38     DEBUG_PRINTF(_L8("COmxILCallbackManager::NewL"));
       
    39 	COmxILCallbackManager* self = new (ELeave)COmxILCallbackManager(
       
    40 		apComponentHandle,
       
    41 		apAppData,
       
    42 		apCallbacks);
       
    43 	CleanupStack::PushL(self);
       
    44 	self->ConstructL();
       
    45 	CleanupStack::Pop(self);
       
    46 	return self;
       
    47 	}
       
    48 
       
    49 void
       
    50 COmxILCallbackManager::ConstructL()
       
    51 	{
       
    52     DEBUG_PRINTF(_L8("COmxILCallbackManager::ConstructL"));
       
    53 
       
    54 	CActiveScheduler::Add(this);
       
    55 	User::LeaveIfError(iCommandQueue.CreateLocal(KMaxMsgQueueEntries));
       
    56 	iCommandQueue.NotifyDataAvailable(iStatus);
       
    57 
       
    58 	User::LeaveIfError(iPendingQueue.CreateLocal(KMaxMsgQueueEntries));
       
    59 
       
    60 	SetActive();
       
    61 
       
    62 	}
       
    63 
       
    64 COmxILCallbackManager::COmxILCallbackManager(OMX_HANDLETYPE apComponentHandle,
       
    65 											 OMX_PTR apAppData,
       
    66 											 OMX_CALLBACKTYPE* apCallbacks)
       
    67 	:
       
    68 	CActive(CActive::EPriorityStandard),
       
    69 	XOmxILCallbackManagerIfImpl(
       
    70 		static_cast<OMX_COMPONENTTYPE*>(apComponentHandle),
       
    71 		apAppData,
       
    72 		apCallbacks),
       
    73 	iCommandQueue(),
       
    74 	iPendingQueue(),
       
    75 	iFlushPendingQueue(EFalse),
       
    76 	iCurrentState(OMX_StateLoaded),
       
    77 	iPreviousState(OMX_StateLoaded)
       
    78 	{
       
    79     DEBUG_PRINTF(_L8("COmxILCallbackManager::COmxILCallbackManager"));
       
    80 	}
       
    81 
       
    82 
       
    83 COmxILCallbackManager::~COmxILCallbackManager()
       
    84 	{
       
    85     DEBUG_PRINTF(_L8("COmxILCallbackManager::~COmxILCallbackManager"));
       
    86 
       
    87 	Cancel();
       
    88 
       
    89 	CleanUpQueue(iPendingQueue);
       
    90 
       
    91 	CleanUpQueue(iCommandQueue);
       
    92 
       
    93 	}
       
    94 
       
    95 
       
    96 void
       
    97 COmxILCallbackManager::CleanUpQueue(RCallbackManagerQueue& aQueue)
       
    98 	{
       
    99     DEBUG_PRINTF(_L8("COmxILCallbackManager::CleanUpQueue"));
       
   100 
       
   101 	if (aQueue.Handle() != 0)
       
   102 		{
       
   103 		CCallbackCommand* pCommand = 0;
       
   104 		TInt err = KErrNone;
       
   105 		while ((err = aQueue.Receive(pCommand)) == KErrNone)
       
   106 			{
       
   107 			DEBUG_PRINTF2(_L8("COmxILCallbackManager::CleanUpQueue : aQueue.Receive [%X]"), pCommand);
       
   108 			delete pCommand;
       
   109 			pCommand = 0;
       
   110 			}
       
   111 
       
   112 		if (KErrNone != err)
       
   113 			{
       
   114 			DEBUG_PRINTF2(_L8("COmxILCallbackManager::CleanUpQueue : aQueue.Receive returned error [%d]"), err);
       
   115 			if (KErrNoMemory == err)
       
   116 				{
       
   117 				HandleInsufficientResources();
       
   118 				}
       
   119 			}
       
   120 
       
   121 		}
       
   122 
       
   123 	aQueue.Close();
       
   124 
       
   125 	}
       
   126 
       
   127 
       
   128 void
       
   129 COmxILCallbackManager::SetPortManager(MOmxILPortManagerIf& apPortManager)
       
   130 	{
       
   131 	DoSetPortManager(apPortManager);
       
   132 	}
       
   133 
       
   134 void
       
   135 COmxILCallbackManager::SetFsm(COmxILFsm& apFsm)
       
   136 	{
       
   137 	DoSetFsm(apFsm);
       
   138 	}
       
   139 
       
   140 OMX_ERRORTYPE
       
   141 COmxILCallbackManager::RegisterComponentHandle(OMX_HANDLETYPE aComponentHandle)
       
   142 	{
       
   143     DEBUG_PRINTF(_L8("COmxILCallbackManager::RegisterComponentHandle"));
       
   144 
       
   145 	__ASSERT_DEBUG(aComponentHandle,
       
   146 				   User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
   147 
       
   148 	CCompHandleRegistrationCommand* pHandleReg =
       
   149 		new CCompHandleRegistrationCommand(aComponentHandle);
       
   150 	if (!pHandleReg || (iCommandQueue.Send(pHandleReg) != KErrNone))
       
   151 		{
       
   152 		delete pHandleReg;
       
   153 		DoRegisterComponentHandle(aComponentHandle);
       
   154 		return OMX_ErrorInsufficientResources;
       
   155 		}
       
   156 
       
   157 	return OMX_ErrorNone;
       
   158 
       
   159 	}
       
   160 
       
   161 /**
       
   162    The IL Client callback registration is handled in this implementation
       
   163    asynchronously. Note that this implementation assumes that the IL Client
       
   164    will update the callbacks information once all expected callbacks from this
       
   165    component have already been received and therefore, the callback change will
       
   166    be safe leading to no race condition at the IL Client side.
       
   167 
       
   168    @param apCallbacks The IL Client callback structure.
       
   169 
       
   170    @param apAppData Pointer to an application provided value so that the
       
   171 	    application can have a component specific context when receiving
       
   172 	    the callback.
       
   173 
       
   174    @return OMX_ERRORTYPE
       
   175  */
       
   176 OMX_ERRORTYPE
       
   177 COmxILCallbackManager::RegisterILClientCallbacks(
       
   178 	const OMX_CALLBACKTYPE* apCallbacks,
       
   179 	const OMX_PTR apAppData)
       
   180 	{
       
   181     DEBUG_PRINTF(_L8("COmxILCallbackManager::RegisterILClientCallbacks"));
       
   182 
       
   183 	CClientCallbacksRegistrationCommand* pClientCBacksReg =
       
   184 		new CClientCallbacksRegistrationCommand(
       
   185 			apCallbacks,
       
   186 			apAppData);
       
   187 	if (!pClientCBacksReg || (iCommandQueue.Send(pClientCBacksReg) != KErrNone))
       
   188 		{
       
   189 		delete pClientCBacksReg;
       
   190 		DoRegisterILClientCallbacks(apCallbacks, apAppData);
       
   191 		return OMX_ErrorInsufficientResources;
       
   192 		}
       
   193 
       
   194 	return OMX_ErrorNone;
       
   195 
       
   196 	}
       
   197 
       
   198 OMX_ERRORTYPE
       
   199 COmxILCallbackManager::RegisterTunnelCallback(
       
   200 	OMX_U32 aLocalPortIndex,
       
   201 	OMX_DIRTYPE aLocalPortDirection,
       
   202 	OMX_HANDLETYPE aTunnelledComponentHandle,
       
   203 	OMX_U32 aTunnelledPortIndex)
       
   204 	{
       
   205 	DEBUG_PRINTF2(_L8("COmxILCallbackManager::RegisterTunnelCallback : aTunnelledComponentHandle [%x]"), aTunnelledComponentHandle);
       
   206 
       
   207 	CTunnelCallbackRegistrationCommand* pTunnelCBacksReg =
       
   208 		new CTunnelCallbackRegistrationCommand(aLocalPortIndex,
       
   209 											   aLocalPortDirection,
       
   210 											   aTunnelledComponentHandle,
       
   211 											   aTunnelledPortIndex);
       
   212 
       
   213 	if (!pTunnelCBacksReg || (iCommandQueue.Send(pTunnelCBacksReg) != KErrNone))
       
   214 		{
       
   215 		delete pTunnelCBacksReg;
       
   216 		return OMX_ErrorInsufficientResources;
       
   217 		}
       
   218 
       
   219 	return OMX_ErrorNone;
       
   220 
       
   221 	}
       
   222 
       
   223 OMX_ERRORTYPE
       
   224 COmxILCallbackManager::DeregisterTunnelCallback(
       
   225 	OMX_U32 aLocalPortIndex)
       
   226 	{
       
   227 
       
   228 	DEBUG_PRINTF(_L8("COmxILCallbackManager::DeregisterTunnelCallback"));
       
   229 
       
   230 	return RegisterTunnelCallback(aLocalPortIndex,
       
   231 								  OMX_DirMax,
       
   232 								  0,
       
   233 								  0);
       
   234 
       
   235 	}
       
   236 
       
   237 OMX_ERRORTYPE
       
   238 COmxILCallbackManager::RegisterBufferMarkPropagationPort(
       
   239 	OMX_U32 aPortIndex,
       
   240 	OMX_U32 aPropagationPortIndex)
       
   241 	{
       
   242 	DEBUG_PRINTF(_L8("COmxILCallbackManager::RegisterBufferMarkPropagationPort"));
       
   243 
       
   244 	CBufferMarkPropagationRegistrationCommand* pBufferMarkPropReg =
       
   245 		new CBufferMarkPropagationRegistrationCommand(aPortIndex,
       
   246 													  aPropagationPortIndex);
       
   247 	if (!pBufferMarkPropReg || (iCommandQueue.Send(pBufferMarkPropReg) != KErrNone))
       
   248 		{
       
   249 		delete pBufferMarkPropReg;
       
   250 		HandleInsufficientResources();
       
   251 		}
       
   252 
       
   253 	return OMX_ErrorNone;
       
   254 
       
   255 	}
       
   256 
       
   257 TBool
       
   258 COmxILCallbackManager::BufferRemovalIndication(
       
   259 	OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   260 	OMX_DIRTYPE aDirection)
       
   261 	{
       
   262 	DEBUG_PRINTF(_L8("COmxILCallbackManager::BufferRemovalIndication"));
       
   263 
       
   264 	CBufferRemovalCommand* pBufferRemovalCmd =
       
   265 		new CBufferRemovalCommand(apBufferHeader, aDirection);
       
   266 
       
   267 	if (!pBufferRemovalCmd ||
       
   268 		(iCommandQueue.Send(pBufferRemovalCmd) != KErrNone))
       
   269 		{
       
   270 		delete pBufferRemovalCmd;
       
   271 		HandleInsufficientResources();
       
   272 		}
       
   273 
       
   274 	// Always return false now as the buffer would be removed asynchronously
       
   275 	return EFalse;
       
   276 
       
   277 	}
       
   278 
       
   279 OMX_ERRORTYPE
       
   280 COmxILCallbackManager::TransitionCompleteNotification(OMX_STATETYPE aOmxState)
       
   281 	{
       
   282     DEBUG_PRINTF(_L8("COmxILCallbackManager::TransitionCompleteNotification"));
       
   283 
       
   284 	return EventNotificationImpl(OMX_EventCmdComplete,
       
   285 								OMX_CommandStateSet,
       
   286 								aOmxState,
       
   287 								0);
       
   288 
       
   289 	}
       
   290 
       
   291 
       
   292 OMX_ERRORTYPE
       
   293 COmxILCallbackManager::CommandCompleteNotification(OMX_COMMANDTYPE aOmxCommand,
       
   294 												   OMX_U32 aOmxPortIndex)
       
   295 	{
       
   296     DEBUG_PRINTF(_L8("COmxILCallbackManager::CommandCompleteNotification"));
       
   297 
       
   298 	return EventNotification(OMX_EventCmdComplete,
       
   299 							 aOmxCommand,
       
   300 							 aOmxPortIndex,
       
   301 							 0);
       
   302 
       
   303 	}
       
   304 
       
   305 #ifdef _OMXIL_COMMON_IL516C_ON
       
   306 OMX_ERRORTYPE
       
   307 COmxILCallbackManager::EjectBuffersRequest(OMX_U32 aLocalOmxPortIndex)
       
   308 	{
       
   309     DEBUG_PRINTF2(_L8("COmxILCallbackManager::EjectBuffersRequest : aLocalOmxPortIndex [%u]"), aLocalOmxPortIndex);
       
   310 
       
   311 	CEjectBuffersRequestCommand* pEjectCBack =
       
   312 		new CEjectBuffersRequestCommand(aLocalOmxPortIndex);
       
   313 	if (!pEjectCBack || (iCommandQueue.Send(pEjectCBack) != KErrNone))
       
   314 		{
       
   315 		delete pEjectCBack;
       
   316 		HandleInsufficientResources();
       
   317 		}
       
   318 
       
   319 	return OMX_ErrorNone;
       
   320 
       
   321 	}
       
   322 #endif
       
   323 
       
   324 OMX_ERRORTYPE
       
   325 COmxILCallbackManager::ErrorEventNotification(OMX_ERRORTYPE aOmxError)
       
   326 	{
       
   327     DEBUG_PRINTF2(_L8("COmxILCallbackManager::ErrorEventNotification : aOmxError[%X] "), aOmxError);
       
   328 
       
   329 	return EventNotification(OMX_EventError,
       
   330 							 aOmxError,
       
   331 							 0,
       
   332 							 0);
       
   333 
       
   334 	}
       
   335 
       
   336 OMX_ERRORTYPE
       
   337 COmxILCallbackManager::EventNotification(OMX_EVENTTYPE aEvent,
       
   338 										 TUint32 aData1,
       
   339 										 TUint32 aData2,
       
   340 										 OMX_STRING aExtraInfo)
       
   341 	{
       
   342 	// The error code is ignored intentionally, as errors from this function cannot be handled by clients, since they don't have
       
   343 	// another mechanism for reporting an error
       
   344 	(void)EventNotificationImpl(aEvent, aData1, aData2, aExtraInfo);
       
   345 	return OMX_ErrorNone;
       
   346 	}
       
   347 
       
   348 
       
   349 OMX_ERRORTYPE COmxILCallbackManager::EventNotificationImpl(OMX_EVENTTYPE aEvent,
       
   350 														   TUint32 aData1,
       
   351 														   TUint32 aData2,
       
   352 														   OMX_STRING aExtraInfo)
       
   353 	{
       
   354     DEBUG_PRINTF4(_L8("COmxILCallbackManager::EventNotificationImpl : aEvent[%X] aData1[%X] aData2[%u]"), aEvent, aData1, aData2);
       
   355 
       
   356 	CEventCallbackCommand* pEventCBack =
       
   357 		new CEventCallbackCommand(aEvent,
       
   358 								  aData1,
       
   359 								  aData2,
       
   360 								  aExtraInfo);
       
   361 	if (!pEventCBack || (iCommandQueue.Send(pEventCBack) != KErrNone))
       
   362 		{
       
   363 		delete pEventCBack;
       
   364 		HandleInsufficientResources();
       
   365 		return OMX_ErrorInsufficientResources;
       
   366 		}
       
   367 
       
   368 	return OMX_ErrorNone;
       
   369 
       
   370 	}
       
   371 
       
   372 
       
   373 OMX_ERRORTYPE
       
   374 COmxILCallbackManager::BufferDoneNotification(OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   375 											 OMX_U32 aLocalPortIndex,
       
   376 											 OMX_DIRTYPE aLocalPortDirection)
       
   377 	{
       
   378     DEBUG_PRINTF(_L8("COmxILCallbackManager::BufferDoneNotificaton"));
       
   379 
       
   380 	return SendBufferDoneNotification(apBufferHeader,
       
   381 									  aLocalPortIndex,
       
   382 									  aLocalPortDirection,
       
   383 									  CCallbackCommand::EPriorityNormal);
       
   384 
       
   385 	}
       
   386 
       
   387 OMX_ERRORTYPE
       
   388 COmxILCallbackManager::ClockBufferDoneNotification(OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   389 												   OMX_U32 aLocalPortIndex,
       
   390 												   OMX_DIRTYPE aLocalPortDirection)
       
   391 	{
       
   392     DEBUG_PRINTF(_L8("COmxILCallbackManager::ClockBufferDoneNotification"));
       
   393 
       
   394 	return SendBufferDoneNotification(apBufferHeader,
       
   395 									  aLocalPortIndex,
       
   396 									  aLocalPortDirection,
       
   397 									  CCallbackCommand::EPriorityHigh);
       
   398 
       
   399 	}
       
   400 
       
   401 OMX_ERRORTYPE
       
   402 COmxILCallbackManager::PortSettingsChangeNotification(
       
   403 	OMX_U32 aLocalPortIndex,
       
   404 	TUint aPortSettingsIndex,
       
   405 	const TDesC8& aPortSettings)
       
   406 	{
       
   407     DEBUG_PRINTF2(_L8("COmxILCallbackManager::PortSettingsChangeNotification : aLocalPortIndex[%d]"), aLocalPortIndex);
       
   408 
       
   409 	HBufC8* pPortSettings = aPortSettings.Alloc();
       
   410 	if (!pPortSettings)
       
   411 		{
       
   412 		HandleInsufficientResources();
       
   413 		return OMX_ErrorNone;
       
   414 		}
       
   415 
       
   416 	CPortSettingsChangeCommand* pPortSettingsCmd =
       
   417 		new CPortSettingsChangeCommand(aLocalPortIndex,
       
   418 									   aPortSettingsIndex,
       
   419 									   pPortSettings);
       
   420 	if (!pPortSettingsCmd)
       
   421 		{
       
   422 		delete pPortSettings;
       
   423 		HandleInsufficientResources();
       
   424 		return OMX_ErrorNone;
       
   425 		}
       
   426 
       
   427 	if (iCommandQueue.Send(pPortSettingsCmd) != KErrNone)
       
   428 		{
       
   429 		delete pPortSettingsCmd; // Destructor will delete pPortSettings
       
   430 		HandleInsufficientResources();
       
   431 		}
       
   432 
       
   433 	return OMX_ErrorNone;
       
   434 
       
   435 	}
       
   436 
       
   437 OMX_ERRORTYPE
       
   438 COmxILCallbackManager::SendBufferDoneNotification(
       
   439 	OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   440 	OMX_U32 aLocalPortIndex,
       
   441 	OMX_DIRTYPE aLocalPortDirection,
       
   442 	TInt aPriority)
       
   443 	{
       
   444     DEBUG_PRINTF(_L8("COmxILCallbackManager::SendBufferDoneNotification"));
       
   445 
       
   446 	__ASSERT_ALWAYS(apBufferHeader &&
       
   447 					(OMX_DirInput == aLocalPortDirection ||
       
   448 					 OMX_DirOutput == aLocalPortDirection),
       
   449 					User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
   450 
       
   451 	__ASSERT_ALWAYS(apBufferHeader->nOffset + apBufferHeader->nFilledLen
       
   452 					<= apBufferHeader->nAllocLen,
       
   453 					User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
   454 
       
   455 	CBufferDoneCallbackCommand* pEventCBack =
       
   456 		new CBufferDoneCallbackCommand(apBufferHeader,
       
   457 									   aLocalPortIndex,
       
   458 									   aLocalPortDirection,
       
   459 									   aPriority);
       
   460 
       
   461 	if (!pEventCBack || (iCommandQueue.Send(pEventCBack) != KErrNone))
       
   462 		{
       
   463 		delete pEventCBack;
       
   464 		HandleInsufficientResources();
       
   465 		}
       
   466 
       
   467 	return OMX_ErrorNone;
       
   468 
       
   469 	}
       
   470 
       
   471 
       
   472 void
       
   473 COmxILCallbackManager::RunL()
       
   474 	{
       
   475     DEBUG_PRINTF2(_L8("COmxILCallbackManager::RunL : Handle[%X]"), ipHandle);
       
   476 
       
   477 	ProcessQueue(iCommandQueue);
       
   478 
       
   479 	// Setup for next callbacks
       
   480 	iCommandQueue.NotifyDataAvailable(iStatus);
       
   481 	SetActive();
       
   482 
       
   483 	}
       
   484 
       
   485 
       
   486 void
       
   487 COmxILCallbackManager::ProcessQueue(RCallbackManagerQueue& aQueue)
       
   488 	{
       
   489     DEBUG_PRINTF2(_L8("COmxILCallbackManager::ProcessQueue : Handle[%X]"), ipHandle);
       
   490 
       
   491 	CCallbackCommand* pCommand = 0;
       
   492 
       
   493 	TInt receiveRes = 0;
       
   494 	TBool hasBeenDeferred = EFalse;
       
   495 	while ((receiveRes = aQueue.Receive(pCommand)) == KErrNone)
       
   496 		{
       
   497 		if (pCommand)
       
   498 			{
       
   499 			DEBUG_PRINTF2(_L8("COmxILCallbackManager::ProcessQueue : aQueue.Receive [%X]"),
       
   500 						  pCommand);
       
   501 			hasBeenDeferred = EFalse;
       
   502 			(*pCommand)(*this, hasBeenDeferred);
       
   503 			if (hasBeenDeferred)
       
   504 				{
       
   505 				// Move the current command to the pending queue
       
   506 				if (iPendingQueue.Send(pCommand) != KErrNone)
       
   507 					{
       
   508 					delete pCommand;
       
   509 					pCommand = 0;
       
   510 					HandleInsufficientResources();
       
   511 					}
       
   512 				}
       
   513 			else
       
   514 				{
       
   515 				delete pCommand;
       
   516 				pCommand = 0;
       
   517 				}
       
   518 			}
       
   519 
       
   520 		}
       
   521 
       
   522 	if (KErrNoMemory == receiveRes)
       
   523 		{
       
   524 		HandleInsufficientResources();
       
   525 		}
       
   526 
       
   527 	}
       
   528 
       
   529 void
       
   530 COmxILCallbackManager::DoCancel()
       
   531 	{
       
   532     DEBUG_PRINTF2(_L8("COmxILCallbackManager::DoCancel : Handle[%X]"), ipHandle);
       
   533 
       
   534 	iCommandQueue.CancelDataAvailable();
       
   535 
       
   536 	}
       
   537 
       
   538 
       
   539 //
       
   540 // COmxILCallbackManager::RCallbackManagerQueue
       
   541 //
       
   542 TBool
       
   543 COmxILCallbackManager::RCallbackManagerQueue::RemoveBufferDoneCbCommandsByBufferHeader(
       
   544 	COmxILCallbackManager& aCbMgr,
       
   545 	const OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   546 	OMX_DIRTYPE aDirection)
       
   547 	{
       
   548     DEBUG_PRINTF2(_L8("RCallbackManagerQueue::RemoveBufferDoneCbCommandsByBufferHeader : Handle[%X]"), aCbMgr.ipHandle);
       
   549 
       
   550 	if (KErrNone != DrainBackQueue())
       
   551 		{
       
   552 		aCbMgr.HandleInsufficientResources();
       
   553 		return EFalse;
       
   554 		}
       
   555 
       
   556 	if(!iFrontQueue.IsEmpty())
       
   557 		{
       
   558 		TBool removed = EFalse;
       
   559 		TDblQueIter<TFrontQueueElement> frontQueueIter(iFrontQueue);
       
   560 		TFrontQueueElement* pLastElement = iFrontQueue.Last();
       
   561 		TFrontQueueElement* pCurrentElement = 0;
       
   562 
       
   563 		do
       
   564 			{
       
   565 			pCurrentElement = frontQueueIter++;
       
   566 			__ASSERT_DEBUG(pCurrentElement && pCurrentElement->ipInfo,
       
   567 						   User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
   568 			removed = reinterpret_cast<CCallbackCommand*>(
       
   569 				const_cast<TAny*>(pCurrentElement->ipInfo))->
       
   570 				DoRemoveBufferDoneCbCommandByBufferHeader(aCbMgr,
       
   571 														  apBufferHeader,
       
   572 														  aDirection);
       
   573 			if (removed)
       
   574 				{
       
   575 				pCurrentElement->iLink.Deque();
       
   576 				delete reinterpret_cast<CCallbackCommand*>(
       
   577 					const_cast<TAny*>(pCurrentElement->ipInfo));
       
   578 				delete pCurrentElement;
       
   579 				DEBUG_PRINTF2(_L8("RCallbackManagerQueue::RemoveBufferDoneCbCommandsByBufferHeader : Removed Buffer Done @ Header [%X]"), apBufferHeader);
       
   580 				return ETrue;
       
   581 				}
       
   582 			}
       
   583 		while (pCurrentElement != pLastElement);
       
   584 		}
       
   585 
       
   586 	return EFalse;
       
   587 
       
   588 	}
       
   589 
       
   590 TBool
       
   591 COmxILCallbackManager::RCallbackManagerQueue::RemoveBufferDoneCbCommandsByPortIndex(
       
   592 	COmxILCallbackManager& aCbMgr,
       
   593 	OMX_U32 aLocalPortIndex)
       
   594 	{
       
   595     DEBUG_PRINTF2(_L8("RCallbackManagerQueue::RemoveBufferDoneCbCommandsByPortIndex : Handle[%X]"), aCbMgr.ipHandle);
       
   596 
       
   597 	TBool somethingRemoved = EFalse;
       
   598 
       
   599 	if (KErrNone != DrainBackQueue())
       
   600 		{
       
   601 		aCbMgr.HandleInsufficientResources();
       
   602 		return EFalse;
       
   603 		}
       
   604 
       
   605 	if(!iFrontQueue.IsEmpty())
       
   606 		{
       
   607 		TBool removed = EFalse;
       
   608 		TDblQueIter<TFrontQueueElement> frontQueueIter(iFrontQueue);
       
   609 		TFrontQueueElement* pLastElement = iFrontQueue.Last();
       
   610 		TFrontQueueElement* pCurrentElement = 0;
       
   611 
       
   612 		do
       
   613 			{
       
   614 			pCurrentElement = frontQueueIter++;
       
   615 			__ASSERT_DEBUG(pCurrentElement && pCurrentElement->ipInfo,
       
   616 						   User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
   617 			removed = reinterpret_cast<CCallbackCommand*>(
       
   618 				const_cast<TAny*>(pCurrentElement->ipInfo))->
       
   619 				DoRemoveBufferDoneCbCommandByPortIndex(aCbMgr,
       
   620 													   aLocalPortIndex);
       
   621 			if (removed)
       
   622 				{
       
   623 				somethingRemoved = ETrue;
       
   624 				pCurrentElement->iLink.Deque();
       
   625 				delete reinterpret_cast<CCallbackCommand*>(
       
   626 					const_cast<TAny*>(pCurrentElement->ipInfo));
       
   627 				delete pCurrentElement;
       
   628 				DEBUG_PRINTF2(_L8("RCallbackManagerQueue::RemoveBufferDoneCbCommandsByPortIndex : Removed Buffer Done @ Port Index [%d]"), aLocalPortIndex);
       
   629 				}
       
   630 			}
       
   631 		while (pCurrentElement != pLastElement);
       
   632 		}
       
   633 
       
   634 	return somethingRemoved;
       
   635 
       
   636 	}
       
   637 
       
   638 
       
   639 TBool
       
   640 COmxILCallbackManager::RCallbackManagerQueue::ExecuteBufferDoneCbCommandsByPortIndex(
       
   641 	COmxILCallbackManager& aCbMgr,
       
   642 	OMX_U32 aLocalPortIndex)
       
   643 	{
       
   644     DEBUG_PRINTF2(_L8("RCallbackManagerQueue::ExecuteBufferDoneCbCommandsByPortIndex : Handle[%X]"), aCbMgr.ipHandle);
       
   645 
       
   646 	TBool somethingExecuted = EFalse;
       
   647 
       
   648 	if (KErrNone != DrainBackQueue())
       
   649 		{
       
   650 		aCbMgr.HandleInsufficientResources();
       
   651 		return EFalse;
       
   652 		}
       
   653 
       
   654 	if(!iFrontQueue.IsEmpty())
       
   655 		{
       
   656 		TBool executed = EFalse;
       
   657 		TDblQueIter<TFrontQueueElement> frontQueueIter(iFrontQueue);
       
   658 		TFrontQueueElement* pLastElement = iFrontQueue.Last();
       
   659 		TFrontQueueElement* pCurrentElement = 0;
       
   660 
       
   661 		do
       
   662 			{
       
   663 			pCurrentElement = frontQueueIter++;
       
   664 			__ASSERT_DEBUG(pCurrentElement && pCurrentElement->ipInfo,
       
   665 						   User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
   666 			executed = reinterpret_cast<CCallbackCommand*>(
       
   667 				const_cast<TAny*>(pCurrentElement->ipInfo))->
       
   668 				DoExecuteBufferDoneCbCommandByPortIndex(aCbMgr,
       
   669 														aLocalPortIndex);
       
   670 			if (executed)
       
   671 				{
       
   672 				somethingExecuted = ETrue;
       
   673 				pCurrentElement->iLink.Deque();
       
   674 				delete reinterpret_cast<CCallbackCommand*>(
       
   675 					const_cast<TAny*>(pCurrentElement->ipInfo));
       
   676 				delete pCurrentElement;
       
   677 				DEBUG_PRINTF2(_L8("RCallbackManagerQueue::ExecuteBufferDoneCbCommandsByPortIndex : Executed Buffer Done @ Port Index [%d]"), aLocalPortIndex);
       
   678 				}
       
   679 			}
       
   680 		while (pCurrentElement != pLastElement);
       
   681 		}
       
   682 
       
   683 	return somethingExecuted;
       
   684 
       
   685 	}
       
   686 
       
   687 
       
   688 //
       
   689 // COmxILCallbackManager commands
       
   690 //
       
   691 
       
   692 TBool
       
   693 COmxILCallbackManager::CCallbackCommand::DoRemoveBufferDoneCbCommandByBufferHeader(
       
   694 	COmxILCallbackManager& /*aCbMgr*/,
       
   695 	const OMX_BUFFERHEADERTYPE* /*apBufferHeader*/,
       
   696 	OMX_DIRTYPE /*aDirection*/)
       
   697 	{
       
   698 	return EFalse;
       
   699 	}
       
   700 
       
   701 TBool
       
   702 COmxILCallbackManager::CCallbackCommand::DoRemoveBufferDoneCbCommandByPortIndex(
       
   703 	COmxILCallbackManager& /*aCbMgr*/,
       
   704 	OMX_U32 /* aLocalPortIndex */)
       
   705 	{
       
   706 	return EFalse;
       
   707 	}
       
   708 
       
   709 TBool
       
   710 COmxILCallbackManager::CCallbackCommand::DoExecuteBufferDoneCbCommandByPortIndex(
       
   711 	COmxILCallbackManager& /*aCbMgr*/,
       
   712 	OMX_U32 /* aLocalPortIndex */)
       
   713 	{
       
   714 	return EFalse;
       
   715 	}
       
   716 
       
   717 void
       
   718 COmxILCallbackManager::CCompHandleRegistrationCommand::operator()(
       
   719 	COmxILCallbackManager& aCbMgr, TBool& /* aHasBeenDeferred */)
       
   720 	{
       
   721     DEBUG_PRINTF2(_L8("CCompHandleRegistrationCommand::operator() : Handle[%X]"), aCbMgr.ipHandle);
       
   722 	aCbMgr.DoRegisterComponentHandle(ipHandle);
       
   723 	}
       
   724 
       
   725 void
       
   726 COmxILCallbackManager::CClientCallbacksRegistrationCommand::operator()(
       
   727 	COmxILCallbackManager& aCbMgr, TBool& /* aHasBeenDeferred */)
       
   728 	{
       
   729     DEBUG_PRINTF2(_L8("CClientCallbacksRegistrationCommand::operator() : Handle[%X]"), aCbMgr.ipHandle);
       
   730 	aCbMgr.DoRegisterILClientCallbacks(ipCallbacks, ipAppData);
       
   731 	}
       
   732 
       
   733 void
       
   734 COmxILCallbackManager::CBufferMarkPropagationRegistrationCommand::operator()(
       
   735 	COmxILCallbackManager& aCbMgr, TBool& /* aHasBeenDeferred */)
       
   736 	{
       
   737     DEBUG_PRINTF2(_L8("CBufferMarkPropagationRegistrationCommand::operator() : Handle[%X]"), aCbMgr.ipHandle);
       
   738 
       
   739 	OMX_ERRORTYPE omxError =
       
   740 		aCbMgr.DoRegisterBufferMarkPropagationPort(
       
   741 			iMarkPropagationInfo.iPortIndex,
       
   742 			iMarkPropagationInfo.iPropagationPortIndex);
       
   743 
       
   744 	if (OMX_ErrorInsufficientResources == omxError)
       
   745 		{
       
   746 		aCbMgr.HandleInsufficientResources();
       
   747 		}
       
   748 	}
       
   749 
       
   750 void
       
   751 COmxILCallbackManager::CBufferRemovalCommand::operator()(
       
   752 	COmxILCallbackManager& aCbMgr, TBool& /* aHasBeenDeferred */)
       
   753 	{
       
   754     DEBUG_PRINTF2(_L8("CBufferRemovalCommand::operator() : Handle[%X]"), aCbMgr.ipHandle);
       
   755 
       
   756 	// Returned value not relevant
       
   757 	aCbMgr.iPendingQueue.RemoveBufferDoneCbCommandsByBufferHeader(
       
   758 		aCbMgr,
       
   759 		ipBufferHeader,
       
   760 		iDirection);
       
   761 
       
   762 	// Returned value not relevant
       
   763 	aCbMgr.iCommandQueue.RemoveBufferDoneCbCommandsByBufferHeader(
       
   764 		aCbMgr,
       
   765 		ipBufferHeader,
       
   766 		iDirection);
       
   767 
       
   768 
       
   769 	}
       
   770 
       
   771 void
       
   772 COmxILCallbackManager::CTunnelCallbackRegistrationCommand::operator()(
       
   773 	COmxILCallbackManager& aCbMgr, TBool& /* aHasBeenDeferred */)
       
   774 	{
       
   775     DEBUG_PRINTF2(_L8("CTunnelCallbackRegistrationCommand::operator() : Handle[%X]"), aCbMgr.ipHandle);
       
   776 
       
   777 	if (!iTunnelInfo.iTunnelledComponentHandle)
       
   778 		{
       
   779 		// This is a tunnel deregistration command, then remove any pending
       
   780 		// callbacks on that tunnel...
       
   781 		aCbMgr.iCommandQueue.RemoveBufferDoneCbCommandsByPortIndex(
       
   782 			aCbMgr,
       
   783 			iTunnelInfo.iLocalPortIndex);
       
   784 		}
       
   785 
       
   786 	OMX_ERRORTYPE omxError =
       
   787 		aCbMgr.DoRegisterTunnelCallback(iTunnelInfo.iLocalPortIndex,
       
   788 										iTunnelInfo.iLocalPortDirection,
       
   789 										iTunnelInfo.iTunnelledComponentHandle,
       
   790 										iTunnelInfo.iTunnelledPortIndex);
       
   791 
       
   792 	if (OMX_ErrorInsufficientResources == omxError)
       
   793 		{
       
   794 		aCbMgr.HandleInsufficientResources();
       
   795 		}
       
   796 
       
   797 	}
       
   798 
       
   799 
       
   800 void
       
   801 COmxILCallbackManager::CEventCallbackCommand::operator()(
       
   802 	COmxILCallbackManager& aCbMgr, TBool& /* aHasBeenDeferred */)
       
   803 	{
       
   804     DEBUG_PRINTF2(_L8("CEventCallbackCommand::operator() : Handle[%X]"), aCbMgr.ipHandle);
       
   805 
       
   806 	OMX_ERRORTYPE omxError = OMX_ErrorNone;
       
   807 	switch(iData1)
       
   808 		{
       
   809 	case OMX_CommandStateSet:
       
   810 		{
       
   811 		aCbMgr.iPreviousState = aCbMgr.iCurrentState;
       
   812 		aCbMgr.iCurrentState  = static_cast<OMX_STATETYPE>(iData2);
       
   813 
       
   814 		DEBUG_PRINTF4(_L8("CEventCallbackCommand::operator() : Handle[%X] iPreviousState[%d] -> iCurrentState[%d]"), aCbMgr.ipHandle, aCbMgr.iPreviousState, aCbMgr.iCurrentState);
       
   815 
       
   816 		if (OMX_StatePause == aCbMgr.iPreviousState &&
       
   817 			OMX_StateIdle == aCbMgr.iCurrentState)
       
   818 			{
       
   819 			// Flush pending queue first...
       
   820 			aCbMgr.ProcessQueue(aCbMgr.iPendingQueue);
       
   821 
       
   822 			// ... and now signal command completion...
       
   823 			omxError =
       
   824 				aCbMgr.DoEventNotification(iEvent,
       
   825 										   iData1,
       
   826 										   iData2,
       
   827 										   iExtraInfo);
       
   828 
       
   829 			}
       
   830 		else if (OMX_StatePause == aCbMgr.iPreviousState &&
       
   831 			OMX_StateExecuting == aCbMgr.iCurrentState)
       
   832 			{
       
   833 			// Signal command completion first...
       
   834 			omxError =
       
   835 				aCbMgr.DoEventNotification(iEvent,
       
   836 										   iData1,
       
   837 										   iData2,
       
   838 										   iExtraInfo);
       
   839 
       
   840 			// ... and now flush...
       
   841 			aCbMgr.ProcessQueue(aCbMgr.iPendingQueue);
       
   842 
       
   843 			}
       
   844 		else
       
   845 			{
       
   846 			// Signal command completion...
       
   847 			omxError =
       
   848 				aCbMgr.DoEventNotification(iEvent,
       
   849 										   iData1,
       
   850 										   iData2,
       
   851 										   iExtraInfo);
       
   852 
       
   853 			}
       
   854 
       
   855 		}
       
   856 		break;
       
   857 
       
   858 	case OMX_CommandPortDisable:
       
   859 	case OMX_CommandFlush:
       
   860 		{
       
   861 		// Process pending queue unconditionally...
       
   862 		aCbMgr.iFlushPendingQueue = ETrue;
       
   863 
       
   864 		// Flush first...
       
   865 		if (OMX_ALL == iData2)
       
   866 			{
       
   867 			aCbMgr.ProcessQueue(aCbMgr.iPendingQueue);
       
   868 			}
       
   869 		else
       
   870 			{
       
   871 			aCbMgr.iPendingQueue.
       
   872 				ExecuteBufferDoneCbCommandsByPortIndex(aCbMgr,
       
   873 													   iData2);
       
   874 
       
   875 			}
       
   876 
       
   877 		aCbMgr.iFlushPendingQueue = EFalse;
       
   878 
       
   879 		// ... and now signal command completion...
       
   880 		omxError =
       
   881 			aCbMgr.DoEventNotification(iEvent,
       
   882 									   iData1,
       
   883 									   iData2,
       
   884 									   iExtraInfo);
       
   885 
       
   886 		}
       
   887 		break;
       
   888 
       
   889 	default:
       
   890 		{
       
   891 		// Signal command completion...
       
   892 		omxError =
       
   893 			aCbMgr.DoEventNotification(iEvent,
       
   894 									   iData1,
       
   895 									   iData2,
       
   896 									   iExtraInfo);
       
   897 
       
   898 		}
       
   899 
       
   900 		};
       
   901 
       
   902 	if (OMX_ErrorInsufficientResources == omxError)
       
   903 		{
       
   904 		aCbMgr.HandleInsufficientResources();
       
   905 		}
       
   906 
       
   907 	}
       
   908 
       
   909 
       
   910 void
       
   911 COmxILCallbackManager::CBufferDoneCallbackCommand::operator()(
       
   912 	COmxILCallbackManager& aCbMgr, TBool& aHasBeenDeferred)
       
   913 	{
       
   914     DEBUG_PRINTF2(_L8("CBufferDoneCallbackCommand::operator() : Handle[%X]"), aCbMgr.ipHandle);
       
   915 
       
   916 	// Only send the buffer done callback if is not in Pause stae or if there
       
   917 	// is a buffer flushing situation...
       
   918 
       
   919 	if ((OMX_StatePause == aCbMgr.iCurrentState) &&
       
   920 		(!aCbMgr.iFlushPendingQueue))
       
   921 		{
       
   922 		aHasBeenDeferred = ETrue;
       
   923 		return;
       
   924 		}
       
   925 
       
   926 	OMX_ERRORTYPE omxError =
       
   927 		aCbMgr.DoBufferDoneNotification(ipBufferHeader,
       
   928 										iLocalPortIndex,
       
   929 										iLocalPortDirection);
       
   930 
       
   931 	if (OMX_ErrorInsufficientResources == omxError)
       
   932 		{
       
   933 		aCbMgr.HandleInsufficientResources();
       
   934 		}
       
   935 
       
   936 	}
       
   937 
       
   938 TBool
       
   939 COmxILCallbackManager::CBufferDoneCallbackCommand::DoRemoveBufferDoneCbCommandByBufferHeader(
       
   940 	COmxILCallbackManager& aCbMgr,
       
   941 	const OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   942 	OMX_DIRTYPE aDirection)
       
   943 	{
       
   944 
       
   945 	if (apBufferHeader == ipBufferHeader)
       
   946 		{
       
   947 		__ASSERT_DEBUG(aCbMgr.ipFsm,
       
   948 					   User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
   949 		__ASSERT_DEBUG(aDirection == OMX_DirInput ||
       
   950 					   aDirection == OMX_DirOutput,
       
   951 					   User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
   952 
       
   953 		DEBUG_PRINTF4(_L8("DoRemoveBufferDoneCbCommandByBufferHeader() : Nofiying FSM : Handle[%X] aDirection[%X] apBufferHeader[%X]"), aCbMgr.ipHandle, aDirection, apBufferHeader);
       
   954 
       
   955 		// Make sure the buffer contents are cleared...
       
   956 		TOmxILUtil::ClearBufferContents(
       
   957 			const_cast<OMX_BUFFERHEADERTYPE*>(apBufferHeader));
       
   958 
       
   959 		if (aDirection == OMX_DirInput)
       
   960 			{
       
   961 			aCbMgr.ipFsm->EmptyThisBuffer(
       
   962 				const_cast<OMX_BUFFERHEADERTYPE*>(apBufferHeader));
       
   963 			}
       
   964 		else
       
   965 			{
       
   966 			aCbMgr.ipFsm->FillThisBuffer(
       
   967 				const_cast<OMX_BUFFERHEADERTYPE*>(apBufferHeader));
       
   968 			}
       
   969 		return ETrue;
       
   970 		}
       
   971 
       
   972 	return EFalse;
       
   973 
       
   974 	}
       
   975 
       
   976 //
       
   977 // This method only prints some logging information for debugging purposes. For
       
   978 // now, there's no other action to be performed as the deletion is done by the caller.
       
   979 //
       
   980 TBool
       
   981 COmxILCallbackManager::CBufferDoneCallbackCommand::DoRemoveBufferDoneCbCommandByPortIndex(
       
   982 	COmxILCallbackManager& /* aCbMgr */,
       
   983 	OMX_U32 aLocalPortIndex)
       
   984 	{
       
   985 
       
   986 	if (iLocalPortIndex == aLocalPortIndex)
       
   987 		{
       
   988 		DEBUG_PRINTF2(_L8("CBufferDoneCallbackCommand::DoRemoveBufferDoneCbCommandByPortIndex() : FOUND -> PortIndex[%d]"), aLocalPortIndex);
       
   989 		return ETrue;
       
   990 		}
       
   991 
       
   992     DEBUG_PRINTF2(_L8("CBufferDoneCallbackCommand::DoRemoveBufferDoneCbCommandByPortIndex() : NOT FOUND -> PortIndex[%d]"), aLocalPortIndex);
       
   993 
       
   994 	return EFalse;
       
   995 	}
       
   996 
       
   997 
       
   998 TBool
       
   999 COmxILCallbackManager::CBufferDoneCallbackCommand::DoExecuteBufferDoneCbCommandByPortIndex(
       
  1000 	COmxILCallbackManager& aCbMgr,
       
  1001 	OMX_U32 aLocalPortIndex)
       
  1002 	{
       
  1003 
       
  1004 	TBool executed = EFalse;
       
  1005 
       
  1006 	if (iLocalPortIndex == aLocalPortIndex)
       
  1007 		{
       
  1008 		TBool hasBeenDeferred = EFalse;
       
  1009 		// The only use case for this method is during unconditional flushing
       
  1010 		// of the pending queue...
       
  1011 		__ASSERT_DEBUG(aCbMgr.iFlushPendingQueue,
       
  1012 					   User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
  1013 		this->operator()(aCbMgr, hasBeenDeferred);
       
  1014 		__ASSERT_DEBUG(!hasBeenDeferred,
       
  1015 					   User::Panic(KOmxILCallbackManagerPanicCategory, 1));
       
  1016 		executed = ETrue;
       
  1017 		}
       
  1018 
       
  1019 	DEBUG_PRINTF3(_L8("CBufferDoneCallbackCommand::DoExecuteBufferDoneCbCommandByPortIndex() : %s FOUND  -> PortIndex[%d]"),
       
  1020 				  (executed ? "" : "NOT"), aLocalPortIndex);
       
  1021 
       
  1022 	return executed;
       
  1023 
       
  1024 	}
       
  1025 
       
  1026 
       
  1027 TBool
       
  1028 XOmxILCallbackManagerIfImpl::TBufferMarkPropagationInfo::Compare(
       
  1029 	const TBufferMarkPropagationInfo& aBmpi1,
       
  1030 	const TBufferMarkPropagationInfo& aBmpi2)
       
  1031 	{
       
  1032 	return (aBmpi1.iPortIndex == aBmpi2.iPortIndex ? ETrue : EFalse);
       
  1033 	}
       
  1034 
       
  1035 TBool
       
  1036 XOmxILCallbackManagerIfImpl::TOutputPortBufferMarkInfo::Compare(
       
  1037 	const TOutputPortBufferMarkInfo& aOpbmi1,
       
  1038 	const TOutputPortBufferMarkInfo& aOpbmi2)
       
  1039 	{
       
  1040 	return (aOpbmi1.iPortIndex == aOpbmi2.iPortIndex ? ETrue : EFalse);
       
  1041 	}
       
  1042 
       
  1043 COmxILCallbackManager::CPortSettingsChangeCommand::~CPortSettingsChangeCommand()
       
  1044 	{
       
  1045 	delete ipPortSettings;
       
  1046 	}
       
  1047 
       
  1048 void
       
  1049 COmxILCallbackManager::CPortSettingsChangeCommand::operator()(
       
  1050 	COmxILCallbackManager& aCbMgr, TBool& /* aHasBeenDeferred */)
       
  1051 	{
       
  1052     DEBUG_PRINTF3(_L8("CPortSettingsChangeCommand::operator() : Handle[%X], iLocalPortIndex=[%d]"),
       
  1053 				  aCbMgr.ipHandle, iLocalPortIndex);
       
  1054 
       
  1055 	OMX_ERRORTYPE omxError =
       
  1056 		aCbMgr.DoPortSettingsChangeNotification(iLocalPortIndex,
       
  1057 												iPortSettingsIndex,
       
  1058 												*ipPortSettings);
       
  1059 
       
  1060 	if (OMX_ErrorInsufficientResources == omxError)
       
  1061 		{
       
  1062 		aCbMgr.HandleInsufficientResources();
       
  1063 		}
       
  1064 
       
  1065 	}
       
  1066 
       
  1067 #ifdef _OMXIL_COMMON_IL516C_ON	
       
  1068 void
       
  1069 COmxILCallbackManager::CEjectBuffersRequestCommand::operator()(
       
  1070 	COmxILCallbackManager& aCbMgr, TBool& /* aHasBeenDeferred */)
       
  1071 	{
       
  1072     DEBUG_PRINTF3(_L8("CEjectBuffersRequestCommand::operator() : Handle[%X], iLocalOmxPortIndex=[%u]"),
       
  1073 				  aCbMgr.ipHandle, iLocalOmxPortIndex);
       
  1074 
       
  1075 	OMX_ERRORTYPE omxError =
       
  1076 		aCbMgr.DoEjectBuffersRequest(iLocalOmxPortIndex);
       
  1077 
       
  1078 	if (OMX_ErrorInsufficientResources == omxError)
       
  1079 		{
       
  1080 		aCbMgr.HandleInsufficientResources();
       
  1081 		}
       
  1082 
       
  1083 	}
       
  1084 #endif //_OMXIL_COMMON_IL516C_ON