omxil_generic/omxilcomplib/src/omxilportimpl.inl
changeset 0 0e4a32b9112d
equal deleted inserted replaced
-1:000000000000 0:0e4a32b9112d
       
     1 // Copyright (c) 2010 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 
       
    23 
       
    24 
       
    25 
       
    26 inline OMX_DIRTYPE
       
    27 COmxILPortImpl::Direction() const
       
    28 	{
       
    29 	return iParamPortDefinition.eDir;
       
    30 	}
       
    31 
       
    32 inline TBool
       
    33 COmxILPortImpl::IsEnabled() const
       
    34 	{
       
    35 	return iParamPortDefinition.bEnabled;
       
    36 	}
       
    37 
       
    38 inline TBool
       
    39 COmxILPortImpl::IsPopulated() const
       
    40 	{
       
    41 	return (OMX_TRUE == iParamPortDefinition.bPopulated ? ETrue : EFalse);
       
    42 	}
       
    43 
       
    44 inline TBool
       
    45 COmxILPortImpl::IsDePopulated() const
       
    46 	{
       
    47 	return (iBufferHeaders.Count() == 0 ? ETrue : EFalse);
       
    48 	}
       
    49 
       
    50 inline TBool
       
    51 COmxILPortImpl::IsTunnelled() const
       
    52 	{
       
    53 	return (iTunnelledComponent != 0 ? ETrue : EFalse);
       
    54 	}
       
    55 
       
    56 inline TBool
       
    57 COmxILPortImpl::IsTunnelledAndBufferSupplier() const
       
    58 	{
       
    59 	TBool retValue = (
       
    60 		iTunnelledComponent &&
       
    61 		(((iParamCompBufferSupplier.eBufferSupplier ==
       
    62 		   OMX_BufferSupplyInput)
       
    63 		  &&
       
    64 		  (iParamPortDefinition.eDir == OMX_DirInput))
       
    65 		 ||
       
    66 		 ((iParamCompBufferSupplier.eBufferSupplier == OMX_BufferSupplyOutput)
       
    67 		  &&
       
    68 		  (iParamPortDefinition.eDir == OMX_DirOutput)))
       
    69 		);
       
    70 
       
    71 	return retValue;
       
    72 
       
    73 	}
       
    74 
       
    75 inline TBool
       
    76 COmxILPortImpl::IsTransitioningToEnabled() const
       
    77 	{
       
    78 	return (iTransitionState == EPortTransitioningToEnabled ? ETrue : EFalse);
       
    79 	}
       
    80 
       
    81 inline TBool
       
    82 COmxILPortImpl::IsTransitioningToDisabled() const
       
    83 	{
       
    84 	return (iTransitionState == EPortTransitioningToDisabled ? ETrue : EFalse);
       
    85 	}
       
    86 
       
    87 inline OMX_U32
       
    88 COmxILPortImpl::Index() const
       
    89 	{
       
    90 	return iParamPortDefinition.nPortIndex;
       
    91 	}
       
    92 
       
    93 inline OMX_PORTDOMAINTYPE
       
    94 COmxILPortImpl::Domain() const
       
    95 	{
       
    96 	return iParamPortDefinition.eDomain;
       
    97 	}
       
    98 
       
    99 inline OMX_U32
       
   100 COmxILPortImpl::Count() const
       
   101 	{
       
   102 	return iBufferHeaders.Count();
       
   103 	}
       
   104 
       
   105 inline OMX_BUFFERHEADERTYPE* const&
       
   106 COmxILPortImpl::operator[](TInt anIndex) const
       
   107 	{
       
   108 	return this->operator[](anIndex);
       
   109 	}
       
   110 
       
   111 inline OMX_BUFFERHEADERTYPE*&
       
   112 COmxILPortImpl::operator[](TInt anIndex)
       
   113 	{
       
   114 	__ASSERT_ALWAYS((anIndex>=0 && anIndex<iBufferHeaders.Count()),
       
   115 					User::Panic(KOmxILPortPanicCategory, 1));
       
   116 	return iBufferHeaders[anIndex];
       
   117 	}
       
   118 
       
   119 
       
   120 inline OMX_U32
       
   121 COmxILPortImpl::BufferMarkPropagationPort() const
       
   122 	{
       
   123 	return iBufferMarkPropagationPortIndex;
       
   124 	}
       
   125 
       
   126 
       
   127 template<typename T>
       
   128 inline OMX_ERRORTYPE
       
   129 COmxILPortImpl::GetParamStructureFromTunnel(
       
   130 	T& aComponentConfigStructure, OMX_INDEXTYPE aParamIndex) const
       
   131 	{
       
   132 
       
   133 	__ASSERT_ALWAYS(iTunnelledComponent,
       
   134 					User::Panic(KOmxILPortPanicCategory, 1));
       
   135 
       
   136 	aComponentConfigStructure.nSize		 = sizeof(T);
       
   137 	aComponentConfigStructure.nVersion	 = TOmxILSpecVersion();
       
   138 	aComponentConfigStructure.nPortIndex = iTunnelledPort;
       
   139 
       
   140 	if (OMX_ErrorNone !=
       
   141 		OMX_GetParameter(iTunnelledComponent,
       
   142 						 aParamIndex,
       
   143 						 &aComponentConfigStructure) )
       
   144 		{
       
   145 		return OMX_ErrorUndefined;
       
   146 		}
       
   147 
       
   148 	return OMX_ErrorNone;
       
   149 
       
   150 	}
       
   151 
       
   152 
       
   153 
       
   154 inline
       
   155 COmxILPortImpl::TBufferMarkInfo::TBufferMarkInfo(
       
   156 	const OMX_MARKTYPE*& apMark,
       
   157 	TBool aOwnMark /* = ETrue */)
       
   158 	:
       
   159 	ipMarkTargetComponent(apMark->hMarkTargetComponent),
       
   160 	ipMarkData(apMark->pMarkData),
       
   161 	iOwnMark(aOwnMark)
       
   162 	{
       
   163 	__ASSERT_DEBUG(ipMarkTargetComponent,
       
   164 				   User::Panic(KOmxILPortPanicCategory, 1));
       
   165 	}
       
   166 
       
   167 inline
       
   168 COmxILPortImpl::TBufferMarkInfo::TBufferMarkInfo(
       
   169 	OMX_HANDLETYPE& apMarkTargetComponent,
       
   170 	OMX_PTR& apMarkData,
       
   171 	TBool aOwnMark /* = ETrue */)
       
   172 	:
       
   173 	ipMarkTargetComponent(apMarkTargetComponent),
       
   174 	ipMarkData(apMarkData),
       
   175 	iOwnMark(aOwnMark)
       
   176 	{
       
   177 	__ASSERT_DEBUG(ipMarkTargetComponent,
       
   178 				   User::Panic(KOmxILPortPanicCategory, 1));
       
   179 	}
       
   180 
       
   181 inline
       
   182 COmxILPortImpl::TBufferMarkInfoQue::TBufferMarkInfoQue(TInt aOffset)
       
   183 	:
       
   184 	Tq(aOffset),
       
   185 	iNumElements(0)
       
   186 	{
       
   187 	}
       
   188 
       
   189 inline COmxILPortImpl::TBufferMarkInfo*
       
   190 COmxILPortImpl::TBufferMarkInfoQue::First() const
       
   191 	{
       
   192 	return Tq::First();
       
   193 	}
       
   194 
       
   195 inline void
       
   196 COmxILPortImpl::TBufferMarkInfoQue::AddLast(COmxILPortImpl::TBufferMarkInfo& aRef)
       
   197 	{
       
   198 	Tq::AddLast(aRef);
       
   199 	++iNumElements;
       
   200 	}
       
   201 
       
   202 inline void
       
   203 COmxILPortImpl::TBufferMarkInfoQue::Remove(COmxILPortImpl::TBufferMarkInfo& aRef)
       
   204 	{
       
   205 	Tq::Remove(aRef);
       
   206 	--iNumElements;
       
   207 	}
       
   208 
       
   209 inline TInt
       
   210 COmxILPortImpl::TBufferMarkInfoQue::Elements() const
       
   211 	{
       
   212 	return iNumElements;
       
   213 	}
       
   214 
       
   215 inline void
       
   216 COmxILPortImpl::TBufferMarkInfoQue::ResetAndDestroy()
       
   217 	{
       
   218 	while (!Tq::IsEmpty())
       
   219 		{
       
   220 		COmxILPortImpl::TBufferMarkInfo* pMark = Tq::First();
       
   221 		__ASSERT_DEBUG(pMark, User::Panic(KOmxILPortPanicCategory, 1));
       
   222 		Tq::Remove(*pMark);
       
   223 		delete pMark;
       
   224 		}
       
   225 	iNumElements = 0;
       
   226 	}
       
   227 
       
   228 
       
   229 inline
       
   230 COmxILPortImpl::TBufferInfo::TBufferInfo(
       
   231 	OMX_BUFFERHEADERTYPE* apHeader,
       
   232 	THeaderLocationProperty aLocation,
       
   233 	THeaderOwnershipProperty aOwnership,
       
   234 	OMX_U8* apBuffer,
       
   235 	OMX_PTR apApp,
       
   236 	OMX_PTR apPlatform,
       
   237 	OMX_PTR apPort)
       
   238 	:
       
   239 	ipHeader(apHeader),
       
   240 	iBufferProperties(0),
       
   241 	ipBuffer(apBuffer),
       
   242 	ipApp(apApp),
       
   243 	ipPlatform(apPlatform),
       
   244 	ipPort(apPort)
       
   245 	{
       
   246 	__ASSERT_DEBUG(ipHeader, User::Panic(KOmxILPortPanicCategory, 1));
       
   247 	iBufferProperties = aLocation | aOwnership;
       
   248 	}
       
   249 
       
   250 
       
   251 // This constructor should only be used for array look-ups
       
   252 inline
       
   253 COmxILPortImpl::TBufferInfo::TBufferInfo(
       
   254 	OMX_BUFFERHEADERTYPE* apHeader)
       
   255 	:
       
   256 	ipHeader(apHeader),
       
   257 	iBufferProperties(0),
       
   258 	ipBuffer(0),
       
   259 	ipApp(0),
       
   260 	ipPlatform(0),
       
   261 	ipPort(0)
       
   262 	{
       
   263 	__ASSERT_DEBUG(ipHeader, User::Panic(KOmxILPortPanicCategory, 1));
       
   264 	iBufferProperties = EBufferAtHome | EBufferOwned;
       
   265 	}
       
   266 
       
   267 
       
   268 inline const OMX_BUFFERHEADERTYPE*
       
   269 COmxILPortImpl::TBufferInfo::GetHeader() const
       
   270 	{
       
   271 	return ipHeader;
       
   272 	}
       
   273 
       
   274 inline OMX_BUFFERHEADERTYPE*
       
   275 COmxILPortImpl::TBufferInfo::GetHeader()
       
   276 	{
       
   277 	return ipHeader;
       
   278 	}
       
   279 
       
   280 inline
       
   281 COmxILPortImpl::TBufferInfo::operator OMX_BUFFERHEADERTYPE*&()
       
   282 	{
       
   283 	return ipHeader;
       
   284 	}
       
   285 
       
   286 inline
       
   287 COmxILPortImpl::TBufferInfo::operator OMX_BUFFERHEADERTYPE* const&() const
       
   288 	{
       
   289 	return ipHeader;
       
   290 	}
       
   291 
       
   292 inline OMX_U8*
       
   293 COmxILPortImpl::TBufferInfo::GetBufferPointer() const
       
   294 	{
       
   295 	return ipBuffer;
       
   296 	}
       
   297 
       
   298 inline OMX_U8*
       
   299 COmxILPortImpl::TBufferInfo::GetBufferPointer()
       
   300 	{
       
   301 	return ipBuffer;
       
   302 	}
       
   303 
       
   304 inline OMX_PTR
       
   305 COmxILPortImpl::TBufferInfo::GetPortPointer() const
       
   306 	{
       
   307 	return ipPort;
       
   308 	}
       
   309 
       
   310 inline OMX_PTR
       
   311 COmxILPortImpl::TBufferInfo::GetPortPointer()
       
   312 	{
       
   313 	return ipPort;
       
   314 	}
       
   315 
       
   316 inline OMX_PTR
       
   317 COmxILPortImpl::TBufferInfo::GetPlatformPointer() const
       
   318 	{
       
   319 	return ipPlatform;
       
   320 	}
       
   321 
       
   322 inline OMX_PTR
       
   323 COmxILPortImpl::TBufferInfo::GetPlatformPointer()
       
   324 	{
       
   325 	return ipPlatform;
       
   326 	}
       
   327 
       
   328 inline OMX_PTR
       
   329 COmxILPortImpl::TBufferInfo::GetAppPointer() const
       
   330 	{
       
   331 	return ipApp;
       
   332 	}
       
   333 
       
   334 inline OMX_PTR
       
   335 COmxILPortImpl::TBufferInfo::GetAppPointer()
       
   336 	{
       
   337 	return ipApp;
       
   338 	}
       
   339 
       
   340 inline void
       
   341 COmxILPortImpl::TBufferInfo::SetBufferAtHome()
       
   342 	{
       
   343 	iBufferProperties |= EBufferAtHome;
       
   344 	}
       
   345 
       
   346 inline void
       
   347 COmxILPortImpl::TBufferInfo::SetBufferAway()
       
   348 	{
       
   349 	iBufferProperties &= EBufferAwayMask;
       
   350 	}
       
   351 
       
   352 inline void
       
   353 COmxILPortImpl::TBufferInfo::SetBufferOwned()
       
   354 	{
       
   355 	iBufferProperties |= EBufferOwned;
       
   356 	}
       
   357 
       
   358 inline void
       
   359 COmxILPortImpl::TBufferInfo::SetBufferNotOwned()
       
   360 	{
       
   361 	iBufferProperties &= EBufferNotOwnedMask;
       
   362 	}
       
   363 
       
   364 inline TBool
       
   365 COmxILPortImpl::TBufferInfo::IsBufferAtHome() const
       
   366 	{
       
   367 	return ((iBufferProperties & EBufferAtHome) != 0x0 ? ETrue : EFalse);
       
   368 	}
       
   369 
       
   370 inline TBool
       
   371 COmxILPortImpl::TBufferInfo::IsBufferOwned() const
       
   372 	{
       
   373 	return ((iBufferProperties & EBufferOwned) != 0x0 ? ETrue : EFalse);
       
   374 	}
       
   375 
       
   376 inline const OMX_PARAM_PORTDEFINITIONTYPE& 
       
   377 COmxILPortImpl::GetParamPortDefinition() const
       
   378 	{
       
   379 	return iParamPortDefinition;
       
   380 	}
       
   381 	
       
   382 inline const OMX_HANDLETYPE& 
       
   383 COmxILPortImpl::GetTunnelledComponent() const
       
   384 	{
       
   385 	return iTunnelledComponent;
       
   386 	}
       
   387 	
       
   388 inline const OMX_U32& 
       
   389 COmxILPortImpl::GetTunnelledPort() const
       
   390 	{
       
   391 	return iTunnelledPort;
       
   392 	}
       
   393 
       
   394 inline OMX_PARAM_PORTDEFINITIONTYPE& 
       
   395 COmxILPortImpl::GetParamPortDefinition()
       
   396 	{
       
   397 	return iParamPortDefinition;
       
   398 	}
       
   399 	
       
   400 inline OMX_HANDLETYPE& 
       
   401 COmxILPortImpl::GetTunnelledComponent()
       
   402 	{
       
   403 	return iTunnelledComponent;
       
   404 	}
       
   405 	
       
   406 inline OMX_U32& 
       
   407 COmxILPortImpl::GetTunnelledPort()
       
   408 	{
       
   409 	return iTunnelledPort;
       
   410 	}