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