|
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: Declares class for comfort noise generating utility (CNG) |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CNGGENERATOR_H |
|
20 #define CNGGENERATOR_H |
|
21 |
|
22 #include <mmfutilities.h> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class MJitterBufferObserver; |
|
26 |
|
27 /** |
|
28 * Comfort noise generating utility |
|
29 * |
|
30 * @lib MMccJitterBuffer.lib |
|
31 * @since Series 60 5.0 |
|
32 */ |
|
33 NONSHARABLE_CLASS (CVoIPCNGenerator) : public CBase |
|
34 { |
|
35 public: // Constructor and destructor |
|
36 |
|
37 /** |
|
38 * Two phased constructor |
|
39 */ |
|
40 static CVoIPCNGenerator* NewL(MJitterBufferObserver* iObserver, |
|
41 const TFourCC& aCodec); |
|
42 |
|
43 /** |
|
44 * Destructor |
|
45 */ |
|
46 virtual ~CVoIPCNGenerator(); |
|
47 |
|
48 public: // New functions |
|
49 |
|
50 /** |
|
51 * Generates an SID packet to given buffer |
|
52 * @since Series 60 5.0 |
|
53 * @param aPayload Buffer to be filled with SID data |
|
54 * @param aRequestSize Amount of data to be generated to buffer. |
|
55 * @return void |
|
56 */ |
|
57 void GenerateSidPacket(TDes8& aPayload, TInt aRequestSize); |
|
58 |
|
59 /** |
|
60 * Requests error concealment for the next frame. |
|
61 * @since Series 60 5.0 |
|
62 * @param None |
|
63 * @return void |
|
64 */ |
|
65 void ConcealErrorForNextFrame() const; |
|
66 |
|
67 /** |
|
68 * Returns current DTX status |
|
69 * @since Series 60 5.0 |
|
70 * @param None |
|
71 * @return TBool ETrue if DTX period ongoing |
|
72 */ |
|
73 TBool DtxPeriodStatus() const; |
|
74 |
|
75 /** |
|
76 * Decide whether we are in DTX period or in normal speech period |
|
77 * @since Series 60 5.0 |
|
78 * @param const TDes8& - Buffer containing data |
|
79 * @return TInt |
|
80 */ |
|
81 void DoDtxDecision(const TDes8& aPayload); |
|
82 |
|
83 /** |
|
84 * Checks whether buffer contains SID frame. |
|
85 * @since Series 60 5.0 |
|
86 * @param const TDes8& - Buffer containing data |
|
87 * @return TBool - ETrue if buffer contains SID frame |
|
88 */ |
|
89 TBool IsSidBuffer(const TDes8& aData); |
|
90 |
|
91 private: // New functions |
|
92 |
|
93 /** |
|
94 * Generates an AMR CN packet into aPayload |
|
95 * @since Series 60 5.0 |
|
96 * @param aPayload |
|
97 * @return void |
|
98 */ |
|
99 void GenerateAmrNoDataPacket(TDes8& aPayload) const; |
|
100 |
|
101 /** |
|
102 * Generates an VoIP NO_DATA frame into aPayload |
|
103 * @since Series 60 5.0 |
|
104 * @param aPayload Buffer to be filled with VoIP NO_DATA information |
|
105 * @param aRequestSize Amount of data to be generated to buffer. |
|
106 * @return void |
|
107 */ |
|
108 void GenerateVoIPNoDataPacket(TDes8& aPayload, TInt aRequestSize) const; |
|
109 |
|
110 private: //Constructors |
|
111 |
|
112 /** |
|
113 * C++ default constructor. |
|
114 */ |
|
115 CVoIPCNGenerator(MJitterBufferObserver* iObserver, const TFourCC& aCodec); |
|
116 |
|
117 /** |
|
118 * Symbian 2nd phase constructor. |
|
119 */ |
|
120 void ConstructL(); |
|
121 |
|
122 private: // Data |
|
123 |
|
124 // Codec type |
|
125 TFourCC iCodec; |
|
126 |
|
127 // For Error Concealment IF creation |
|
128 MJitterBufferObserver* iObserver; |
|
129 |
|
130 // Generated CN frames |
|
131 TInt iGeneratedCNFrames; |
|
132 |
|
133 // DTX period started |
|
134 TBool iDtxPeriodStarted; |
|
135 |
|
136 }; |
|
137 |
|
138 #endif // CNGGENERATOR_H |
|
139 |
|
140 |
|
141 // End of file |