os/mm/mmdevicefw/mdf/src/openmax/omxprocessingunit.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-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 #include <mdf/mdfpuconfig.h>
    17 #include "omxcomponentbody.h"
    18 #include <omxprocessingunit.h>
    19 #include <omxinputport.h>
    20 #include <omxoutputport.h>
    21 #include <mmf/server/taskconfig.h>
    22 
    23 /**
    24 Default constructor.
    25 */
    26 EXPORT_C COmxProcessingUnit::COmxProcessingUnit()
    27 	{ 
    28 	}
    29 
    30 /**
    31 Destructor.
    32 */
    33 EXPORT_C COmxProcessingUnit::~COmxProcessingUnit()
    34 	{
    35 	delete iBody;
    36 	}
    37 
    38 /**
    39 Safe constructing method. 
    40 @param aComponentName The name of the component to be contructed.
    41 @param aProcessingUnitObserver Reference to the obsever for this Processing Unit.
    42 */
    43 EXPORT_C void COmxProcessingUnit::ConstructL(const TDesC8& aComponentName, const MMdfProcessingUnitObserver& aProcessingUnitObserver)
    44 	{
    45 	iBody = CBody::NewL(aComponentName, *this, this, aProcessingUnitObserver);
    46 	}
    47 
    48 /**.
    49 @see CMdfProcessingUnit::Create
    50 */	
    51 EXPORT_C TInt COmxProcessingUnit::Create(const MMdfProcessingUnitObserver& /* aProcessingUnitObserver */)
    52 	{
    53 	return KErrNotSupported;
    54 	}
    55 
    56 /**.
    57 @see CMdfProcessingUnit::GetInputPorts
    58 */
    59 EXPORT_C TInt COmxProcessingUnit::GetInputPorts(RPointerArray<MMdfInputPort>& aComponentInputPorts)
    60 	{
    61 	return iBody->GetInputPorts(aComponentInputPorts);
    62 	}
    63 
    64 /**
    65 @see CMdfProcessingUnit::GetOutputPorts
    66 */
    67 EXPORT_C TInt COmxProcessingUnit::GetOutputPorts(RPointerArray<MMdfOutputPort>& aComponentOutputPorts)
    68 	{
    69 	return iBody->GetOutputPorts(aComponentOutputPorts);
    70 	}
    71 	
    72 /**
    73 @see CMdfProcessingUnit::Initialize
    74 @see MMdfProcessingUnitObserver::InitializeComplete()
    75 */
    76 EXPORT_C void COmxProcessingUnit::Initialize()
    77 	{
    78 	iBody->Initialize();
    79 	}
    80 
    81 /**
    82 @see CMdfProcessingUnit::Execute
    83 */
    84 EXPORT_C void COmxProcessingUnit::Execute()
    85 	{
    86 	iBody->Execute();
    87 	}
    88 	
    89 /**
    90 @see CMdfProcessingUnit::State
    91 */
    92 EXPORT_C TProcessingUnitState COmxProcessingUnit::State()
    93 	{
    94 	return iBody->State();
    95 	}
    96 
    97 /**
    98 @see CMdfProcessingUnit::Configure
    99 */
   100 EXPORT_C TInt COmxProcessingUnit::Configure(const TPuConfig& aConfig)
   101 	{
   102 	return iBody->Configure(aConfig);
   103 	}
   104 
   105 /**
   106 @see CMdfProcessingUnit::GetConfig
   107 */
   108 EXPORT_C TInt COmxProcessingUnit::GetConfig(TPuConfig& aConfig)
   109 	{
   110 	return iBody->GetConfig(aConfig);
   111 	}
   112 
   113 /**
   114 @see CMdfProcessingUnit::Pause
   115 */	
   116 EXPORT_C TInt COmxProcessingUnit::Pause()
   117 	{
   118 	return iBody->Pause();
   119 	}
   120 
   121 /**
   122 @see CMdfProcessingUnit::Stop
   123 */
   124 EXPORT_C void COmxProcessingUnit::Stop()
   125 	{
   126 	iBody->Stop();
   127 	}
   128 
   129 EXPORT_C TInt COmxProcessingUnit::MopcEventHandler(OMX_HANDLETYPE aComponent, OMX_EVENTTYPE aEvent, TUint32 aData1,
   130 	TUint32 aData2, TAny* aExtraInfo)
   131 	{
   132 	return iBody->EventHandler(aComponent, aEvent, aData1, aData2, aExtraInfo);
   133 	}
   134 
   135 /**
   136 @see CMdfProcessingUnit::CreateCustomInterface
   137 */
   138 EXPORT_C TInt COmxProcessingUnit::CreateCustomInterface(TUid aUid)
   139 	{
   140 	return iBody->CreateCustomInterface(aUid);	
   141 	}
   142 
   143 /**
   144 @see CMdfProcessingUnit::CustomInterface
   145 */	
   146 EXPORT_C TAny* COmxProcessingUnit::CustomInterface(TUid aUid)
   147 	{
   148  	return iBody->CustomInterface(aUid);
   149 	}	
   150 
   151 /**
   152 Add an input port to the component
   153 @param aInputPort A pointer to the input port
   154 @return KErrNone if successful or one of the system wide error codes
   155 */	
   156 EXPORT_C TInt COmxProcessingUnit::AddInputPort(MMdfInputPort* aInputPort)
   157 	{
   158 	return iBody->AddInputPort(aInputPort);
   159 	}
   160 
   161 /**
   162 Add an output port to the component
   163 @param aOutputPort A pointer to the output port
   164 @return KErrNone if successful or one of the system wide error codes
   165 */	
   166 EXPORT_C TInt COmxProcessingUnit::AddOutputPort(MMdfOutputPort* aOutputPort)
   167 	{
   168 	return iBody->AddOutputPort(aOutputPort);
   169 	}
   170 	
   171 /**
   172 Return the observer interface for the component
   173 @return The observer interface
   174 */	
   175 EXPORT_C const MMdfProcessingUnitObserver* COmxProcessingUnit::Observer()
   176 	{
   177 	return iBody->Observer();
   178 	}
   179 
   180 /**
   181 Sets the internal PU State
   182 @param aPuState The internal state of the component
   183 */	
   184 EXPORT_C void COmxProcessingUnit::SetPuState(TProcessingUnitState aPuState)
   185 	{
   186 	iBody->SetPuState(aPuState);
   187 	}
   188 	
   189 // Calls to OmxComponent
   190 
   191 /**
   192 	Requests a current parameter from the OpenMAX Processing Unit.
   193 	@param	aParamIndex						The index of the structure to be filled.
   194 	@param	aComponentParameterStructure	A pointer to structure to be filled by the component.
   195 	@return	An error code indicating if the function call was successful.
   196 			KErrNone on success, otherwise another of the system-wide error codes.
   197 */
   198 EXPORT_C TInt COmxProcessingUnit::OmxGetParameter(OMX_INDEXTYPE aParamIndex, TAny* aComponentParameterStructure)
   199 	{
   200 	return iBody->GetParameter(aParamIndex, aComponentParameterStructure);
   201 	}
   202 
   203 /**
   204 	Instructs the OpenMAX Processing Unit to use the buffer passed in the function's argument. 
   205 	@param  aBuffer		The buffer to be used.
   206 	@param 	aPortIndex	The port that the given buffer should be associated with.	  
   207 	@return 			An error code indicating if the function call was successful. KErrNone
   208 						on success, otherwise another of the system-wide error codes.
   209 */	
   210 EXPORT_C TInt COmxProcessingUnit::OmxUseBuffer(CMMFBuffer* aBuffer, TUint32 aPortIndex)
   211 	{
   212 	return iBody->UseBuffer(aBuffer, aPortIndex);
   213 	}
   214 
   215 /**
   216 	Instructs the OpenMAX Processing Unit to allocate a buffer.  Ownership is transferred to the caller.
   217 	@param	aPortIndex	The Port Index that the new buffer is associated with.
   218 	@param  aSizeBytes	The size of the buffer to be allocated, in bytes.		  
   219 	@return A pointer to the newly created buffer.
   220 */
   221 EXPORT_C CMMFBuffer* COmxProcessingUnit::OmxAllocateBufferL(TUint32 aPortIndex, TUint32 aSizeBytes)
   222 	{
   223 	return iBody->AllocateBufferL(aPortIndex, aSizeBytes);
   224 	}
   225 
   226 /**
   227 	Instructs the OpenMAX Processing Unit to free the buffer passed in the function's argument. 
   228 	@param  aBuffer		The buffer to be freed
   229 	@return 			An error code indicating if the function call was successful. KErrNone
   230 						on success, otherwise another of the system-wide error codes.
   231 */
   232 EXPORT_C TInt COmxProcessingUnit::OmxFreeBuffer(CMMFBuffer* aBuffer)
   233 	{
   234 	return iBody->FreeBuffer(aBuffer);
   235 	}
   236 
   237 /**
   238 	Sends an full buffer to an input port of a component.
   239 	@param	aBuffer		The buffer to be emptied.
   240 	@param	aObserver	The observer of the input port that is to be notified.
   241 	@return				An error code indicating if the function call was successful. KErrNone
   242 						on success, otherwise another of the system-wide error codes.
   243 */
   244 EXPORT_C TInt COmxProcessingUnit::OmxEmptyThisBuffer(const CMMFBuffer* aBuffer, MOmxInputPortCallbacks* aObserver)
   245 	{
   246 	return iBody->EmptyThisBuffer(aBuffer, aObserver);
   247 	}
   248 
   249 /**
   250 	Sends an empty buffer to an output port of a component.
   251 	@param	aBuffer		The buffer to be filled.
   252 	@param	aObserver	The observer of the output port that is to be notified.
   253 	@return				An error code indicating if the function call was successful. KErrNone
   254 						on success, otherwise another of the system-wide error codes.
   255 */
   256 EXPORT_C TInt COmxProcessingUnit::OmxFillThisBuffer(CMMFBuffer* aBuffer, MOmxOutputPortCallbacks* aObserver)
   257 	{
   258 	return iBody->FillThisBuffer(aBuffer, aObserver);
   259 	}
   260 	
   261 /**
   262 	Sends a command to the OpenMAX Processing Unit.
   263 	@param	aCmd		The command for the component to execute.	
   264 	@param	aParam1		The parameter for the command to be executed.
   265 	@param	aCmdData	A pointer to the data for the command.
   266 	@return	An error code indicating if the function call was successful.
   267 			KErrNone on success, otherwise another of the system-wide error codes.
   268 */
   269 EXPORT_C TInt COmxProcessingUnit::OmxSendCommand(OMX_COMMANDTYPE aCmd, TUint32 aParam1, TAny* aCmdData)
   270 	{
   271 	return iBody->SendCommand(aCmd, aParam1, aCmdData);	
   272 	}
   273 
   274 /**
   275 	Sends a parameter from the OpenMAX Processing Unit.
   276 	@param	aParamIndex						The index of the structure to be sent.
   277 	@param	aComponentParameterStructure	A pointer to structure to be used by the component.
   278 	@return	An error code indicating if the function call was successful.
   279 			KErrNone on success, otherwise another of the system-wide error codes.
   280 */
   281 EXPORT_C TInt COmxProcessingUnit::OmxSetParameter(OMX_INDEXTYPE aParamIndex, TAny* aComponentParameterStructure)
   282 	{
   283 	return iBody->SetParameter(aParamIndex, aComponentParameterStructure);	
   284 	}
   285 
   286 
   287