|
1 /* |
|
2 * Copyright (c) 2007 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: Accessory audio stream format. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef ACCPOLAUDIOSTREAMFORMAT_H |
|
19 #define ACCPOLAUDIOSTREAMFORMAT_H |
|
20 |
|
21 #include <e32cmn.h> |
|
22 #include <accpolobjectbase.h> |
|
23 #include <accpolobjecttypes.h> |
|
24 |
|
25 /** Pulse Code Modulation. A common linear audio encoding format. */ |
|
26 const TUid KUidFormatPCM16 = |
|
27 { |
|
28 0x0000001 |
|
29 }; |
|
30 |
|
31 /** Umbrella name for MPEG1 Layer 3, MPEG2 Layer 3 and |
|
32 MPEG 2.5 Layer 3 audio codec. */ |
|
33 const TUid KUidFormatMP3 = |
|
34 { |
|
35 0x0000002 |
|
36 }; |
|
37 |
|
38 /** Adaptive multi-rate wide band speech codec. */ |
|
39 const TUid KUidFormatAWB = |
|
40 { |
|
41 0x0000003 |
|
42 }; |
|
43 |
|
44 /** Low Complexity Sub Band Coding. */ |
|
45 const TUid KUidFormatSBC = |
|
46 { |
|
47 0x0000004 |
|
48 }; |
|
49 |
|
50 /** Mobile baseline speech. */ |
|
51 const TUid KUidFormatAMR = |
|
52 { |
|
53 0x0000005 |
|
54 }; |
|
55 |
|
56 /** MPEG-4 advanced audio coding. */ |
|
57 const TUid KUidFormatAAC = |
|
58 { |
|
59 0x0000006 |
|
60 }; |
|
61 |
|
62 /** Extended AAC version for low bit rates. */ |
|
63 const TUid KUidFormatEAAC = |
|
64 { |
|
65 0x0000007 |
|
66 }; |
|
67 |
|
68 /** Speech coding by scalar quantization. */ |
|
69 const TUid KUidFormatG711 = |
|
70 { |
|
71 0x0000008 |
|
72 }; |
|
73 |
|
74 /** Internet low bit rate codec. */ |
|
75 const TUid KUidFormatILBC = |
|
76 { |
|
77 0x0000009 |
|
78 }; |
|
79 |
|
80 /** A low bit rate speech coder standard */ |
|
81 const TUid KUidFormatG729 = |
|
82 { |
|
83 0x000000A |
|
84 }; |
|
85 |
|
86 /** Used to refer non coded 8 bit linear audion */ |
|
87 const TUid KUidFormatRA8 = |
|
88 { |
|
89 0x000000B |
|
90 }; |
|
91 |
|
92 /** |
|
93 * Store's an audio stream format parameters. |
|
94 * |
|
95 * @accpolaudiodevicetopology.lib |
|
96 */ |
|
97 NONSHARABLE_CLASS ( CAccPolAudioStreamFormat ) : public CAccPolObjectBase |
|
98 { |
|
99 |
|
100 public: |
|
101 |
|
102 /** |
|
103 * Stream type. |
|
104 */ |
|
105 enum TStreamType |
|
106 { |
|
107 EStreamNone = 0, |
|
108 EFormatSpecificStreamType, |
|
109 EMono, |
|
110 EStereo |
|
111 }; |
|
112 |
|
113 /** |
|
114 * Bit resolution. |
|
115 */ |
|
116 enum TBitResolution |
|
117 { |
|
118 EFormatNone = 0, |
|
119 EFormatSpecificBitResolution, |
|
120 EBitsPerSample16, |
|
121 EBitsPerSample24, |
|
122 EBitsPerSample32, |
|
123 }; |
|
124 |
|
125 /** |
|
126 * Destructor. |
|
127 */ |
|
128 virtual ~CAccPolAudioStreamFormat(); |
|
129 |
|
130 /** |
|
131 * Two-phased constructor. |
|
132 */ |
|
133 IMPORT_C static CAccPolAudioStreamFormat* NewL( |
|
134 const TStreamConObjectType aObjectType, |
|
135 CAccPolObjectCon* aObject = NULL ); |
|
136 |
|
137 /** |
|
138 * Two-phased constructor. |
|
139 */ |
|
140 IMPORT_C static CAccPolAudioStreamFormat* NewL( |
|
141 const TStreamConObjectType aObjectType, |
|
142 const TUint8 aUnitId, |
|
143 const TUid aAudioFormat, |
|
144 const TStreamType aStreamType, |
|
145 const TBitResolution aBitResolution, |
|
146 const TUint32 aSamFreq ); |
|
147 /** |
|
148 * Two-phased constructor. |
|
149 */ |
|
150 IMPORT_C static CAccPolAudioStreamFormat* NewLC( |
|
151 const TStreamConObjectType aObjectType, |
|
152 CAccPolObjectCon* aObject = NULL ); |
|
153 |
|
154 /** |
|
155 * Two-phased constructor. |
|
156 */ |
|
157 IMPORT_C static CAccPolAudioStreamFormat* NewLC( |
|
158 const TStreamConObjectType aObjectType, |
|
159 const TUint8 aUnitId, |
|
160 const TUid aAudioFormat, |
|
161 const TStreamType aStreamType, |
|
162 const TBitResolution aBitResolution, |
|
163 const TUint32 aSamFreq ); |
|
164 |
|
165 /** |
|
166 * Assign operator for audio stream format class. |
|
167 * |
|
168 * @param CAccPolAudioStreamFormat, Const reference to object to be copied. |
|
169 * @return CAccPolAudioStreamFormat, Reference to object pointer. |
|
170 */ |
|
171 IMPORT_C CAccPolAudioStreamFormat& operator= ( |
|
172 const CAccPolAudioStreamFormat& ); |
|
173 |
|
174 /** |
|
175 * Sets the unit id. |
|
176 * |
|
177 * @param aUnitId, Unit id to be stored. |
|
178 * In USB case input or output terminal unit id where the audio stream format |
|
179 * parameters are associated. |
|
180 * @return void. |
|
181 */ |
|
182 IMPORT_C void SetUnitId( const TUint8 aUnitId ); |
|
183 |
|
184 /** |
|
185 * Sets the audio format. |
|
186 * |
|
187 * @param aAudioFormat, Audio format to be stored. |
|
188 * Possible TUid's are defined in AccPolAudioStreamFormat.h. |
|
189 * @return void. |
|
190 */ |
|
191 IMPORT_C void SetAudioFormat( const TUid aAudioFormat ); |
|
192 |
|
193 /** |
|
194 * Sets the audio data stream type. |
|
195 * |
|
196 * @param aStreamType, Stream type to be stored. |
|
197 * Possible channel types are defined in AccPolAudioStreamFormat.h. |
|
198 * @return void. |
|
199 */ |
|
200 IMPORT_C void SetStreamType( const TStreamType aStreamType ); |
|
201 |
|
202 /** |
|
203 * Sets the bit resolution. |
|
204 * |
|
205 * @param aBitResolution, Bit resolution to be stored. |
|
206 * Possible bit resolution values are defined in AccPolAudioStreamFormat.h. |
|
207 * @return void. |
|
208 */ |
|
209 IMPORT_C void SetBitResolution( const TBitResolution aBitResolution ); |
|
210 |
|
211 /** |
|
212 * Sets the sampling frequency. |
|
213 * |
|
214 * @param aSamFreq, Sampling frequency to be stored (Hz). |
|
215 * @return void. |
|
216 */ |
|
217 IMPORT_C void SetSamFreq( const TUint32 aSamFreq ); |
|
218 |
|
219 /** |
|
220 * Returns the unit id. |
|
221 * |
|
222 * @return TUint8, Value of unit id. |
|
223 */ |
|
224 IMPORT_C TUint8 UnitId() const; |
|
225 |
|
226 /** |
|
227 * Returns the audio format. |
|
228 * |
|
229 * @return TUid, Value of audio format. |
|
230 */ |
|
231 IMPORT_C const TUid AudioFormat() const; |
|
232 |
|
233 /** |
|
234 * Returns the audio stream type. |
|
235 * |
|
236 * @return TStreamType, Value of stream type. |
|
237 */ |
|
238 IMPORT_C TStreamType StreamType() const; |
|
239 |
|
240 /** |
|
241 * Returns the bit resolution. |
|
242 * |
|
243 * @return TBitResolution, Value of bit resolution. |
|
244 */ |
|
245 IMPORT_C TBitResolution BitResolution() const; |
|
246 |
|
247 /** |
|
248 * Returns the discrete sampling frequency. |
|
249 * |
|
250 * @return TUint32, Value of sampling frequency. |
|
251 */ |
|
252 IMPORT_C TUint32 SamFreq() const; |
|
253 |
|
254 /** |
|
255 * Duplicates the object data. |
|
256 * |
|
257 * @return CAccPolObjectBase*, Pointer to duplicated object. |
|
258 */ |
|
259 CAccPolObjectBase* DuplicateLC( CAccPolObjectCon* aObject = NULL ); |
|
260 |
|
261 /** |
|
262 * Externalize object. |
|
263 * |
|
264 * @param aStream, Write stream object. |
|
265 * @return void. |
|
266 */ |
|
267 void ExternalizeL( RWriteStream& aStream ) const; |
|
268 |
|
269 /** |
|
270 * Internalize object. |
|
271 * |
|
272 * @param aStream, Read stream object. |
|
273 * @return void. |
|
274 */ |
|
275 void InternalizeL( RReadStream& aStream ); |
|
276 |
|
277 protected: |
|
278 |
|
279 /** |
|
280 * C++ default constructor. |
|
281 */ |
|
282 CAccPolAudioStreamFormat( const TStreamConObjectType aObjectType, |
|
283 CAccPolObjectCon* aObject = NULL ); |
|
284 |
|
285 /** |
|
286 * C++ default constructor. |
|
287 */ |
|
288 CAccPolAudioStreamFormat( const TStreamConObjectType aObjectType, |
|
289 const TUint8 aUnitId, |
|
290 const TUid aAudioFormat, |
|
291 const TStreamType aStreamType, |
|
292 const TBitResolution aBitResolution, |
|
293 const TUint32 aSamFreq ); |
|
294 |
|
295 /** |
|
296 * By default Symbian 2nd phase constructor is private. |
|
297 */ |
|
298 void ConstructL(); |
|
299 |
|
300 private: |
|
301 |
|
302 /** |
|
303 * Unit id. |
|
304 */ |
|
305 TUint8 iUnitId; |
|
306 |
|
307 /** |
|
308 * Audio format. |
|
309 */ |
|
310 TUid iAudioFormat; |
|
311 |
|
312 /** |
|
313 * Channel type. |
|
314 */ |
|
315 TStreamType iStreamType; |
|
316 |
|
317 /** |
|
318 * Bit resolution. |
|
319 */ |
|
320 TBitResolution iBitResolution; |
|
321 |
|
322 /** |
|
323 * Sampling frequency / Hz. |
|
324 */ |
|
325 TUint32 iSamFreq; |
|
326 }; |
|
327 |
|
328 #endif // ACCPOLAUDIOSTREAMFORMAT_H |