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