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 "pcmprocessingunit.h" sl@0: #include "pcminputport.h" sl@0: #include "pcmoutputport.h" sl@0: #include sl@0: sl@0: const TInt KPcmInputPortIndex = 0; sl@0: const TInt KPcmOutputPortIndex = 1; sl@0: _LIT8(KPcmILComponentName, "OMX.SYMBIAN.AUDIO.CODEC.PCM"); sl@0: sl@0: sl@0: CPcmProcessingUnit::CPcmProcessingUnit() sl@0: { sl@0: } sl@0: sl@0: CPcmProcessingUnit* CPcmProcessingUnit::NewP8P16L() sl@0: { sl@0: CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(EPCM8, EPCM16); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CPcmProcessingUnit* CPcmProcessingUnit::NewP16P8L() sl@0: { sl@0: CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(EPCM16, EPCM8); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CPcmProcessingUnit* CPcmProcessingUnit::NewPU8P16L() sl@0: { sl@0: CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(EPCMU8, EPCM16); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CPcmProcessingUnit* CPcmProcessingUnit::NewP16PU8L() sl@0: { sl@0: CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(EPCM16, EPCMU8); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: void CPcmProcessingUnit::ConstructL(TPcmDataType aSrcDataType, TPcmDataType aDestDataType) sl@0: { sl@0: iSrcDataType = aSrcDataType; sl@0: iDestDataType = aDestDataType; sl@0: } sl@0: sl@0: sl@0: CPcmProcessingUnit::~CPcmProcessingUnit() sl@0: { sl@0: // Delete input and output ports sl@0: delete iInputPort; sl@0: iInputPort = NULL; sl@0: delete iOutputPort; sl@0: iOutputPort = NULL; sl@0: } sl@0: sl@0: sl@0: TInt CPcmProcessingUnit::Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver) sl@0: { sl@0: TInt err = KErrNone; sl@0: // Create underlying OMX component sl@0: TRAP(err, COmxProcessingUnit::ConstructL(KPcmILComponentName, aProcessingUnitObserver)); sl@0: if (err == KErrNone) sl@0: { sl@0: SetPuState(EProcessingUnitLoaded); sl@0: sl@0: // Create Input and output ports sl@0: TRAP(err, iInputPort = CPcmInputPort::NewL(KPcmInputPortIndex, this, iSrcDataType)); sl@0: if(err != KErrNone) sl@0: { sl@0: return err; sl@0: } sl@0: sl@0: TRAPD(err, iOutputPort = CPcmOutputPort::NewL(KPcmOutputPortIndex, this, iDestDataType)); sl@0: if(err != KErrNone) sl@0: { sl@0: return err; sl@0: } sl@0: sl@0: // Add them to processing unit sl@0: err = AddInputPort(iInputPort); sl@0: if (err != KErrNone) sl@0: { sl@0: return err; sl@0: } sl@0: err = AddOutputPort(iOutputPort); sl@0: } sl@0: return err; sl@0: } sl@0: sl@0: sl@0: TInt CPcmProcessingUnit::Configure(const TPuConfig& /*aConfig*/) sl@0: { sl@0: return KErrNone; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: