omxil_generic/omxilcomplib/src/omxilvideoport.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 <openmax/il/common/omxilvideoport.h>
       
    23 #include <openmax/il/common/omxilutil.h>
       
    24 #include "log.h"
       
    25 #include "omxilvideoportimpl.h"
       
    26 
       
    27 EXPORT_C
       
    28 COmxILVideoPort::COmxILVideoPort()
       
    29 	{
       
    30 	DEBUG_PRINTF(_L8("COmxILVideoPort::COmxILVideoPort"));
       
    31 	}
       
    32 
       
    33 EXPORT_C
       
    34 void COmxILVideoPort::ConstructL(const TOmxILCommonPortData& aCommonPortData,
       
    35                                 const RArray<OMX_VIDEO_CODINGTYPE>& aSupportedVideoFormats,
       
    36                                 const RArray<OMX_COLOR_FORMATTYPE>& aSupportedColorFormats)
       
    37 	{
       
    38     COmxILPort::ConstructL(aCommonPortData); //create COmxILPortImpl
       
    39 	ipVideoPortImpl=COmxILVideoPortImpl::NewL(aSupportedVideoFormats, aSupportedColorFormats, aCommonPortData); //create COmxILVideoPortImpl	
       
    40 	}
       
    41 	
       
    42 EXPORT_C
       
    43 COmxILVideoPort::~COmxILVideoPort()
       
    44 	{
       
    45 	DEBUG_PRINTF(_L8("COmxILVideoPort::~COmxILVideoPort"));
       
    46 	delete ipVideoPortImpl;
       
    47 	}
       
    48 
       
    49 EXPORT_C OMX_ERRORTYPE 
       
    50 COmxILVideoPort::GetLocalOmxParamIndexes(RArray<TUint>& aIndexArray) const
       
    51 	{
       
    52 	DEBUG_PRINTF(_L8("COmxILVideoPort::GetLocalOmxParamIndexes"));
       
    53 
       
    54 	// Always collect local indexes from parent
       
    55 	OMX_ERRORTYPE omxRetValue = COmxILPort::GetLocalOmxParamIndexes(aIndexArray);
       
    56 	
       
    57 	if (OMX_ErrorNone != omxRetValue)
       
    58 		{
       
    59 		return omxRetValue;
       
    60 		}
       
    61 		
       
    62 	TInt err = aIndexArray.InsertInOrder(OMX_IndexParamVideoPortFormat);
       
    63 	
       
    64 	// Note that index duplication is OK.
       
    65 	if (KErrNone != err && KErrAlreadyExists != err)
       
    66 		{
       
    67 		return OMX_ErrorInsufficientResources;
       
    68 		}
       
    69 	
       
    70 	return OMX_ErrorNone;
       
    71 
       
    72 	}
       
    73 
       
    74 EXPORT_C OMX_ERRORTYPE 
       
    75 COmxILVideoPort::GetLocalOmxConfigIndexes(RArray<TUint>& aIndexArray) const
       
    76 	{
       
    77 	DEBUG_PRINTF(_L8("COmxILVideoPort::GetLocalOmxConfigIndexes"));
       
    78 
       
    79 	// Always collect local indexes from parent
       
    80 	return COmxILPort::GetLocalOmxConfigIndexes(aIndexArray);
       
    81 
       
    82 	}
       
    83 
       
    84 EXPORT_C OMX_ERRORTYPE COmxILVideoPort::GetParameter(OMX_INDEXTYPE aParamIndex, TAny* apComponentParameterStructure) const
       
    85 	{
       
    86 	DEBUG_PRINTF(_L8("COmxILVideoPort::GetParameter"));
       
    87 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
       
    88 	switch(aParamIndex)
       
    89 		{
       
    90 		case OMX_IndexParamVideoPortFormat:
       
    91 			{
       
    92 			__ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
    93 			omxRetValue=ipVideoPortImpl->GetParameter(aParamIndex, apComponentParameterStructure);
       
    94 			break;
       
    95 			}
       
    96 		default:
       
    97 			{
       
    98 			// Try the parent's indexes
       
    99 			omxRetValue=COmxILPort::GetParameter(aParamIndex, apComponentParameterStructure);
       
   100 			}
       
   101 		};
       
   102 	return omxRetValue;
       
   103 	}
       
   104 
       
   105 EXPORT_C OMX_ERRORTYPE COmxILVideoPort::SetParameter(OMX_INDEXTYPE aParamIndex, const TAny* apComponentParameterStructure, TBool& aUpdateProcessingFunction)
       
   106 	{
       
   107 	DEBUG_PRINTF(_L8("COmxILVideoPort::SetParameter"));
       
   108 	OMX_ERRORTYPE omxRetValue = OMX_ErrorNone;
       
   109 	switch(aParamIndex)
       
   110 		{
       
   111 		case OMX_IndexParamVideoPortFormat:
       
   112 			{
       
   113 			__ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
   114 			omxRetValue=ipVideoPortImpl->SetParameter(aParamIndex, apComponentParameterStructure, aUpdateProcessingFunction);
       
   115 			break;
       
   116 			}
       
   117 		default:
       
   118 			{
       
   119 			// Try the parent's indexes
       
   120 			omxRetValue=COmxILPort::SetParameter(aParamIndex, apComponentParameterStructure, aUpdateProcessingFunction);
       
   121 			}
       
   122 		};
       
   123 	return omxRetValue;
       
   124 	}
       
   125 
       
   126 EXPORT_C TBool COmxILVideoPort::UpdateColorFormat(OMX_COLOR_FORMATTYPE& aOldColor, OMX_COLOR_FORMATTYPE aNewColor, TBool& aUpdated)
       
   127 	{
       
   128 	__ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
   129 	return ipVideoPortImpl->UpdateColorFormat(aOldColor, aNewColor, aUpdated);
       
   130 	}
       
   131 
       
   132 EXPORT_C TBool COmxILVideoPort::UpdateCodingType(OMX_VIDEO_CODINGTYPE& aOldCodingType, OMX_VIDEO_CODINGTYPE aNewCodingType, TBool& aUpdated)
       
   133 	{
       
   134 	__ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
   135 	return ipVideoPortImpl->UpdateCodingType(aOldCodingType, aNewCodingType, aUpdated);
       
   136 	}
       
   137 	
       
   138 EXPORT_C RArray<OMX_VIDEO_CODINGTYPE>& COmxILVideoPort::GetSupportedVideoFormats()
       
   139 	{
       
   140 	__ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
   141 	return ipVideoPortImpl->GetSupportedVideoFormats();
       
   142 
       
   143 	}
       
   144 	
       
   145 EXPORT_C RArray<OMX_COLOR_FORMATTYPE>& COmxILVideoPort::GetSupportedColorFormats()
       
   146 	{
       
   147 	__ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
   148 	return ipVideoPortImpl->GetSupportedColorFormats();
       
   149 	}
       
   150 	
       
   151 
       
   152 EXPORT_C OMX_VIDEO_PARAM_PORTFORMATTYPE& COmxILVideoPort::GetParamVideoPortFormat()
       
   153     {
       
   154     __ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
   155     return ipVideoPortImpl->GetParamVideoPortFormat();
       
   156     }
       
   157 
       
   158 EXPORT_C const RArray<OMX_VIDEO_CODINGTYPE>& COmxILVideoPort::GetSupportedVideoFormats() const
       
   159 	{
       
   160 	__ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
   161 	return ipVideoPortImpl->GetSupportedVideoFormats();
       
   162 
       
   163 	}
       
   164 	
       
   165 EXPORT_C const RArray<OMX_COLOR_FORMATTYPE>& COmxILVideoPort::GetSupportedColorFormats() const
       
   166 	{
       
   167 	__ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
   168 	return ipVideoPortImpl->GetSupportedColorFormats();
       
   169 	}
       
   170 	
       
   171 
       
   172 EXPORT_C const OMX_VIDEO_PARAM_PORTFORMATTYPE& COmxILVideoPort::GetParamVideoPortFormat() const
       
   173     {
       
   174     __ASSERT_ALWAYS(ipVideoPortImpl, User::Panic(KOmxILVideoPortPanicCategory, 1));
       
   175     return ipVideoPortImpl->GetParamVideoPortFormat();
       
   176     }	
       
   177 	
       
   178 EXPORT_C OMX_ERRORTYPE
       
   179 COmxILVideoPort::GetConfig(OMX_INDEXTYPE aConfigIndex,
       
   180                       TAny* apComponentConfigStructure) const
       
   181     {
       
   182     DEBUG_PRINTF(_L8("COmxILPort::GetConfig"));
       
   183     return COmxILPort::GetConfig(aConfigIndex,
       
   184                                  apComponentConfigStructure);
       
   185     }
       
   186 
       
   187 EXPORT_C OMX_ERRORTYPE
       
   188 COmxILVideoPort::SetConfig(OMX_INDEXTYPE aConfigIndex,
       
   189                       const TAny* apComponentConfigStructure,
       
   190                       TBool& aUpdateProcessingFunction)
       
   191     {
       
   192     DEBUG_PRINTF(_L8("COmxILPort::SetConfig"));
       
   193     return COmxILPort::SetConfig(aConfigIndex,
       
   194                                 apComponentConfigStructure,
       
   195                                 aUpdateProcessingFunction);
       
   196 
       
   197     }
       
   198 
       
   199 EXPORT_C OMX_ERRORTYPE
       
   200 COmxILVideoPort::GetExtensionIndex(OMX_STRING aParameterName,
       
   201                               OMX_INDEXTYPE* apIndexType) const
       
   202     {
       
   203     return COmxILPort::GetExtensionIndex(aParameterName,
       
   204                                         apIndexType);
       
   205     }
       
   206 
       
   207 EXPORT_C OMX_ERRORTYPE
       
   208 COmxILVideoPort::PopulateBuffer(OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   209                            const OMX_PTR apAppPrivate,
       
   210                            OMX_U32 aSizeBytes,
       
   211                            OMX_U8* apBuffer,
       
   212                            TBool& aPortPopulationCompleted)
       
   213     {
       
   214     DEBUG_PRINTF2(_L8("COmxILVideoPort::PopulateBuffer : pBuffer [%X]"), apBuffer);
       
   215     return COmxILPort::PopulateBuffer(appBufferHdr,
       
   216                                         apAppPrivate,
       
   217                                         aSizeBytes,
       
   218                                         apBuffer,
       
   219                                         aPortPopulationCompleted);
       
   220     }
       
   221 
       
   222 
       
   223 EXPORT_C OMX_ERRORTYPE
       
   224 COmxILVideoPort::FreeBuffer(OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   225                        TBool& aPortDepopulationCompleted)
       
   226     {
       
   227     DEBUG_PRINTF2(_L8("COmxILVideoPort::FreeBuffer : BUFFER [%X]"), apBufferHeader);
       
   228     return COmxILPort::FreeBuffer(apBufferHeader, aPortDepopulationCompleted);
       
   229     }
       
   230 
       
   231 
       
   232 EXPORT_C OMX_ERRORTYPE
       
   233 COmxILVideoPort::TunnelRequest(OMX_HANDLETYPE aTunneledComp,
       
   234                           OMX_U32 aTunneledPort,
       
   235                           OMX_TUNNELSETUPTYPE* apTunnelSetup)
       
   236     {
       
   237     DEBUG_PRINTF(_L8("COmxILVideoPort::TunnelRequest"));
       
   238     return COmxILPort::TunnelRequest(aTunneledComp,
       
   239                                     aTunneledPort,
       
   240                                     apTunnelSetup);
       
   241     }
       
   242 
       
   243 
       
   244 EXPORT_C OMX_ERRORTYPE
       
   245 COmxILVideoPort::PopulateTunnel(TBool& portPopulationCompleted)
       
   246     {
       
   247     DEBUG_PRINTF(_L8("COmxILVideoPort::PopulateTunnel"));
       
   248     return COmxILPort::PopulateTunnel(portPopulationCompleted);
       
   249     }
       
   250 
       
   251 
       
   252 EXPORT_C OMX_ERRORTYPE
       
   253 COmxILVideoPort::FreeTunnel(TBool& portDepopulationCompleted)
       
   254     {
       
   255     DEBUG_PRINTF(_L8("COmxILVideoPort::FreeTunnel"));
       
   256     return COmxILPort::FreeTunnel(portDepopulationCompleted);
       
   257     }
       
   258 
       
   259 EXPORT_C TBool
       
   260 COmxILVideoPort::SetBufferSent(OMX_BUFFERHEADERTYPE* apBufferHeader,
       
   261                           TBool& aBufferMarkedWithOwnMark)
       
   262     {
       
   263     DEBUG_PRINTF(_L8("COmxILVideoPort::SetBufferSent"));
       
   264     return COmxILPort::SetBufferSent(apBufferHeader,
       
   265                                     aBufferMarkedWithOwnMark);
       
   266     }
       
   267 
       
   268 EXPORT_C TBool
       
   269 COmxILVideoPort::SetBufferReturned(OMX_BUFFERHEADERTYPE* apBufferHeader)
       
   270     {
       
   271     DEBUG_PRINTF(_L8("COmxILVideoPort::SetBufferReturned"));
       
   272     return COmxILPort::SetBufferReturned(apBufferHeader);
       
   273     }
       
   274 
       
   275 EXPORT_C void
       
   276 COmxILVideoPort::SetTransitionToEnabled()
       
   277     {
       
   278     DEBUG_PRINTF(_L8("COmxILVideoPort::SetTransitionToEnabled"));
       
   279     return COmxILPort::SetTransitionToEnabled();
       
   280     }
       
   281 
       
   282 EXPORT_C void
       
   283 COmxILVideoPort::SetTransitionToDisabled()
       
   284     {
       
   285     DEBUG_PRINTF(_L8("COmxILVideoPort::SetTransitionToDisabled"));
       
   286     return COmxILPort::SetTransitionToDisabled();
       
   287     }
       
   288 
       
   289 EXPORT_C void
       
   290 COmxILVideoPort::SetTransitionToDisabledCompleted()
       
   291     {
       
   292     DEBUG_PRINTF(_L8("COmxILVideoPort::SetTransitionToDisabledCompleted"));
       
   293     return COmxILPort::SetTransitionToDisabledCompleted();
       
   294     }
       
   295 
       
   296 EXPORT_C void
       
   297 COmxILVideoPort::SetTransitionToEnabledCompleted()
       
   298     {
       
   299     DEBUG_PRINTF(_L8("COmxILVideoPort::SetTransitionToEnabledCompleted"));
       
   300     return COmxILPort::SetTransitionToEnabledCompleted();
       
   301     }
       
   302 
       
   303 EXPORT_C OMX_ERRORTYPE
       
   304 COmxILVideoPort::StoreBufferMark(const OMX_MARKTYPE* apMark)
       
   305     {
       
   306     DEBUG_PRINTF(_L8("COmxILVideoPort::StoreBufferMark"));
       
   307     return COmxILPort::StoreBufferMark(apMark);
       
   308     }
       
   309 
       
   310 EXPORT_C OMX_ERRORTYPE
       
   311 COmxILVideoPort::SetComponentRoleDefaults(TUint aComponentRoleIndex)
       
   312     {
       
   313     DEBUG_PRINTF(_L8("COmxILVideoPort::SetComponentRoleDefaults"));
       
   314 
       
   315     return COmxILPort::SetComponentRoleDefaults(aComponentRoleIndex);
       
   316     }
       
   317 
       
   318 EXPORT_C TBool
       
   319 COmxILVideoPort::HasAllBuffersAtHome() const
       
   320     {
       
   321     return COmxILPort::HasAllBuffersAtHome();
       
   322     }
       
   323 
       
   324 EXPORT_C TBool
       
   325 COmxILVideoPort::IsBufferAtHome(OMX_BUFFERHEADERTYPE* apBufferHeader) const
       
   326     {
       
   327     DEBUG_PRINTF2(_L8("COmxILVideoPort::IsBufferAtHome : [%X]"), apBufferHeader);
       
   328     return COmxILPort::IsBufferAtHome(apBufferHeader);
       
   329     }
       
   330 
       
   331 EXPORT_C OMX_ERRORTYPE
       
   332 COmxILVideoPort::DoPortReconfiguration(TUint aPortSettingsIndex,
       
   333                                   const TDesC8& aPortSettings,
       
   334                                   OMX_EVENTTYPE& aEventForILClient)
       
   335     {
       
   336     DEBUG_PRINTF(_L8("COmxILVideoPort::DoPortReconfiguration"));
       
   337 
       
   338     return COmxILPort::DoPortReconfiguration(aPortSettingsIndex,
       
   339                                                 aPortSettings,
       
   340                                                 aEventForILClient);
       
   341     }
       
   342 
       
   343 EXPORT_C OMX_ERRORTYPE
       
   344 COmxILVideoPort::DoBufferAllocation(OMX_U32 aSizeBytes,
       
   345 							   OMX_U8*& apPortSpecificBuffer,
       
   346 							   OMX_PTR& apPortPrivate,
       
   347 							   OMX_PTR& apPlatformPrivate,
       
   348 							   OMX_PTR apAppPrivate)
       
   349 	{
       
   350 	DEBUG_PRINTF2(_L8("COmxILVideoPort::DoBufferAllocation : aSizeBytes[%u]"), aSizeBytes);
       
   351 	return COmxILPort::DoBufferAllocation(aSizeBytes,
       
   352 										apPortSpecificBuffer,
       
   353 										apPortPrivate,
       
   354 										apPlatformPrivate,
       
   355 										apAppPrivate);
       
   356 	}
       
   357 
       
   358 EXPORT_C void
       
   359 COmxILVideoPort::DoBufferDeallocation(OMX_PTR apPortSpecificBuffer,
       
   360 								 OMX_PTR apPortPrivate,
       
   361 								 OMX_PTR apPlatformPrivate,
       
   362 								 OMX_PTR apAppPrivate)
       
   363 	{
       
   364 	DEBUG_PRINTF(_L8("COmxILVideoPort::DoBufferDeallocation"));
       
   365 	return COmxILPort::DoBufferDeallocation(apPortSpecificBuffer,
       
   366 								apPortPrivate,
       
   367 								apPlatformPrivate,
       
   368 								apAppPrivate);
       
   369 	}
       
   370 
       
   371 
       
   372 EXPORT_C OMX_ERRORTYPE
       
   373 COmxILVideoPort::DoBufferWrapping(OMX_U32 aSizeBytes,
       
   374 							 OMX_U8* apBuffer,
       
   375 							 OMX_PTR& apPortPrivate,
       
   376 							 OMX_PTR& apPlatformPrivate,
       
   377 							 OMX_PTR apAppPrivate)
       
   378 	{
       
   379 	DEBUG_PRINTF(_L8("COmxILVideoPort::DoBufferWrapping"));
       
   380 	return COmxILPort::DoBufferWrapping(aSizeBytes,
       
   381 										apBuffer,
       
   382 										apPortPrivate,
       
   383 										apPlatformPrivate,
       
   384 										apAppPrivate);
       
   385 	}
       
   386 
       
   387 EXPORT_C void
       
   388 COmxILVideoPort::DoBufferUnwrapping(OMX_PTR apBuffer,
       
   389 							   OMX_PTR appPortPrivate,
       
   390 							   OMX_PTR apPlatformPrivate,
       
   391 							   OMX_PTR apAppPrivate)
       
   392 	{
       
   393 
       
   394 	DEBUG_PRINTF(_L8("COmxILVideoPort::DoBufferUnwrapping"));
       
   395 	return COmxILPort::DoBufferUnwrapping(apBuffer,
       
   396 										appPortPrivate,
       
   397 										apPlatformPrivate,
       
   398 										apAppPrivate);
       
   399 	}
       
   400 
       
   401 EXPORT_C OMX_ERRORTYPE
       
   402 COmxILVideoPort::DoOmxUseBuffer(OMX_HANDLETYPE aTunnelledComponent,
       
   403 						   OMX_BUFFERHEADERTYPE** appBufferHdr,
       
   404 						   OMX_U32 aTunnelledPortIndex,
       
   405 						   OMX_PTR apPortPrivate,
       
   406 						   OMX_PTR apPlatformPrivate,
       
   407 						   OMX_U32 aSizeBytes,
       
   408 						   OMX_U8* apBuffer)
       
   409 	{
       
   410 
       
   411 	DEBUG_PRINTF(_L8("COmxILVideoPort::DoOmxUseBuffer"));
       
   412 	return COmxILPort::DoOmxUseBuffer(aTunnelledComponent,
       
   413 									   appBufferHdr,
       
   414 									   aTunnelledPortIndex,
       
   415 									   apPortPrivate,
       
   416 									   apPlatformPrivate,
       
   417 									   aSizeBytes,
       
   418 									   apBuffer);
       
   419 	}
       
   420 	
       
   421 	
       
   422 EXPORT_C
       
   423 TInt COmxILVideoPort::Extension_(TUint aExtensionId, TAny *&a0, TAny *a1)
       
   424 	{
       
   425 	return COmxILPort::Extension_(aExtensionId, a0, a1);
       
   426 	}
       
   427