|
1 /* |
|
2 * Copyright (c) 2004 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: Header file for AMR audio codec data class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCMRAMRNBCODECDATA_H |
|
20 #define CCMRAMRNBCODECDATA_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "CCMRAudioCodecData.h" |
|
24 |
|
25 |
|
26 // CONSTANTS |
|
27 // this is the max buffer size that the corresponding HW codec implementation will output, so it is not necessarily == 1 * AMR framelength |
|
28 const TInt KCMRMaxAMRNBBufferLength = 32; |
|
29 |
|
30 // Uid of the AMRNB CMMFCodec |
|
31 const TUid KCMRAMRSWCodecUid = {0x101FAF68}; //KAdvancedUidCodecPCM16ToAMR |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class TCMRAudioEncParams; |
|
35 // CLASS DECLARATION |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 /** |
|
41 * Base class for audio codec data |
|
42 * |
|
43 * @lib |
|
44 * @since 2.6 |
|
45 */ |
|
46 class CCMRAMRNBCodecData : public CCMRAudioCodecData |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * C++ default constructor. |
|
52 */ |
|
53 CCMRAMRNBCodecData(TCMRCodecType aType); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 virtual ~CCMRAMRNBCodecData(); |
|
59 |
|
60 public: // functions from baseclass |
|
61 |
|
62 /** |
|
63 * From CCMRAudioCodecData Check if the codec is supported in this configuration |
|
64 * @return TBool ETrue if supported |
|
65 */ |
|
66 TBool Supported(); |
|
67 |
|
68 /** |
|
69 * Return preferred duration of PCM capture in microseconds, relevant only for CMMFCodecs |
|
70 * @return TReal duration in milliseconds |
|
71 */ |
|
72 TReal GetPCMCaptureDurationMs() const; |
|
73 |
|
74 /** |
|
75 * From CCMRAudioCodecData Set bitrate for the codec |
|
76 * @param aBitRate in bps |
|
77 * @return void |
|
78 */ |
|
79 void SetBitRateL(TInt aBitRate); |
|
80 |
|
81 /** |
|
82 * From CCMRAudioCodecData Get the current bitrate |
|
83 * @return TInt bitrate in bps |
|
84 */ |
|
85 TInt GetBitRateL() const; |
|
86 |
|
87 /** |
|
88 * From CCMRAudioCodecData Get the configuration parameters for the codec |
|
89 * @param aDataSource MMF audio input |
|
90 * @return TDes8* configuration parameter structure |
|
91 */ |
|
92 TDes8* GetCodecConfigParamL(MDataSource* aDataSource); |
|
93 |
|
94 /** |
|
95 * From CCMRAudioCodecData Reads the framelength from the header of the given buffer |
|
96 * @param const TUint8* aBuf |
|
97 * @param TInt aDataLen |
|
98 * @return TInt frame length in bytes |
|
99 */ |
|
100 TInt FrameLength( const TUint8* aBuf, TInt aDataLen ) const; |
|
101 |
|
102 /** |
|
103 * From CCMRAudioCodecData Get the max frame length (single coded frame) |
|
104 * @return TInt framelength in bytes |
|
105 */ |
|
106 TInt MaxFrameLengthL() const; |
|
107 |
|
108 /** |
|
109 * From CCMRAudioCodecData Returns the max used buffer length for this codec. Client can then e.g. allocate buffers based on it |
|
110 * @return TInt Max frame length in bytes |
|
111 */ |
|
112 TInt inline MaxBufferLength() const { return KCMRMaxAMRNBBufferLength; }; |
|
113 |
|
114 /** |
|
115 * From CCMRAudioCodecData Configures sample DevSound HW device |
|
116 * @return TInt error code |
|
117 */ |
|
118 TInt AudioHWConfigL(MDataSource* aDataSource, const TDesC8& aParams ); |
|
119 |
|
120 /** |
|
121 * From CCMRAudioCodecData Configures sample DevSound HW device |
|
122 * @return TUid Uid |
|
123 */ |
|
124 inline TUid SWCodecUid() {return KCMRAMRSWCodecUid;} ; |
|
125 |
|
126 /** |
|
127 * From CCMRAudioCodecData Preferred samplecount per inputbuffer. |
|
128 * @return TInt samplecount. |
|
129 */ |
|
130 TInt PreferredSampleCountPerInputBuffer(); |
|
131 |
|
132 /** |
|
133 * Get the preferred framecount per PCM inputbuffer. |
|
134 * @return TInt samplecount. |
|
135 */ |
|
136 TInt PreferredFrameCountPerInputBuffer(); |
|
137 }; |
|
138 |
|
139 #endif // CCMRAMRNBCODECDATA_H |
|
140 |
|
141 // End of File |