|
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 |
|
20 #include "mcemsrpcodec.h" |
|
21 #include "mcecommsrpcodec.h" |
|
22 #include "mcemessagestream.h" |
|
23 |
|
24 |
|
25 #define _FLAT_DATA static_cast<CMceComMessageCodec*>( iFlatData ) |
|
26 #define FLAT_DATA( data ) _FLAT_DATA->data |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CMceMsrpCodec::~CMceMsrpCodec |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CMceMsrpCodec::~CMceMsrpCodec() |
|
35 { |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CMceMsrpCodec::CloneL |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 EXPORT_C CMceMessageCodec* CMceMsrpCodec::CloneL() const |
|
43 { |
|
44 CMceMsrpCodec* clone = CMceMsrpCodec::NewLC( FLAT_DATA( iSdpName ) ); |
|
45 |
|
46 CMceComMessageCodec* cloneFlatData = |
|
47 static_cast<CMceComMessageCodec*>( clone->iFlatData ); |
|
48 |
|
49 cloneFlatData->iID = FLAT_DATA( iID ); |
|
50 cloneFlatData->SetFmtpAttributeL( *(FLAT_DATA( iFmtpAttr )) ); |
|
51 cloneFlatData->iEnableVAD = FLAT_DATA( iEnableVAD ); |
|
52 cloneFlatData->iSamplingFreq = FLAT_DATA( iSamplingFreq ); |
|
53 cloneFlatData->iPTime = FLAT_DATA( iPTime ); |
|
54 cloneFlatData->iMaxPTime = FLAT_DATA( iMaxPTime ); |
|
55 cloneFlatData->iBitrate = FLAT_DATA( iBitrate ); |
|
56 cloneFlatData->iAllowedBitrates = FLAT_DATA( iAllowedBitrates ); |
|
57 cloneFlatData->iPayloadType = FLAT_DATA( iPayloadType ); |
|
58 cloneFlatData->iCodecMode = FLAT_DATA( iCodecMode ); |
|
59 cloneFlatData->iFourCC = FLAT_DATA( iFourCC ); |
|
60 cloneFlatData->iFrameSize = FLAT_DATA( iFrameSize ); |
|
61 |
|
62 CleanupStack::Pop( clone ); |
|
63 |
|
64 return clone; |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CMceMsrpCodec::EnableVAD |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 EXPORT_C TInt CMceMsrpCodec::EnableVAD( TBool aEnableVAD ) |
|
72 { |
|
73 FLAT_DATA( iEnableVAD ) = aEnableVAD; |
|
74 return KErrNone; |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CMceMsrpCodec::SetBitrate |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 EXPORT_C TInt CMceMsrpCodec::SetBitrate(TUint /*aBitrate*/) |
|
82 { |
|
83 return KErrNone; |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CMceMsrpCodec::SetAllowedBitrates |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 EXPORT_C TInt CMceMsrpCodec::SetAllowedBitrates(TUint /*aBitrates*/) |
|
91 { |
|
92 return KErrNone; |
|
93 } |
|
94 |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CMceMsrpCodec::SetSamplingFreq |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C TInt CMceMsrpCodec::SetSamplingFreq(TUint aSamplingFreq) |
|
101 { |
|
102 FLAT_DATA( iSamplingFreq ) = aSamplingFreq; |
|
103 return KErrNone; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CMceMsrpCodec::SetPTime |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C TInt CMceMsrpCodec::SetPTime(TUint aPTime) |
|
111 { |
|
112 FLAT_DATA( iPTime ) = aPTime; |
|
113 return KErrNone; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CMceMsrpCodec::SetMaxPTime |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C TInt CMceMsrpCodec::SetMaxPTime(TUint aMaxPTime) |
|
121 { |
|
122 FLAT_DATA( iMaxPTime ) = aMaxPTime; |
|
123 return KErrNone; |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // CMceMsrpCodec::SetPayloadType |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 EXPORT_C TInt CMceMsrpCodec::SetPayloadType(TUint8 aPayloadType) |
|
131 { |
|
132 FLAT_DATA( iPayloadType ) = aPayloadType; |
|
133 return KErrNone; |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CMceMsrpCodec::SetCodecMode |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C TInt CMceMsrpCodec::SetCodecMode( TUint /*aCodecMode*/ ) |
|
141 { |
|
142 return KErrNone; |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CMceMsrpCodec::NewL |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 CMceMsrpCodec* CMceMsrpCodec::NewL( TBuf8<KMceMaxSdpNameLength> aSdpName ) |
|
150 { |
|
151 CMceMsrpCodec* self = NewLC( aSdpName ); |
|
152 CleanupStack::Pop( self ); |
|
153 return self; |
|
154 |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CMceMsrpCodec::NewL |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 CMceMsrpCodec* CMceMsrpCodec::NewLC( TBuf8<KMceMaxSdpNameLength> aSdpName ) |
|
162 { |
|
163 CMceMsrpCodec* self = new (ELeave) CMceMsrpCodec(); |
|
164 CleanupStack::PushL( self ); |
|
165 self->ConstructL( aSdpName ); |
|
166 return self; |
|
167 |
|
168 } |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // CMceMsrpCodec::CMceMsrpCodec |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 CMceMsrpCodec::CMceMsrpCodec() |
|
175 : CMceMessageCodec() |
|
176 { |
|
177 } |
|
178 |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CMceMsrpCodec::ConstructL |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 void CMceMsrpCodec::ConstructL( TBuf8<KMceMaxSdpNameLength> aSdpName ) |
|
185 { |
|
186 CMceComMessageCodec* codec = CMceComMsrpCodec::NewLC( aSdpName ); |
|
187 CMceMessageCodec::ConstructL( codec ); |
|
188 |
|
189 CleanupStack::Pop( codec ); |
|
190 } |
|
191 |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CMceMsrpCodec::SetSdpNameL |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 void CMceMsrpCodec::SetSdpNameL( const TDesC8& aSdpName ) |
|
198 { |
|
199 __ASSERT_ALWAYS( aSdpName.Length() <= KMceMaxSdpNameLength, |
|
200 User::Leave( KErrArgument ) ); |
|
201 FLAT_DATA( iSdpName ).Copy( aSdpName ); |
|
202 } |
|
203 |