|
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: LiveComm Videotelephony Plugin session Class |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32base.h> |
|
19 #include <e32std.h> |
|
20 #include <e32cmn.h> |
|
21 #include <featmgr.h> |
|
22 |
|
23 #include <w32std.h> |
|
24 #include <coecntrl.h> |
|
25 #include <eikenv.h> |
|
26 #include <eikappui.h> |
|
27 #include <apgcli.h> |
|
28 |
|
29 #include "clcvtsession.h" |
|
30 |
|
31 #include "cvtengmodel.h" |
|
32 |
|
33 #include "clcvtvideoplayerbase.h" |
|
34 #include "clcvtlocalvideoplayer.h" |
|
35 #include "clcvtremotevideoplayer.h" |
|
36 #include "tlcvtstates.h" |
|
37 #include "clcvtcmdexecutor.h" |
|
38 #include "mlcvtenginecommandmanager.h" |
|
39 #include "lcvtplugincommand.h" |
|
40 #include "lcvtutility.h" |
|
41 |
|
42 // Default call index. |
|
43 const TInt KVtUiDefaultCallId = 1; |
|
44 |
|
45 // Granularity of command observer array. |
|
46 const TInt KLcVtCommandObserverArrayGranularity = 5; |
|
47 |
|
48 |
|
49 |
|
50 // Enumerates states for CLcVtActiveExec. |
|
51 enum |
|
52 { |
|
53 // Operation finished. Must equal to zero. |
|
54 EVtSessionNone, |
|
55 |
|
56 // Active execution states for iActiveExec: |
|
57 |
|
58 // Startup (prepare engine): |
|
59 EVtSessionStartup = 100, // 100 |
|
60 // Initialise engine. |
|
61 EVtSessionStartupInitEngine = EVtSessionStartup, // 100 |
|
62 // Prepare viewfinder. |
|
63 EVtSessionStartupPrepareViewfinder, // 101 |
|
64 // Prepare remote render. |
|
65 EVtSessionStartupPrepareRemoteRender, // 102 |
|
66 // Startup Finish |
|
67 EVtSessionStartupFinish, // 103 |
|
68 |
|
69 // Shutdown (reset engine): |
|
70 EVtSessionShutdown = 300, // 300 |
|
71 // Hide application. |
|
72 EVtSessionShutdownHideApplication = EVtSessionShutdown, // 300 |
|
73 // Reset engine. |
|
74 EVtSessionShutdownResetEngine, // 301 |
|
75 |
|
76 |
|
77 // Answered: |
|
78 EVtSessionAnswered = 500, // 500 |
|
79 // Start remote render. |
|
80 EVtSessionAnsweredStartRemoteRender = EVtSessionAnswered, // 500 |
|
81 // Prepare Camere |
|
82 EVtSessionAnsweredDoPrepareCamera, // 501 |
|
83 // Select camera as source. |
|
84 EVtSessionAnsweredSetlectCamera, // 502 |
|
85 // Select blank image as source. |
|
86 EVtSessionAnsweredSetlectNone, |
|
87 // Start view finder |
|
88 EVtSessionAnsweredStartViewFinder, // 504 |
|
89 // Show Application |
|
90 EVtSessionAnsweredBringToForeground, // 505 |
|
91 |
|
92 //EVtSessionAnswered = 500, // 500 |
|
93 //EVtSessionAnsweredBringToForeground = EVtSessionAnswered, // 505 |
|
94 |
|
95 // Finish. |
|
96 EVtSessionAnsweredFinish // 506 |
|
97 }; |
|
98 |
|
99 |
|
100 /** |
|
101 * Encapsulates event handling. |
|
102 * @since Series 60 2.6 |
|
103 */ |
|
104 class CLcVtSession::CEventObserver |
|
105 : public CBase, |
|
106 public MLcVtEngineCommandManager, |
|
107 public MVtEngEventObserver, |
|
108 #ifndef NGA_VIDEO_RENDER |
|
109 public MVtEngFrameObserver, |
|
110 #endif |
|
111 public MVtEngCommandObserver |
|
112 { |
|
113 public: // Constructors and destructors |
|
114 |
|
115 /** |
|
116 * Two-phased constructor. |
|
117 * @param aSession plugin session. |
|
118 */ |
|
119 static CEventObserver* NewL(CLcVtSession& aSession); |
|
120 |
|
121 /** |
|
122 * Destructor. |
|
123 */ |
|
124 ~CEventObserver(); |
|
125 |
|
126 public: // Functions from base classes |
|
127 |
|
128 /** |
|
129 * @see MLcVtEngineCommandManager::AddObserverL. |
|
130 */ |
|
131 void AddObserverL( MVtEngCommandObserver& aObserver ); |
|
132 |
|
133 /** |
|
134 * @see MLcVtEngineCommandManager::RemoveObserver. |
|
135 */ |
|
136 void RemoveObserver( MVtEngCommandObserver& aObserver ); |
|
137 |
|
138 /** |
|
139 * @see MVtEngEventObserver::HandleVtEventL. |
|
140 */ |
|
141 void HandleVtEventL( TInt aEvent ); |
|
142 |
|
143 /** |
|
144 * @see MVtEngCommandObserver::HandleVTCommandPerformedL. |
|
145 */ |
|
146 void HandleVTCommandPerformedL( |
|
147 TVtEngCommandId aCommand, |
|
148 const TInt aError ); |
|
149 #ifndef NGA_VIDEO_RENDER |
|
150 /** |
|
151 * @see MVtEngFrameObserver::vtHandleFrameL. |
|
152 */ |
|
153 void vtHandleFrameL( TFrameType aType, CFbsBitmap* aBitmap ); |
|
154 |
|
155 /** |
|
156 * @see MVtEngFrameObserver::vtSetFrame |
|
157 */ |
|
158 void vtSetFrame( TFrameType aType, CFbsBitmap* aBitmap ); |
|
159 #endif |
|
160 private: |
|
161 |
|
162 /** |
|
163 * Constructor. |
|
164 * @param aSession plugin session. |
|
165 */ |
|
166 CEventObserver(CLcVtSession& aSession ); |
|
167 |
|
168 /** |
|
169 * Symbian OS constructor. |
|
170 */ |
|
171 void ConstructL(); |
|
172 |
|
173 private: |
|
174 |
|
175 // Ref to plugin session. |
|
176 CLcVtSession& iSession; |
|
177 |
|
178 // ETrue when command events are being sent. |
|
179 TBool iInCommandPerformed; |
|
180 |
|
181 // Owned array of observers. |
|
182 RPointerArray< MVtEngCommandObserver > iCommandObservers; |
|
183 |
|
184 }; |
|
185 |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 // ----------------------------------------------------------------------------- |
|
190 // |
|
191 CLcVtSession* CLcVtSession::NewL() |
|
192 { |
|
193 CLcVtSession* self = new ( ELeave ) CLcVtSession(); |
|
194 CleanupStack::PushL( self ); |
|
195 self->ConstructL(); |
|
196 CleanupStack::Pop( self ); |
|
197 return self; |
|
198 } |
|
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 CLcVtSession::CLcVtSession( ) |
|
205 { |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 void CLcVtSession::ConstructL() |
|
213 { |
|
214 |
|
215 __VTPRINTENTER( "CLcVtSession.ConstructL" ) |
|
216 |
|
217 __VTPRINT( DEBUG_MEDIA , "FeatureManager::InitializeLibL()" ) |
|
218 FeatureManager::InitializeLibL(); |
|
219 |
|
220 __VTPRINT( DEBUG_MEDIA , "iCameraHandler.SetSession(this)" ) |
|
221 iCameraHandler.SetSession(this); |
|
222 __VTPRINT( DEBUG_MEDIA , "iRemoteVideoPlayer = CLcVtRemoteVideoPlayer_NewL" ) |
|
223 iRemoteVideoPlayer = CLcVtRemoteVideoPlayer::NewL(this, *this); |
|
224 __VTPRINT( DEBUG_MEDIA , "iLocalVideoPlayer = CLcVtLocalVideoPlayer_NewL" ) |
|
225 iLocalVideoPlayer = CLcVtLocalVideoPlayer::NewL(this, *this, iCameraHandler); |
|
226 |
|
227 #ifndef NGA_VIDEO_RENDER |
|
228 iFbsStarted = EFalse; |
|
229 |
|
230 __VTPRINT( DEBUG_MEDIA , "iWsSession = &(CCoeEnv::Static()->WsSession())" ) |
|
231 iWsSession = &(CCoeEnv::Static()->WsSession()); |
|
232 __VTPRINT( DEBUG_MEDIA , "iWsSessionScreenDev = CCoeEnv::Static()->ScreenDevice()" ) |
|
233 iWsSessionScreenDev = CCoeEnv::Static()->ScreenDevice(); |
|
234 __VTPRINT( DEBUG_MEDIA , "iRootWin = &(CCoeEnv::Static()->RootWin())" ) |
|
235 iRootWin = &(CCoeEnv::Static()->RootWin()); |
|
236 |
|
237 __VTPRINT( DEBUG_MEDIA , "ConnectFbsServerL()" ) |
|
238 ConnectFbsServerL(); |
|
239 #endif |
|
240 __VTPRINT( DEBUG_MEDIA , "iEventObserver = CEventObserver_NewL" ) |
|
241 iEventObserver = CEventObserver::NewL( *this ); |
|
242 |
|
243 iModel = CVtEngModel::NewL( *iEventObserver, *iEventObserver ); |
|
244 |
|
245 __VTPRINT( DEBUG_MEDIA , "iLcVtStates_new" ) |
|
246 iLcVtStates = new ( ELeave ) TLcVtStates( *iModel ); |
|
247 __VTPRINT( DEBUG_MEDIA , "iLcVtStates->Update()" ) |
|
248 iLcVtStates->Update(); |
|
249 |
|
250 __VTPRINT( DEBUG_MEDIA , "new_iActiveExec" ) |
|
251 iActiveExec = |
|
252 new ( ELeave ) CLcVtActiveExec( CActive::EPriorityHigh ); |
|
253 |
|
254 __VTPRINT( DEBUG_MEDIA , "SetCallIdL( KVtUiDefaultCallId )" ) |
|
255 SetCallIdL( KVtUiDefaultCallId ); |
|
256 |
|
257 __VTPRINT( DEBUG_MEDIA , "iAsyncCallback" ) |
|
258 iAsyncCallback = |
|
259 new ( ELeave ) CAsyncCallBack ( |
|
260 TCallBack( &DoExit, this ), |
|
261 CActive::EPriorityStandard ); |
|
262 #if 0 |
|
263 __VTPRINT( DEBUG_MEDIA , "iLayoutChangeCallback" ) |
|
264 iLayoutChangeCallback = |
|
265 new ( ELeave ) CAsyncCallBack( |
|
266 TCallBack( &DelayedHandleLayoutChanged, this ), |
|
267 CActive::EPriorityStandard ); |
|
268 #endif |
|
269 __VTPRINTEXIT( "CLcVtSession.ConstructL" ) |
|
270 |
|
271 } |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // |
|
275 // ----------------------------------------------------------------------------- |
|
276 // |
|
277 CLcVtSession::~CLcVtSession() |
|
278 { |
|
279 __VTPRINTENTER( "CLcVtSession.~CLcVtSession" ) |
|
280 |
|
281 //delete iLayoutChangeCallback; |
|
282 delete iAsyncCallback; |
|
283 |
|
284 #ifndef NGA_VIDEO_RENDER |
|
285 DisconnectFbsServer(); |
|
286 #endif |
|
287 delete iActiveExec; |
|
288 delete iLcVtStates; |
|
289 |
|
290 delete iModel; |
|
291 |
|
292 delete iEventObserver; |
|
293 iEventObserver = NULL; |
|
294 |
|
295 #ifdef NGA_VIDEO_RENDER |
|
296 DestroyVideoWindows(); |
|
297 #endif |
|
298 |
|
299 delete iLocalVideoPlayer; |
|
300 delete iRemoteVideoPlayer; |
|
301 |
|
302 delete iRemoteDisplayName; |
|
303 delete iRemoteDetails; |
|
304 __VTPRINTEXIT( "CLcVtSession.~CLcVtSession" ) |
|
305 FeatureManager::UnInitializeLib(); |
|
306 } |
|
307 |
|
308 #ifndef NGA_VIDEO_RENDER |
|
309 void CLcVtSession::ConnectFbsServerL() |
|
310 { |
|
311 // VT use bitmaps viewfinder now, So we start FBS server for proto demo |
|
312 // and later we will use Qt image object to implement bitmaps view finder or we will use direct view finder |
|
313 TInt err( KErrNone ); |
|
314 // Start Font&Bitmap server |
|
315 err = FbsStartup(); |
|
316 if ( err == KErrNone ) |
|
317 { |
|
318 err = RFbsSession::Connect(); |
|
319 if( err == KErrNone ) |
|
320 { |
|
321 iFbsStarted = ETrue; |
|
322 } |
|
323 } |
|
324 |
|
325 iDummy = new ( ELeave ) CFbsBitmap(); |
|
326 //CleanupStack::PushL( iDummy ); |
|
327 User::LeaveIfError( iDummy->Create( TSize( 4096, 1 ), EColor64K ) ); |
|
328 |
|
329 iGc = new (ELeave) CWindowGc( iWsSessionScreenDev ); |
|
330 //CleanupStack::PushL( iGc ); |
|
331 User::LeaveIfError( iGc->Construct()); |
|
332 |
|
333 //CleanupStack::Pop(2); |
|
334 } |
|
335 |
|
336 |
|
337 void CLcVtSession::DisconnectFbsServer() |
|
338 { |
|
339 delete iGc; |
|
340 delete iDummy; |
|
341 if ( iFbsStarted ) |
|
342 { |
|
343 RFbsSession::Disconnect(); |
|
344 iFbsStarted = EFalse; |
|
345 } |
|
346 } |
|
347 #endif |
|
348 #ifdef NGA_VIDEO_RENDER |
|
349 |
|
350 _LIT(KVTWindowGroupName,"32VTPluginVideoWindow"); |
|
351 |
|
352 void CLcVtSession::CreateVideoWindowsL() |
|
353 { |
|
354 __VTPRINTENTER( "CLcVtSession.CreateVideoWindowsL" ) |
|
355 User::LeaveIfError( iRwSession.Connect() ); |
|
356 |
|
357 iRwGroup = new (ELeave) RWindowGroup( iRwSession ) ; |
|
358 iRwGroup->Construct( (TUint32)iRwGroup, EFalse ); |
|
359 |
|
360 iRwGroup->SetName( KVTWindowGroupName ); |
|
361 iRwGroup->SetOrdinalPosition( 1 , ECoeWinPriorityNeverAtFront ); |
|
362 iRwGroup->AutoForeground(EFalse); |
|
363 |
|
364 iDev = new (ELeave) CWsScreenDevice( iRwSession ); |
|
365 iDev->Construct( ); |
|
366 |
|
367 iRemoteVideoWindow = new (ELeave) RWindow( iRwSession ); |
|
368 iRemoteVideoWindow->Construct( *iRwGroup, (TUint32)iRemoteVideoWindow ); |
|
369 |
|
370 TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect(); |
|
371 iRemoteVideoWindow->SetExtent( RMRect.iTl, RMRect.Size() ); |
|
372 iRemoteVideoWindow->SetOrdinalPosition( 1, ECoeWinPriorityNeverAtFront ); |
|
373 iRemoteVideoWindow->Activate(); |
|
374 |
|
375 iLocalVideoWindow = new (ELeave) RWindow( iRwSession ); |
|
376 iLocalVideoWindow->Construct( *iRwGroup, (TUint32)iLocalVideoWindow ); |
|
377 |
|
378 TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect(); |
|
379 iLocalVideoWindow->SetExtent( VFRect.iTl, VFRect.Size() ); |
|
380 iLocalVideoWindow->SetOrdinalPosition( 1, ECoeWinPriorityNeverAtFront ); |
|
381 iLocalVideoWindow->Activate(); |
|
382 |
|
383 iRwSession.Flush(); |
|
384 |
|
385 __VTPRINTEXIT( "CLcVtSession.CreateVideoWindowsL" ) |
|
386 } |
|
387 |
|
388 void CLcVtSession::DestroyVideoWindows() |
|
389 { |
|
390 |
|
391 delete iDev; |
|
392 iDev = NULL; |
|
393 delete iRemoteVideoWindow; |
|
394 iRemoteVideoWindow = NULL; |
|
395 delete iLocalVideoWindow; |
|
396 iLocalVideoWindow = NULL; |
|
397 delete iRwGroup; |
|
398 iRwGroup = NULL; |
|
399 iRwSession.Close(); |
|
400 } |
|
401 |
|
402 #endif |
|
403 |
|
404 |
|
405 void CLcVtSession::SetLcSessionObserver( MLcSessionObserver* aObserver ) |
|
406 { |
|
407 iObserver = aObserver; |
|
408 } |
|
409 |
|
410 void CLcVtSession::SetLcUiProvider( MLcUiProvider* aUiProvider ) |
|
411 { |
|
412 iUiProvider = aUiProvider; |
|
413 } |
|
414 |
|
415 TBool CLcVtSession::IsBackgroundStartup() |
|
416 { |
|
417 return ETrue; |
|
418 } |
|
419 |
|
420 TBool CLcVtSession::SendDialTone( TChar aKey ) |
|
421 { |
|
422 iDtmfTone = aKey; |
|
423 __VTPRINT2( DEBUG_GEN, "CLcVtSession.SendDialTone: %d", iDtmfTone() ) |
|
424 if ( Execute( KVtEngStartDtmfTone, &iDtmfTone ) != KErrNone ) |
|
425 { |
|
426 return EFalse; |
|
427 } |
|
428 else |
|
429 { |
|
430 return ETrue; |
|
431 } |
|
432 } |
|
433 |
|
434 void CLcVtSession::EstablishLcSessionL() |
|
435 { |
|
436 __VTPRINTENTER( "CLcVtSession.EstablishLcSessionL" ) |
|
437 |
|
438 TLcVtStateBase::SetInitialStateL( *this, *iLcVtStates ); |
|
439 |
|
440 __VTPRINTEXIT( "CLcVtSession.EstablishLcSessionL" ) |
|
441 } |
|
442 |
|
443 void CLcVtSession::TerminateLcSessionL() |
|
444 { |
|
445 __VTPRINTENTER( "CLcVtSession.TerminateLcSessionL" ) |
|
446 |
|
447 HandleCommandL( EPluginCmdEndActiveCall ); |
|
448 |
|
449 __VTPRINTEXIT( "CLcVtSession.TerminateLcSessionL" ) |
|
450 } |
|
451 |
|
452 MLcVideoPlayer* CLcVtSession::RemoteVideoPlayer() |
|
453 { |
|
454 return iRemoteVideoPlayer; |
|
455 } |
|
456 |
|
457 MLcVideoPlayer* CLcVtSession::LocalVideoPlayer() |
|
458 { |
|
459 return iLocalVideoPlayer; |
|
460 } |
|
461 |
|
462 MLcSession::TLcSessionState CLcVtSession::LcSessionState() const |
|
463 { |
|
464 return iSessionState; |
|
465 } |
|
466 |
|
467 const TDesC& CLcVtSession::LocalDisplayName() |
|
468 { |
|
469 return KNullDesC; |
|
470 } |
|
471 const TDesC& CLcVtSession::RemoteDisplayName() |
|
472 { |
|
473 if ( iRemoteDisplayName ) |
|
474 { |
|
475 return *iRemoteDisplayName; |
|
476 } |
|
477 return KNullDesC; |
|
478 } |
|
479 |
|
480 TInt CLcVtSession::SetParameter( TInt aId, TInt aValue ) |
|
481 { |
|
482 if (aId == 0) |
|
483 iMainWindow = reinterpret_cast<RWindow*>(aValue); |
|
484 |
|
485 return 0; |
|
486 } |
|
487 |
|
488 TInt CLcVtSession::ParameterValue( TInt aId ) |
|
489 { |
|
490 return 0; |
|
491 } |
|
492 |
|
493 const TDesC& CLcVtSession::RemoteDetails() |
|
494 { |
|
495 if ( iRemoteDetails ) |
|
496 { |
|
497 return *iRemoteDetails; |
|
498 } |
|
499 return KNullDesC; |
|
500 } |
|
501 |
|
502 void CLcVtSession::UpdateLcSessionL() |
|
503 { |
|
504 __VTPRINTENTER( "CLcVtSession.UpdateLcSessionL" ) |
|
505 |
|
506 if(iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning ) |
|
507 { |
|
508 __VTPRINTEXIT( "CLcVtSession.UpdateLcSessionL -- State Not OK" ) |
|
509 return; |
|
510 } |
|
511 #if 0 |
|
512 if(iLocalVideoPlayer->IsOrientationChanged()) |
|
513 HandleLayoutChanged(); |
|
514 else |
|
515 UpdateRenderingParametersL(); |
|
516 #endif |
|
517 UpdateRenderingParametersL(); |
|
518 __VTPRINTEXIT( "CLcVtSession.UpdateLcSessionL" ) |
|
519 } |
|
520 |
|
521 // ----------------------------------------------------------------------------- |
|
522 // From MLcAudioControl |
|
523 // ----------------------------------------------------------------------------- |
|
524 // |
|
525 TBool CLcVtSession::IsLcAudioMutedL() |
|
526 { |
|
527 return EFalse; |
|
528 } |
|
529 |
|
530 // ----------------------------------------------------------------------------- |
|
531 // From MLcAudioControl |
|
532 // ----------------------------------------------------------------------------- |
|
533 // |
|
534 void CLcVtSession::MuteLcAudioL( TBool aMute ) |
|
535 { |
|
536 } |
|
537 |
|
538 // ----------------------------------------------------------------------------- |
|
539 // From MLcAudioControl |
|
540 // ----------------------------------------------------------------------------- |
|
541 // |
|
542 TBool CLcVtSession::IsLcMicMutedL() |
|
543 { |
|
544 TBool result = !(iLcVtStates->AudioState().IsAudio()); |
|
545 __VTPRINT2( DEBUG_GEN, "CLcVtSession.IsLcMicMutedL = %d", result ) |
|
546 return result; |
|
547 } |
|
548 |
|
549 // ----------------------------------------------------------------------------- |
|
550 // From MLcAudioControl |
|
551 // ----------------------------------------------------------------------------- |
|
552 // |
|
553 void CLcVtSession::MuteLcMicL( TBool aMute ) |
|
554 { |
|
555 __VTPRINT2( DEBUG_GEN, "CLcVtSession.MuteLcMicL aMute = %d", aMute ) |
|
556 |
|
557 if(aMute) |
|
558 { |
|
559 HandleCommandL(EPluginCmdDisableAudio); |
|
560 } |
|
561 else |
|
562 { |
|
563 HandleCommandL(EPluginCmdEnableAudio); |
|
564 } |
|
565 } |
|
566 |
|
567 // ----------------------------------------------------------------------------- |
|
568 // From MLcAudioControl |
|
569 // ----------------------------------------------------------------------------- |
|
570 // |
|
571 TBool CLcVtSession::IsEnablingLcLoudspeakerAllowed() |
|
572 { |
|
573 return ETrue; |
|
574 } |
|
575 |
|
576 // ----------------------------------------------------------------------------- |
|
577 // From MLcAudioControl |
|
578 // ----------------------------------------------------------------------------- |
|
579 // |
|
580 void CLcVtSession::EnableLcLoudspeakerL( TBool aEnabled ) |
|
581 { |
|
582 __VTPRINT2( DEBUG_GEN, "CLcVtSession.EnableLcLoudspeakerL aEnabled = %d", aEnabled ) |
|
583 |
|
584 if(aEnabled) |
|
585 { |
|
586 HandleCommandL(EPluginCmdActivateLoudspeaker); |
|
587 } |
|
588 else |
|
589 { |
|
590 HandleCommandL(EPluginCmdDeactivateLoudspeaker); |
|
591 } |
|
592 } |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // From MLcAudioControl |
|
596 // ----------------------------------------------------------------------------- |
|
597 // |
|
598 TBool CLcVtSession::IsLcLoudspeakerEnabled() |
|
599 { |
|
600 TBool result = !(iLcVtStates->AudioState().CanActivateLoudspeaker()); |
|
601 __VTPRINT2( DEBUG_GEN, "CLcVtSession.IsLcLoudspeakerEnabled = %d", result ) |
|
602 return result; |
|
603 } |
|
604 |
|
605 // ----------------------------------------------------------------------------- |
|
606 // From MLcAudioControl |
|
607 // ----------------------------------------------------------------------------- |
|
608 // |
|
609 TInt CLcVtSession::LcVolumeL() |
|
610 { |
|
611 MVtEngAudio& audio = iModel->Audio(); |
|
612 MVtEngAudio::TAudioRoutingState audioRouting; |
|
613 User::LeaveIfError( audio.GetRoutingState( audioRouting ) ); |
|
614 const TInt volume( audio.OutputVolume( |
|
615 !( audioRouting == MVtEngAudio::EAudioLoudspeaker ) ) ); |
|
616 |
|
617 return volume; |
|
618 } |
|
619 |
|
620 // ----------------------------------------------------------------------------- |
|
621 // From MLcAudioControl |
|
622 // ----------------------------------------------------------------------------- |
|
623 // |
|
624 void CLcVtSession::SetLcVolumeL( TInt aValue ) |
|
625 { |
|
626 __VTPRINTENTER( "CLcVtSession.SetLcVolumeL" ) |
|
627 MVtEngAudio& audio = iModel->Audio(); |
|
628 const TInt HandsetVolume( audio.OutputVolume(ETrue) ); |
|
629 const TInt HandsfreeVolume( audio.OutputVolume(EFalse) ); |
|
630 MVtEngAudio::TVtEngOutputVolume volume; |
|
631 volume.iHandsetVolume = HandsetVolume; |
|
632 volume.iHandsfreeVolume = HandsfreeVolume; |
|
633 |
|
634 MVtEngAudio::TAudioRoutingState audioRouting; |
|
635 User::LeaveIfError( audio.GetRoutingState( audioRouting ) ); |
|
636 if(audioRouting == MVtEngAudio::EAudioHandset) |
|
637 volume.iHandsetVolume = aValue; |
|
638 else |
|
639 volume.iHandsfreeVolume = aValue; |
|
640 |
|
641 ExecuteCmdL( KVtEngSetAudioVolume, volume ); |
|
642 __VTPRINTEXIT( "CLcVtSession.SetLcVolumeL" ) |
|
643 } |
|
644 |
|
645 // ----------------------------------------------------------------------------- |
|
646 // From MLcAudioControl |
|
647 // ----------------------------------------------------------------------------- |
|
648 // |
|
649 void CLcVtSession::IncreaseLcVolumeL() |
|
650 { |
|
651 ExecuteCmdL( KVtEngIncreaseAudioVolume ); |
|
652 } |
|
653 |
|
654 // ----------------------------------------------------------------------------- |
|
655 // From MLcAudioControl |
|
656 // ----------------------------------------------------------------------------- |
|
657 // |
|
658 void CLcVtSession::DecreaseLcVolumeL() |
|
659 { |
|
660 ExecuteCmdL( KVtEngDecreaseAudioVolume ); |
|
661 } |
|
662 |
|
663 CVtEngModel& CLcVtSession::Model() |
|
664 { |
|
665 return *iModel; |
|
666 } |
|
667 |
|
668 |
|
669 void CLcVtSession::HandleCommandL(const TInt aCommand) |
|
670 { |
|
671 |
|
672 __VTPRINTENTER( "CLcVtSession.HandleCommandL" ) |
|
673 |
|
674 if ( iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning ) |
|
675 { |
|
676 __VTPRINTEXIT( "CLcVtSession.HandleCommandL NOT ready" ) |
|
677 return; |
|
678 } |
|
679 |
|
680 if ( iState->HandleCommandL( aCommand ) == TLcVtStateBase::EEventHandled ) |
|
681 { |
|
682 __VTPRINTEXIT( "CLcVtSession.HandleCommandL <silently ignoring> 0" ) |
|
683 return; |
|
684 } |
|
685 |
|
686 __VTPRINT2( DEBUG_GEN, "CLcVtSession.HandleCommandL command = %d", aCommand ) |
|
687 |
|
688 switch ( aCommand ) |
|
689 { |
|
690 case EPluginCmdEnableAudio: |
|
691 CmdEnableAudioL(); |
|
692 break; |
|
693 |
|
694 case EPluginCmdDisableAudio: |
|
695 CmdDisableAudioL(); |
|
696 break; |
|
697 |
|
698 case EPluginCmdUsePrimaryCamera: |
|
699 CmdUseCameraL( ETrue ); |
|
700 break; |
|
701 |
|
702 case EPluginCmdUseSecondaryCamera: |
|
703 CmdUseCameraL( EFalse ); |
|
704 break; |
|
705 |
|
706 case EPluginCmdEnableVideo: |
|
707 CmdEnableVideoL(); |
|
708 break; |
|
709 |
|
710 case EPluginCmdDisableVideo: |
|
711 CmdDisableVideoL(); |
|
712 break; |
|
713 |
|
714 case EPluginCmdActivateLoudspeaker: |
|
715 CmdActivateLoudspeakerL(); |
|
716 break; |
|
717 |
|
718 case EPluginCmdDeactivateLoudspeaker: |
|
719 CmdDeactivateLoudspeakerL(); |
|
720 break; |
|
721 |
|
722 } |
|
723 |
|
724 __VTPRINTEXIT( "CLcVtSession.HandleCommandL" ) |
|
725 |
|
726 iLcVtStates->Update(); |
|
727 } |
|
728 |
|
729 // ----------------------------------------------------------------------------- |
|
730 // CLcVtSession::CmdEnableAudioL |
|
731 // ----------------------------------------------------------------------------- |
|
732 // |
|
733 void CLcVtSession::CmdEnableAudioL() |
|
734 { |
|
735 ExecuteCmdL( KVtEngUnmuteOutgoingAudio ); |
|
736 iLcVtStates->Update(); |
|
737 } |
|
738 |
|
739 |
|
740 // ----------------------------------------------------------------------------- |
|
741 // CLcVtSession::CmdDisableAudioL |
|
742 // ----------------------------------------------------------------------------- |
|
743 // |
|
744 void CLcVtSession::CmdDisableAudioL() |
|
745 { |
|
746 ExecuteCmdL( KVtEngMuteOutgoingAudio ); |
|
747 iLcVtStates->Update(); |
|
748 } |
|
749 |
|
750 |
|
751 // ----------------------------------------------------------------------------- |
|
752 // CLcVtSession::CmdUseCameraL |
|
753 // ----------------------------------------------------------------------------- |
|
754 // |
|
755 void CLcVtSession::CmdUseCameraL( const TBool aPrimaryCamera ) |
|
756 { |
|
757 |
|
758 MVtEngMedia& media = iModel->Media(); |
|
759 |
|
760 MVtEngMedia::TMediaSource selectedSource = |
|
761 ( aPrimaryCamera ) ? |
|
762 MVtEngMedia::EMediaCameraPri : MVtEngMedia::EMediaCameraSec; |
|
763 |
|
764 TInt available = 0; |
|
765 LcVtUtility::GetOutgoingMediaState( media, available ); |
|
766 if ( available & MVtEngMedia::EMediaVideo ) |
|
767 { |
|
768 ExecuteCmdL( KVtEngStopViewFinder ); |
|
769 |
|
770 TRAPD( err, ExecuteCmdL( KVtEngSetSource, selectedSource ) ); |
|
771 |
|
772 if ( err == KErrNone ) |
|
773 { |
|
774 ExecuteCmdL( KVtEngStartViewFinder ); |
|
775 } |
|
776 else |
|
777 { |
|
778 //ShowOtherCameraNotUsableNoteL(); |
|
779 } |
|
780 } |
|
781 else |
|
782 { |
|
783 /* |
|
784 MVtEngMedia::TPrepareCameraParams params; |
|
785 params.iMediaSource = selectedSource; |
|
786 params.iInitialize = EFalse; |
|
787 TRAPD( err, ExecuteCmdL( KVtEngPrepareCamera, params ) ); |
|
788 if ( err != KErrNone ) |
|
789 { |
|
790 ShowOtherCameraNotUsableNoteL(); |
|
791 } |
|
792 */ |
|
793 } |
|
794 |
|
795 } |
|
796 |
|
797 |
|
798 // ----------------------------------------------------------------------------- |
|
799 // CLcVtSession::CmdEnableVideoL |
|
800 // ----------------------------------------------------------------------------- |
|
801 // |
|
802 void CLcVtSession::CmdEnableVideoL() |
|
803 { |
|
804 // if outgoing video is frozen |
|
805 MVtEngMedia& media = iModel->Media(); |
|
806 if ( LcVtUtility::GetFreezeState( media ) ) |
|
807 { |
|
808 ExecuteCmdL( KVtEngUnfreeze ); |
|
809 // swap images if needed |
|
810 //RestoreViewFinderL(); |
|
811 } |
|
812 else |
|
813 { |
|
814 ExecuteCmdL( KVtEngStopViewFinder ); |
|
815 //iUplinkWindow->SetStreamBitmap( NULL ); |
|
816 MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaCamera; |
|
817 ExecuteCmdL( KVtEngSetSource, source ); |
|
818 MVtEngMedia::TCameraId id; |
|
819 if ( iModel->Media().GetCurrentCameraId( id ) == KErrInUse ) |
|
820 { |
|
821 //ShowCameraInUseNoteL(); |
|
822 } |
|
823 ExecuteCmdL( KVtEngStartViewFinder ); |
|
824 } |
|
825 // update VB settings |
|
826 //UpdateVBSettingL(); |
|
827 iLcVtStates->Update(); |
|
828 } |
|
829 |
|
830 // ----------------------------------------------------------------------------- |
|
831 // CLcVtSession::CmdDisableVideoL |
|
832 // ----------------------------------------------------------------------------- |
|
833 // |
|
834 void CLcVtSession::CmdDisableVideoL() |
|
835 { |
|
836 ExecuteCmdL( KVtEngStopViewFinder ); |
|
837 |
|
838 //iUplinkWindow->SetStreamBitmap( NULL ); |
|
839 |
|
840 TInt err = KErrNotFound; |
|
841 if ( LcVtUtility::HasStillImage( iModel->Media() ) ) |
|
842 { |
|
843 __VTPRINT( DEBUG_GEN, "VtUi.:CmdDisableVideoL.HasStill" ) |
|
844 MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaStillImage; |
|
845 TRAP( err, ExecuteCmdL( KVtEngSetSource, source ) ); |
|
846 } |
|
847 if ( ( err != KErrNone ) ) |
|
848 { |
|
849 __VTPRINT( DEBUG_GEN, "VtUi.:CmdDisableVideoL.MediaNone" ) |
|
850 MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaNone; |
|
851 ExecuteCmdL( KVtEngSetSource, source ); |
|
852 } |
|
853 |
|
854 ExecuteCmdL( KVtEngStartViewFinder ); |
|
855 iLcVtStates->Update(); |
|
856 } |
|
857 |
|
858 // ----------------------------------------------------------------------------- |
|
859 // CLcVtSession::CmdActivateLoudspeakerL |
|
860 // ----------------------------------------------------------------------------- |
|
861 // |
|
862 void CLcVtSession::CmdActivateLoudspeakerL() |
|
863 { |
|
864 MVtEngAudio::TVtEngRoutingSetting audioSetting = |
|
865 MVtEngAudio::EActivateHandsfree; |
|
866 ExecuteCmdL( KVtEngSetAudioRouting, audioSetting ); |
|
867 iLcVtStates->Update(); |
|
868 } |
|
869 |
|
870 // ----------------------------------------------------------------------------- |
|
871 // CLcVtSession::CmdDeactivateLoudspeakerL |
|
872 // ----------------------------------------------------------------------------- |
|
873 // |
|
874 void CLcVtSession::CmdDeactivateLoudspeakerL() |
|
875 { |
|
876 MVtEngAudio::TVtEngRoutingSetting audioSetting = |
|
877 MVtEngAudio::EDeactivateHansfree; |
|
878 ExecuteCmdL( KVtEngSetAudioRouting, audioSetting ); |
|
879 iLcVtStates->Update(); |
|
880 } |
|
881 |
|
882 |
|
883 // ----------------------------------------------------------------------------- |
|
884 // CLcVtSession::SetZoomFactorL |
|
885 // ----------------------------------------------------------------------------- |
|
886 // |
|
887 void CLcVtSession::SetZoomFactorL( TInt aZoomStep ) |
|
888 { |
|
889 __VTPRINTENTER( "CLcVtSessionCLcVtSession.SetZoomFactorL" ) |
|
890 MVtEngMedia& media = iModel->Media(); |
|
891 if ( LcVtUtility::IsZoomAllowed( media ) ) |
|
892 { |
|
893 ExecuteCmdL( KVtEngSetZoomStep, aZoomStep ); |
|
894 } |
|
895 __VTPRINTEXIT( "CLcVtSession.SetZoomFactorL" ) |
|
896 } |
|
897 |
|
898 #ifndef NGA_VIDEO_RENDER |
|
899 //local video display, VT use bitmaps vf now, and maybe replace by direct vf later |
|
900 void CLcVtSession::vtHandleFrameL( CFbsBitmap* aBitmap ) |
|
901 { |
|
902 __VTPRINTENTER( "CLcVtSession.vtHandleFrameL" ) |
|
903 |
|
904 /* |
|
905 TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect(); |
|
906 const TPoint KVFcordinate( VFRect.iTl.iX, VFRect.iTl.iY ); |
|
907 iMainWindow->Invalidate(); |
|
908 iMainWindow->BeginRedraw(); |
|
909 iGc->Activate( *iMainWindow ); |
|
910 aBitmap->BeginDataAccess(); |
|
911 aBitmap->EndDataAccess(); |
|
912 iGc->BitBlt( KVFcordinate , aBitmap ); |
|
913 iGc->Deactivate(); |
|
914 iMainWindow->EndRedraw(); |
|
915 */ |
|
916 |
|
917 /* |
|
918 TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect(); |
|
919 const TPoint KVFcordinate( VFRect.iTl.iX -2 , VFRect.iTl.iY - 168 ); |
|
920 iLocalVideoWindow->Invalidate(); |
|
921 iLocalVideoWindow->BeginRedraw(); |
|
922 iGc->Activate( *iLocalVideoWindow ); |
|
923 iGc->BitBlt( KVFcordinate , aBitmap ); |
|
924 iGc->Deactivate(); |
|
925 iLocalVideoWindow->EndRedraw(); |
|
926 */ |
|
927 |
|
928 __VTPRINTEXIT("CLcVtSession.vtHandleFrameL") |
|
929 } |
|
930 #endif |
|
931 |
|
932 TInt CLcVtSession::SetForegroundStatus( TBool aIsForeground ) |
|
933 { |
|
934 __VTPRINTENTER( "CLcVtSession.SetForegroundStatus" ) |
|
935 __VTPRINT2( DEBUG_MEDIA , " foreground: %d", aIsForeground ) |
|
936 |
|
937 if ( iRwGroup ) |
|
938 { |
|
939 TInt priority = aIsForeground ? ECoeWinPriorityNormal : ECoeWinPriorityNeverAtFront; |
|
940 iRwGroup->SetOrdinalPosition( 1 , priority ); |
|
941 iRemoteVideoWindow->SetOrdinalPosition( 1 , priority ); |
|
942 iLocalVideoWindow->SetOrdinalPosition( 1 , priority ); |
|
943 iRwSession.Flush(); |
|
944 } |
|
945 __VTPRINTEXIT( "CLcVtSession.SetForegroundStatus" ) |
|
946 |
|
947 return KErrNone; |
|
948 } |
|
949 |
|
950 // ----------------------------------------------------------------------------- |
|
951 // CLcVtSession::ShutdownL |
|
952 // ----------------------------------------------------------------------------- |
|
953 // |
|
954 void CLcVtSession::ShutdownL() |
|
955 { |
|
956 __VTPRINTENTER( "CLcVtSession.ShutdownL" ) |
|
957 iActiveExec->Start( EVtSessionShutdown, *this ); |
|
958 __VTPRINTEXIT( "CLcVtSession.ShutdownL" ) |
|
959 } |
|
960 |
|
961 // ----------------------------------------------------------------------------- |
|
962 // CLcVtSession::StartupPhase1L |
|
963 // ----------------------------------------------------------------------------- |
|
964 // |
|
965 void CLcVtSession::StartupPhase1L() |
|
966 { |
|
967 __VTPRINTENTER( "CLcVtSession.StartupPhase1L" ) |
|
968 iActiveExec->Start( EVtSessionStartup, *this ); |
|
969 __VTPRINTEXIT( "CLcVtSession.StartupPhase1L" ) |
|
970 } |
|
971 |
|
972 |
|
973 // ----------------------------------------------------------------------------- |
|
974 // CLcVtSession::StartupPhase2L |
|
975 // ----------------------------------------------------------------------------- |
|
976 // |
|
977 void CLcVtSession::StartupPhase2L() |
|
978 { |
|
979 __VTPRINTENTER( "CLcVtSession.StartupPhase2L" ) |
|
980 iActiveExec->Start( EVtSessionAnswered, *this ); |
|
981 __VTPRINTEXIT( "CLcVtSession.StartupPhase2L" ) |
|
982 } |
|
983 |
|
984 // ----------------------------------------------------------------------------- |
|
985 // CLcVtSession::ActiveExecExecuteL |
|
986 // ----------------------------------------------------------------------------- |
|
987 // |
|
988 TBool CLcVtSession::ActiveExecExecuteL( |
|
989 CLcVtActiveExec& /*aActiveExec*/, |
|
990 const TInt aState, |
|
991 TInt& aNextState, |
|
992 TRequestStatus& aRequest ) |
|
993 { |
|
994 return ActiveExecInitExecuteL( |
|
995 aState, |
|
996 aNextState, |
|
997 aRequest ); |
|
998 } |
|
999 |
|
1000 // ----------------------------------------------------------------------------- |
|
1001 // CLcVtSession::ActiveExecContinue |
|
1002 // ----------------------------------------------------------------------------- |
|
1003 // |
|
1004 TBool CLcVtSession::ActiveExecContinue( |
|
1005 CLcVtActiveExec& /*aActiveExec*/, |
|
1006 TInt& aState, |
|
1007 const TInt aError ) |
|
1008 { |
|
1009 return ActiveExecInitContinue( aState, aError ); |
|
1010 } |
|
1011 |
|
1012 // ----------------------------------------------------------------------------- |
|
1013 // CLcVtSession::ActiveExecCancel |
|
1014 // ----------------------------------------------------------------------------- |
|
1015 // |
|
1016 void CLcVtSession::ActiveExecCancel( |
|
1017 CLcVtActiveExec& /*aActiveExec*/, |
|
1018 TInt aState ) |
|
1019 { |
|
1020 ActiveExecInitCancel( aState ); |
|
1021 } |
|
1022 |
|
1023 // ----------------------------------------------------------------------------- |
|
1024 // CLcVtSession::ActiveExecDone |
|
1025 // ----------------------------------------------------------------------------- |
|
1026 // |
|
1027 void CLcVtSession::ActiveExecDone( |
|
1028 CLcVtActiveExec& /*aActiveExec*/, |
|
1029 const TInt aInitialState ) |
|
1030 { |
|
1031 ActiveExecInitDone( aInitialState ); |
|
1032 } |
|
1033 |
|
1034 |
|
1035 // ----------------------------------------------------------------------------- |
|
1036 // CLcVtSession::ActiveExecInitCancel |
|
1037 // ----------------------------------------------------------------------------- |
|
1038 // |
|
1039 void CLcVtSession::ActiveExecInitCancel( |
|
1040 const TInt /*aState*/ ) |
|
1041 { |
|
1042 __VTPRINTENTER( "CLcVtSession.InitExecCancel" ) |
|
1043 |
|
1044 delete iCmdExecutor; |
|
1045 |
|
1046 if ( iShutdownRequest ) |
|
1047 { |
|
1048 User::RequestComplete( iShutdownRequest, KErrCancel ); |
|
1049 iShutdownRequest = NULL; |
|
1050 } |
|
1051 __VTPRINTEXIT( "CLcVtSession.InitExecCancel" ) |
|
1052 } |
|
1053 |
|
1054 // ----------------------------------------------------------------------------- |
|
1055 // CLcVtSession::ActiveExecInitDone |
|
1056 // ----------------------------------------------------------------------------- |
|
1057 // |
|
1058 void CLcVtSession::ActiveExecInitDone( |
|
1059 const TInt aInitialState ) |
|
1060 { |
|
1061 __VTPRINTENTER( "CLcVtSession.ExecInitDone" ) |
|
1062 __VTPRINT2( DEBUG_GEN, "CLcVtSession.InitExecDone.ini=%d", aInitialState ) |
|
1063 // Operation succeeded |
|
1064 |
|
1065 // Now we have finished. |
|
1066 if ( iState ) |
|
1067 { |
|
1068 if ( aInitialState == EVtSessionAnswered ) |
|
1069 { |
|
1070 TRAP_IGNORE( iState->LcVtStartupPhase2DoneL() ); |
|
1071 iSessionState = EOpen; |
|
1072 iObserver->StateChanged( *this ); |
|
1073 } |
|
1074 else if ( aInitialState == EVtSessionShutdown ) |
|
1075 { |
|
1076 TRAP_IGNORE( iState->ShutdownDoneL() ); |
|
1077 } |
|
1078 else // EVtSessionStartup |
|
1079 { |
|
1080 TRAP_IGNORE( iState->LcVtStartupPhase1DoneL() ); |
|
1081 } |
|
1082 } |
|
1083 __VTPRINTEXIT( "CLcVtSession.ExecInitDone" ) |
|
1084 } |
|
1085 |
|
1086 |
|
1087 // ----------------------------------------------------------------------------- |
|
1088 // CLcVtSession::ActiveExecInitExecuteL |
|
1089 // ----------------------------------------------------------------------------- |
|
1090 // |
|
1091 TBool CLcVtSession::ActiveExecInitExecuteL( |
|
1092 const TInt aState, |
|
1093 TInt& aNextState, |
|
1094 TRequestStatus& aRequest ) |
|
1095 { |
|
1096 __VTPRINTENTER( "CLcVtSession.ActiveExecInitExecuteL" ) |
|
1097 __VTPRINT2( DEBUG_GEN, "CLcVtSession.ActiveExecInitExecuteL.st=%d", aState ) |
|
1098 |
|
1099 TBool synch = EFalse; |
|
1100 |
|
1101 switch ( aState ) |
|
1102 { |
|
1103 // Startup chain: |
|
1104 case EVtSessionStartupInitEngine: |
|
1105 //ChangeApplicationFocus(ETrue); |
|
1106 #if defined (__WINS__) |
|
1107 ActiveExecInitExecuteCommandL( KVtEngInitializeEngineDiag, aRequest ); |
|
1108 #else |
|
1109 ActiveExecInitExecuteCommandL( KVtEngInitializeEngine, aRequest ); |
|
1110 #endif |
|
1111 aNextState = EVtSessionStartupPrepareViewfinder; |
|
1112 //aNextState = EVtSessionStartupFinish; |
|
1113 break; |
|
1114 |
|
1115 case EVtSessionStartupPrepareViewfinder: |
|
1116 //iSessionState = EOpen; |
|
1117 //iObserver->StateChanged( *this ); |
|
1118 |
|
1119 #ifdef NGA_VIDEO_RENDER |
|
1120 CreateVideoWindowsL(); |
|
1121 #endif |
|
1122 ActiveExecInitPrepareViewFinderL( aRequest ); |
|
1123 aNextState = EVtSessionStartupPrepareRemoteRender; |
|
1124 break; |
|
1125 |
|
1126 case EVtSessionStartupPrepareRemoteRender: |
|
1127 ActiveExecInitPrepareRemoteRenderL( aRequest ); |
|
1128 aNextState = EVtSessionStartupFinish; |
|
1129 break; |
|
1130 |
|
1131 case EVtSessionStartupFinish: |
|
1132 aNextState = EVtSessionNone; |
|
1133 synch = ETrue; |
|
1134 break; |
|
1135 |
|
1136 |
|
1137 // Shutdown chain: |
|
1138 case EVtSessionShutdownHideApplication: |
|
1139 ChangeApplicationFocus( EFalse ); |
|
1140 synch = ETrue; |
|
1141 aNextState = EVtSessionShutdownResetEngine; |
|
1142 break; |
|
1143 case EVtSessionShutdownResetEngine: |
|
1144 { |
|
1145 aRequest = KRequestPending; |
|
1146 |
|
1147 MVtEngCommandHandler& command = iModel->CommandHandler(); |
|
1148 // There should not be any commands ongoing because |
|
1149 // we have canceled all dialogs (and this should |
|
1150 // be the only command without dialog). |
|
1151 command.CancelCommand( command.PendingCommand() ); // ignore error |
|
1152 command.ExecuteL( KVtEngResetEngine, NULL ); |
|
1153 iShutdownRequest = &aRequest; |
|
1154 |
|
1155 aNextState = EVtSessionNone; |
|
1156 } |
|
1157 break; |
|
1158 |
|
1159 |
|
1160 |
|
1161 // Answered chain: |
|
1162 case EVtSessionAnsweredStartRemoteRender: |
|
1163 { |
|
1164 ActiveExecInitExecuteCommandL( KVtEngStartRenderRemote, aRequest ); |
|
1165 //TRequestStatus* status = &aRequest; |
|
1166 //User::RequestComplete( status, KErrNone ); |
|
1167 |
|
1168 MVtEngSessionInfo& session = iModel->Session(); |
|
1169 MVtEngMedia& media = iModel->Media(); |
|
1170 if ( LcVtUtility::HasCameras( media ) ) |
|
1171 { |
|
1172 //aNextState = EVtSessionAnsweredDoPrepareCamera; |
|
1173 aNextState = EVtSessionAnsweredSetlectNone; |
|
1174 } |
|
1175 else |
|
1176 { |
|
1177 aNextState = EVtSessionAnsweredSetlectNone; |
|
1178 } |
|
1179 } |
|
1180 break; |
|
1181 |
|
1182 case EVtSessionAnsweredSetlectNone: |
|
1183 { |
|
1184 ActiveExecInitSetSourceL( MVtEngMedia::EMediaNone, aRequest ); |
|
1185 aNextState = EVtSessionAnsweredStartViewFinder; |
|
1186 } |
|
1187 break; |
|
1188 case EVtSessionAnsweredDoPrepareCamera: |
|
1189 { |
|
1190 MVtEngMedia& media = iModel->Media(); |
|
1191 MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaCamera; |
|
1192 ActiveExecInitPrepareCameraL( source, aRequest ); |
|
1193 aNextState = EVtSessionAnsweredSetlectCamera; |
|
1194 } |
|
1195 break; |
|
1196 |
|
1197 case EVtSessionAnsweredSetlectCamera: |
|
1198 ActiveExecInitSetSourceL( MVtEngMedia::EMediaCamera, aRequest ); |
|
1199 aNextState = EVtSessionAnsweredStartViewFinder; |
|
1200 break; |
|
1201 |
|
1202 case EVtSessionAnsweredStartViewFinder: |
|
1203 ActiveExecInitExecuteCommandL( KVtEngStartViewFinder, aRequest ); |
|
1204 aNextState = EVtSessionAnsweredBringToForeground; |
|
1205 break; |
|
1206 |
|
1207 case EVtSessionAnsweredBringToForeground: |
|
1208 { |
|
1209 //CreateVideoWindowsL(); |
|
1210 |
|
1211 ChangeApplicationFocus(ETrue); |
|
1212 TRequestStatus* status = &aRequest; |
|
1213 User::RequestComplete( status, KErrNone ); |
|
1214 aNextState = EVtSessionAnsweredFinish; |
|
1215 } |
|
1216 break; |
|
1217 |
|
1218 case EVtSessionAnsweredFinish: |
|
1219 { |
|
1220 //iRwGroup->SetOrdinalPosition( 1 , ECoeWinPriorityNormal ); |
|
1221 |
|
1222 TBool handleAsForeground( ETrue ); |
|
1223 TPtrC8 params( reinterpret_cast< TUint8* >( &handleAsForeground ), sizeof( TBool ) ); |
|
1224 MVtEngCommandHandler& command = iModel->CommandHandler(); |
|
1225 TRAPD( err, command.ExecuteL( KVtEngSetUIForeground, ¶ms )); |
|
1226 if(err != KErrNone) |
|
1227 { |
|
1228 err = KErrNone; |
|
1229 } |
|
1230 |
|
1231 iLcVtStates->Update(); |
|
1232 |
|
1233 iObserver->StateChanged( *iLocalVideoPlayer ); |
|
1234 iObserver->StateChanged( *iRemoteVideoPlayer ); |
|
1235 |
|
1236 synch = ETrue; |
|
1237 aNextState = EVtSessionNone; |
|
1238 } |
|
1239 break; |
|
1240 } |
|
1241 |
|
1242 __VTPRINT2( DEBUG_GEN, "CLcVtSession.ActiveExecInitExecuteL.sync=%d", synch ) |
|
1243 __VTPRINT2( DEBUG_GEN, "CLcVtSession.ActiveExecInitExecuteL.next=%d", aNextState ) |
|
1244 __VTPRINTEXITR( "CLcVtSession.ActiveExecInitExecuteL %d", synch ) |
|
1245 return synch; |
|
1246 |
|
1247 } |
|
1248 |
|
1249 |
|
1250 // ----------------------------------------------------------------------------- |
|
1251 // CLcVtSession::ActiveExecInitContinue |
|
1252 // ----------------------------------------------------------------------------- |
|
1253 // |
|
1254 TBool CLcVtSession::ActiveExecInitContinue( |
|
1255 TInt& aState, |
|
1256 const TInt /*aError*/ ) |
|
1257 { |
|
1258 __VTPRINTENTER( "CLcVtSession.InitExecCont" ) |
|
1259 __VTPRINT2( DEBUG_GEN, "CLcVtSession.InitExecCont.st=%d", aState ) |
|
1260 |
|
1261 const TBool cont = EFalse; |
|
1262 __VTPRINT2( DEBUG_GEN, "VtUi.InitExecCont.cont=%d", cont ) |
|
1263 |
|
1264 if ( !cont ) |
|
1265 { |
|
1266 // Operation failed. |
|
1267 if ( iState ) |
|
1268 { |
|
1269 TRAP_IGNORE( iState->LcVtStartupFailedL() ); |
|
1270 } |
|
1271 } |
|
1272 __VTPRINTEXITR( "VtUi.InitExecCont %d", cont ) |
|
1273 return cont; |
|
1274 } |
|
1275 |
|
1276 |
|
1277 // ----------------------------------------------------------------------------- |
|
1278 // CLcVtSession::ActiveExecInitExecuteCommandL |
|
1279 // ----------------------------------------------------------------------------- |
|
1280 // |
|
1281 void CLcVtSession::ActiveExecInitExecuteCommandL( |
|
1282 const TVtEngCommandId aCommand, |
|
1283 TRequestStatus& aRequest ) |
|
1284 { |
|
1285 iCmdExecutor = |
|
1286 ExecuteCmdAsyncL( |
|
1287 &iCmdExecutor, |
|
1288 aCommand, |
|
1289 aRequest ); |
|
1290 } |
|
1291 |
|
1292 |
|
1293 // ----------------------------------------------------------------------------- |
|
1294 // CLcVtSession::ActiveExecInitPrepareViewFinderL |
|
1295 // ----------------------------------------------------------------------------- |
|
1296 // |
|
1297 void CLcVtSession::ActiveExecInitPrepareViewFinderL( |
|
1298 TRequestStatus& aRequest ) |
|
1299 { |
|
1300 |
|
1301 __VTPRINTENTER( "CLcVtSession.ActiveExecInitPrepareViewFinderL" ) |
|
1302 |
|
1303 TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect(); |
|
1304 TSize size (VFRect.Size()); |
|
1305 |
|
1306 #ifdef NGA_VIDEO_RENDER |
|
1307 |
|
1308 __VTPRINT3(DEBUG_GEN, "CLcVtSession.ActiveExecInitPrepareViewFinderL size(%d,%d)", size.iWidth, size.iHeight ) |
|
1309 |
|
1310 iLocalVideoWindow->SetPosition( VFRect.iTl ); |
|
1311 iLocalVideoWindow->SetSize( VFRect.Size() ); |
|
1312 |
|
1313 iRwSession.Flush(); |
|
1314 |
|
1315 __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iTl.iX: %d", VFRect.iTl.iX ) |
|
1316 __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iTl.iY: %d", VFRect.iTl.iY ) |
|
1317 __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iWidth: %d", VFRect.Width() ) |
|
1318 __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iHeight: %d", VFRect.Height() ) |
|
1319 |
|
1320 TVtEngRenderingOptionsNGA configViewfinder( *iLocalVideoWindow, iRwSession ); |
|
1321 iCmdExecutor = |
|
1322 ExecuteCmdAsyncL( |
|
1323 &iCmdExecutor, |
|
1324 KVtEngPrepareViewFinder, |
|
1325 configViewfinder, |
|
1326 aRequest ); |
|
1327 |
|
1328 |
|
1329 /* |
|
1330 TPoint point( 0, 0 ); |
|
1331 TRect vfRect( point, size ); |
|
1332 |
|
1333 TVtEngRenderingOptionsDSA configViewfinder(*iEventObserver, iRwSession ,*iDev, *iLocalVideoWindow, vfRect, vfRect); |
|
1334 |
|
1335 iCmdExecutor = |
|
1336 ExecuteCmdAsyncL( |
|
1337 &iCmdExecutor, |
|
1338 KVtEngPrepareViewFinderDSA, |
|
1339 configViewfinder, |
|
1340 aRequest ); |
|
1341 */ |
|
1342 |
|
1343 #else |
|
1344 |
|
1345 __VTPRINT3(DEBUG_GEN, "CLcVtSession.ActiveExecInitPrepareViewFinderL size(%d,%d)", size.iWidth, size.iHeight ) |
|
1346 |
|
1347 TVtEngRenderingOptions configViewfinder(*iEventObserver, size); |
|
1348 |
|
1349 iCmdExecutor = |
|
1350 ExecuteCmdAsyncL( |
|
1351 &iCmdExecutor, |
|
1352 KVtEngPrepareViewFinder, |
|
1353 configViewfinder, |
|
1354 aRequest ); |
|
1355 |
|
1356 #endif |
|
1357 } |
|
1358 |
|
1359 |
|
1360 // ----------------------------------------------------------------------------- |
|
1361 // CLcVtSession::ActiveExecInitPrepareRemoteRenderL |
|
1362 // ----------------------------------------------------------------------------- |
|
1363 // |
|
1364 void CLcVtSession::ActiveExecInitPrepareRemoteRenderL( |
|
1365 TRequestStatus& aRequest ) |
|
1366 { |
|
1367 |
|
1368 TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect(); |
|
1369 const TSize KRMsize( RMRect.Size()); |
|
1370 TRect screen( KRMsize ); |
|
1371 TRect clip( KRMsize ); |
|
1372 |
|
1373 #ifdef NGA_VIDEO_RENDER |
|
1374 |
|
1375 iRemoteVideoWindow->SetPosition( RMRect.iTl ); |
|
1376 iRemoteVideoWindow->SetSize( RMRect.Size() ); |
|
1377 |
|
1378 iRwSession.Flush(); |
|
1379 |
|
1380 __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iX: %d", RMRect.iTl.iX ) |
|
1381 __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iY: %d", RMRect.iTl.iY ) |
|
1382 __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iWidth: %d", RMRect.Width() ) |
|
1383 __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iHeight: %d", RMRect.Height() ) |
|
1384 |
|
1385 |
|
1386 TVtEngRenderingOptionsNGA configRemoteRender( *iRemoteVideoWindow, iRwSession ); |
|
1387 iCmdExecutor = |
|
1388 ExecuteCmdAsyncL( |
|
1389 &iCmdExecutor, |
|
1390 KVtEngPrepareRemoteRenderNGA, |
|
1391 configRemoteRender, |
|
1392 aRequest ); |
|
1393 |
|
1394 #else |
|
1395 |
|
1396 const TPoint KRMcordinate( RMRect.iTl.iX, RMRect.iTl.iY ); |
|
1397 |
|
1398 TVtEngRenderingOptionsDP configRemoteRender(*iEventObserver, *iWsSession ,*iWsSessionScreenDev, *iMainWindow, screen, clip, KRMcordinate ); |
|
1399 |
|
1400 iCmdExecutor = |
|
1401 ExecuteCmdAsyncL( |
|
1402 &iCmdExecutor, |
|
1403 KVtEngPrepareRemoteRenderDP, |
|
1404 configRemoteRender, |
|
1405 aRequest ); |
|
1406 |
|
1407 #endif |
|
1408 |
|
1409 } |
|
1410 |
|
1411 |
|
1412 // ----------------------------------------------------------------------------- |
|
1413 // CLcVtSession::ActiveExecInitPrepareCameraL |
|
1414 // ----------------------------------------------------------------------------- |
|
1415 // |
|
1416 void CLcVtSession::ActiveExecInitPrepareCameraL( |
|
1417 const MVtEngMedia::TMediaSource aSource, |
|
1418 TRequestStatus& aRequest ) |
|
1419 { |
|
1420 MVtEngMedia::TPrepareCameraParams params; |
|
1421 params.iMediaSource = aSource; |
|
1422 params.iInitialize = ETrue; |
|
1423 iCmdExecutor = |
|
1424 ExecuteCmdAsyncL( |
|
1425 &iCmdExecutor, |
|
1426 KVtEngPrepareCamera, |
|
1427 params, |
|
1428 aRequest ); |
|
1429 } |
|
1430 |
|
1431 // ----------------------------------------------------------------------------- |
|
1432 // CLcVtSession::ActiveExecInitSetSourceL |
|
1433 // ----------------------------------------------------------------------------- |
|
1434 // |
|
1435 void CLcVtSession::ActiveExecInitSetSourceL( |
|
1436 const MVtEngMedia::TMediaSource aSource, |
|
1437 TRequestStatus& aRequest ) |
|
1438 { |
|
1439 MVtEngMedia::TMediaSource source = |
|
1440 aSource; |
|
1441 iCmdExecutor = |
|
1442 ExecuteCmdAsyncL( |
|
1443 &iCmdExecutor, |
|
1444 KVtEngSetSource, |
|
1445 source, |
|
1446 aRequest ); |
|
1447 } |
|
1448 |
|
1449 |
|
1450 // ----------------------------------------------------------------------------- |
|
1451 // CLcVtSession::ExecuteCmdAsyncL |
|
1452 // ----------------------------------------------------------------------------- |
|
1453 // |
|
1454 CLcVtCmdExecutor* CLcVtSession::ExecuteCmdAsyncL( |
|
1455 CLcVtCmdExecutor** aDialogPtr, |
|
1456 const TVtEngCommandId aCommand, |
|
1457 TRequestStatus& aStatus ) |
|
1458 { |
|
1459 return DoExecuteCmdAsyncL( aDialogPtr, aCommand, NULL, aStatus ); |
|
1460 } |
|
1461 |
|
1462 // ----------------------------------------------------------------------------- |
|
1463 // CLcVtSession::ExecuteCmdAsyncL |
|
1464 // ----------------------------------------------------------------------------- |
|
1465 // |
|
1466 template< class T > |
|
1467 CLcVtCmdExecutor* CLcVtSession::ExecuteCmdAsyncL( |
|
1468 CLcVtCmdExecutor** aDialogPtr, |
|
1469 const TVtEngCommandId aCommand, |
|
1470 T& aParam, |
|
1471 TRequestStatus& aStatus ) |
|
1472 { |
|
1473 TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ), sizeof( T ) ); |
|
1474 return DoExecuteCmdAsyncL( aDialogPtr, aCommand, ¶ms, aStatus ); |
|
1475 } |
|
1476 |
|
1477 // ----------------------------------------------------------------------------- |
|
1478 // CLcVtSession::DoExecuteCmdAsyncL |
|
1479 // ----------------------------------------------------------------------------- |
|
1480 // |
|
1481 CLcVtCmdExecutor* CLcVtSession::DoExecuteCmdAsyncL( |
|
1482 CLcVtCmdExecutor** aDialogPtr, |
|
1483 const TVtEngCommandId aCommand, |
|
1484 TDesC8* aParams, |
|
1485 TRequestStatus& aStatus ) |
|
1486 { |
|
1487 __VTPRINT2( DEBUG_GEN, "CLcVtSession.DoExecAsync.cmd=%d", aCommand ) |
|
1488 MVtEngCommandHandler& command = iModel->CommandHandler(); |
|
1489 const TInt caps = command.GetCommandCaps( aCommand ); |
|
1490 |
|
1491 if ( caps >= KErrNone ) |
|
1492 { |
|
1493 const TBool asynchronous = |
|
1494 ( caps & MVtEngCommandHandler::EAttribAsync ); |
|
1495 |
|
1496 if ( asynchronous ) |
|
1497 { |
|
1498 CLcVtCmdExecutor* executor = |
|
1499 new ( ELeave ) CLcVtCmdExecutor( |
|
1500 aDialogPtr, |
|
1501 iModel->CommandHandler(), |
|
1502 *iEventObserver ); |
|
1503 executor->ExecuteCmdL( aCommand, aParams, &aStatus ); |
|
1504 return executor; |
|
1505 } |
|
1506 else |
|
1507 { |
|
1508 command.ExecuteL( aCommand, aParams ); |
|
1509 RefreshStatesL(); |
|
1510 TRequestStatus* status = &aStatus; |
|
1511 User::RequestComplete( status, KErrNone ); |
|
1512 } |
|
1513 } |
|
1514 else |
|
1515 { |
|
1516 // Failed. |
|
1517 User::Leave( caps ); |
|
1518 } |
|
1519 |
|
1520 return NULL; |
|
1521 } |
|
1522 |
|
1523 // ----------------------------------------------------------------------------- |
|
1524 // CLcVtSession::ExecuteCmdL |
|
1525 // ----------------------------------------------------------------------------- |
|
1526 // |
|
1527 void CLcVtSession::ExecuteCmdL( const TVtEngCommandId aCommand ) |
|
1528 { |
|
1529 DoExecuteCmdL( aCommand, NULL ); |
|
1530 } |
|
1531 |
|
1532 // ----------------------------------------------------------------------------- |
|
1533 // CLcVtSession::ExecuteCmdL |
|
1534 // ----------------------------------------------------------------------------- |
|
1535 // |
|
1536 template< class T > |
|
1537 void CLcVtSession::ExecuteCmdL( |
|
1538 const TVtEngCommandId aCommand, |
|
1539 T& aParam ) |
|
1540 { |
|
1541 TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ), sizeof( T ) ); |
|
1542 DoExecuteCmdL( aCommand, ¶ms ); |
|
1543 } |
|
1544 |
|
1545 // ----------------------------------------------------------------------------- |
|
1546 // CLcVtSession::DoExecuteCmdL |
|
1547 // ----------------------------------------------------------------------------- |
|
1548 // |
|
1549 void CLcVtSession::DoExecuteCmdL( |
|
1550 const TVtEngCommandId aCommand, |
|
1551 TDesC8* aParams ) |
|
1552 { |
|
1553 __VTPRINT2( DEBUG_GEN, "CLcVtSession.DoExec.cmd=%d", aCommand ) |
|
1554 MVtEngCommandHandler& command = iModel->CommandHandler(); |
|
1555 const TInt caps = command.GetCommandCaps( aCommand ); |
|
1556 |
|
1557 if ( caps >= KErrNone ) |
|
1558 { |
|
1559 const TBool asynchronous = |
|
1560 ( caps & MVtEngCommandHandler::EAttribAsync ); |
|
1561 |
|
1562 if ( asynchronous ) |
|
1563 { |
|
1564 CLcVtCmdExecutor* executor = |
|
1565 new ( ELeave ) CLcVtCmdExecutor( |
|
1566 NULL, |
|
1567 iModel->CommandHandler(), |
|
1568 *iEventObserver ); |
|
1569 iUiProvider->BlockUi(ETrue); |
|
1570 //executor->ExecuteCmdL( aCommand, aParams, NULL ); |
|
1571 TRAPD( err, executor->ExecuteCmdL( aCommand, aParams, NULL ) ); |
|
1572 iUiProvider->BlockUi(EFalse); |
|
1573 if(err != KErrNone) |
|
1574 User::Leave(err); |
|
1575 |
|
1576 } |
|
1577 else |
|
1578 { |
|
1579 command.ExecuteL( aCommand, aParams ); |
|
1580 RefreshStatesL(); |
|
1581 } |
|
1582 } |
|
1583 else |
|
1584 { |
|
1585 // Failed. |
|
1586 User::Leave( caps ); |
|
1587 } |
|
1588 } |
|
1589 |
|
1590 |
|
1591 // ----------------------------------------------------------------------------- |
|
1592 // CLcVtSession::Execute |
|
1593 // ----------------------------------------------------------------------------- |
|
1594 // |
|
1595 TInt CLcVtSession::Execute( const TVtEngCommandId aCommand, TDesC8* aParam ) |
|
1596 { |
|
1597 MVtEngCommandHandler& command = iModel->CommandHandler(); |
|
1598 TRAPD( err, command.ExecuteL( aCommand, aParam ) ); |
|
1599 #ifdef VTDEBUG |
|
1600 if ( err != KErrNone ) |
|
1601 { |
|
1602 __VTPRINT3( DEBUG_GEN, "CLcVtSession.Execute.Nok.cmd=%d,err=%d", aCommand, err ) |
|
1603 } |
|
1604 #endif // VTDEBUG |
|
1605 return err; |
|
1606 } |
|
1607 |
|
1608 |
|
1609 // ----------------------------------------------------------------------------- |
|
1610 // CLcVtSession::ChangeApplicationFocus |
|
1611 // ----------------------------------------------------------------------------- |
|
1612 // |
|
1613 void CLcVtSession::ChangeApplicationFocus( const TBool aForeground ) |
|
1614 { |
|
1615 __VTPRINTENTER( "CLcVtSession.ChangeApplicationFocus" ) |
|
1616 if ( iUiProvider ){ |
|
1617 iUiProvider->HandleForegroundStatus(aForeground); |
|
1618 } |
|
1619 __VTPRINTEXIT( "CLcVtSession.ChangeApplicationFocus" ) |
|
1620 } |
|
1621 |
|
1622 |
|
1623 // ----------------------------------------------------------------------------- |
|
1624 // CLcVtSession::ChangeState |
|
1625 // ----------------------------------------------------------------------------- |
|
1626 // |
|
1627 void CLcVtSession::ChangeState( TLcVtStateBase* aState ) |
|
1628 { |
|
1629 __VTPRINTENTER( "CLcVtSession.ChangeState" ) |
|
1630 iState = aState; |
|
1631 __VTPRINTEXIT( "CLcVtSession.ChangeState" ) |
|
1632 } |
|
1633 |
|
1634 #if 0 |
|
1635 // ----------------------------------------------------------------------------- |
|
1636 // CLcVtSession::StartDtmfTone |
|
1637 // ----------------------------------------------------------------------------- |
|
1638 // |
|
1639 void CLcVtSession::StartDtmfTone( const TChar& aTone ) |
|
1640 { |
|
1641 // should be called only through current application state |
|
1642 iDtmfTone = aTone; |
|
1643 __VTPRINT2( DEBUG_GEN, "CLcVtSession.DTMF.Start.%d", iDtmfTone() ) |
|
1644 if ( Execute( KVtEngStartDtmfTone, &iDtmfTone ) != KErrNone ) |
|
1645 { |
|
1646 iDtmfTone = 0; |
|
1647 } |
|
1648 } |
|
1649 |
|
1650 // ----------------------------------------------------------------------------- |
|
1651 // CLcVtSession::StopDtmfTone |
|
1652 // ----------------------------------------------------------------------------- |
|
1653 // |
|
1654 void CLcVtSession::StopDtmfTone() |
|
1655 { |
|
1656 // should be called only through current application state |
|
1657 if ( iDtmfTone() ) |
|
1658 { |
|
1659 __VTPRINT( DEBUG_GEN, "CLcVtSession.DTMF.STOP" ) |
|
1660 (void) Execute( KVtEngStopDtmfTone, NULL ); |
|
1661 iDtmfTone = 0; |
|
1662 } |
|
1663 } |
|
1664 #endif |
|
1665 // ----------------------------------------------------------------------------- |
|
1666 // CLcVtSession::SetCallIdL |
|
1667 // ----------------------------------------------------------------------------- |
|
1668 // |
|
1669 void CLcVtSession::SetCallIdL( const TInt aCallId ) |
|
1670 { |
|
1671 } |
|
1672 |
|
1673 // ----------------------------------------------------------------------------- |
|
1674 // CLcVtSession::SetCallNameL |
|
1675 // ----------------------------------------------------------------------------- |
|
1676 // |
|
1677 TBool CLcVtSession::SetCallNameL( const TDesC& aName ) |
|
1678 { |
|
1679 HBufC* name = aName.AllocL(); |
|
1680 delete iRemoteDisplayName; |
|
1681 iRemoteDisplayName = name; |
|
1682 return ETrue; |
|
1683 } |
|
1684 |
|
1685 // ----------------------------------------------------------------------------- |
|
1686 // CLcVtSession::SetCallNameL |
|
1687 // ----------------------------------------------------------------------------- |
|
1688 // |
|
1689 void CLcVtSession::SetCallNumberL( const TDesC& aNumber ) |
|
1690 { |
|
1691 HBufC* number = aNumber.AllocL(); |
|
1692 delete iRemoteDetails; |
|
1693 iRemoteDetails = number; |
|
1694 } |
|
1695 |
|
1696 |
|
1697 // ----------------------------------------------------------------------------- |
|
1698 // CLcVtSession::StartShutdown |
|
1699 // ----------------------------------------------------------------------------- |
|
1700 // |
|
1701 void CLcVtSession::StartShutdown() |
|
1702 { |
|
1703 __VTPRINTENTER( "CLcVtSession.StartShutdown" ) |
|
1704 iSessionState = EClosing; |
|
1705 if ( iObserver != NULL ) |
|
1706 { |
|
1707 iObserver->StateChanged( *this ); |
|
1708 } |
|
1709 //iUiProvider->BlockUi(ETrue); |
|
1710 __VTPRINTEXIT( "CLcVtSession.StartShutdown" ) |
|
1711 } |
|
1712 |
|
1713 // ----------------------------------------------------------------------------- |
|
1714 // CLcVtSession::NumberSource |
|
1715 // ----------------------------------------------------------------------------- |
|
1716 // |
|
1717 TDesC* CLcVtSession::NumberSource() const |
|
1718 { |
|
1719 return NULL; |
|
1720 } |
|
1721 |
|
1722 |
|
1723 // ----------------------------------------------------------------------------- |
|
1724 // CLcVtSession::RefreshL |
|
1725 // ----------------------------------------------------------------------------- |
|
1726 // |
|
1727 void CLcVtSession::RefreshL( const TInt aRefreshFlags ) |
|
1728 { |
|
1729 } |
|
1730 |
|
1731 |
|
1732 // ----------------------------------------------------------------------------- |
|
1733 // CLcVtSession::RefreshStatesL |
|
1734 // ----------------------------------------------------------------------------- |
|
1735 // |
|
1736 void CLcVtSession::RefreshStatesL() |
|
1737 { |
|
1738 __VTPRINTENTER( "CLcVtSession.RefreshStatesL" ) |
|
1739 // If transaction (set of commands) is pending refresh in delayed until |
|
1740 // all of them are processed. |
|
1741 __VTPRINTEXIT( "CLcVtSession.RefreshStatesL" ) |
|
1742 } |
|
1743 |
|
1744 #if 0 |
|
1745 // ----------------------------------------------------------------------------- |
|
1746 // CLcVtSession::HandleLayoutChanged |
|
1747 // ----------------------------------------------------------------------------- |
|
1748 // |
|
1749 TInt CLcVtSession::HandleLayoutChanged() |
|
1750 { |
|
1751 __VTPRINTENTER( "CLcVtSession.HandleLayoutChanged" ) |
|
1752 iLayoutChangeCallback->CallBack(); |
|
1753 __VTPRINTEXIT( "CLcVtSession.HandleLayoutChanged" ) |
|
1754 return KErrNone; |
|
1755 } |
|
1756 |
|
1757 |
|
1758 // ----------------------------------------------------------------------------- |
|
1759 // CLcVtSession::DelayedHandleLayoutChanged |
|
1760 // ----------------------------------------------------------------------------- |
|
1761 // |
|
1762 TInt CLcVtSession::DelayedHandleLayoutChanged( TAny* aPtr ) |
|
1763 { |
|
1764 __VTPRINTENTER( "CLcVtSession.DelayedHandleLayoutChanged" ) |
|
1765 CLcVtSession* self = reinterpret_cast< CLcVtSession* > ( aPtr ); |
|
1766 //self->iUiStates->SetDisableBlindSetting( ETrue ); |
|
1767 TRAPD( err, self->HandleLayoutChangedL() ); |
|
1768 //self->iUiStates->SetDisableBlindSetting( EFalse ); |
|
1769 //self->RefreshBlind(); |
|
1770 __VTPRINTENTER( "CLcVtSession.DelayedHandleLayoutChanged" ) |
|
1771 return err; |
|
1772 } |
|
1773 |
|
1774 // ----------------------------------------------------------------------------- |
|
1775 // CLcVtSession::HandleLayoutChangedL |
|
1776 // ----------------------------------------------------------------------------- |
|
1777 // |
|
1778 void CLcVtSession::HandleLayoutChangedL() |
|
1779 { |
|
1780 __VTPRINTENTER( "CLcVtSession.LayoutChg" ) |
|
1781 |
|
1782 if ( iState ) |
|
1783 { |
|
1784 iState->HandleLayoutChangedL(); |
|
1785 } |
|
1786 |
|
1787 /* |
|
1788 if ( !iAllowVideoDlgShowed ) |
|
1789 { |
|
1790 if ( iState ) |
|
1791 { |
|
1792 iState->HandleLayoutChangedL(); |
|
1793 } |
|
1794 } |
|
1795 else |
|
1796 { |
|
1797 iUiStates->SetLayoutChangeNeeded( EFalse ); |
|
1798 DoHandleLayoutChangedL(); |
|
1799 } |
|
1800 */ |
|
1801 __VTPRINTEXIT( "CLcVtSession.LayoutChg" ) |
|
1802 } |
|
1803 |
|
1804 // ----------------------------------------------------------------------------- |
|
1805 // CLcVtSession::DoHandleLayoutChangedL |
|
1806 // ----------------------------------------------------------------------------- |
|
1807 // |
|
1808 void CLcVtSession::DoHandleLayoutChangedL() |
|
1809 { |
|
1810 __VTPRINTENTER( "CLcVtSession.DoLayoutChg" ) |
|
1811 |
|
1812 // Fully update rendering parameters |
|
1813 UpdateRenderingParametersL(); |
|
1814 // Notify engine about layout change |
|
1815 //iLayoutChg = ETrue; |
|
1816 TRAPD( error, ExecuteCmdL( KVtEngHandleLayoutChange ) ); |
|
1817 //iLayoutChg = EFalse; |
|
1818 |
|
1819 // Not ready error is allowed to happen (e.g. when sharing) |
|
1820 if ( error && ( error != KErrNotReady ) ) |
|
1821 { |
|
1822 User::Leave( error ); |
|
1823 } |
|
1824 else |
|
1825 { |
|
1826 __VTPRINT( DEBUG_GEN, |
|
1827 "CLcVtSession.DoLayoutChg KVtEngHandleLayoutChange == KErrNotReady (ok)" ) |
|
1828 } |
|
1829 |
|
1830 __VTPRINTEXIT( "CLcVtSession.DoLayoutChg" ) |
|
1831 } |
|
1832 #endif |
|
1833 |
|
1834 // ----------------------------------------------------------------------------- |
|
1835 // CLcVtSession::UpdateRenderingParametersL |
|
1836 // ----------------------------------------------------------------------------- |
|
1837 // |
|
1838 #ifdef NGA_VIDEO_RENDER |
|
1839 |
|
1840 void CLcVtSession::UpdateRenderingParametersL() |
|
1841 { |
|
1842 __VTPRINTENTER( "CLcVtSession.UpdateRenderingParametersL" ) |
|
1843 |
|
1844 iRwGroup->SetOrdinalPosition( 1 , ECoeWinPriorityNormal ); |
|
1845 |
|
1846 TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect(); |
|
1847 iRemoteVideoWindow->SetExtent( RMRect.iTl, RMRect.Size() ); |
|
1848 iRemoteVideoWindow->SetOrdinalPosition( 1 , ECoeWinPriorityNeverAtFront ); |
|
1849 iRemoteVideoWindow->SetTransparencyAlphaChannel(); |
|
1850 |
|
1851 __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iX: %d", RMRect.iTl.iX ) |
|
1852 __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iTl.iY: %d", RMRect.iTl.iY ) |
|
1853 __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iWidth: %d", RMRect.Width() ) |
|
1854 __VTPRINT2( DEBUG_MEDIA , " RemoteVideoPlayer.RMRect.iHeight: %d", RMRect.Height() ) |
|
1855 |
|
1856 |
|
1857 TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect(); |
|
1858 iLocalVideoWindow->SetExtent( VFRect.iTl, VFRect.Size() ); |
|
1859 iLocalVideoWindow->SetOrdinalPosition( 1, ECoeWinPriorityNeverAtFront ); |
|
1860 iLocalVideoWindow->SetTransparencyAlphaChannel(); |
|
1861 |
|
1862 __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iTl.iX: %d", VFRect.iTl.iX ) |
|
1863 __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iTl.iY: %d", VFRect.iTl.iY ) |
|
1864 __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iWidth: %d", VFRect.Width() ) |
|
1865 __VTPRINT2( DEBUG_MEDIA , " LocalVideoPlayer.VFRect.iHeight: %d", VFRect.Height() ) |
|
1866 |
|
1867 iRwSession.Flush(); |
|
1868 |
|
1869 __VTPRINTEXIT( "CLcVtSession.UpdateRenderingParametersL" ) |
|
1870 |
|
1871 } |
|
1872 |
|
1873 |
|
1874 #else |
|
1875 |
|
1876 void CLcVtSession::UpdateRenderingParametersL() |
|
1877 { |
|
1878 |
|
1879 __VTPRINTENTER( "CLcVtSession.UpdateRenderingParametersL" ) |
|
1880 |
|
1881 MVtEngMedia& media = iModel->Media(); |
|
1882 const TBool viewFinderStarted = |
|
1883 media.RenderingStarted( MVtEngMedia::EMediaOutgoing ); |
|
1884 const TBool remoteRenderStarted = |
|
1885 media.RenderingStarted( MVtEngMedia::EMediaIncoming ); |
|
1886 |
|
1887 // Stop viewfinder & remote render. |
|
1888 if( viewFinderStarted ) |
|
1889 { |
|
1890 ExecuteCmdL( KVtEngStopViewFinder ); |
|
1891 } |
|
1892 ExecuteCmdL( KVtEngStopRenderRemote ); |
|
1893 |
|
1894 TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect(); |
|
1895 TSize size (VFRect.Size()); |
|
1896 |
|
1897 TVtEngRenderingOptions configViewfinder(*iEventObserver,size); |
|
1898 |
|
1899 ExecuteCmdL( KVtEngPrepareViewFinder, configViewfinder ); |
|
1900 |
|
1901 // Prepare remote render. |
|
1902 TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect(); |
|
1903 const TSize KRMsize( RMRect.Size()); |
|
1904 TRect screen( KRMsize ); |
|
1905 TRect clip( KRMsize ); |
|
1906 const TPoint KRMcordinate( RMRect.iTl.iX, RMRect.iTl.iY ); |
|
1907 |
|
1908 TVtEngRenderingOptionsDP configRemoteRender(*iEventObserver, *iWsSession ,*iWsSessionScreenDev, *iMainWindow, screen, clip, KRMcordinate ); |
|
1909 |
|
1910 TRAPD ( err, ExecuteCmdL( |
|
1911 KVtEngPrepareRemoteRenderDP, |
|
1912 configRemoteRender ) ); |
|
1913 |
|
1914 if ( err != KErrNone ) |
|
1915 { |
|
1916 if ( viewFinderStarted ) |
|
1917 { |
|
1918 // Start viewfinder. |
|
1919 ExecuteCmdL( KVtEngStartViewFinder ); |
|
1920 } |
|
1921 User::Leave ( err ); |
|
1922 } |
|
1923 |
|
1924 // Start remote render. |
|
1925 TRAP_IGNORE( ExecuteCmdL( KVtEngStartRenderRemote ) ); |
|
1926 |
|
1927 if ( viewFinderStarted ) |
|
1928 { |
|
1929 // Start viewfinder. |
|
1930 ExecuteCmdL( KVtEngStartViewFinder ); |
|
1931 } |
|
1932 |
|
1933 __VTPRINTEXIT( "CLcVtSession.UpdateRenderingParametersL" ) |
|
1934 |
|
1935 } |
|
1936 |
|
1937 #endif |
|
1938 |
|
1939 // ----------------------------------------------------------------------------- |
|
1940 // CLcVtSession::HandleEngineResetL |
|
1941 // ----------------------------------------------------------------------------- |
|
1942 // |
|
1943 void CLcVtSession::HandleEngineResetL() |
|
1944 { |
|
1945 __VTPRINTENTER( "CLcVtSession.HandleEngineResetL" ) |
|
1946 if ( iShutdownRequest ) |
|
1947 { |
|
1948 __VTPRINT( DEBUG_GEN, " CLcVtSession.HandleEngineResetL shutdown" ) |
|
1949 User::RequestComplete( iShutdownRequest, KErrNone ); |
|
1950 iShutdownRequest = NULL; |
|
1951 } |
|
1952 __VTPRINTEXIT( "CLcVtSession.HandleEngineResetL" ) |
|
1953 } |
|
1954 |
|
1955 |
|
1956 // ----------------------------------------------------------------------------- |
|
1957 // CLcVtSession::HandleShutdownReady |
|
1958 // ----------------------------------------------------------------------------- |
|
1959 // |
|
1960 void CLcVtSession::HandleShutdownReady() |
|
1961 { |
|
1962 __VTPRINTENTER( "CLcVtSession.HandleShutdownReady" ) |
|
1963 |
|
1964 if(iAsyncCallback->IsActive()) |
|
1965 { |
|
1966 iAsyncCallback->Cancel(); |
|
1967 } |
|
1968 |
|
1969 iAsyncCallback->Set( |
|
1970 TCallBack( &DoExit, this ) ); |
|
1971 iAsyncCallback->CallBack(); |
|
1972 __VTPRINTEXIT( "CLcVtSession.HandleShutdownReady" ) |
|
1973 } |
|
1974 |
|
1975 |
|
1976 // ----------------------------------------------------------------------------- |
|
1977 // CLcVtSession::DoExit |
|
1978 // ----------------------------------------------------------------------------- |
|
1979 // |
|
1980 TInt CLcVtSession::DoExit( TAny* aSession ) |
|
1981 { |
|
1982 __VTPRINTENTER( "CLcVtSession.DoExit" ) |
|
1983 CLcVtSession* self = static_cast< CLcVtSession* >( aSession ); |
|
1984 self->iAsyncCallback->Cancel(); |
|
1985 // Before exiting ensure there are no pending actions. |
|
1986 self->ActiveExecInitCancel( 0 ); |
|
1987 self->CloseApp(); |
|
1988 __VTPRINTEXIT( "CLcVtSession.DoExit" ) |
|
1989 return KErrNone; |
|
1990 } |
|
1991 |
|
1992 // ----------------------------------------------------------------------------- |
|
1993 // CLcVtSession::CloseApp |
|
1994 // ----------------------------------------------------------------------------- |
|
1995 // |
|
1996 void CLcVtSession::CloseApp() |
|
1997 { |
|
1998 __VTPRINTENTER( "CLcVtSession.CloseApp" ) |
|
1999 //iUiProvider->BlockUi(EFalse); |
|
2000 #if 0 |
|
2001 if(iEventObserver) |
|
2002 { |
|
2003 delete iEventObserver; |
|
2004 iEventObserver = NULL; |
|
2005 } |
|
2006 #endif |
|
2007 iSessionState = EClosed; |
|
2008 iObserver->StateChanged( *this ); |
|
2009 __VTPRINTEXIT( "CLcVtSession.CloseApp" ) |
|
2010 } |
|
2011 |
|
2012 // Implementation of CLcVtSession::CEventObserver |
|
2013 |
|
2014 // ----------------------------------------------------------------------------- |
|
2015 // CLcVtSession::CEventObserver::CEventObserver |
|
2016 // ----------------------------------------------------------------------------- |
|
2017 // |
|
2018 CLcVtSession::CEventObserver::CEventObserver( CLcVtSession& aSession ) |
|
2019 :iSession(aSession), |
|
2020 iCommandObservers( KLcVtCommandObserverArrayGranularity ) |
|
2021 { |
|
2022 } |
|
2023 |
|
2024 // ----------------------------------------------------------------------------- |
|
2025 // CLcVtSession::CEventObserver::ConstructL |
|
2026 // ----------------------------------------------------------------------------- |
|
2027 // |
|
2028 void CLcVtSession::CEventObserver::ConstructL() |
|
2029 { |
|
2030 } |
|
2031 |
|
2032 // ----------------------------------------------------------------------------- |
|
2033 // CLcVtSession::CEventObserver::NewL |
|
2034 // ----------------------------------------------------------------------------- |
|
2035 // |
|
2036 CLcVtSession::CEventObserver* CLcVtSession::CEventObserver::NewL( CLcVtSession& aSession ) |
|
2037 { |
|
2038 CEventObserver* self = new ( ELeave ) CEventObserver(aSession ); |
|
2039 CleanupStack::PushL( self ); |
|
2040 self->ConstructL(); |
|
2041 CleanupStack::Pop( self ); |
|
2042 return self; |
|
2043 } |
|
2044 |
|
2045 // ----------------------------------------------------------------------------- |
|
2046 // CLcVtSession::CEventObserver::~CEventObserver |
|
2047 // ----------------------------------------------------------------------------- |
|
2048 // |
|
2049 CLcVtSession::CEventObserver::~CEventObserver() |
|
2050 { |
|
2051 iCommandObservers.Close(); |
|
2052 } |
|
2053 |
|
2054 // ----------------------------------------------------------------------------- |
|
2055 // CLcVtSession::CEventObserver::AddObserverL |
|
2056 // ----------------------------------------------------------------------------- |
|
2057 // |
|
2058 void CLcVtSession::CEventObserver::AddObserverL( |
|
2059 MVtEngCommandObserver& aObserver ) |
|
2060 { |
|
2061 User::LeaveIfError( |
|
2062 iCommandObservers.Append( &aObserver ) ); |
|
2063 } |
|
2064 |
|
2065 // ----------------------------------------------------------------------------- |
|
2066 // CLcVtSession::CEventObserver::RemoveObserver |
|
2067 // ----------------------------------------------------------------------------- |
|
2068 // |
|
2069 void CLcVtSession::CEventObserver::RemoveObserver( |
|
2070 MVtEngCommandObserver& aObserver ) |
|
2071 { |
|
2072 const TInt pos = iCommandObservers.Find( &aObserver ); |
|
2073 if ( pos != KErrNotFound ) |
|
2074 { |
|
2075 if ( !iInCommandPerformed ) |
|
2076 { |
|
2077 iCommandObservers.Remove( pos ); |
|
2078 } |
|
2079 else |
|
2080 { |
|
2081 iCommandObservers[ pos ] = NULL; |
|
2082 } |
|
2083 } |
|
2084 } |
|
2085 |
|
2086 |
|
2087 void CLcVtSession::CEventObserver::HandleVtEventL( TInt aEvent ) |
|
2088 { |
|
2089 __VTPRINTENTER( "CEventObserver.HandleVtEventL" ) |
|
2090 __VTPRINT2( DEBUG_GEN, "CEventObserver.HandleVtEventL event=%d ",aEvent ); |
|
2091 |
|
2092 /** Allow application state to handle event first. It may also deny further |
|
2093 * handling by indicating the event was handled */ |
|
2094 if ( iSession.iState && |
|
2095 iSession.iState->HandleVtEventL( aEvent ) |
|
2096 == TLcVtStateBase::EEventHandled ) |
|
2097 { |
|
2098 __VTPRINTEXITR( "CEventObserver.HandleVtEventL %d", 0 ) |
|
2099 return; |
|
2100 } |
|
2101 |
|
2102 iSession.iLcVtStates->Update(); |
|
2103 |
|
2104 iSession.iObserver->Updated(*(iSession.iLocalVideoPlayer)); |
|
2105 iSession.iObserver->Updated(*(iSession.iRemoteVideoPlayer)); |
|
2106 |
|
2107 __VTPRINTEXIT( "CEventObserver.HandleVtEventL" ) |
|
2108 } |
|
2109 |
|
2110 void CLcVtSession::CEventObserver::HandleVTCommandPerformedL( |
|
2111 TVtEngCommandId aCommand, |
|
2112 const TInt aError ) |
|
2113 { |
|
2114 __VTPRINTENTER( "CEventObserver.HandleVTCommandPerformedL" ) |
|
2115 __VTPRINT3( DEBUG_GEN, "CEventObserver.HandleVTCommandPerformedL cmd=%d , result=%d",aCommand, aError ); |
|
2116 |
|
2117 if ( iSession.iState && |
|
2118 iSession.iState->HandleVTCommandPerformedL( aCommand, aError ) == |
|
2119 TLcVtStateBase::EEventHandled ) |
|
2120 { |
|
2121 // state didn't allow further processing of command completion |
|
2122 __VTPRINTEXITR( "CEventObserver.HandleVTCommandPerformedL %d", 0 ) |
|
2123 return; |
|
2124 } |
|
2125 |
|
2126 iSession.RefreshStatesL(); |
|
2127 |
|
2128 iSession.iLcVtStates->Update(); |
|
2129 |
|
2130 const TInt count = iCommandObservers.Count(); |
|
2131 TInt nullPosition = KErrNotFound; |
|
2132 |
|
2133 iInCommandPerformed = ETrue; |
|
2134 |
|
2135 // iInCommandPerformed equals ETrue while inside the following loop; |
|
2136 // Exceptions must not be raised. |
|
2137 for ( TInt index = 0; index < count; index++ ) |
|
2138 { |
|
2139 MVtEngCommandObserver* obs = iCommandObservers[ index ]; |
|
2140 if ( obs ) |
|
2141 { |
|
2142 TRAP_IGNORE( obs->HandleVTCommandPerformedL( aCommand, aError ) ); |
|
2143 } |
|
2144 else |
|
2145 { |
|
2146 // We store only one position; eventually all NULL elements of the |
|
2147 // array will be removed. |
|
2148 nullPosition = index; |
|
2149 } |
|
2150 } |
|
2151 iInCommandPerformed = EFalse; |
|
2152 |
|
2153 if ( nullPosition != KErrNotFound ) |
|
2154 { |
|
2155 iCommandObservers.Remove( nullPosition ); |
|
2156 } |
|
2157 |
|
2158 |
|
2159 // Specific handling of some commands: |
|
2160 if ( aCommand == KVtEngResetEngine ) // Engine has been reset |
|
2161 { |
|
2162 //__ASSERT_ALWAYS( !aError, VtUiPanic::Panic( EVtUiPanicResetFailed ) ); |
|
2163 iSession.HandleEngineResetL(); |
|
2164 } |
|
2165 |
|
2166 |
|
2167 __VTPRINTEXITR( "CEventObserver.HandleVTCommandPerformedL %d", 1 ) |
|
2168 |
|
2169 } |
|
2170 |
|
2171 #ifndef NGA_VIDEO_RENDER |
|
2172 void CLcVtSession::CEventObserver::vtHandleFrameL( |
|
2173 TFrameType aType, |
|
2174 CFbsBitmap* aBitmap ) |
|
2175 { |
|
2176 iSession.vtHandleFrameL( aBitmap); |
|
2177 } |
|
2178 |
|
2179 void CLcVtSession::CEventObserver::vtSetFrame( |
|
2180 TFrameType aType, |
|
2181 CFbsBitmap* aBitmap ) |
|
2182 { |
|
2183 } |
|
2184 #endif |
|
2185 |
|
2186 TBool CLcVtSession::IsFeatureSupported( CLcEngine::TLcFeature aLcFeature ) |
|
2187 { |
|
2188 __VTPRINT2( DEBUG_GEN, "CLcVtSession.IsFeatureSupported feature=%d", aLcFeature) |
|
2189 TBool flag = EFalse; |
|
2190 switch ( aLcFeature ) |
|
2191 { |
|
2192 case CLcEngine::ELcSendVideoQuery: |
|
2193 { |
|
2194 MVtEngSessionInfo::TDirection direction; |
|
2195 if ( iModel->Session().GetDirection( direction ) != KErrNone ) |
|
2196 { |
|
2197 direction = MVtEngSessionInfo::EDirectionMT; |
|
2198 } |
|
2199 __VTPRINT2( DEBUG_GEN, "CLcVtSession.IsFeatureSupported direction=%d", direction ) |
|
2200 flag = ( direction == MVtEngSessionInfo::EDirectionMT ); |
|
2201 } |
|
2202 break; |
|
2203 |
|
2204 default: |
|
2205 break; |
|
2206 } |
|
2207 |
|
2208 // return feature not supported if not handled |
|
2209 return flag; |
|
2210 } |
|
2211 |
|
2212 // End of file |
|
2213 |
|
2214 /* |
|
2215 * |
|
2216 // ----------------------------------------------------------------------------- |
|
2217 // CLcVtSession::UpdateLocalVideoRenderParamL |
|
2218 // ----------------------------------------------------------------------------- |
|
2219 // |
|
2220 void CLcVtSession::UpdateLocalVideoRenderParamL() |
|
2221 { |
|
2222 __VTPRINTENTER( "CLcVtSession.UpdateLocalVideoRenderParamL" ) |
|
2223 |
|
2224 if(iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning ) |
|
2225 { |
|
2226 __VTPRINTEXIT( "CLcVtSession.UpdateLocalVideoRenderParamL -- not running state" ) |
|
2227 return; |
|
2228 } |
|
2229 |
|
2230 MVtEngMedia& media = Model().Media(); |
|
2231 const TBool viewFinderStarted = |
|
2232 media.RenderingStarted( MVtEngMedia::EMediaOutgoing ); |
|
2233 |
|
2234 if( viewFinderStarted ) |
|
2235 { |
|
2236 ExecuteCmdL( KVtEngStopViewFinder ); |
|
2237 } |
|
2238 |
|
2239 TRect VFRect = LocalVideoPlayer()->LcWindow()->LcWindowRect(); |
|
2240 TSize size (VFRect.Size()); |
|
2241 |
|
2242 TVtEngRenderingOptions configViewfinder(*iEventObserver,size); |
|
2243 |
|
2244 ExecuteCmdL( KVtEngPrepareViewFinder, configViewfinder ); |
|
2245 |
|
2246 if ( viewFinderStarted ) |
|
2247 { |
|
2248 // Start viewfinder. |
|
2249 ExecuteCmdL( KVtEngStartViewFinder ); |
|
2250 } |
|
2251 |
|
2252 __VTPRINTEXIT( "CLcVtSession.UpdateLocalVideoRenderParamL" ) |
|
2253 } |
|
2254 |
|
2255 // ----------------------------------------------------------------------------- |
|
2256 // CLcVtSession::UpdateRemoteVideoRenderParamL |
|
2257 // ----------------------------------------------------------------------------- |
|
2258 // |
|
2259 void CLcVtSession::UpdateRemoteVideoRenderParamL() |
|
2260 { |
|
2261 __VTPRINTENTER( "CLcVtSession.UpdateRemoteVideoRenderParamL" ) |
|
2262 |
|
2263 if(iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning ) |
|
2264 { |
|
2265 __VTPRINTEXIT( "CLcVtSession.UpdateRemoteVideoRenderParamL -- not running state" ) |
|
2266 return; |
|
2267 } |
|
2268 |
|
2269 MVtEngMedia& media = Model().Media(); |
|
2270 const TBool remoteRenderStarted = |
|
2271 media.RenderingStarted( MVtEngMedia::EMediaIncoming ); |
|
2272 |
|
2273 ExecuteCmdL( KVtEngStopRenderRemote ); |
|
2274 |
|
2275 TRect RMRect = RemoteVideoPlayer()->LcWindow()->LcWindowRect(); |
|
2276 const TSize KRMsize( RMRect.Size()); |
|
2277 TRect screen( KRMsize ); |
|
2278 TRect clip( KRMsize ); |
|
2279 const TPoint KRMcordinate( RMRect.iTl.iX, RMRect.iTl.iY ); |
|
2280 |
|
2281 __VTPRINT2( DEBUG_MEDIA , " RMRect.iTl.iX: %d", RMRect.iTl.iX) |
|
2282 __VTPRINT2( DEBUG_MEDIA , " RMRect.iTl.iY: %d", RMRect.iTl.iY ) |
|
2283 __VTPRINT2( DEBUG_MEDIA , " RMRect.iWidth: %d", RMRect.Width() ) |
|
2284 __VTPRINT2( DEBUG_MEDIA , " RMRect.iHeight: %d", RMRect.Height() ) |
|
2285 |
|
2286 TVtEngRenderingOptionsDP configRemoteRender(*iEventObserver, *iWsSession ,*iWsSessionScreenDev, *iMainWindow, screen, clip, KRMcordinate ); |
|
2287 |
|
2288 ExecuteCmdL( |
|
2289 KVtEngPrepareRemoteRenderDP, |
|
2290 configRemoteRender ); |
|
2291 |
|
2292 TRAP_IGNORE( ExecuteCmdL( KVtEngStartRenderRemote ) ); |
|
2293 |
|
2294 __VTPRINTEXIT( "CLcVtSession.UpdateRemoteVideoRenderParamL" ) |
|
2295 |
|
2296 } |
|
2297 |
|
2298 // ----------------------------------------------------------------------------- |
|
2299 // CLcVtSession::LayoutChangedL |
|
2300 // ----------------------------------------------------------------------------- |
|
2301 // |
|
2302 void CLcVtSession::LayoutChangedL() |
|
2303 { |
|
2304 __VTPRINTENTER( "CLcVtSession.LayoutChangedL" ) |
|
2305 |
|
2306 if(iLcVtStates->ExecState() != TLcVtStates::EExecStateRunning ) |
|
2307 { |
|
2308 __VTPRINTEXIT( "CLcVtSession.LayoutChangedL -- not running state" ) |
|
2309 return; |
|
2310 } |
|
2311 |
|
2312 TRAPD( error, ExecuteCmdL( KVtEngHandleLayoutChange ) ); |
|
2313 |
|
2314 __VTPRINTEXIT( "CLcVtSession.LayoutChangedL" ) |
|
2315 } |
|
2316 |
|
2317 */ |