36 #include <mcesession.h> |
35 #include <mcesession.h> |
37 #include <mcevideocodec.h> |
36 #include <mcevideocodec.h> |
38 #include <mceh263codec.h> |
37 #include <mceh263codec.h> |
39 #include <mceavccodec.h> |
38 #include <mceavccodec.h> |
40 |
39 |
41 const TInt KMaxBrightness = 100; |
40 |
42 const TInt KMinBrightness = -100; |
41 // ----------------------------------------------------------------------------- |
43 const TInt KBrightnessStepSize = 10; |
42 // |
44 |
43 // ----------------------------------------------------------------------------- |
45 // Names of AVC levels in string for config keys stored in CenRep |
44 // |
46 _LIT8( KMusAvcBitrateLevel1, "AvcBrL1=" ); |
45 CMusEngLiveSession* CMusEngLiveSession::NewL() |
47 _LIT8( KMusAvcBitrateLevel1b, "AvcBrL1b=" ); |
46 { |
48 _LIT8( KMusAvcBitrateLevel1_1, "AvcBrL1_1=" ); |
47 CMusEngLiveSession* self = new( ELeave )CMusEngLiveSession(); |
49 _LIT8( KMusAvcBitrateLevel1_2, "AvcBrL1_2=" ); |
|
50 _LIT8( KMusAvcBitrateLevel1_3, "AvcBrL1_3=" ); |
|
51 _LIT8( KMusAvcBitrateLevel2, "AvcBrL2=" ); |
|
52 |
|
53 _LIT8( KMusEncoderInfoTokenizer, ";" ); |
|
54 |
|
55 //Number of big and small zoom steps on Zoom scale |
|
56 const TInt KZoomBigStepCount = 15; |
|
57 const TInt KZoomSmallStepCount = KZoomBigStepCount*2; |
|
58 const TInt KZoomStepMinSize = 1; |
|
59 |
|
60 const TInt64 KZoomFasterTime = 333333; // 1/3 second |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 EXPORT_C CMusEngLiveSession* CMusEngLiveSession::NewL( |
|
67 const TDesC& aFileName, |
|
68 const TRect& aRect, |
|
69 MMusEngSessionObserver& aSessionObserver, |
|
70 MMusEngOutSessionObserver& aOutSessionObserver, |
|
71 MMusEngLiveSessionObserver& aLiveSessionObserver, |
|
72 TUint aSipProfileId ) |
|
73 { |
|
74 CMusEngLiveSession* self = new( ELeave ) CMusEngLiveSession( |
|
75 aSessionObserver, |
|
76 aOutSessionObserver, |
|
77 aLiveSessionObserver, |
|
78 aRect, |
|
79 aFileName ); |
|
80 CleanupStack::PushL( self ); |
48 CleanupStack::PushL( self ); |
81 self->ConstructL( aSipProfileId ); |
49 self->ConstructL(); |
82 CleanupStack::Pop( self ); |
50 CleanupStack::Pop( self ); |
83 return self; |
51 return self; |
84 } |
52 } |
85 |
53 |
86 |
54 // ----------------------------------------------------------------------------- |
87 // ----------------------------------------------------------------------------- |
55 // |
88 // |
56 // ----------------------------------------------------------------------------- |
89 // ----------------------------------------------------------------------------- |
57 // |
90 // |
58 CMusEngLiveSession::CMusEngLiveSession() |
91 EXPORT_C CMusEngLiveSession* CMusEngLiveSession::NewL( |
59 : CMusEngMceOutSession() |
92 const TRect& aRect, |
60 { |
93 MMusEngSessionObserver& aSessionObserver, |
61 } |
94 MMusEngOutSessionObserver& aOutSessionObserver, |
62 |
95 MMusEngLiveSessionObserver& aLiveSessionObserver, |
63 // ----------------------------------------------------------------------------- |
96 TUint aSipProfileId ) |
64 // |
97 { |
65 // ----------------------------------------------------------------------------- |
98 CMusEngLiveSession* self = new( ELeave ) CMusEngLiveSession( |
66 // |
99 aSessionObserver, |
67 void CMusEngLiveSession::ConstructL() |
100 aOutSessionObserver, |
68 { |
101 aLiveSessionObserver, |
69 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ConstructL()" ) |
102 aRect ); |
70 |
103 CleanupStack::PushL( self ); |
71 iCameraHandler.ReadCameraUsageKeyL(); |
104 self->ConstructL( aSipProfileId ); |
72 CMusEngMceOutSession::ConstructL(); |
105 CleanupStack::Pop( self ); |
73 |
106 return self; |
74 iLiveVideoPlayer = |
107 } |
75 CMusEngLiveVideoPlayer::NewL( *this, iCameraHandler, *this ); |
108 |
76 |
|
77 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ConstructL()" ) |
|
78 } |
109 |
79 |
110 // ----------------------------------------------------------------------------- |
80 // ----------------------------------------------------------------------------- |
111 // |
81 // |
112 // ----------------------------------------------------------------------------- |
82 // ----------------------------------------------------------------------------- |
113 // |
83 // |
114 CMusEngLiveSession::~CMusEngLiveSession() |
84 CMusEngLiveSession::~CMusEngLiveSession() |
115 { |
85 { |
116 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::~CMusEngLiveSession()" ) |
86 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::~CMusEngLiveSession()" ) |
117 |
87 delete iLiveVideoPlayer; |
118 delete iOrientationHandler; |
|
119 |
|
120 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::~CMusEngLiveSession()" ) |
88 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::~CMusEngLiveSession()" ) |
121 } |
89 } |
122 |
90 |
123 |
91 // ----------------------------------------------------------------------------- |
124 // ----------------------------------------------------------------------------- |
92 // From MLcSession |
125 // |
93 // ----------------------------------------------------------------------------- |
126 // ----------------------------------------------------------------------------- |
94 // |
127 // |
95 MLcVideoPlayer* CMusEngLiveSession::LocalVideoPlayer() |
128 EXPORT_C TInt CMusEngLiveSession::CurrentZoomL() const |
96 { |
129 { |
97 return iLiveVideoPlayer; |
130 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::CurrentZoomL()" ) |
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void CMusEngLiveSession::CompleteSessionStructureL( |
|
105 CMceStreamBundle& /*aLocalBundle*/ ) |
|
106 { |
|
107 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::CompleteSessionStructureL()" ) |
|
108 |
131 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
109 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
132 |
110 |
133 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
111 iCameraHandler.SetSession( iSession ); |
134 |
112 |
135 TInt currentZoom = camera->ZoomFactorL() + camera->DigitalZoomFactorL(); |
|
136 |
|
137 MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::CurrentZoomL( %d )", |
|
138 currentZoom ) |
|
139 |
|
140 return currentZoom; |
|
141 } |
|
142 |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 EXPORT_C void CMusEngLiveSession::SetZoomL( TInt aNewZoomFactor ) |
|
149 { |
|
150 MUS_LOG1( "mus: [ENGINE] -> CMusEngLiveSession::SetZoomL( %d )", |
|
151 aNewZoomFactor ) |
|
152 |
|
153 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
154 __ASSERT_ALWAYS( aNewZoomFactor <= MaxZoomL() && |
|
155 aNewZoomFactor >= MinZoomL(), |
|
156 User::Leave( KErrArgument ) ); |
|
157 |
|
158 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
159 |
|
160 if ( aNewZoomFactor < iCameraInfo.iMaxZoom ) |
|
161 { |
|
162 MUS_LOG( "mus: [ENGINE] Optical zoom factor increased" ) |
|
163 camera->SetZoomFactorL( aNewZoomFactor ); |
|
164 } |
|
165 |
|
166 if ( aNewZoomFactor - iCameraInfo.iMaxZoom >= 0 ) |
|
167 { |
|
168 camera->SetDigitalZoomFactorL( aNewZoomFactor - iCameraInfo.iMaxZoom ); |
|
169 MUS_LOG1( "mus: [ENGINE] Digital zoom factor increased to %d", |
|
170 aNewZoomFactor - iCameraInfo.iMaxZoom ) |
|
171 } |
|
172 |
|
173 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::SetZoomL()" ) |
|
174 } |
|
175 |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 EXPORT_C TInt CMusEngLiveSession::MinZoomL() const |
|
182 { |
|
183 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::MinZoomL()" ) |
|
184 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
185 |
|
186 // Although we do not need camera for return value, we have to have it in |
|
187 // order to have proper iCameraInfo |
|
188 MusEngMceUtils::GetCameraL( *iSession ); |
|
189 |
|
190 MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::MinZoomL( %d )", |
|
191 iCameraInfo.iMinZoom ) |
|
192 |
|
193 return iCameraInfo.iMinZoom; |
|
194 } |
|
195 |
|
196 |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 // ----------------------------------------------------------------------------- |
|
200 // |
|
201 EXPORT_C TInt CMusEngLiveSession::MaxZoomL() const |
|
202 { |
|
203 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::MaxZoomL()" ) |
|
204 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
205 |
|
206 // Although we do not need camera for return value, we have to have it in |
|
207 // order to have proper iCameraInfo |
|
208 MusEngMceUtils::GetCameraL( *iSession ); |
|
209 |
|
210 TInt maxZoom = iCameraInfo.iMaxZoom + iCameraInfo.iMaxDigitalZoom; |
|
211 |
|
212 MUS_LOG1( "mus: [ENGINE] Max optical zoom( %d )", |
|
213 iCameraInfo.iMaxZoom ) |
|
214 MUS_LOG1( "mus: [ENGINE] Max digital zoom( %d )", |
|
215 iCameraInfo.iMaxDigitalZoom ) |
|
216 MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::MaxZoomL( %d )", |
|
217 maxZoom ) |
|
218 |
|
219 return maxZoom; |
|
220 } |
|
221 |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 EXPORT_C void CMusEngLiveSession::ZoomInL() |
|
228 { |
|
229 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ZoomInL()" ) |
|
230 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
231 |
|
232 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
233 |
|
234 // First try to increase optical zoom factor. If in maximum value, try to |
|
235 // increase digital zoom factor. |
|
236 TInt stepSize = ZoomStepSize( iZoomInTime ); |
|
237 TInt zoomFactor = camera->ZoomFactorL(); |
|
238 TInt zoomDigitalFactor = camera->DigitalZoomFactorL(); |
|
239 |
|
240 //increate optical zoom factor |
|
241 if ( zoomFactor + stepSize <= iCameraInfo.iMaxZoom ) |
|
242 { |
|
243 //optical zoom factor is enough |
|
244 camera->SetZoomFactorL( zoomFactor + stepSize ); |
|
245 stepSize = 0; |
|
246 } |
|
247 else if (zoomFactor < iCameraInfo.iMaxZoom) |
|
248 { |
|
249 stepSize -= iCameraInfo.iMaxZoom - zoomFactor; |
|
250 camera->SetZoomFactorL( iCameraInfo.iMaxZoom ); |
|
251 } |
|
252 |
|
253 //increate digital zoom factor |
|
254 if (stepSize > 0) |
|
255 { |
|
256 if ( zoomDigitalFactor + stepSize <= iCameraInfo.iMaxDigitalZoom ) |
|
257 { |
|
258 camera->SetDigitalZoomFactorL( zoomDigitalFactor + stepSize ); |
|
259 } |
|
260 else |
|
261 { |
|
262 camera->SetDigitalZoomFactorL( iCameraInfo.iMaxDigitalZoom ); |
|
263 MUS_LOG( "mus: [ENGINE] CMusEngLiveSession::ZoomInL(): Optical \ |
|
264 and digital zoom factors are in maximum value" ) |
|
265 } |
|
266 } |
|
267 |
|
268 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ZoomInL()" ) |
|
269 |
|
270 } |
|
271 |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // |
|
275 // ----------------------------------------------------------------------------- |
|
276 // |
|
277 EXPORT_C void CMusEngLiveSession::ZoomOutL() |
|
278 { |
|
279 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ZoomOutL()" ) |
|
280 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
281 |
|
282 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
283 |
|
284 // First try to decrease digital zoom factor. If already zero, try to |
|
285 // decrease optical zoom factor. |
|
286 TInt stepSize = ZoomStepSize( iZoomOutTime ); |
|
287 TInt zoomFactor = camera->ZoomFactorL(); |
|
288 TInt zoomDigitalFactor = camera->DigitalZoomFactorL(); |
|
289 |
|
290 //decreate digital zoom factor firstly |
|
291 if ( zoomDigitalFactor - stepSize >= 0 ) |
|
292 { |
|
293 //digital zoom factor is enough |
|
294 camera->SetDigitalZoomFactorL( zoomDigitalFactor - stepSize ); |
|
295 stepSize = 0; |
|
296 } |
|
297 else if ( zoomDigitalFactor > 0 ) |
|
298 { |
|
299 stepSize -= zoomDigitalFactor; |
|
300 camera->SetDigitalZoomFactorL( 0 ); |
|
301 MUS_LOG("mus: [ENGINE] Digigal Factor to zero") |
|
302 } |
|
303 |
|
304 //decreate optical zoom factor firstly |
|
305 if ( stepSize > 0 ) |
|
306 { |
|
307 if ( zoomFactor - stepSize > iCameraInfo.iMinZoom ) |
|
308 { |
|
309 camera->SetZoomFactorL( zoomFactor - stepSize ); |
|
310 } |
|
311 else |
|
312 { |
|
313 MUS_LOG( "mus: [ENGINE] CMusEngLiveSession::ZoomOutL(): Optical and \ |
|
314 digital zoom factors are in minimum value" ) |
|
315 camera->SetZoomFactorL( iCameraInfo.iMinZoom ); |
|
316 } |
|
317 } |
|
318 |
|
319 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ZoomOutL()" ) |
|
320 } |
|
321 |
|
322 |
|
323 // ----------------------------------------------------------------------------- |
|
324 // |
|
325 // ----------------------------------------------------------------------------- |
|
326 // |
|
327 EXPORT_C void CMusEngLiveSession::ZoomDefaultL() |
|
328 { |
|
329 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ZoomDefaultL()" ) |
|
330 |
|
331 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
332 |
|
333 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
334 |
|
335 camera->SetZoomFactorL( iDefaultZoomFactor ); |
|
336 camera->SetDigitalZoomFactorL( 0 ); |
|
337 |
|
338 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ZoomDefaultL()" ) |
|
339 } |
|
340 |
|
341 |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 // ----------------------------------------------------------------------------- |
|
345 // |
|
346 EXPORT_C void CMusEngLiveSession::SetBrightnessL( TInt aBrightness ) const |
|
347 { |
|
348 MUS_LOG1( "mus: [ENGINE] -> CMusEngLiveSession::SetBrightnessL( %d )", |
|
349 aBrightness ) |
|
350 |
|
351 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
352 |
|
353 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
354 camera->SetBrightnessL( aBrightness ); |
|
355 |
|
356 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::SetBrightnessL()" ) |
|
357 } |
|
358 |
|
359 |
|
360 // ----------------------------------------------------------------------------- |
|
361 // |
|
362 // ----------------------------------------------------------------------------- |
|
363 // |
|
364 EXPORT_C TInt CMusEngLiveSession::CurrentBrightnessL() const |
|
365 { |
|
366 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::CurrentBrightnessL()" ) |
|
367 |
|
368 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
369 |
|
370 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
371 TInt currentBrightness = camera->BrightnessL(); |
|
372 |
|
373 MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::CurrentBrightnessL(): %d", |
|
374 currentBrightness ) |
|
375 |
|
376 return currentBrightness; |
|
377 } |
|
378 |
|
379 |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 // ----------------------------------------------------------------------------- |
|
383 // |
|
384 EXPORT_C TInt CMusEngLiveSession::MaxBrightnessL() const |
|
385 { |
|
386 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::MaxBrightnessL()" ) |
|
387 |
|
388 // maximum brightness is not in camera info, but a constant 100 |
|
389 |
|
390 MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::MaxBrightnessL(): %d", |
|
391 KMaxBrightness ) |
|
392 |
|
393 return KMaxBrightness; |
|
394 } |
|
395 |
|
396 |
|
397 // ----------------------------------------------------------------------------- |
|
398 // |
|
399 // ----------------------------------------------------------------------------- |
|
400 // |
|
401 EXPORT_C TInt CMusEngLiveSession::MinBrightnessL() const |
|
402 { |
|
403 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::MinBrightnessL()" ) |
|
404 |
|
405 // maximum brightness is not in camera info, but a constant -100 |
|
406 |
|
407 MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::MinBrightnessL(): %d", |
|
408 KMinBrightness ) |
|
409 |
|
410 return KMinBrightness; |
|
411 } |
|
412 |
|
413 |
|
414 // ----------------------------------------------------------------------------- |
|
415 // |
|
416 // ----------------------------------------------------------------------------- |
|
417 // |
|
418 EXPORT_C void CMusEngLiveSession::IncreaseBrightnessL() |
|
419 { |
|
420 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::IncreaseBrightnessL()" ) |
|
421 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
422 |
|
423 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
424 |
|
425 TInt newBrightness = camera->BrightnessL() + KBrightnessStepSize; |
|
426 |
|
427 if ( newBrightness < KMaxBrightness ) |
|
428 { |
|
429 camera->SetBrightnessL( newBrightness ); |
|
430 } |
|
431 else |
|
432 { |
|
433 camera->SetBrightnessL( KMaxBrightness ); |
|
434 } |
|
435 |
|
436 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::IncreaseBrightnessL()" ) |
|
437 } |
|
438 |
|
439 |
|
440 // ----------------------------------------------------------------------------- |
|
441 // |
|
442 // ----------------------------------------------------------------------------- |
|
443 // |
|
444 EXPORT_C void CMusEngLiveSession::DecreaseBrightnessL() |
|
445 { |
|
446 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::DecreaseBrightnessL()" ) |
|
447 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
448 |
|
449 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
450 |
|
451 TInt newBrightness = camera->BrightnessL() - KBrightnessStepSize; |
|
452 |
|
453 if ( newBrightness > KMinBrightness ) |
|
454 { |
|
455 camera->SetBrightnessL( newBrightness ); |
|
456 } |
|
457 else |
|
458 { |
|
459 camera->SetBrightnessL( KMinBrightness ); |
|
460 } |
|
461 |
|
462 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::DecreaseBrightnessL()" ) |
|
463 } |
|
464 |
|
465 |
|
466 // ----------------------------------------------------------------------------- |
|
467 // |
|
468 // ----------------------------------------------------------------------------- |
|
469 // |
|
470 EXPORT_C void CMusEngLiveSession::BrightnessDefaultL() |
|
471 { |
|
472 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::BrightnessDefaultL()" ) |
|
473 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
474 |
|
475 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
476 |
|
477 camera->SetBrightnessL( iDefaultBrightness ); |
|
478 |
|
479 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::BrightnessDefaultL()" ) |
|
480 } |
|
481 |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 // ----------------------------------------------------------------------------- |
|
486 // |
|
487 EXPORT_C void CMusEngLiveSession::BrightnessAutoL() |
|
488 { |
|
489 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::BrightnessAutoL()" ) |
|
490 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
491 |
|
492 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
493 |
|
494 camera->SetBrightnessL( CCamera::EBrightnessAuto ); |
|
495 |
|
496 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::BrightnessAutoL()" ) |
|
497 } |
|
498 |
|
499 |
|
500 // ----------------------------------------------------------------------------- |
|
501 // |
|
502 // ----------------------------------------------------------------------------- |
|
503 // |
|
504 EXPORT_C void CMusEngLiveSession::RecordL( TBool aRecord ) |
|
505 { |
|
506 MUS_LOG1( "mus: [ENGINE] -> CMusEngLiveSession::RecordL( %d )", aRecord ) |
|
507 |
|
508 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
509 |
|
510 CMceMediaSink* fileSink = MusEngMceUtils::GetMediaSink( *iSession, |
|
511 KMceFileSink ); |
|
512 |
|
513 __ASSERT_ALWAYS( fileSink, User::Leave( KErrNotReady ) ); |
|
514 |
|
515 if( aRecord && !fileSink->IsEnabled() ) |
|
516 { |
|
517 fileSink->EnableL(); |
|
518 } |
|
519 else if ( !aRecord && fileSink->IsEnabled() ) |
|
520 { |
|
521 fileSink->DisableL(); |
|
522 } |
|
523 else |
|
524 { |
|
525 // NOP |
|
526 } |
|
527 |
|
528 MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::RecordL( %d )", aRecord ) |
|
529 } |
|
530 |
|
531 |
|
532 // ----------------------------------------------------------------------------- |
|
533 // |
|
534 // ----------------------------------------------------------------------------- |
|
535 // |
|
536 EXPORT_C TBool CMusEngLiveSession::IsRecording() |
|
537 { |
|
538 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::IsRecording()" ) |
|
539 |
|
540 TBool isRecording( EFalse ); |
|
541 |
|
542 CMceMediaSink* fileSink = MusEngMceUtils::GetMediaSink( *iSession, |
|
543 KMceFileSink ); |
|
544 if ( fileSink ) |
|
545 { |
|
546 isRecording = fileSink->IsEnabled(); |
|
547 } |
|
548 |
|
549 MUS_LOG1( "mus: [ENGINE] <- CMusEngLiveSession::IsRecording(%d)", |
|
550 isRecording ) |
|
551 |
|
552 return isRecording; |
|
553 } |
|
554 |
|
555 |
|
556 // ----------------------------------------------------------------------------- |
|
557 // Enable camera if not already enabled |
|
558 // ----------------------------------------------------------------------------- |
|
559 // |
|
560 EXPORT_C void CMusEngLiveSession::PlayL() |
|
561 { |
|
562 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::PlayL()" ) |
|
563 |
|
564 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
565 |
|
566 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
567 |
|
568 if ( !camera->IsEnabled() ) |
|
569 { |
|
570 camera->EnableL(); |
|
571 } |
|
572 else |
|
573 { |
|
574 MUS_LOG( "mus: [ENGINE] Camera already enabled, ignore request" ) |
|
575 } |
|
576 |
|
577 iOrientationHandler->UpdateL(); |
|
578 |
|
579 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::PlayL()" ) |
|
580 } |
|
581 |
|
582 |
|
583 // ----------------------------------------------------------------------------- |
|
584 // Disable camera if not already disabled |
|
585 // ----------------------------------------------------------------------------- |
|
586 // |
|
587 EXPORT_C void CMusEngLiveSession::PauseL() |
|
588 { |
|
589 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::PauseL()" ) |
|
590 |
|
591 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
592 |
|
593 CMceCameraSource* camera = MusEngMceUtils::GetCameraL( *iSession ); |
|
594 |
|
595 if ( camera->IsEnabled() ) |
|
596 { |
|
597 camera->DisableL(); |
|
598 } |
|
599 else |
|
600 { |
|
601 MUS_LOG( "mus: [ENGINE] Camera already disabled, ignore request" ) |
|
602 } |
|
603 |
|
604 iOrientationHandler->UpdateL(); |
|
605 |
|
606 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::PauseL()" ) |
|
607 } |
|
608 |
|
609 |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 // ----------------------------------------------------------------------------- |
|
613 // |
|
614 EXPORT_C TBool CMusEngLiveSession::IsPlayingL() |
|
615 { |
|
616 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
617 |
|
618 return ( MusEngMceUtils::GetCameraL( *iSession )->IsEnabled() ); |
|
619 } |
|
620 |
|
621 // ----------------------------------------------------------------------------- |
|
622 // |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 void CMusEngLiveSession::EnableDisplayL( TBool aEnable ) |
|
626 { |
|
627 CMusEngMceSession::EnableDisplayL( aEnable ); |
|
628 iOrientationHandler->UpdateL(); |
|
629 } |
|
630 |
|
631 // ----------------------------------------------------------------------------- |
|
632 // |
|
633 // ----------------------------------------------------------------------------- |
|
634 // |
|
635 void CMusEngLiveSession::RefreshOrientationL() |
|
636 { |
|
637 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::RefreshOrientationL()" ) |
|
638 |
|
639 iOrientationHandler->RefreshOrientationL(); |
|
640 |
|
641 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::RefreshOrientationL()" ) |
|
642 } |
|
643 |
|
644 // ----------------------------------------------------------------------------- |
|
645 // |
|
646 // ----------------------------------------------------------------------------- |
|
647 // |
|
648 void CMusEngLiveSession::InitializeZoomStepSize() |
|
649 { |
|
650 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::InitializeZoomStepSize()" ) |
|
651 |
|
652 iBigZoomStep = ( iCameraInfo.iMaxZoom + iCameraInfo.iMaxDigitalZoom - |
|
653 iCameraInfo.iMinZoom ) / KZoomBigStepCount; |
|
654 |
|
655 if ( iBigZoomStep < KZoomStepMinSize ) |
|
656 iBigZoomStep = KZoomStepMinSize; |
|
657 |
|
658 iSmallZoomStep = ( iCameraInfo.iMaxZoom + iCameraInfo.iMaxDigitalZoom - |
|
659 iCameraInfo.iMinZoom ) / KZoomSmallStepCount; |
|
660 |
|
661 if ( iSmallZoomStep < KZoomStepMinSize ) |
|
662 iSmallZoomStep = KZoomStepMinSize; |
|
663 |
|
664 MUS_LOG2( "mus: [ENGINE] iSmallZoomStep = %d, iBigZoomStep = %d", |
|
665 iSmallZoomStep, iBigZoomStep ) |
|
666 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::InitializeZoomStepSize()" ) |
|
667 } |
|
668 |
|
669 // ----------------------------------------------------------------------------- |
|
670 // |
|
671 // ----------------------------------------------------------------------------- |
|
672 // |
|
673 void CMusEngLiveSession::CompleteSessionStructureL( |
|
674 CMceStreamBundle& /*aLocalBundle*/ ) |
|
675 { |
|
676 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::CompleteSessionStructureL()" ) |
|
677 |
|
678 __ASSERT_ALWAYS( iSession, User::Leave( KErrNotReady ) ); |
|
679 |
|
680 // Create outgoing video stream |
113 // Create outgoing video stream |
681 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
114 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
682 |
115 |
683 CMceRtpSink* rtpsink = CMceRtpSink::NewLC(); |
116 CMceRtpSink* rtpsink = CMceRtpSink::NewLC(); |
684 videoStream->AddSinkL( rtpsink ); |
117 videoStream->AddSinkL( rtpsink ); |
685 CleanupStack::Pop( rtpsink ); |
118 CleanupStack::Pop( rtpsink ); |
686 |
119 |
687 CMceCameraSource* camera = CMceCameraSource::NewLC( *iManager ); |
120 CMceCameraSource* camera = CMceCameraSource::NewLC( *iManager ); |
688 camera->DisableL(); // Start session in pause mode. |
121 camera->DisableL(); // Start session in pause mode. |
689 camera->GetCameraInfo( iCameraInfo ); |
122 |
690 iDefaultZoomFactor = camera->ZoomFactorL(); |
123 iCameraHandler.InitializeL( *camera ); |
691 |
|
692 InitializeZoomStepSize(); |
|
693 |
124 |
694 videoStream->SetSourceL( camera ); |
125 videoStream->SetSourceL( camera ); |
695 CleanupStack::Pop( camera ); |
126 CleanupStack::Pop( camera ); |
696 |
127 |
697 iSession->AddStreamL( videoStream ); |
128 iSession->AddStreamL( videoStream ); |
698 CleanupStack::Pop( videoStream ); |
129 CleanupStack::Pop( videoStream ); |
699 |
130 |
700 // Construct recording stream if needed |
131 // Construct recording stream if needed |
701 if ( iRecordedFile != KNullDesC ) |
132 if ( iLiveVideoPlayer->LcFileName().Length() > 0 ) |
702 { |
133 { |
703 CMceVideoStream* streamForRecording = CMceVideoStream::NewLC(); |
134 CMceVideoStream* streamForRecording = CMceVideoStream::NewLC(); |
704 |
135 |
705 CMceFileSink* fileSink = CMceFileSink::NewLC( iRecordedFile ); |
136 CMceFileSink* fileSink = |
|
137 CMceFileSink::NewLC( iLiveVideoPlayer->LcFileName() ); |
706 fileSink->DisableL(); // Start in not recording mode |
138 fileSink->DisableL(); // Start in not recording mode |
707 streamForRecording->AddSinkL( fileSink ); |
139 streamForRecording->AddSinkL( fileSink ); |
708 CleanupStack::Pop( fileSink ); |
140 CleanupStack::Pop( fileSink ); |
709 |
141 |
710 streamForRecording->SetSourceL( camera ); |
142 streamForRecording->SetSourceL( camera ); |
711 iSession->AddStreamL( streamForRecording ); |
143 iSession->AddStreamL( streamForRecording ); |
712 CleanupStack::Pop( streamForRecording ); |
144 CleanupStack::Pop( streamForRecording ); |
713 } |
145 } |
714 |
146 |
|
147 iLiveVideoPlayer->SetMceSession( iSession ); |
|
148 |
715 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::CompleteSessionStructureL()" ) |
149 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::CompleteSessionStructureL()" ) |
716 } |
150 } |
717 |
151 |
718 |
|
719 // ----------------------------------------------------------------------------- |
|
720 // |
|
721 // ----------------------------------------------------------------------------- |
|
722 // |
|
723 void CMusEngLiveSession::HandleSessionStateChanged( |
|
724 CMceSession& aSession, |
|
725 TInt aStatusCode, |
|
726 const TDesC8& aReasonPhrase ) |
|
727 { |
|
728 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::HandleSessionStateChanged" ) |
|
729 |
|
730 MUS_ENG_LOG_SESSION_STATE_AND_STATUS( aSession, aStatusCode, aReasonPhrase ) |
|
731 |
|
732 if ( iSession && |
|
733 iSession == &aSession && |
|
734 aSession.State() == CMceSession::EEstablished && |
|
735 iStoreEncoderConfigInfo ) |
|
736 { |
|
737 iStoreEncoderConfigInfo = EFalse; |
|
738 TRAPD( error, StoreEncoderConfigInfoL() ) |
|
739 if ( error != KErrNone && error != KErrNotFound ) |
|
740 { |
|
741 // Only acceptable error is absence of repository entry, |
|
742 // otherwise we inform user about failed session. |
|
743 iSessionObserver.SessionFailed(); |
|
744 } |
|
745 } |
|
746 |
|
747 CMusEngMceSession::HandleSessionStateChanged( aSession, |
|
748 aStatusCode, |
|
749 aReasonPhrase ); |
|
750 |
|
751 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::HandleSessionStateChanged" ) |
|
752 } |
|
753 |
|
754 |
|
755 // ----------------------------------------------------------------------------- |
152 // ----------------------------------------------------------------------------- |
756 // Sets video codec attributes |
153 // Sets video codec attributes |
757 // ----------------------------------------------------------------------------- |
154 // ----------------------------------------------------------------------------- |
758 // |
155 // |
759 void CMusEngLiveSession::AdjustVideoCodecL( CMceVideoCodec& aVideoCodec ) |
156 void CMusEngLiveSession::AdjustVideoCodecL( CMceVideoCodec& aVideoCodec, |
|
157 TMceSourceType aSourceType ) |
760 { |
158 { |
761 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::AdjustVideoCodecL()" ) |
159 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::AdjustVideoCodecL()" ) |
762 |
160 |
763 CMusEngMceOutSession::AdjustVideoCodecL( aVideoCodec ); |
161 CMusEngMceOutSession::AdjustVideoCodecL( aVideoCodec, aSourceType ); |
764 |
162 |
765 // Starting with 80Kbps will give better quality than starting with |
163 // Starting with 80Kbps will give better quality than starting with |
766 // 64kbps.And if network behaves bad than anyhow we will drop down or |
164 // 64kbps.And if network behaves bad than anyhow we will drop down or |
767 // if network is good guy than we climp up to 128. |
165 // if network is good guy than we climp up to 128. |
768 // Esp in operator variance. No constant defined in MCE so defining |
166 // Esp in operator variance. No constant defined in MCE so defining |
862 } |
252 } |
863 |
253 |
864 MUS_ENG_LOG_STREAM_STATE( aStream ) |
254 MUS_ENG_LOG_STREAM_STATE( aStream ) |
865 |
255 |
866 CMceVideoStream* recordingStream = |
256 CMceVideoStream* recordingStream = |
867 MusEngMceUtils::GetRecordingStream( *iSession ); |
257 MusEngMceUtils::GetRecordingStream( *iSession ); |
868 |
258 |
869 if ( recordingStream && |
259 if ( recordingStream && |
870 recordingStream == &aStream && |
260 recordingStream == &aStream && |
871 aStream.State() == CMceMediaStream::ENoResources && |
261 aStream.State() == CMceMediaStream::ENoResources && |
872 aSink.IsEnabled() == EFalse ) |
262 aSink.IsEnabled() == EFalse ) |
873 { |
263 { |
874 iLiveSessionObserver.DiskFull(); |
264 InformObserverAboutSessionFailure( MLcSession::EDiskFull ); |
875 } |
265 } |
876 else |
266 else |
877 { |
267 { |
878 // Cannot handle, forward to a base class |
268 // Cannot handle, forward to a base class |
879 CMusEngMceSession::StreamStateChanged( aStream, aSink ); |
269 CMusEngMceSession::StreamStateChanged( aStream, aSink ); |
880 } |
270 } |
881 |
271 |
882 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::StreamStateChanged( sink )" ) |
272 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::StreamStateChanged( sink )" ) |
883 } |
273 } |
884 |
|
885 |
|
886 // ----------------------------------------------------------------------------- |
|
887 // |
|
888 // ----------------------------------------------------------------------------- |
|
889 // |
|
890 CMusEngLiveSession::CMusEngLiveSession( |
|
891 MMusEngSessionObserver& aSessionObserver, |
|
892 MMusEngOutSessionObserver& aOutSessionObserver, |
|
893 MMusEngLiveSessionObserver& aLiveSessionObserver, |
|
894 const TRect& aRect, |
|
895 const TDesC& aRecordedFile ) |
|
896 : CMusEngMceOutSession( aRect, |
|
897 aSessionObserver, |
|
898 aOutSessionObserver ), |
|
899 iLiveSessionObserver( aLiveSessionObserver ), |
|
900 iDefaultZoomFactor( -1 ), |
|
901 iDefaultBrightness( 0 ), |
|
902 iRecordedFile( aRecordedFile ), |
|
903 iZoomInTime(0), |
|
904 iZoomOutTime(0), |
|
905 iSmallZoomStep( KZoomStepMinSize ), |
|
906 iBigZoomStep( KZoomStepMinSize ) |
|
907 { |
|
908 } |
|
909 |
|
910 |
|
911 // ----------------------------------------------------------------------------- |
|
912 // |
|
913 // ----------------------------------------------------------------------------- |
|
914 // |
|
915 void CMusEngLiveSession::ConstructL( TUint aSipProfileId ) |
|
916 { |
|
917 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ConstructL()" ) |
|
918 |
|
919 CMusEngMceOutSession::ConstructL( aSipProfileId ); |
|
920 |
|
921 iOrientationHandler = CMusEngOrientationHandler::NewL( *this, iLiveSessionObserver ); |
|
922 |
|
923 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ConstructL()" ) |
|
924 } |
|
925 |
|
926 |
|
927 // ----------------------------------------------------------------------------- |
|
928 // |
|
929 // ----------------------------------------------------------------------------- |
|
930 // |
|
931 void CMusEngLiveSession::SetEncodingDeviceL( CMceVideoCodec& aVideoCodec ) |
|
932 { |
|
933 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::SetEncodingDeviceL()" ) |
|
934 |
|
935 // We try to read encoding device UID. If we do not succeed, we use default |
|
936 |
|
937 const TUid KDefaultEncodingDevice( TUid::Uid( 0x20001C13 ) ); |
|
938 TUid encodingDevice( KDefaultEncodingDevice ); |
|
939 TRAPD( error, |
|
940 encodingDevice = MultimediaSharingSettings::EncodingDeviceL() ) |
|
941 __ASSERT_ALWAYS( error == KErrNone || error == KErrNotFound, |
|
942 User::Leave( error ) ); |
|
943 aVideoCodec.SetPreferredEncodingDecodingDeviceL( encodingDevice ); |
|
944 |
|
945 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::SetEncodingDeviceL()" ) |
|
946 } |
|
947 |
|
948 |
|
949 // ----------------------------------------------------------------------------- |
|
950 // |
|
951 // ----------------------------------------------------------------------------- |
|
952 // |
|
953 void CMusEngLiveSession::SetCodecConfigKeyL( CMceVideoCodec& aVideoCodec ) |
|
954 { |
|
955 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::SetCodecConfigKeyL()" ) |
|
956 |
|
957 HBufC8* configKey( NULL ); |
|
958 |
|
959 // We try to read config key. If we do not succeed, we prepare to |
|
960 // write keys to CenRep for the next time. |
|
961 TRAPD( error, configKey = ReadCodecConfigKeyL( aVideoCodec ) ) |
|
962 |
|
963 if ( error == KErrNone ) |
|
964 { |
|
965 // There is a repository for config keys |
|
966 if ( configKey ) |
|
967 { |
|
968 // ...and key is found. |
|
969 CleanupStack::PushL( configKey ); |
|
970 aVideoCodec.SetConfigKeyL( *configKey ); |
|
971 CleanupStack::PopAndDestroy( configKey ); |
|
972 } |
|
973 else |
|
974 { |
|
975 // ...but key is not found, so it must be written to CenRep when |
|
976 // available. |
|
977 iStoreEncoderConfigInfo = ETrue; |
|
978 } |
|
979 } |
|
980 else if ( error == KErrNotFound ) |
|
981 { |
|
982 // There is no repository for config keys so there is no point |
|
983 // trying to write anything there. Session setup can still continue. |
|
984 MUS_LOG1( "mus: [ENGINE] No repository for config keys [%d]", error ) |
|
985 } |
|
986 else |
|
987 { |
|
988 User::Leave( error ); |
|
989 } |
|
990 |
|
991 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::SetCodecConfigKeyL()" ) |
|
992 } |
|
993 |
|
994 |
|
995 // ----------------------------------------------------------------------------- |
|
996 // |
|
997 // ----------------------------------------------------------------------------- |
|
998 // |
|
999 HBufC8* CMusEngLiveSession::ReadCodecConfigKeyL( |
|
1000 const CMceVideoCodec& aVideoCodec ) const |
|
1001 { |
|
1002 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ReadCodecConfigKeyL()" ) |
|
1003 |
|
1004 HBufC8* key( NULL ); |
|
1005 |
|
1006 HBufC8* encoderInfo = MultimediaSharingSettings::EncoderConfigInfoLC(); |
|
1007 __ASSERT_ALWAYS( encoderInfo, User::Leave( KErrNotFound ) ); |
|
1008 |
|
1009 TPtrC8 keyId( ConfigKeyIdL( aVideoCodec ) ); |
|
1010 |
|
1011 TInt tokenStartPosition( encoderInfo->FindC( keyId ) ); |
|
1012 if ( tokenStartPosition > KErrNotFound ) |
|
1013 { |
|
1014 TInt tokenLength( encoderInfo->Mid( tokenStartPosition ).FindC( |
|
1015 KMusEncoderInfoTokenizer ) ); |
|
1016 if ( tokenLength > KErrNotFound ) |
|
1017 { |
|
1018 // Separate key from token by removing keyId |
|
1019 TInt keyStartPosition = tokenStartPosition + keyId.Length(); |
|
1020 TInt keyLength = tokenLength - keyId.Length(); |
|
1021 TPtrC8 keyPtr = encoderInfo->Mid( keyStartPosition, keyLength ); |
|
1022 key = keyPtr.AllocL(); |
|
1023 } |
|
1024 } |
|
1025 |
|
1026 CleanupStack::PopAndDestroy( encoderInfo ); |
|
1027 |
|
1028 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ReadCodecConfigKeyL()" ) |
|
1029 |
|
1030 return key; |
|
1031 } |
|
1032 |
|
1033 |
|
1034 // ----------------------------------------------------------------------------- |
|
1035 // |
|
1036 // ----------------------------------------------------------------------------- |
|
1037 // |
|
1038 void CMusEngLiveSession::StoreEncoderConfigInfoL() const |
|
1039 { |
|
1040 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::StoreEncoderConfigInfoL()" ) |
|
1041 |
|
1042 HBufC8* configInfoInCenRep = MultimediaSharingSettings::EncoderConfigInfoLC(); |
|
1043 __ASSERT_ALWAYS( configInfoInCenRep, User::Leave( KErrNotFound ) ); |
|
1044 |
|
1045 TBuf8<NCentralRepositoryConstants::KMaxBinaryLength> keys; |
|
1046 keys.Append( *configInfoInCenRep ); |
|
1047 |
|
1048 CMceVideoStream* stream = MusEngMceUtils::GetVideoOutStreamL( *iSession ); |
|
1049 const RPointerArray<CMceVideoCodec>& codecs = stream->Codecs(); |
|
1050 |
|
1051 for ( TInt codecIndex = 0; codecIndex < codecs.Count(); ++codecIndex ) |
|
1052 { |
|
1053 if ( codecs[codecIndex]->SdpName().FindF( KMceSDPNameH264 ) >= 0 ) |
|
1054 { |
|
1055 const TPtrC8 keyId = ConfigKeyIdL( *codecs[codecIndex] ); |
|
1056 HBufC8* configKey = codecs[codecIndex]->ConfigKeyL(); |
|
1057 CleanupStack::PushL( configKey ); |
|
1058 |
|
1059 if ( configKey && |
|
1060 keys.FindF( keyId ) == KErrNotFound && |
|
1061 configInfoInCenRep->FindF( keyId ) == KErrNotFound ) |
|
1062 { |
|
1063 |
|
1064 if ( keys.Length() + |
|
1065 keyId.Length() + |
|
1066 configKey->Length() + |
|
1067 KMusEncoderInfoTokenizer().Length() < |
|
1068 NCentralRepositoryConstants::KMaxBinaryLength ) |
|
1069 { |
|
1070 keys.Append( keyId ); |
|
1071 keys.Append( *configKey ); |
|
1072 keys.Append( KMusEncoderInfoTokenizer ); |
|
1073 } |
|
1074 } |
|
1075 |
|
1076 CleanupStack::PopAndDestroy( configKey ); |
|
1077 } |
|
1078 } |
|
1079 |
|
1080 MultimediaSharingSettings::SetEncoderConfigInfoL( keys ); |
|
1081 |
|
1082 CleanupStack::PopAndDestroy( configInfoInCenRep ); |
|
1083 |
|
1084 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::StoreEncoderConfigInfoL()" ) |
|
1085 } |
|
1086 |
|
1087 |
|
1088 // ----------------------------------------------------------------------------- |
|
1089 // |
|
1090 // ----------------------------------------------------------------------------- |
|
1091 // |
|
1092 const TPtrC8 CMusEngLiveSession::ConfigKeyIdL( |
|
1093 const CMceVideoCodec& aVideoCodec ) const |
|
1094 { |
|
1095 MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ConfigKeyIdL()" ) |
|
1096 |
|
1097 // Currently works only for AVC |
|
1098 __ASSERT_ALWAYS( aVideoCodec.SdpName().FindF( KMceSDPNameH264 ) >= 0, |
|
1099 User::Leave( KErrArgument ) ); |
|
1100 |
|
1101 TPtrC8 configKeyTokenId; |
|
1102 |
|
1103 if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1 ) |
|
1104 { |
|
1105 configKeyTokenId.Set( KMusAvcBitrateLevel1() ); |
|
1106 } |
|
1107 else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1b ) |
|
1108 { |
|
1109 configKeyTokenId.Set( KMusAvcBitrateLevel1b() ); |
|
1110 } |
|
1111 else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1_1 ) |
|
1112 { |
|
1113 configKeyTokenId.Set( KMusAvcBitrateLevel1_1() ); |
|
1114 } |
|
1115 else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1_2 ) |
|
1116 { |
|
1117 configKeyTokenId.Set( KMusAvcBitrateLevel1_2() ); |
|
1118 } |
|
1119 else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel1_3 ) |
|
1120 { |
|
1121 configKeyTokenId.Set( KMusAvcBitrateLevel1_3() ); |
|
1122 } |
|
1123 else if ( aVideoCodec.AllowedBitrates() & KMceAvcBitrateLevel2 ) |
|
1124 { |
|
1125 configKeyTokenId.Set( KMusAvcBitrateLevel2() ); |
|
1126 } |
|
1127 else |
|
1128 { |
|
1129 User::Leave( KErrNotFound ); |
|
1130 } |
|
1131 |
|
1132 MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ConfigKeyIdL()" ) |
|
1133 |
|
1134 return configKeyTokenId; |
|
1135 } |
|
1136 |
|
1137 |
|
1138 // ----------------------------------------------------------------------------- |
|
1139 // Calculate the zoom step based time escaped |
|
1140 // ----------------------------------------------------------------------------- |
|
1141 TInt CMusEngLiveSession::ZoomStepSize( TInt64& aTime ) |
|
1142 { |
|
1143 // MUS_LOG( "mus: [ENGINE] -> CMusEngLiveSession::ZoomStepSize()" ) |
|
1144 TTime now; |
|
1145 now.HomeTime(); |
|
1146 TInt64 timeNow = now.Int64(); |
|
1147 TInt stepSize = ( ( timeNow - aTime ) <= KZoomFasterTime ) ? iBigZoomStep : iSmallZoomStep; |
|
1148 |
|
1149 aTime = now.Int64(); |
|
1150 |
|
1151 MUS_LOG1( "mus: [ENGINE] stepSize = %d", stepSize ); |
|
1152 // MUS_LOG( "mus: [ENGINE] <- CMusEngLiveSession::ZoomStepSize()" ) |
|
1153 return stepSize; |
|
1154 } |
|
1155 |
|
1156 |
|