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