First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
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>
26 EXPORT_C COmxProcessingUnit::COmxProcessingUnit()
33 EXPORT_C COmxProcessingUnit::~COmxProcessingUnit()
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.
43 EXPORT_C void COmxProcessingUnit::ConstructL(const TDesC8& aComponentName, const MMdfProcessingUnitObserver& aProcessingUnitObserver)
45 iBody = CBody::NewL(aComponentName, *this, this, aProcessingUnitObserver);
49 @see CMdfProcessingUnit::Create
51 EXPORT_C TInt COmxProcessingUnit::Create(const MMdfProcessingUnitObserver& /* aProcessingUnitObserver */)
53 return KErrNotSupported;
57 @see CMdfProcessingUnit::GetInputPorts
59 EXPORT_C TInt COmxProcessingUnit::GetInputPorts(RPointerArray<MMdfInputPort>& aComponentInputPorts)
61 return iBody->GetInputPorts(aComponentInputPorts);
65 @see CMdfProcessingUnit::GetOutputPorts
67 EXPORT_C TInt COmxProcessingUnit::GetOutputPorts(RPointerArray<MMdfOutputPort>& aComponentOutputPorts)
69 return iBody->GetOutputPorts(aComponentOutputPorts);
73 @see CMdfProcessingUnit::Initialize
74 @see MMdfProcessingUnitObserver::InitializeComplete()
76 EXPORT_C void COmxProcessingUnit::Initialize()
82 @see CMdfProcessingUnit::Execute
84 EXPORT_C void COmxProcessingUnit::Execute()
90 @see CMdfProcessingUnit::State
92 EXPORT_C TProcessingUnitState COmxProcessingUnit::State()
94 return iBody->State();
98 @see CMdfProcessingUnit::Configure
100 EXPORT_C TInt COmxProcessingUnit::Configure(const TPuConfig& aConfig)
102 return iBody->Configure(aConfig);
106 @see CMdfProcessingUnit::GetConfig
108 EXPORT_C TInt COmxProcessingUnit::GetConfig(TPuConfig& aConfig)
110 return iBody->GetConfig(aConfig);
114 @see CMdfProcessingUnit::Pause
116 EXPORT_C TInt COmxProcessingUnit::Pause()
118 return iBody->Pause();
122 @see CMdfProcessingUnit::Stop
124 EXPORT_C void COmxProcessingUnit::Stop()
129 EXPORT_C TInt COmxProcessingUnit::MopcEventHandler(OMX_HANDLETYPE aComponent, OMX_EVENTTYPE aEvent, TUint32 aData1,
130 TUint32 aData2, TAny* aExtraInfo)
132 return iBody->EventHandler(aComponent, aEvent, aData1, aData2, aExtraInfo);
136 @see CMdfProcessingUnit::CreateCustomInterface
138 EXPORT_C TInt COmxProcessingUnit::CreateCustomInterface(TUid aUid)
140 return iBody->CreateCustomInterface(aUid);
144 @see CMdfProcessingUnit::CustomInterface
146 EXPORT_C TAny* COmxProcessingUnit::CustomInterface(TUid aUid)
148 return iBody->CustomInterface(aUid);
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
156 EXPORT_C TInt COmxProcessingUnit::AddInputPort(MMdfInputPort* aInputPort)
158 return iBody->AddInputPort(aInputPort);
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
166 EXPORT_C TInt COmxProcessingUnit::AddOutputPort(MMdfOutputPort* aOutputPort)
168 return iBody->AddOutputPort(aOutputPort);
172 Return the observer interface for the component
173 @return The observer interface
175 EXPORT_C const MMdfProcessingUnitObserver* COmxProcessingUnit::Observer()
177 return iBody->Observer();
181 Sets the internal PU State
182 @param aPuState The internal state of the component
184 EXPORT_C void COmxProcessingUnit::SetPuState(TProcessingUnitState aPuState)
186 iBody->SetPuState(aPuState);
189 // Calls to OmxComponent
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.
198 EXPORT_C TInt COmxProcessingUnit::OmxGetParameter(OMX_INDEXTYPE aParamIndex, TAny* aComponentParameterStructure)
200 return iBody->GetParameter(aParamIndex, aComponentParameterStructure);
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.
210 EXPORT_C TInt COmxProcessingUnit::OmxUseBuffer(CMMFBuffer* aBuffer, TUint32 aPortIndex)
212 return iBody->UseBuffer(aBuffer, aPortIndex);
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.
221 EXPORT_C CMMFBuffer* COmxProcessingUnit::OmxAllocateBufferL(TUint32 aPortIndex, TUint32 aSizeBytes)
223 return iBody->AllocateBufferL(aPortIndex, aSizeBytes);
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.
232 EXPORT_C TInt COmxProcessingUnit::OmxFreeBuffer(CMMFBuffer* aBuffer)
234 return iBody->FreeBuffer(aBuffer);
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.
244 EXPORT_C TInt COmxProcessingUnit::OmxEmptyThisBuffer(const CMMFBuffer* aBuffer, MOmxInputPortCallbacks* aObserver)
246 return iBody->EmptyThisBuffer(aBuffer, aObserver);
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.
256 EXPORT_C TInt COmxProcessingUnit::OmxFillThisBuffer(CMMFBuffer* aBuffer, MOmxOutputPortCallbacks* aObserver)
258 return iBody->FillThisBuffer(aBuffer, aObserver);
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.
269 EXPORT_C TInt COmxProcessingUnit::OmxSendCommand(OMX_COMMANDTYPE aCmd, TUint32 aParam1, TAny* aCmdData)
271 return iBody->SendCommand(aCmd, aParam1, aCmdData);
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.
281 EXPORT_C TInt COmxProcessingUnit::OmxSetParameter(OMX_INDEXTYPE aParamIndex, TAny* aComponentParameterStructure)
283 return iBody->SetParameter(aParamIndex, aComponentParameterStructure);