sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include "omxcomponentbody.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: Default constructor. sl@0: */ sl@0: EXPORT_C COmxProcessingUnit::COmxProcessingUnit() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Destructor. sl@0: */ sl@0: EXPORT_C COmxProcessingUnit::~COmxProcessingUnit() sl@0: { sl@0: delete iBody; sl@0: } sl@0: sl@0: /** sl@0: Safe constructing method. sl@0: @param aComponentName The name of the component to be contructed. sl@0: @param aProcessingUnitObserver Reference to the obsever for this Processing Unit. sl@0: */ sl@0: EXPORT_C void COmxProcessingUnit::ConstructL(const TDesC8& aComponentName, const MMdfProcessingUnitObserver& aProcessingUnitObserver) sl@0: { sl@0: iBody = CBody::NewL(aComponentName, *this, this, aProcessingUnitObserver); sl@0: } sl@0: sl@0: /**. sl@0: @see CMdfProcessingUnit::Create sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::Create(const MMdfProcessingUnitObserver& /* aProcessingUnitObserver */) sl@0: { sl@0: return KErrNotSupported; sl@0: } sl@0: sl@0: /**. sl@0: @see CMdfProcessingUnit::GetInputPorts sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::GetInputPorts(RPointerArray& aComponentInputPorts) sl@0: { sl@0: return iBody->GetInputPorts(aComponentInputPorts); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::GetOutputPorts sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::GetOutputPorts(RPointerArray& aComponentOutputPorts) sl@0: { sl@0: return iBody->GetOutputPorts(aComponentOutputPorts); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::Initialize sl@0: @see MMdfProcessingUnitObserver::InitializeComplete() sl@0: */ sl@0: EXPORT_C void COmxProcessingUnit::Initialize() sl@0: { sl@0: iBody->Initialize(); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::Execute sl@0: */ sl@0: EXPORT_C void COmxProcessingUnit::Execute() sl@0: { sl@0: iBody->Execute(); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::State sl@0: */ sl@0: EXPORT_C TProcessingUnitState COmxProcessingUnit::State() sl@0: { sl@0: return iBody->State(); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::Configure sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::Configure(const TPuConfig& aConfig) sl@0: { sl@0: return iBody->Configure(aConfig); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::GetConfig sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::GetConfig(TPuConfig& aConfig) sl@0: { sl@0: return iBody->GetConfig(aConfig); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::Pause sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::Pause() sl@0: { sl@0: return iBody->Pause(); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::Stop sl@0: */ sl@0: EXPORT_C void COmxProcessingUnit::Stop() sl@0: { sl@0: iBody->Stop(); sl@0: } sl@0: sl@0: EXPORT_C TInt COmxProcessingUnit::MopcEventHandler(OMX_HANDLETYPE aComponent, OMX_EVENTTYPE aEvent, TUint32 aData1, sl@0: TUint32 aData2, TAny* aExtraInfo) sl@0: { sl@0: return iBody->EventHandler(aComponent, aEvent, aData1, aData2, aExtraInfo); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::CreateCustomInterface sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::CreateCustomInterface(TUid aUid) sl@0: { sl@0: return iBody->CreateCustomInterface(aUid); sl@0: } sl@0: sl@0: /** sl@0: @see CMdfProcessingUnit::CustomInterface sl@0: */ sl@0: EXPORT_C TAny* COmxProcessingUnit::CustomInterface(TUid aUid) sl@0: { sl@0: return iBody->CustomInterface(aUid); sl@0: } sl@0: sl@0: /** sl@0: Add an input port to the component sl@0: @param aInputPort A pointer to the input port sl@0: @return KErrNone if successful or one of the system wide error codes sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::AddInputPort(MMdfInputPort* aInputPort) sl@0: { sl@0: return iBody->AddInputPort(aInputPort); sl@0: } sl@0: sl@0: /** sl@0: Add an output port to the component sl@0: @param aOutputPort A pointer to the output port sl@0: @return KErrNone if successful or one of the system wide error codes sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::AddOutputPort(MMdfOutputPort* aOutputPort) sl@0: { sl@0: return iBody->AddOutputPort(aOutputPort); sl@0: } sl@0: sl@0: /** sl@0: Return the observer interface for the component sl@0: @return The observer interface sl@0: */ sl@0: EXPORT_C const MMdfProcessingUnitObserver* COmxProcessingUnit::Observer() sl@0: { sl@0: return iBody->Observer(); sl@0: } sl@0: sl@0: /** sl@0: Sets the internal PU State sl@0: @param aPuState The internal state of the component sl@0: */ sl@0: EXPORT_C void COmxProcessingUnit::SetPuState(TProcessingUnitState aPuState) sl@0: { sl@0: iBody->SetPuState(aPuState); sl@0: } sl@0: sl@0: // Calls to OmxComponent sl@0: sl@0: /** sl@0: Requests a current parameter from the OpenMAX Processing Unit. sl@0: @param aParamIndex The index of the structure to be filled. sl@0: @param aComponentParameterStructure A pointer to structure to be filled by the component. sl@0: @return An error code indicating if the function call was successful. sl@0: KErrNone on success, otherwise another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::OmxGetParameter(OMX_INDEXTYPE aParamIndex, TAny* aComponentParameterStructure) sl@0: { sl@0: return iBody->GetParameter(aParamIndex, aComponentParameterStructure); sl@0: } sl@0: sl@0: /** sl@0: Instructs the OpenMAX Processing Unit to use the buffer passed in the function's argument. sl@0: @param aBuffer The buffer to be used. sl@0: @param aPortIndex The port that the given buffer should be associated with. sl@0: @return An error code indicating if the function call was successful. KErrNone sl@0: on success, otherwise another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::OmxUseBuffer(CMMFBuffer* aBuffer, TUint32 aPortIndex) sl@0: { sl@0: return iBody->UseBuffer(aBuffer, aPortIndex); sl@0: } sl@0: sl@0: /** sl@0: Instructs the OpenMAX Processing Unit to allocate a buffer. Ownership is transferred to the caller. sl@0: @param aPortIndex The Port Index that the new buffer is associated with. sl@0: @param aSizeBytes The size of the buffer to be allocated, in bytes. sl@0: @return A pointer to the newly created buffer. sl@0: */ sl@0: EXPORT_C CMMFBuffer* COmxProcessingUnit::OmxAllocateBufferL(TUint32 aPortIndex, TUint32 aSizeBytes) sl@0: { sl@0: return iBody->AllocateBufferL(aPortIndex, aSizeBytes); sl@0: } sl@0: sl@0: /** sl@0: Instructs the OpenMAX Processing Unit to free the buffer passed in the function's argument. sl@0: @param aBuffer The buffer to be freed sl@0: @return An error code indicating if the function call was successful. KErrNone sl@0: on success, otherwise another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::OmxFreeBuffer(CMMFBuffer* aBuffer) sl@0: { sl@0: return iBody->FreeBuffer(aBuffer); sl@0: } sl@0: sl@0: /** sl@0: Sends an full buffer to an input port of a component. sl@0: @param aBuffer The buffer to be emptied. sl@0: @param aObserver The observer of the input port that is to be notified. sl@0: @return An error code indicating if the function call was successful. KErrNone sl@0: on success, otherwise another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::OmxEmptyThisBuffer(const CMMFBuffer* aBuffer, MOmxInputPortCallbacks* aObserver) sl@0: { sl@0: return iBody->EmptyThisBuffer(aBuffer, aObserver); sl@0: } sl@0: sl@0: /** sl@0: Sends an empty buffer to an output port of a component. sl@0: @param aBuffer The buffer to be filled. sl@0: @param aObserver The observer of the output port that is to be notified. sl@0: @return An error code indicating if the function call was successful. KErrNone sl@0: on success, otherwise another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::OmxFillThisBuffer(CMMFBuffer* aBuffer, MOmxOutputPortCallbacks* aObserver) sl@0: { sl@0: return iBody->FillThisBuffer(aBuffer, aObserver); sl@0: } sl@0: sl@0: /** sl@0: Sends a command to the OpenMAX Processing Unit. sl@0: @param aCmd The command for the component to execute. sl@0: @param aParam1 The parameter for the command to be executed. sl@0: @param aCmdData A pointer to the data for the command. sl@0: @return An error code indicating if the function call was successful. sl@0: KErrNone on success, otherwise another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::OmxSendCommand(OMX_COMMANDTYPE aCmd, TUint32 aParam1, TAny* aCmdData) sl@0: { sl@0: return iBody->SendCommand(aCmd, aParam1, aCmdData); sl@0: } sl@0: sl@0: /** sl@0: Sends a parameter from the OpenMAX Processing Unit. sl@0: @param aParamIndex The index of the structure to be sent. sl@0: @param aComponentParameterStructure A pointer to structure to be used by the component. sl@0: @return An error code indicating if the function call was successful. sl@0: KErrNone on success, otherwise another of the system-wide error codes. sl@0: */ sl@0: EXPORT_C TInt COmxProcessingUnit::OmxSetParameter(OMX_INDEXTYPE aParamIndex, TAny* aComponentParameterStructure) sl@0: { sl@0: return iBody->SetParameter(aParamIndex, aComponentParameterStructure); sl@0: } sl@0: sl@0: sl@0: