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