|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CMCEAMRCODEC_H |
|
22 #define CMCEAMRCODEC_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <mceaudiocodec.h> |
|
26 #include <mcedefs.h> |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KMceAmrNbBitrate475 = 4750; |
|
30 const TInt KMceAmrNbBitrate515 = 5150; |
|
31 const TInt KMceAmrNbBitrate590 = 5900; |
|
32 const TInt KMceAmrNbBitrate670 = 6700; |
|
33 const TInt KMceAmrNbBitrate740 = 7400; |
|
34 const TInt KMceAmrNbBitrate795 = 7950; |
|
35 const TInt KMceAmrNbBitrate102 = 10200; |
|
36 const TInt KMceAmrNbBitrate122 = 12200; |
|
37 |
|
38 const TUint KMceAllowedAmrNbBitrate475 = 0x0001; |
|
39 const TUint KMceAllowedAmrNbBitrate515 = 0x0002; |
|
40 const TUint KMceAllowedAmrNbBitrate590 = 0x0004; |
|
41 const TUint KMceAllowedAmrNbBitrate670 = 0x0008; |
|
42 const TUint KMceAllowedAmrNbBitrate740 = 0x0010; |
|
43 const TUint KMceAllowedAmrNbBitrate795 = 0x0020; |
|
44 const TUint KMceAllowedAmrNbBitrate102 = 0x0040; |
|
45 const TUint KMceAllowedAmrNbBitrate122 = 0x0080; |
|
46 const TUint KMceAllowedAmrNbBitrateAll = 0x00FF; |
|
47 |
|
48 // Allowed bitrates bitfield can contain additional information |
|
49 const TUint KMceAllowedAmrNbAdditionalInfo = 0xF00; |
|
50 |
|
51 // If this bit is not present, mode-change-period=1 |
|
52 const TUint KMceAllowedAmrNbChangePeriod2 = 0x0100; |
|
53 |
|
54 // If this bit is not present, mode-change-neighbor=0 |
|
55 const TUint KMceAllowedAmrNbChangeNeighbor1 = 0x0200; |
|
56 |
|
57 |
|
58 const TUint KMceAmrNbSamplingFreq = 8000; |
|
59 const TUint KMceAmrWbSamplingFreq = 16000; |
|
60 |
|
61 const TUint KMceDefaultMaxPtime = 400; |
|
62 const TUint KMceDefaultPtime = 20; |
|
63 |
|
64 |
|
65 // DATA TYPES |
|
66 enum TAmrCodecMode |
|
67 { |
|
68 EMceBandwidthEfficient = 4, |
|
69 EMceOctetAligned |
|
70 }; |
|
71 |
|
72 // CLASS DECLARATION |
|
73 |
|
74 /** |
|
75 * Class for the AMR codec information. |
|
76 * |
|
77 * It checks the validity of inserted values for AMR. |
|
78 * |
|
79 * @lib mceclient.lib |
|
80 */ |
|
81 class CMceAmrCodec : public CMceAudioCodec |
|
82 { |
|
83 public: // Constructors and destructor |
|
84 |
|
85 /** |
|
86 * Destructor. |
|
87 */ |
|
88 IMPORT_C ~CMceAmrCodec(); |
|
89 |
|
90 public: // From base class |
|
91 |
|
92 /** |
|
93 * Enable / Disable Voice Activity Detection. |
|
94 * @param aEnableVAD, Boolean indicating whether to enable Voice Activity Detection |
|
95 * @return KErrNotSupported if codec doesn't support VAD; otherwise KErrNone. |
|
96 */ |
|
97 IMPORT_C TInt EnableVAD(TBool aEnableVAD); |
|
98 |
|
99 /** |
|
100 * Sets bitrate used with codec for encoding. |
|
101 * @param aBitrate, bitrate value for encoding |
|
102 * @return KErrNotSupported if codec doesn't support bitrate value issued; otherwise KErrNone. |
|
103 */ |
|
104 IMPORT_C TInt SetBitrate(TUint aBitrate); |
|
105 |
|
106 /** |
|
107 * Sets bitrates allowed with codec. |
|
108 * @param aBitrates, allowed bitrate values (like KMceAmrNbBitrate590|KMceAmrNbBitrate670) |
|
109 * @return KErrNotSupported if codec doesn't support bitrate value issued; otherwise KErrNone. |
|
110 */ |
|
111 IMPORT_C TInt SetAllowedBitrates(TUint aBitrates); |
|
112 |
|
113 /** |
|
114 * Sets the sampling frequency. |
|
115 * @param aSamplingFreq, Sampling frequency to be used |
|
116 * @return KErrNotSupported if codec doesn't support sampling frequency issued; otherwise KErrNone. |
|
117 */ |
|
118 IMPORT_C TInt SetSamplingFreq(TUint aSamplingFreq); |
|
119 |
|
120 /** |
|
121 * Sets the packetization rate. |
|
122 * @param aPTime, Packetization rate, must be multiple of audio frame size. |
|
123 * @return KErrNotSupported if codec doesn't support packetrate value issued; otherwise KErrNone. |
|
124 */ |
|
125 IMPORT_C TInt SetPTime(TUint aPTime); |
|
126 |
|
127 /** |
|
128 * Sets the maximum packetization rate. |
|
129 * @param aMaxPTime, maximum allowed packetization rate, must be multiple of audio frame size. |
|
130 * @return KErrNotSupported if codec doesn't support packetrate value issued; otherwise KErrNone. |
|
131 */ |
|
132 IMPORT_C TInt SetMaxPTime(TUint aMaxPTime); |
|
133 |
|
134 /** |
|
135 * Sets the payload type identifier. |
|
136 * @param aPayloadType payload type identifier. |
|
137 * @return One of the standard system-wide error codes. |
|
138 */ |
|
139 IMPORT_C TInt SetPayloadType(TUint8 aPayloadType); |
|
140 |
|
141 /** |
|
142 * Sets the codec mode. |
|
143 * @param aCodecMode Codec mode ( Bandwidth efficient / octet aligned ) |
|
144 * @return KErrNotSupported if codec doesnt' support codec mode value issued; otherwise KErrNone. |
|
145 */ |
|
146 IMPORT_C TInt SetCodecMode(TUint aCodecMode); |
|
147 |
|
148 /** |
|
149 * Clones codec, ownership is transferred. |
|
150 * @return cloned codec |
|
151 */ |
|
152 IMPORT_C CMceAudioCodec* CloneL() const; |
|
153 |
|
154 public: |
|
155 |
|
156 /** |
|
157 * Two-phased constructor. |
|
158 * @param aSdpName sdp name |
|
159 */ |
|
160 static CMceAmrCodec* NewL( TBuf8<KMceMaxSdpNameLength> aSdpName); |
|
161 |
|
162 /** |
|
163 * Two-phased constructor. |
|
164 * @param aSdpName sdp name |
|
165 */ |
|
166 static CMceAmrCodec* NewLC(TBuf8<KMceMaxSdpNameLength> aSdpName); |
|
167 |
|
168 |
|
169 protected: |
|
170 |
|
171 /** |
|
172 * C++ default constructor. |
|
173 */ |
|
174 CMceAmrCodec(); |
|
175 |
|
176 /** |
|
177 * Sets the sdp name. |
|
178 * @param aSdpName the sdp name |
|
179 */ |
|
180 void SetSdpNameL( const TDesC8& aSdpName ); |
|
181 |
|
182 private: |
|
183 |
|
184 /** |
|
185 * By default Symbian 2nd phase constructor is private. |
|
186 */ |
|
187 void ConstructL( TBuf8<KMceMaxSdpNameLength> aSdpName); |
|
188 |
|
189 |
|
190 |
|
191 //for testing |
|
192 |
|
193 MCE_UNIT_TEST_DEFS |
|
194 }; |
|
195 |
|
196 #endif |
|
197 |
|
198 // End of File |