16 */ |
16 */ |
17 |
17 |
18 // INCLUDE FILES |
18 // INCLUDE FILES |
19 #include <jdebug.h> |
19 #include <jdebug.h> |
20 #include <JniEnvWrapper.h> |
20 #include <JniEnvWrapper.h> |
|
21 #include <ctsydomainpskeys.h> |
21 |
22 |
22 #include "cmmaplayer.h" |
23 #include "cmmaplayer.h" |
23 #include "cmmaeventsource.h" |
24 #include "cmmaeventsource.h" |
24 #include "cmmadurationupdater.h" |
25 #include "cmmadurationupdater.h" |
25 #include "cmmavolumecontrol.h" |
26 #include "cmmavolumecontrol.h" |
|
27 #include "cmmacallstatemonitor.h" |
26 |
28 |
27 // CONSTANTS |
29 // CONSTANTS |
28 _LIT(KPanicOutOfMem, "out of memory"); |
30 _LIT(KPanicOutOfMem, "out of memory"); |
29 |
31 |
30 #ifdef _DEBUG // Needed only in ASSER_DEBUG statements. |
32 #ifdef _DEBUG // Needed only in ASSER_DEBUG statements. |
41 iStateListeners.Reset(); |
43 iStateListeners.Reset(); |
42 delete iActionCompletedEvent; |
44 delete iActionCompletedEvent; |
43 delete iOOMErrorEvent; |
45 delete iOOMErrorEvent; |
44 delete iDurationUpdater; |
46 delete iDurationUpdater; |
45 delete iContentType; |
47 delete iContentType; |
|
48 delete iStateObserver; |
46 } |
49 } |
47 |
50 |
48 |
51 |
49 EXPORT_C CMMAPlayer::CMMAPlayer(): |
52 EXPORT_C CMMAPlayer::CMMAPlayer(): |
50 iRepeatNumberOfTimes(0), |
53 iRepeatNumberOfTimes(0), |
51 iRepeatForever(EFalse), |
54 iRepeatForever(EFalse), |
52 iRepeatCount(0), |
55 iRepeatCount(0), |
53 iDuration(KTimeUnknown), |
56 iDuration(KTimeUnknown), |
54 iState(EUnrealized) |
57 iState(EUnrealized), |
|
58 isPausedByCall(EFalse) |
55 { |
59 { |
56 } |
60 } |
57 |
61 |
58 |
62 |
59 void CMMAPlayer::ConstructL() |
63 void CMMAPlayer::ConstructL() |
60 { |
64 { |
61 DEBUG("MMA::CMMAPlayer::ConstructL + "); |
65 DEBUG("MMA::CMMAPlayer::ConstructL + "); |
62 iDurationUpdater = CMMADurationUpdater::NewL(*this); |
66 iDurationUpdater = CMMADurationUpdater::NewL(*this); |
|
67 // Listen to call state changes |
|
68 iStateObserver = CMMACallStateMonitor::NewL(KPSUidCtsyCallInformation, |
|
69 KCTsyCallState,this); |
|
70 |
63 DEBUG("MMA::CMMAPlayer::ConstructL - "); |
71 DEBUG("MMA::CMMAPlayer::ConstructL - "); |
64 } |
72 } |
65 |
73 |
66 |
74 |
67 void CMMAPlayer::StaticAddSourceStreamL(JNIEnv* aJniEnv, |
75 void CMMAPlayer::StaticAddSourceStreamL(JNIEnv* aJniEnv, |
143 ChangeState(ERealized); |
151 ChangeState(ERealized); |
144 |
152 |
145 } |
153 } |
146 |
154 |
147 |
155 |
148 void CMMAPlayer::CloseL() |
156 EXPORT_C void CMMAPlayer::CloseL() |
149 { |
157 { |
150 DEBUG("MMA::CMMAPlayer::CloseL "); |
158 DEBUG("MMA::CMMAPlayer::CloseL "); |
151 PostObjectEvent(CMMAPlayerEvent::EClosed, NULL); |
159 PostObjectEvent(CMMAPlayerEvent::EClosed, NULL); |
152 |
160 |
153 ChangeState(EClosed); |
161 ChangeState(EClosed); |
419 CleanupStack::Pop(); // sourceStream |
427 CleanupStack::Pop(); // sourceStream |
420 return sourceStream; |
428 return sourceStream; |
421 } |
429 } |
422 |
430 |
423 |
431 |
424 void CMMAPlayer::PostActionCompleted(TInt aError) |
432 EXPORT_C void CMMAPlayer::PostActionCompleted(TInt aError) |
425 { |
433 { |
426 iActionCompletedEvent->SetEventData(aError); |
434 iActionCompletedEvent->SetEventData(aError); |
427 iEventPoster->PostEvent(iActionCompletedEvent, |
435 iEventPoster->PostEvent(iActionCompletedEvent, |
428 CMMAEvent::ENotifyPriority); |
436 CMMAEvent::ENotifyPriority); |
429 } |
437 } |
450 if (iControls.Count() > 0) |
458 if (iControls.Count() > 0) |
451 { |
459 { |
452 iControls.ResetAndDestroy(); |
460 iControls.ResetAndDestroy(); |
453 } |
461 } |
454 } |
462 } |
|
463 |
|
464 |
|
465 void CMMAPlayer::HandleCallStateEventL(TUid aUid, TInt aKey) |
|
466 { |
|
467 DEBUG("CMMAPlayer::HandleCallStateEvent +"); |
|
468 DEBUG_INT2( "CMMAVideoUrlPlayer::HandleCallStateEvent(TUid aUid, TInt aKey) = (%d, %d)",aUid.iUid, aKey); |
|
469 |
|
470 TInt callState; |
|
471 iStateObserver->GetValue(callState); |
|
472 DEBUG_INT( "CMMAVideoUrlPlayer::HandleCallStateEvent: state = %d", callState); |
|
473 |
|
474 switch (callState) |
|
475 { |
|
476 case EPSCTsyCallStateUninitialized: |
|
477 { |
|
478 DEBUG_INT( "CMMAVideoUrlPlayer::HandlePSEvent EPSCTsyCallStateUninitialized istate = %d", iState); |
|
479 break; |
|
480 } |
|
481 |
|
482 case EPSCTsyCallStateAlerting: |
|
483 |
|
484 case EPSCTsyCallStateRinging: |
|
485 |
|
486 case EPSCTsyCallStateDialling: |
|
487 |
|
488 case EPSCTsyCallStateAnswering: |
|
489 |
|
490 case EPSCTsyCallStateConnected: |
|
491 { |
|
492 DEBUG_INT( "CMMAVideoUrlPlayer::HandlePSEvent EPSCTsyCallStateConnected iState = %d", iState); |
|
493 if(iState == CMMAPlayer::EStarted) |
|
494 { |
|
495 DEBUG( "CMMAVideoUrlPlayer::HandlePSEvent EPSCTsyCallStateConnected started state"); |
|
496 StopL(ETrue); |
|
497 isPausedByCall = ETrue; |
|
498 } |
|
499 break; |
|
500 } |
|
501 case EPSCTsyCallStateDisconnecting: |
|
502 { |
|
503 DEBUG_INT( "CMMAVideoUrlPlayer::HandlePSEvent EPSCTsyCallStateDisconnecting istate = %d", iState); |
|
504 break; |
|
505 } |
|
506 case EPSCTsyCallStateNone: |
|
507 { |
|
508 DEBUG_INT( "CMMAVideoUrlPlayer::HandlePSEvent EPSCTsyCallStateNone istate = %d", iState); |
|
509 if( (iState == CMMAPlayer::EPrefetched) && isPausedByCall ) |
|
510 { |
|
511 DEBUG( "CMMAVideoUrlPlayer::HandlePSEvent EPSCTsyCallStateNone Prefetched state"); |
|
512 StartL(ETrue); |
|
513 isPausedByCall = EFalse; |
|
514 } |
|
515 break; |
|
516 } |
|
517 |
|
518 case EPSCTsyCallStateHold: |
|
519 { |
|
520 DEBUG_INT( "CMMAVideoUrlPlayer::HandlePSEvent EPSCTsyCallStateHold iState = %d", iState); |
|
521 break; |
|
522 } |
|
523 default: |
|
524 { |
|
525 DEBUG( "CMMAVideoUrlPlayer::HandlePSEvent default"); |
|
526 // Default is no pause |
|
527 break; |
|
528 } |
|
529 } |
|
530 } |
455 // END OF FILE |
531 // END OF FILE |