omxil_generic/omxilcomplib/src/omxilcomponentimpl.cpp
changeset 0 0e4a32b9112d
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  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #include <openmax/il/khronos/v1_x/OMX_Types.h>
       
    22 #include "omxilindexmanager.h"
       
    23 #include "omxilportmanager.h"
       
    24 #include "omxilcallbackmanager.h"
       
    25 #include "omxilincontextcallbackmanager.h"
       
    26 #include <openmax/il/common/omxilconfigmanager.h>
       
    27 #include <openmax/il/common/omxilprocessingfunction.h>
       
    28 #include <openmax/il/common/omxilstatedefs.h>
       
    29 #include <openmax/il/common/omxilcomponent.h>
       
    30 #include "omxilcomponentimpl.h"
       
    31 #include "omxilfsm.h"
       
    32 #include "log.h"
       
    33 
       
    34 COmxILComponentImpl* COmxILComponentImpl::NewL(COmxILComponent* aComponent, OMX_HANDLETYPE aHandle)
       
    35 	{
       
    36 	if (aComponent==0 || aHandle==0)
       
    37 		{
       
    38 		User::Leave(KErrArgument);
       
    39 		}
       
    40 	COmxILComponentImpl* self=new(ELeave) COmxILComponentImpl(aComponent, aHandle);
       
    41 	return self;		
       
    42 	}
       
    43 
       
    44 COmxILComponentImpl::COmxILComponentImpl(COmxILComponent* aComponent, OMX_HANDLETYPE aHandle)
       
    45 	: 	ipComponent(aComponent),
       
    46 		iComponentName(0),
       
    47 		ipHandle(static_cast<OMX_COMPONENTTYPE*>(aHandle)),
       
    48 		ipAppData(0),
       
    49 		ipCallbacks(0),
       
    50 		ipFsm(0),
       
    51 		ipConfigManager(0),
       
    52 		ipCallbackManager(0),
       
    53 		ipPortManager(0),
       
    54 		ipProcessingFunction(0)
       
    55 	{
       
    56 	DEBUG_PRINTF3(_L8("COmxILComponentImpl::COmxILComponentImpl : Comp[%X], Handle[%X]"), aComponent, ipHandle);
       
    57 	}
       
    58 
       
    59 COmxILComponentImpl::~COmxILComponentImpl()
       
    60 	{
       
    61     DEBUG_PRINTF2(_L8("COmxILComponentImpl::~COmxILComponentImpl : Handle[%X]"), ipHandle);
       
    62 	delete ipProcessingFunction;
       
    63 	delete ipPortManager;
       
    64 	delete ipConfigManager;
       
    65 	delete ipFsm;
       
    66 	delete ipCallbackManager;	
       
    67 	iComponentName.Close();
       
    68 	}
       
    69 
       
    70 OMX_ERRORTYPE
       
    71 COmxILComponentImpl::GetComponentVersion(
       
    72 	OMX_HANDLETYPE aComponent,
       
    73 	OMX_STRING aComponentName,
       
    74 	OMX_VERSIONTYPE* apComponentVersion,
       
    75 	OMX_VERSIONTYPE* apSpecVersion,
       
    76 	OMX_UUIDTYPE* apComponentUUID)
       
    77 	{
       
    78 	DEBUG_PRINTF2(_L8("COmxILComponentImpl::GetComponentVersion : Handle[%X]"), aComponent);
       
    79     OMX_ERRORTYPE omxError;
       
    80     omxError = (static_cast<COmxILFsm*>
       
    81 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
    82 		GetComponentVersion(aComponentName, apComponentVersion,
       
    83 							apSpecVersion, apComponentUUID);
       
    84     return omxError;
       
    85 	}
       
    86 
       
    87 OMX_ERRORTYPE
       
    88 COmxILComponentImpl::SendCommand(
       
    89 	OMX_HANDLETYPE aComponent,
       
    90 	OMX_COMMANDTYPE aCmd,
       
    91 	OMX_U32 aParam1,
       
    92 	OMX_PTR aCmdData)
       
    93 	{
       
    94     DEBUG_PRINTF2(_L8("COmxILComponentImpl::SendCommand : Handle[%X]"), aComponent);
       
    95     OMX_ERRORTYPE omxError;
       
    96 	omxError =  (static_cast<COmxILFsm*>
       
    97 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
    98 		SendCommand(aCmd ,aParam1, aCmdData);
       
    99 	
       
   100 	return omxError;
       
   101 	}
       
   102 
       
   103 OMX_ERRORTYPE
       
   104 COmxILComponentImpl::GetParameter(
       
   105 	OMX_HANDLETYPE aComponent,
       
   106 	OMX_INDEXTYPE aParamIndex,
       
   107 	OMX_PTR aComponentParameterStructure)
       
   108 	{
       
   109     DEBUG_PRINTF3(_L8("COmxILComponentImpl::GetParameter : Handle[%X]; ParamIndex[0x%X]"), aComponent, aParamIndex);
       
   110     
       
   111     OMX_ERRORTYPE omxError;
       
   112 	omxError = (static_cast<COmxILFsm*>
       
   113 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   114 		GetParameter(aParamIndex, aComponentParameterStructure);
       
   115 	
       
   116 	return omxError;
       
   117 	}
       
   118 
       
   119 OMX_ERRORTYPE
       
   120 COmxILComponentImpl::SetParameter(
       
   121 	OMX_HANDLETYPE aComponent,
       
   122 	OMX_INDEXTYPE aIndex,
       
   123 	OMX_PTR aComponentParameterStructure)
       
   124 	{
       
   125     DEBUG_PRINTF3(_L8("COmxILComponentImpl::SetParameter : Handle[%X]; ParamIndex[0x%X]"), aComponent, aIndex);
       
   126     
       
   127     OMX_ERRORTYPE omxError;
       
   128 	omxError = (static_cast<COmxILFsm*>
       
   129 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   130 		SetParameter(aIndex,
       
   131 					 const_cast<const TAny*>(aComponentParameterStructure));
       
   132 
       
   133 	return omxError;
       
   134 	}
       
   135 
       
   136 OMX_ERRORTYPE
       
   137 COmxILComponentImpl::GetConfig(
       
   138 	OMX_HANDLETYPE aComponent,
       
   139 	OMX_INDEXTYPE aIndex,
       
   140 	OMX_PTR aComponentParameterStructure)
       
   141 	{
       
   142     DEBUG_PRINTF3(_L8("COmxILComponentImpl::GetConfig : Handle[%X]; ConfigIndex[0x%X]"), aComponent, aIndex);
       
   143     OMX_ERRORTYPE omxError;
       
   144 	omxError = (static_cast<COmxILFsm*>
       
   145 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   146 		GetConfig(aIndex, aComponentParameterStructure);
       
   147 	return omxError;
       
   148 	}
       
   149 
       
   150 OMX_ERRORTYPE
       
   151 COmxILComponentImpl::SetConfig(
       
   152 	OMX_HANDLETYPE aComponent,
       
   153 	OMX_INDEXTYPE aIndex,
       
   154 	OMX_PTR aComponentConfigStructure)
       
   155 	{
       
   156     DEBUG_PRINTF3(_L8("COmxILComponentImpl::SetConfig : Handle[%X]; ConfigIndex[0x%X]"), aComponent, aIndex);
       
   157     OMX_ERRORTYPE omxError;
       
   158 	omxError = (static_cast<COmxILFsm*>
       
   159 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   160 		SetConfig(aIndex, const_cast<const TAny*>(aComponentConfigStructure));
       
   161 	return omxError;
       
   162 	}
       
   163 
       
   164 OMX_ERRORTYPE
       
   165 COmxILComponentImpl::GetExtensionIndex(
       
   166 	OMX_HANDLETYPE aComponent,
       
   167 	OMX_STRING aParameterName,
       
   168 	OMX_INDEXTYPE* aIndexType)
       
   169 	{
       
   170     DEBUG_PRINTF2(_L8("COmxILComponentImpl::GetExtensionIndex : Handle[%X]"), aComponent);
       
   171     OMX_ERRORTYPE omxError;
       
   172 	omxError = (static_cast<COmxILFsm*>
       
   173 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   174 		GetExtensionIndex(aParameterName, aIndexType);
       
   175 	return omxError;
       
   176 	}
       
   177 
       
   178 OMX_ERRORTYPE
       
   179 COmxILComponentImpl::GetState(
       
   180 	OMX_HANDLETYPE aComponent,
       
   181 	OMX_STATETYPE* aState)
       
   182 	{
       
   183     DEBUG_PRINTF2(_L8("COmxILComponentImpl::GetState : Handle[%X]"), aComponent);
       
   184     OMX_ERRORTYPE omxError;
       
   185     omxError = (static_cast<COmxILFsm*>
       
   186 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   187 		GetState(aState);
       
   188     return omxError;
       
   189 	}
       
   190 
       
   191 OMX_ERRORTYPE
       
   192 COmxILComponentImpl::ComponentTunnelRequest(
       
   193 	OMX_HANDLETYPE aComponent,
       
   194 	OMX_U32 aPort,
       
   195 	OMX_HANDLETYPE aTunneledComp,
       
   196 	OMX_U32 aTunneledPort,
       
   197 	OMX_TUNNELSETUPTYPE* aTunnelSetup)
       
   198 	{
       
   199     DEBUG_PRINTF2(_L8("COmxILComponentImpl::ComponentTunnelRequest : Handle[%X]"), aComponent);
       
   200     OMX_ERRORTYPE omxError;
       
   201 	omxError = (static_cast<COmxILFsm*>
       
   202 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   203 		ComponentTunnelRequest(aPort, aTunneledComp,
       
   204 							   aTunneledPort, aTunnelSetup);
       
   205 	return omxError;
       
   206 	}
       
   207 
       
   208 OMX_ERRORTYPE
       
   209 COmxILComponentImpl::UseBuffer(
       
   210 	OMX_HANDLETYPE aComponent,
       
   211 	OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   212 	OMX_U32 aPortIndex,
       
   213 	OMX_PTR apAppPrivate,
       
   214 	OMX_U32 aSizeBytes,
       
   215 	OMX_U8* aBuffer)
       
   216 	{
       
   217     DEBUG_PRINTF2(_L8("COmxILComponentImpl::UseBuffer : Handle[%X]"), aComponent);
       
   218     OMX_ERRORTYPE omxError;
       
   219     omxError = (static_cast<COmxILFsm*>
       
   220 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   221 		UseBuffer(appBufferHdr, aPortIndex, apAppPrivate, aSizeBytes, aBuffer);
       
   222     return omxError;
       
   223 	}
       
   224 
       
   225 OMX_ERRORTYPE
       
   226 COmxILComponentImpl::AllocateBuffer(
       
   227 	OMX_HANDLETYPE aComponent,
       
   228 	OMX_BUFFERHEADERTYPE** apBuffer,
       
   229 	OMX_U32 aPortIndex,
       
   230 	OMX_PTR aAppData,
       
   231 	OMX_U32 aSizeBytes)
       
   232 	{
       
   233     DEBUG_PRINTF2(_L8("COmxILComponentImpl::AllocateBuffer : Handle[%X]"), aComponent);
       
   234     OMX_ERRORTYPE omxError;
       
   235     omxError = (static_cast<COmxILFsm*>
       
   236 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   237 		AllocateBuffer(apBuffer, aPortIndex, aAppData, aSizeBytes);
       
   238     return omxError;
       
   239 	}
       
   240 
       
   241 OMX_ERRORTYPE
       
   242 COmxILComponentImpl::FreeBuffer(
       
   243 	OMX_HANDLETYPE aComponent,
       
   244 	OMX_U32 aPortIndex,
       
   245 	OMX_BUFFERHEADERTYPE* aBuffer)
       
   246 	{
       
   247     DEBUG_PRINTF2(_L8("COmxILComponentImpl::FreeBuffer : Handle[%X]"), aComponent);
       
   248     OMX_ERRORTYPE omxError;
       
   249     omxError = (static_cast<COmxILFsm*>
       
   250 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   251 		FreeBuffer(aPortIndex, aBuffer);
       
   252     return omxError;
       
   253 	}
       
   254 
       
   255 OMX_ERRORTYPE
       
   256 COmxILComponentImpl::EmptyThisBuffer(
       
   257 	OMX_HANDLETYPE aComponent,
       
   258 	OMX_BUFFERHEADERTYPE* aBuffer)
       
   259 	{
       
   260     DEBUG_PRINTF2(_L8("COmxILComponentImpl::EmptyThisBuffer : Handle[%X]"), aComponent);
       
   261 #ifdef _OMXIL_COMMON_BUFFER_TRACING_ON
       
   262 	RDebug::Print(_L("COmxILComponentImpl::EmptyThisBuffer component=0x%08X header=0x%08X port=%d flags=0x%X filledLen=%d timeStamp=%Ld"),
       
   263 		aComponent, aBuffer, aBuffer->nInputPortIndex, aBuffer->nFlags, aBuffer->nFilledLen, aBuffer->nTimeStamp);
       
   264 #endif
       
   265 	OMX_ERRORTYPE omxError;
       
   266 	omxError =  (static_cast<COmxILFsm*>
       
   267 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   268 		EmptyThisBuffer(aBuffer);
       
   269 	
       
   270 	return omxError;
       
   271 	}
       
   272 
       
   273 OMX_ERRORTYPE
       
   274 COmxILComponentImpl::FillThisBuffer(
       
   275 	OMX_HANDLETYPE aComponent,
       
   276 	OMX_BUFFERHEADERTYPE* aBuffer)
       
   277 	{
       
   278     DEBUG_PRINTF2(_L8("COmxILComponentImpl::FillThisBuffer : Handle[%X]"), aComponent);
       
   279 #ifdef _OMXIL_COMMON_BUFFER_TRACING_ON
       
   280 	RDebug::Print(_L("COmxILComponentImpl::FillThisBuffer component=0x%08X header=0x%08X port=%d"), aComponent, aBuffer, aBuffer->nOutputPortIndex);
       
   281 #endif
       
   282 	
       
   283 	OMX_ERRORTYPE omxError;
       
   284 	omxError =  (static_cast<COmxILFsm*>
       
   285 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   286 		FillThisBuffer(aBuffer);
       
   287 	
       
   288 	return omxError;
       
   289 	}
       
   290 
       
   291 OMX_ERRORTYPE
       
   292 COmxILComponentImpl::SetCallbacks(
       
   293 	OMX_HANDLETYPE aComponent,
       
   294 	OMX_CALLBACKTYPE* aCallbacks,
       
   295 	OMX_PTR aAppData)
       
   296 	{	
       
   297     DEBUG_PRINTF2(_L8("COmxILComponentImpl::SetCallbacks : Handle[%X]"), aComponent);
       
   298     OMX_ERRORTYPE omxError;
       
   299 	omxError = (static_cast<COmxILFsm*>
       
   300 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   301 		SetCallbacks(const_cast<const OMX_CALLBACKTYPE*>(aCallbacks), aAppData);
       
   302 	if (OMX_ErrorNone==omxError)
       
   303 		{
       
   304 		(static_cast<OMX_COMPONENTTYPE*>(aComponent))->pApplicationPrivate = aAppData;
       
   305 		}
       
   306 	return omxError;
       
   307 	}
       
   308 
       
   309 OMX_ERRORTYPE
       
   310 COmxILComponentImpl::ComponentDeInit(
       
   311 	OMX_HANDLETYPE aComponent)
       
   312 	{
       
   313     DEBUG_PRINTF2(_L8("COmxILComponentImpl::ComponentDeInit : Handle[%X]"), aComponent);
       
   314 	delete (static_cast<COmxILComponent*>(
       
   315 				(static_cast<COmxILFsm*>(
       
   316 					(static_cast<OMX_COMPONENTTYPE*>(aComponent))->
       
   317 					pComponentPrivate))->GetComponent()));
       
   318 	return OMX_ErrorNone;
       
   319 	}
       
   320 
       
   321 OMX_ERRORTYPE
       
   322 COmxILComponentImpl::UseEGLImage(
       
   323 		OMX_HANDLETYPE aComponent,
       
   324 		OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   325 		OMX_U32 aPortIndex,
       
   326 		OMX_PTR aAppPrivate,
       
   327 		void* eglImage)
       
   328 	{
       
   329     DEBUG_PRINTF2(_L8("COmxILComponentImpl::UseEGLImage : Handle[%X]"), aComponent);
       
   330     OMX_ERRORTYPE omxError;
       
   331     omxError = (static_cast<COmxILFsm*>
       
   332 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   333 		UseEGLImage(appBufferHdr, aPortIndex, aAppPrivate, eglImage);
       
   334     return omxError;
       
   335 	}
       
   336 
       
   337 OMX_ERRORTYPE
       
   338 COmxILComponentImpl::ComponentRoleEnum(
       
   339 	OMX_HANDLETYPE aComponent,
       
   340 	OMX_U8* aRole,
       
   341 	OMX_U32 aIndex)
       
   342 	{
       
   343     DEBUG_PRINTF2(_L8("COmxILComponentImpl::ComponentRoleEnum : Handle[%X]"), aComponent);
       
   344     OMX_ERRORTYPE omxError;
       
   345     omxError = (static_cast<COmxILFsm*>
       
   346 			((static_cast<OMX_COMPONENTTYPE*>(aComponent))->pComponentPrivate))->
       
   347 		ComponentRoleEnum(aRole, aIndex);
       
   348     return omxError;
       
   349 	}
       
   350 
       
   351 void
       
   352 COmxILComponentImpl::InitComponentL()
       
   353 	{
       
   354     DEBUG_PRINTF2(_L8("COmxILComponentImpl::InitComponent : Handle[%X]"), ipHandle);
       
   355 	__ASSERT_ALWAYS(ipHandle && ipProcessingFunction && ipCallbackManager && ipPortManager && ipConfigManager, User::Panic(KOmxILComponentPanicCategory, 1));
       
   356 	ipFsm = COmxILFsm::NewL(*ipComponent,
       
   357 							*ipProcessingFunction,
       
   358 							*ipPortManager,
       
   359 							*ipConfigManager,
       
   360 							*ipCallbackManager);
       
   361 	
       
   362 	char componentNamebuffer[OMX_MAX_STRINGNAME_SIZE];
       
   363 	OMX_VERSIONTYPE componentVersion;
       
   364 	OMX_VERSIONTYPE specVersion;
       
   365 	OMX_UUIDTYPE componentUid;
       
   366 
       
   367 	ipConfigManager->GetComponentVersion(componentNamebuffer,
       
   368 										 &componentVersion,
       
   369 										 &specVersion,
       
   370 										 &componentUid);
       
   371 	TBuf8<128> componentNameBuf8;
       
   372 	componentNameBuf8 = const_cast<const TUint8*>(reinterpret_cast<TUint8*>(componentNamebuffer));
       
   373 	iComponentName.CreateL(componentNameBuf8, componentNameBuf8.Length() + 1);
       
   374 	iComponentName.PtrZ();
       
   375     DEBUG_PRINTF2(_L8("COmxILComponentImpl::InitComponent : [%S]"), &iComponentName);
       
   376 
       
   377 	// Fill in the component handle
       
   378 	ipHandle->nVersion				 = componentVersion;
       
   379 	// The FSM will take care of all the API calls
       
   380 	ipHandle->pComponentPrivate		 = ipFsm;
       
   381 	ipHandle->pApplicationPrivate	 = 0;
       
   382 	ipHandle->GetComponentVersion	 = COmxILComponentImpl::GetComponentVersion;
       
   383 	ipHandle->SendCommand			 = COmxILComponentImpl::SendCommand;
       
   384 	ipHandle->GetParameter			 = COmxILComponentImpl::GetParameter;
       
   385 	ipHandle->SetParameter			 = COmxILComponentImpl::SetParameter;
       
   386 	ipHandle->GetConfig				 = COmxILComponentImpl::GetConfig;
       
   387 	ipHandle->SetConfig				 = COmxILComponentImpl::SetConfig;
       
   388 	ipHandle->GetExtensionIndex		 = COmxILComponentImpl::GetExtensionIndex;
       
   389 	ipHandle->GetState				 = COmxILComponentImpl::GetState;
       
   390 	ipHandle->ComponentTunnelRequest = COmxILComponentImpl::ComponentTunnelRequest;
       
   391 	ipHandle->UseBuffer				 = COmxILComponentImpl::UseBuffer;
       
   392 	ipHandle->AllocateBuffer		 = COmxILComponentImpl::AllocateBuffer;
       
   393 	ipHandle->FreeBuffer			 = COmxILComponentImpl::FreeBuffer;
       
   394 	ipHandle->EmptyThisBuffer		 = COmxILComponentImpl::EmptyThisBuffer;
       
   395 	ipHandle->FillThisBuffer		 = COmxILComponentImpl::FillThisBuffer;
       
   396 	ipHandle->SetCallbacks			 = COmxILComponentImpl::SetCallbacks;
       
   397 	ipHandle->ComponentDeInit		 = COmxILComponentImpl::ComponentDeInit;
       
   398 	ipHandle->UseEGLImage			 = COmxILComponentImpl::UseEGLImage;
       
   399 	ipHandle->ComponentRoleEnum		 = COmxILComponentImpl::ComponentRoleEnum;
       
   400 
       
   401 	OMX_ERRORTYPE omxRetValue =
       
   402 		ipCallbackManager->RegisterComponentHandle(ipHandle);
       
   403 	if (OMX_ErrorNone != omxRetValue)
       
   404 		{
       
   405 		if (OMX_ErrorInsufficientResources == omxRetValue)
       
   406 			{
       
   407 			User::Leave(KErrNoMemory);
       
   408 			}
       
   409 		User::Leave(KErrGeneral);
       
   410 		}
       
   411 
       
   412 	// Let's init the FSM...
       
   413 	ipFsm->InitFsm();
       
   414 	}
       
   415 
       
   416 MOmxILCallbackNotificationIf* COmxILComponentImpl::CreateCallbackManagerL(COmxILComponent::TCallbackManagerType aCallbackManagerType)
       
   417 	{
       
   418 	if (aCallbackManagerType==COmxILComponent::EInContext)
       
   419 		{
       
   420 		ipCallbackManager = COmxILInContextCallbackManager::NewL(ipHandle, ipAppData, ipCallbacks);
       
   421 		}
       
   422 	else if (aCallbackManagerType==COmxILComponent::EOutofContext)
       
   423 		{
       
   424 		ipCallbackManager = COmxILCallbackManager::NewL(ipHandle, ipAppData, ipCallbacks);
       
   425 		}
       
   426 		
       
   427 	return ipCallbackManager;
       
   428 	}
       
   429 
       
   430 TInt COmxILComponentImpl::AddPort(const COmxILPort* aPort, OMX_DIRTYPE aDirection)
       
   431 	{
       
   432 	return ipPortManager->AddPort(aPort, aDirection);
       
   433 	}
       
   434 
       
   435 void COmxILComponentImpl::CreatePortManagerL(COmxILComponent::TPortManagerType /*aType*/,
       
   436 											const OMX_VERSIONTYPE& aOmxVersion,
       
   437 											OMX_U32 aNumberOfAudioPorts,
       
   438 											OMX_U32 aStartAudioPortNumber,
       
   439 											OMX_U32 aNumberOfImagePorts,
       
   440 											OMX_U32 aStartImagePortNumber,
       
   441 											OMX_U32 aNumberOfVideoPorts,
       
   442 											OMX_U32 aStartVideoPortNumber,
       
   443 											OMX_U32 aNumberOfOtherPorts,
       
   444 											OMX_U32 aStartOtherPortNumber,
       
   445 											OMX_BOOL aImmediateReturnTimeBuffer)
       
   446 	{
       
   447 	__ASSERT_ALWAYS(ipProcessingFunction && ipCallbackManager, User::Panic(KOmxILComponentPanicCategory, 1));
       
   448 	ipPortManager = COmxILPortManager::NewL(*ipProcessingFunction,       // The component's processing function
       
   449 											*ipCallbackManager,          // The call back manager object
       
   450 											aOmxVersion,                  // Component's OMX Version
       
   451 											aNumberOfAudioPorts,		 	 // The number of audio ports in this component
       
   452 											aStartAudioPortNumber, 		 // The starting audio port index
       
   453 											aNumberOfImagePorts,		 	 // The number of image ports in this component
       
   454 											aStartImagePortNumber,		 // The starting image port index
       
   455 											aNumberOfVideoPorts,		 	 // The number of video ports in this component
       
   456 											aStartVideoPortNumber,		 // The starting video port index
       
   457 											aNumberOfOtherPorts,		 	 // The number of other ports in this component
       
   458 											aStartOtherPortNumber,	 	 // The starting other port index
       
   459 											aImmediateReturnTimeBuffer
       
   460 											);	
       
   461 	}
       
   462 
       
   463 void COmxILComponentImpl::RegisterProcessingFunction(const COmxILProcessingFunction* apProcessingFunction)
       
   464 	{
       
   465 	__ASSERT_ALWAYS(apProcessingFunction, User::Panic(KOmxILComponentPanicCategory, 1));
       
   466 	ipProcessingFunction = const_cast<COmxILProcessingFunction*>(apProcessingFunction);
       
   467 	}
       
   468 
       
   469 void COmxILComponentImpl::RegisterConfigurationManager(const COmxILConfigManager* apConfigManager)
       
   470 	{
       
   471 	__ASSERT_ALWAYS(apConfigManager, User::Panic(KOmxILComponentPanicCategory, 1));
       
   472 	ipConfigManager = const_cast<COmxILConfigManager*>(apConfigManager);
       
   473 	SetPortManagerForConfigManager();
       
   474 	}	
       
   475 	
       
   476 OMX_COMPONENTTYPE* COmxILComponentImpl::GetHandle() const
       
   477 	{
       
   478 	return ipHandle;
       
   479 	}
       
   480 OMX_PTR COmxILComponentImpl::GetAppData() const
       
   481 	{
       
   482 	return ipAppData;
       
   483 	}
       
   484 OMX_CALLBACKTYPE* COmxILComponentImpl::GetCallbacks() const
       
   485 	{
       
   486 	return ipCallbacks;
       
   487 	}
       
   488 COmxILConfigManager* COmxILComponentImpl::GetConfigManager() const
       
   489 	{
       
   490 	return ipConfigManager;
       
   491 	}
       
   492 COmxILProcessingFunction* COmxILComponentImpl::GetProcessingFunction() const
       
   493 	{
       
   494 	return ipProcessingFunction;
       
   495 	}
       
   496 MOmxILCallbackNotificationIf* COmxILComponentImpl::GetCallbackNotificationIf() const
       
   497 	{
       
   498 	return ipCallbackManager;
       
   499 	}
       
   500 void COmxILComponentImpl::SetPortManagerForConfigManager()
       
   501 	{
       
   502 	__ASSERT_ALWAYS(ipPortManager && ipConfigManager, User::Panic(KOmxILComponentPanicCategory, 1));
       
   503 	ipConfigManager->SetPortManager(ipPortManager);
       
   504 	}