|
1 /* |
|
2 * Copyright (c) 2006 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 #include "mceavccodec.h" |
|
20 |
|
21 // Stub constants |
|
22 const TReal KMceAvcDefaultFrameRate = 15; |
|
23 const TInt KMceAvcDefaultFrameSize = 10000; |
|
24 const TInt KMceAvcDefaultAllowedBitrate = KMceAvcCodecProfileIdBaseline | |
|
25 KMceAvcCodecProfileIopConstraintSet | |
|
26 KMceAvcBitrateLevel1; |
|
27 const TInt KMceAvcLevel1BitrateBps = 64000; |
|
28 |
|
29 const TUint KMceAvcDefaultFrameHeight = 176; |
|
30 const TUint KMceAvcDefaultFrameWidth = 144; |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CMceAvcCodec::~CMceAvcCodec |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 EXPORT_C CMceAvcCodec::~CMceAvcCodec() |
|
42 { |
|
43 } |
|
44 |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CMceAvcCodec::NewL |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 EXPORT_C CMceAvcCodec* CMceAvcCodec::NewL( TBuf8<KMceMaxSdpNameLength> aSdpName ) |
|
51 { |
|
52 CMceAvcCodec* self = NewLC( aSdpName ); |
|
53 CleanupStack::Pop( self ); |
|
54 return self; |
|
55 } |
|
56 |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CMceAvcCodec::NewL |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 EXPORT_C CMceAvcCodec* CMceAvcCodec::NewLC( TBuf8<KMceMaxSdpNameLength> aSdpName ) |
|
63 { |
|
64 CMceAvcCodec* self = new (ELeave) CMceAvcCodec(); |
|
65 CleanupStack::PushL( self ); |
|
66 self->ConstructL( aSdpName ); |
|
67 return self; |
|
68 } |
|
69 |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CMceAvcCodec::SetBitrate |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 EXPORT_C TInt CMceAvcCodec::SetBitrate( TUint aBitrate ) |
|
76 { |
|
77 iBitrate = aBitrate; |
|
78 return KErrNone; |
|
79 } |
|
80 |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CMceAvcCodec::SetAllowedBitrates |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 EXPORT_C TInt CMceAvcCodec::SetAllowedBitrates(TUint aBitrates) |
|
87 { |
|
88 iAllowedBitrates = aBitrates; |
|
89 |
|
90 delete iConfigKey; |
|
91 iConfigKey = NULL; |
|
92 |
|
93 return KErrNone; |
|
94 } |
|
95 |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CMceAvcCodec::SetCodecMode |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 EXPORT_C TInt CMceAvcCodec::SetCodecMode( TUint aCodecMode ) |
|
102 { |
|
103 if ( aCodecMode == KMceAvcModeSingleNal ) |
|
104 { |
|
105 iCodecMode = KMceAvcModeSingleNal; |
|
106 return KErrNone; |
|
107 } |
|
108 return KErrNotSupported; |
|
109 } |
|
110 |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CMceAvcCodec::SetPayloadType |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 EXPORT_C TInt CMceAvcCodec::SetPayloadType(TUint8 aPayloadType) |
|
117 { |
|
118 iPayloadType = aPayloadType; |
|
119 return KErrNone; |
|
120 } |
|
121 |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CMceAvcCodec::CloneL |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 EXPORT_C CMceVideoCodec* CMceAvcCodec::CloneL() const |
|
128 { |
|
129 CMceAvcCodec* clone = CMceAvcCodec::NewLC( iSdpName ); |
|
130 |
|
131 if ( iFmtpAttr ) |
|
132 { |
|
133 clone->iFmtpAttr = iFmtpAttr->AllocL(); |
|
134 } |
|
135 clone->iPayloadType = iPayloadType; |
|
136 |
|
137 clone->iBitrate = iBitrate; |
|
138 clone->iAllowedBitrates = iAllowedBitrates; |
|
139 clone->iCodecMode = iCodecMode; |
|
140 clone->iFourCC = iFourCC; |
|
141 clone->iFrameSize = iFrameSize; |
|
142 |
|
143 clone->iFrameRate = iFrameRate; |
|
144 clone->iMaxBitRate = iMaxBitRate; |
|
145 clone->iAllowedResolutions = iAllowedResolutions; |
|
146 clone->iResolutionWidth = iResolutionWidth; |
|
147 clone->iResolutionHeight = iResolutionHeight; |
|
148 clone->iAllowedFrameRates = iAllowedFrameRates; |
|
149 clone->iClockRate = iClockRate; |
|
150 |
|
151 clone->iPacketizationMode = iPacketizationMode; |
|
152 clone->iAllowedPacketizationModes = iAllowedPacketizationModes; |
|
153 |
|
154 CleanupStack::Pop( clone ); |
|
155 return clone; |
|
156 } |
|
157 |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CMceAvcCodec:: |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 EXPORT_C void CMceAvcCodec::SetMaxBitrateL( TUint aMaxBitrate ) |
|
164 { |
|
165 delete HBufC::NewL( 1 ); // To cause leave in simulation |
|
166 iMaxBitRate = aMaxBitrate; |
|
167 } |
|
168 |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // CMceAvcCodec:: |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 EXPORT_C void CMceAvcCodec::SetAllowedResolutionsL( TUint aResolutions ) |
|
175 { |
|
176 delete HBufC::NewL( 1 ); // To cause leave in simulation |
|
177 iAllowedResolutions = aResolutions; |
|
178 } |
|
179 |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CMceAvcCodec:: |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 EXPORT_C void CMceAvcCodec::SetResolutionL( TSize aResolution ) |
|
186 { |
|
187 delete HBufC::NewL( 1 ); // To cause leave in simulation |
|
188 iResolutionWidth = aResolution.iWidth; |
|
189 iResolutionHeight = aResolution.iHeight; |
|
190 } |
|
191 |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CMceAvcCodec:: |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 EXPORT_C void CMceAvcCodec::SetAllowedFrameRatesL( TUint aFrameRates ) |
|
198 { |
|
199 delete HBufC::NewL( 1 ); // To cause leave in simulation |
|
200 iAllowedFrameRates = aFrameRates; |
|
201 } |
|
202 |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // CMceAvcCodec:: |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 EXPORT_C void CMceAvcCodec::SetFrameRateL( TReal aFrameRate ) |
|
209 { |
|
210 delete HBufC::NewL( 1 ); // To cause leave in simulation |
|
211 iFrameRate = aFrameRate; |
|
212 } |
|
213 |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CMceAvcCodec::SetPreferredEncodingDecodingDeviceL |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 EXPORT_C void CMceAvcCodec::SetPreferredEncodingDecodingDeviceL( |
|
220 TUid aEncodingDecodingDevice ) |
|
221 { |
|
222 delete HBufC::NewL( 1 ); // To cause leave in simulation |
|
223 iEncodingDecodingDevice = aEncodingDecodingDevice; |
|
224 } |
|
225 |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // CMceAvcCodec::SetEncodingKeyL |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 EXPORT_C void CMceAvcCodec::SetConfigKeyL( const TDesC8& aConfigKey ) |
|
232 { |
|
233 HBufC8* configKey = aConfigKey.AllocL(); |
|
234 delete iConfigKey; |
|
235 iConfigKey = configKey; |
|
236 } |
|
237 |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // CMceAvcCodec::SetSdpNameL |
|
241 // ----------------------------------------------------------------------------- |
|
242 // |
|
243 void CMceAvcCodec::SetSdpNameL( const TDesC8& aSdpName ) |
|
244 { |
|
245 __ASSERT_ALWAYS( aSdpName.Length() <= KMceMaxSdpNameLength, |
|
246 User::Leave( KErrArgument ) ); |
|
247 delete HBufC::NewL( 1 ); // To cause leave in simulation |
|
248 iSdpName.Copy( aSdpName ); |
|
249 } |
|
250 |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CMceAvcCodec::CMceAvcCodec |
|
254 // ----------------------------------------------------------------------------- |
|
255 // |
|
256 CMceAvcCodec::CMceAvcCodec() |
|
257 :CMceVideoCodec() |
|
258 { |
|
259 } |
|
260 |
|
261 |
|
262 // ----------------------------------------------------------------------------- |
|
263 // CMceAvcCodec::ConstructL |
|
264 // ----------------------------------------------------------------------------- |
|
265 // |
|
266 void CMceAvcCodec::ConstructL( TBuf8<KMceMaxSdpNameLength> aSdpName ) |
|
267 { |
|
268 iSdpName = aSdpName; |
|
269 iCodecMode = KMceAvcModeSingleNal; |
|
270 iClockRate = KMceAvcDefaultFrameRate; |
|
271 iFrameRate = KMceAvcDefaultFrameRate; |
|
272 iResolutionWidth = KMceAvcDefaultFrameWidth; |
|
273 iResolutionHeight = KMceAvcDefaultFrameHeight; |
|
274 iBitrate = KMceAvcLevel1BitrateBps; |
|
275 iMaxBitRate = KMceAvcLevel1BitrateBps; |
|
276 iAllowedBitrates = KMceAvcDefaultAllowedBitrate; |
|
277 iFrameSize = KMceAvcDefaultFrameSize; |
|
278 // Defaults should be defined in MCE API |
|
279 const TUint8 KMceDefaultAvcPayloadType = 98; |
|
280 iPayloadType = KMceDefaultAvcPayloadType; |
|
281 |
|
282 } |
|
283 |
|
284 |
|
285 |
|
286 |