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