|
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 // USER |
|
20 #include "musenglivesession.h" |
|
21 #include "musengsessionobserver.h" |
|
22 #include "musenglivesessionobserver.h" |
|
23 #include "musunittesting.h" |
|
24 #include "musengmceutils.h" |
|
25 #include "musenglogger.h" |
|
26 #include "mussessionproperties.h" |
|
27 |
|
28 // SYSTEM |
|
29 #include <mcemanager.h> |
|
30 #include <mcecamerasource.h> |
|
31 #include <mcevideostream.h> |
|
32 #include <mcertpsink.h> |
|
33 #include <mcedisplaysink.h> |
|
34 #include <mcefilesink.h> |
|
35 #include <mcesession.h> |
|
36 #include <mcevideocodec.h> |
|
37 #include <mceh263codec.h> |
|
38 #include <mceavccodec.h> |
|
39 |
|
40 |
|
41 // Names of AVC levels in string for config keys stored in CenRep |
|
42 _LIT8( KMusAvcBitrateLevel1, "AvcBrL1=" ); |
|
43 _LIT8( KMusAvcBitrateLevel1b, "AvcBrL1b=" ); |
|
44 _LIT8( KMusAvcBitrateLevel1_1, "AvcBrL1_1=" ); |
|
45 _LIT8( KMusAvcBitrateLevel1_2, "AvcBrL1_2=" ); |
|
46 _LIT8( KMusAvcBitrateLevel1_3, "AvcBrL1_3=" ); |
|
47 _LIT8( KMusAvcBitrateLevel2, "AvcBrL2=" ); |
|
48 |
|
49 _LIT8( KMusEncoderInfoTokenizer, ";" ); |
|
50 |
|
51 |
|
52 const TInt KMaxDispName = 512; |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CMusEngLiveSession* CMusEngLiveSession::NewL( |
|
59 const TDesC& aFileName, |
|
60 const TRect& aRect ) |
|
61 { |
|
62 CMusEngLiveSession* self = new( ELeave ) CMusEngLiveSession( aRect, |
|
63 aFileName ); |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop( self ); |
|
67 return self; |
|
68 } |
|
69 |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 CMusEngLiveSession* CMusEngLiveSession::NewL( |
|
76 const TRect& aRect ) |
|
77 { |
|
78 CMusEngLiveSession* self = new( ELeave ) CMusEngLiveSession( aRect ); |
|
79 CleanupStack::PushL( self ); |
|
80 self->ConstructL(); |
|
81 CleanupStack::Pop( self ); |
|
82 return self; |
|
83 } |
|
84 |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 CMusEngLiveSession::~CMusEngLiveSession() |
|
91 { |
|
92 delete iRemoteDisplayName; |
|
93 } |
|
94 |
|
95 |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // From MLcSession |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CMusEngLiveSession::EstablishLcSessionL() |
|
102 { |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // From MLcSession |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 MLcVideoPlayer* CMusEngLiveSession::LocalVideoPlayer() |
|
110 { |
|
111 return this; |
|
112 } |
|
113 |
|
114 |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // From MLcSession |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 |
|
121 const TDesC& CMusEngLiveSession::RemoteDisplayName() |
|
122 { |
|
123 return *iRemoteDisplayName; |
|
124 } |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // From MLcVideoPlayer |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 MLcVideoPlayer::TLcVideoPlayerState CMusEngLiveSession::LcVideoPlayerState() const |
|
134 { |
|
135 TLcVideoPlayerState vidPlayerState = MLcVideoPlayer::EUnavailable; |
|
136 return vidPlayerState; |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // From MLcVideoPlayer |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 TBool CMusEngLiveSession::LcIsPlayingL() |
|
144 { |
|
145 return iPlaying; |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // From MLcVideoPlayer |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 void CMusEngLiveSession::LcPlayL() |
|
153 { |
|
154 iPlaying = ETrue; |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // From MLcVideoPlayer |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CMusEngLiveSession::LcPauseL() |
|
162 { |
|
163 iPlaying = EFalse; |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // From MLcVideoPlayer |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 MLcWindow* CMusEngLiveSession::LcWindow() |
|
171 { |
|
172 return this; |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // From MLcVideoPlayer |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 MLcCameraControl* CMusEngLiveSession::LcCameraControl() |
|
180 { |
|
181 return this; |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // From MLcVideoPlayer |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 MLcFileControl* CMusEngLiveSession::LcSourceFile() |
|
189 { |
|
190 return NULL; |
|
191 } |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // From MLcVideoPlayer |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 MLcFileControl* CMusEngLiveSession::LcDestinationFile() |
|
198 { |
|
199 return this; |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // From MLcVideoPlayer |
|
204 // ----------------------------------------------------------------------------- |
|
205 // |
|
206 MLcAudioControl* CMusEngLiveSession::LcAudioControl() |
|
207 { |
|
208 return this; |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // From MLcVideoPlayer |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 MLcZoomControl* CMusEngLiveSession::LcZoomControl() |
|
216 { |
|
217 return this; |
|
218 } |
|
219 |
|
220 // ----------------------------------------------------------------------------- |
|
221 // From MLcVideoPlayer |
|
222 // ----------------------------------------------------------------------------- |
|
223 // |
|
224 MLcBrightnessControl* CMusEngLiveSession::LcBrightnessControl() |
|
225 { |
|
226 return this; |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // From MLcVideoPlayer |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 RPointerArray< MLcValueControl >& CMusEngLiveSession::LcExtensionControls() |
|
234 { |
|
235 return iValueControls; |
|
236 } |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // From MLcCameraControl |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 TInt CMusEngLiveSession::LcCameraCountL() |
|
243 { |
|
244 return 1; |
|
245 } |
|
246 |
|
247 // ----------------------------------------------------------------------------- |
|
248 // From MLcCameraControl |
|
249 // ----------------------------------------------------------------------------- |
|
250 // |
|
251 void CMusEngLiveSession::ToggleLcCameraL() |
|
252 { |
|
253 } |
|
254 |
|
255 // ----------------------------------------------------------------------------- |
|
256 // From MLcBrightnessControl |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 TInt CMusEngLiveSession::MinLcBrightnessL() |
|
260 { |
|
261 return iCurrentBrighness; |
|
262 } |
|
263 |
|
264 // ----------------------------------------------------------------------------- |
|
265 // From MLcBrightnessControl |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 TInt CMusEngLiveSession::MaxLcBrightnessL() |
|
269 { |
|
270 return iCurrentBrighness; |
|
271 } |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // From MLcBrightnessControl |
|
275 // ----------------------------------------------------------------------------- |
|
276 // |
|
277 TInt CMusEngLiveSession::LcBrightnessL() |
|
278 { |
|
279 return iCurrentBrighness; |
|
280 } |
|
281 |
|
282 // ----------------------------------------------------------------------------- |
|
283 // From MLcBrightnessControl |
|
284 // ----------------------------------------------------------------------------- |
|
285 // |
|
286 void CMusEngLiveSession::SetLcBrightnessL( TInt aValue ) |
|
287 { |
|
288 iCurrentBrighness = aValue; |
|
289 } |
|
290 |
|
291 // ----------------------------------------------------------------------------- |
|
292 // From MLcBrightnessControl |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 void CMusEngLiveSession::IncreaseLcBrightnessL() |
|
296 { |
|
297 iCurrentBrighness++; |
|
298 } |
|
299 |
|
300 // ----------------------------------------------------------------------------- |
|
301 // From MLcBrightnessControl |
|
302 // ----------------------------------------------------------------------------- |
|
303 // |
|
304 void CMusEngLiveSession::DecreaseLcBrightnessL() |
|
305 { |
|
306 iCurrentBrighness--; |
|
307 } |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // From MLcZoomControl |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 TInt CMusEngLiveSession::MinLcZoomL() |
|
314 { |
|
315 return iCurrentZoom; |
|
316 } |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // From MLcZoomControl |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 TInt CMusEngLiveSession::MaxLcZoomL() |
|
323 { |
|
324 return iCurrentZoom; |
|
325 } |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // From MLcZoomControl |
|
329 // ----------------------------------------------------------------------------- |
|
330 // |
|
331 TInt CMusEngLiveSession::LcZoomValueL() |
|
332 { |
|
333 return iCurrentZoom; |
|
334 } |
|
335 |
|
336 // ----------------------------------------------------------------------------- |
|
337 // From MLcZoomControl |
|
338 // ----------------------------------------------------------------------------- |
|
339 // |
|
340 void CMusEngLiveSession::SetLcZoomValueL( TInt aValue ) |
|
341 { |
|
342 iCurrentZoom = aValue; |
|
343 } |
|
344 |
|
345 // ----------------------------------------------------------------------------- |
|
346 // From MLcZoomControl |
|
347 // ----------------------------------------------------------------------------- |
|
348 // |
|
349 void CMusEngLiveSession::LcZoomInL() |
|
350 { |
|
351 iCurrentZoom++; |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // From MLcZoomControl |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 void CMusEngLiveSession::LcZoomOutL() |
|
359 { |
|
360 iCurrentZoom--; |
|
361 } |
|
362 |
|
363 // ----------------------------------------------------------------------------- |
|
364 // From MLcFileControl |
|
365 // ----------------------------------------------------------------------------- |
|
366 // |
|
367 void CMusEngLiveSession::EnableLcFileL( TBool aEnable ) |
|
368 { |
|
369 iFileEnabled = aEnable; |
|
370 } |
|
371 |
|
372 // ----------------------------------------------------------------------------- |
|
373 // From MLcFileControl |
|
374 // ----------------------------------------------------------------------------- |
|
375 // |
|
376 TBool CMusEngLiveSession::IsLcFileEnabled() |
|
377 { |
|
378 return iFileEnabled; |
|
379 } |
|
380 |
|
381 // ----------------------------------------------------------------------------- |
|
382 // From MLcFileControl |
|
383 // ----------------------------------------------------------------------------- |
|
384 // |
|
385 void CMusEngLiveSession::SetLcFileNameL( const TFileName& aFileName ) |
|
386 { |
|
387 iRecordedFile = aFileName; |
|
388 } |
|
389 |
|
390 // ----------------------------------------------------------------------------- |
|
391 // From MLcFileControl |
|
392 // ----------------------------------------------------------------------------- |
|
393 // |
|
394 TFileName& CMusEngLiveSession::LcFileName() |
|
395 { |
|
396 return iRecordedFile; |
|
397 } |
|
398 |
|
399 // ----------------------------------------------------------------------------- |
|
400 // |
|
401 // ----------------------------------------------------------------------------- |
|
402 // |
|
403 CMusEngLiveSession::CMusEngLiveSession( |
|
404 const TRect& aRect, |
|
405 const TDesC& aRecordedFile ) |
|
406 : CMusEngMceOutSession( aRect ), |
|
407 iRecordedFile( aRecordedFile ) |
|
408 { |
|
409 } |
|
410 |
|
411 |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 void CMusEngLiveSession::ConstructL() |
|
417 { |
|
418 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ConstructL()" ) |
|
419 |
|
420 CMusEngMceOutSession::ConstructL(); |
|
421 |
|
422 iRemoteDisplayName = HBufC::NewL( KMaxDispName ); |
|
423 |
|
424 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ConstructL()" ) |
|
425 } |