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 "pcmprocessingunit.h"
|
sl@0
|
18 |
#include "pcminputport.h"
|
sl@0
|
19 |
#include "pcmoutputport.h"
|
sl@0
|
20 |
#include <mmf/server/taskconfig.h>
|
sl@0
|
21 |
|
sl@0
|
22 |
const TInt KPcmInputPortIndex = 0;
|
sl@0
|
23 |
const TInt KPcmOutputPortIndex = 1;
|
sl@0
|
24 |
_LIT8(KPcmILComponentName, "OMX.SYMBIAN.AUDIO.CODEC.PCM");
|
sl@0
|
25 |
|
sl@0
|
26 |
|
sl@0
|
27 |
CPcmProcessingUnit::CPcmProcessingUnit()
|
sl@0
|
28 |
{
|
sl@0
|
29 |
}
|
sl@0
|
30 |
|
sl@0
|
31 |
CPcmProcessingUnit* CPcmProcessingUnit::NewP8P16L()
|
sl@0
|
32 |
{
|
sl@0
|
33 |
CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit;
|
sl@0
|
34 |
CleanupStack::PushL(self);
|
sl@0
|
35 |
self->ConstructL(EPCM8, EPCM16);
|
sl@0
|
36 |
CleanupStack::Pop(self);
|
sl@0
|
37 |
return self;
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
CPcmProcessingUnit* CPcmProcessingUnit::NewP16P8L()
|
sl@0
|
41 |
{
|
sl@0
|
42 |
CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit;
|
sl@0
|
43 |
CleanupStack::PushL(self);
|
sl@0
|
44 |
self->ConstructL(EPCM16, EPCM8);
|
sl@0
|
45 |
CleanupStack::Pop(self);
|
sl@0
|
46 |
return self;
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
CPcmProcessingUnit* CPcmProcessingUnit::NewPU8P16L()
|
sl@0
|
50 |
{
|
sl@0
|
51 |
CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit;
|
sl@0
|
52 |
CleanupStack::PushL(self);
|
sl@0
|
53 |
self->ConstructL(EPCMU8, EPCM16);
|
sl@0
|
54 |
CleanupStack::Pop(self);
|
sl@0
|
55 |
return self;
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
CPcmProcessingUnit* CPcmProcessingUnit::NewP16PU8L()
|
sl@0
|
59 |
{
|
sl@0
|
60 |
CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit;
|
sl@0
|
61 |
CleanupStack::PushL(self);
|
sl@0
|
62 |
self->ConstructL(EPCM16, EPCMU8);
|
sl@0
|
63 |
CleanupStack::Pop(self);
|
sl@0
|
64 |
return self;
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
void CPcmProcessingUnit::ConstructL(TPcmDataType aSrcDataType, TPcmDataType aDestDataType)
|
sl@0
|
68 |
{
|
sl@0
|
69 |
iSrcDataType = aSrcDataType;
|
sl@0
|
70 |
iDestDataType = aDestDataType;
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|
sl@0
|
73 |
|
sl@0
|
74 |
CPcmProcessingUnit::~CPcmProcessingUnit()
|
sl@0
|
75 |
{
|
sl@0
|
76 |
// Delete input and output ports
|
sl@0
|
77 |
delete iInputPort;
|
sl@0
|
78 |
iInputPort = NULL;
|
sl@0
|
79 |
delete iOutputPort;
|
sl@0
|
80 |
iOutputPort = NULL;
|
sl@0
|
81 |
}
|
sl@0
|
82 |
|
sl@0
|
83 |
|
sl@0
|
84 |
TInt CPcmProcessingUnit::Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver)
|
sl@0
|
85 |
{
|
sl@0
|
86 |
TInt err = KErrNone;
|
sl@0
|
87 |
// Create underlying OMX component
|
sl@0
|
88 |
TRAP(err, COmxProcessingUnit::ConstructL(KPcmILComponentName, aProcessingUnitObserver));
|
sl@0
|
89 |
if (err == KErrNone)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
SetPuState(EProcessingUnitLoaded);
|
sl@0
|
92 |
|
sl@0
|
93 |
// Create Input and output ports
|
sl@0
|
94 |
TRAP(err, iInputPort = CPcmInputPort::NewL(KPcmInputPortIndex, this, iSrcDataType));
|
sl@0
|
95 |
if(err != KErrNone)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
return err;
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
TRAPD(err, iOutputPort = CPcmOutputPort::NewL(KPcmOutputPortIndex, this, iDestDataType));
|
sl@0
|
101 |
if(err != KErrNone)
|
sl@0
|
102 |
{
|
sl@0
|
103 |
return err;
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
// Add them to processing unit
|
sl@0
|
107 |
err = AddInputPort(iInputPort);
|
sl@0
|
108 |
if (err != KErrNone)
|
sl@0
|
109 |
{
|
sl@0
|
110 |
return err;
|
sl@0
|
111 |
}
|
sl@0
|
112 |
err = AddOutputPort(iOutputPort);
|
sl@0
|
113 |
}
|
sl@0
|
114 |
return err;
|
sl@0
|
115 |
}
|
sl@0
|
116 |
|
sl@0
|
117 |
|
sl@0
|
118 |
TInt CPcmProcessingUnit::Configure(const TPuConfig& /*aConfig*/)
|
sl@0
|
119 |
{
|
sl@0
|
120 |
return KErrNone;
|
sl@0
|
121 |
}
|
sl@0
|
122 |
|
sl@0
|
123 |
|
sl@0
|
124 |
|
sl@0
|
125 |
|
sl@0
|
126 |
|