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