13 * |
13 * |
14 * Description: This class is the interface between the playback plugin and RMMFController |
14 * Description: This class is the interface between the playback plugin and RMMFController |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // Version : %version: e003sa33#19 % |
18 |
|
19 // Version : %version: 20 % |
19 |
20 |
20 |
21 |
21 #include <AudioPreference.h> |
22 #include <AudioPreference.h> |
22 #include <mmf/server/mmffile.h> |
23 #include <mmf/server/mmffile.h> |
23 #include <caf/caftypes.h> |
24 #include <caf/caftypes.h> |
77 iControllerEventMonitor->Cancel(); |
78 iControllerEventMonitor->Cancel(); |
78 delete iControllerEventMonitor; |
79 delete iControllerEventMonitor; |
79 iControllerEventMonitor = NULL; |
80 iControllerEventMonitor = NULL; |
80 } |
81 } |
81 |
82 |
82 if ( ! iSurfaceId.IsNull() ) |
83 iSurfaceId = TSurfaceId::CreateNullId(); |
83 { |
|
84 MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoRemoveDisplayWindow ) ); |
|
85 iSurfaceId = TSurfaceId::CreateNullId(); |
|
86 } |
|
87 |
84 |
88 iController.Close(); |
85 iController.Close(); |
89 iDirectScreenAccessAbort = EFalse; |
86 iDirectScreenAccessAbort = EFalse; |
90 } |
87 } |
91 |
88 |
278 |
275 |
279 iDirectScreenAccessAbort = EFalse; |
276 iDirectScreenAccessAbort = EFalse; |
280 } |
277 } |
281 } |
278 } |
282 |
279 |
283 |
|
284 // ------------------------------------------------------------------------------------------------- |
|
285 // CMpxVideoPlayerUtility::SurfaceRemovedFromView() |
|
286 // ------------------------------------------------------------------------------------------------- |
|
287 // |
|
288 void CMpxVideoPlayerUtility::SurfaceRemovedFromView() |
|
289 { |
|
290 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::SurfaceRemovedFromView()")); |
|
291 |
|
292 if ( ! iSurfaceId.IsNull() ) |
|
293 { |
|
294 iSurfaceId = TSurfaceId::CreateNullId(); |
|
295 } |
|
296 } |
|
297 |
|
298 TBool CMpxVideoPlayerUtility::AudioEnabledL() const |
280 TBool CMpxVideoPlayerUtility::AudioEnabledL() const |
299 { |
281 { |
300 TBool enabled; |
282 TBool enabled; |
301 User::LeaveIfError( iVideoPlayControllerCustomCommands.GetAudioEnabled( enabled ) ); |
283 User::LeaveIfError( iVideoPlayControllerCustomCommands.GetAudioEnabled( enabled ) ); |
302 |
284 |
496 // |
478 // |
497 TInt CMpxVideoPlayerUtility::VideoSurfaceCreated() |
479 TInt CMpxVideoPlayerUtility::VideoSurfaceCreated() |
498 { |
480 { |
499 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::VideoSurfaceCreated()")); |
481 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::VideoSurfaceCreated()")); |
500 |
482 |
501 TSurfaceId oldSurfaceId( iSurfaceId ); |
483 TInt error = KErrNone; |
502 TBool replaceSurface = ! ( iSurfaceId.IsNull() ); |
484 |
503 |
485 if ( iSurfaceId.IsNull() ) |
504 TSurfaceId surfaceId; |
486 { |
505 TRect cropRect; |
487 TSurfaceId surfaceId; |
506 TVideoAspectRatio aspectRatio; |
488 TRect cropRect; |
507 |
489 TVideoAspectRatio aspectRatio; |
508 TInt error = |
490 |
509 iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters( surfaceId, |
491 error = iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters( surfaceId, |
510 cropRect, |
492 cropRect, |
511 aspectRatio ); |
493 aspectRatio ); |
512 |
494 |
513 if ( error == KErrNone ) |
495 if ( error == KErrNone ) |
514 { |
|
515 // |
|
516 // Send data to the display handler to remove old surface and add new surface |
|
517 // |
|
518 MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceCreated, |
|
519 surfaceId, |
|
520 cropRect, |
|
521 aspectRatio ) ); |
|
522 |
|
523 iSurfaceId = surfaceId; |
|
524 |
|
525 // |
|
526 // if surface already existed tell video adaptation it is no longer in use. |
|
527 // Video adaptation will remove the surface when it receives this call therefore |
|
528 // the following code must be done at the end of this function. |
|
529 // |
|
530 if ( replaceSurface ) |
|
531 { |
496 { |
532 error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( oldSurfaceId ); |
497 // |
|
498 // Send data to the display handler to remove old surface and add new surface |
|
499 // |
|
500 MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceCreated, |
|
501 surfaceId, |
|
502 cropRect, |
|
503 aspectRatio ) ); |
|
504 |
|
505 iSurfaceId = surfaceId; |
533 } |
506 } |
|
507 } |
|
508 else |
|
509 { |
|
510 error = KErrAlreadyExists; |
534 } |
511 } |
535 |
512 |
536 return error; |
513 return error; |
537 } |
514 } |
538 |
515 |
617 if ( iVideoPlaybackController->iMPXPluginObs ) |
594 if ( iVideoPlaybackController->iMPXPluginObs ) |
618 { |
595 { |
619 CMPXMessage* msg = CMPXMessage::NewL(); |
596 CMPXMessage* msg = CMPXMessage::NewL(); |
620 CleanupStack::PushL( msg ); |
597 CleanupStack::PushL( msg ); |
621 |
598 |
622 msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplaySyncMessage ); |
599 msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplayMessage ); |
623 msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd ); |
600 msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd ); |
624 |
601 |
625 iVideoPlaybackController->iMPXPluginObs->HandlePlaybackSyncMessage( *msg ); |
602 iVideoPlaybackController->iMPXPluginObs->HandlePlaybackMessage( *msg ); |
626 |
603 |
627 CleanupStack::PopAndDestroy( msg ); |
604 CleanupStack::PopAndDestroy( msg ); |
628 } |
605 } |
629 } |
606 } |
630 |
607 |
643 if ( iVideoPlaybackController->iMPXPluginObs ) |
620 if ( iVideoPlaybackController->iMPXPluginObs ) |
644 { |
621 { |
645 CMPXMessage* msg = CMPXMessage::NewL(); |
622 CMPXMessage* msg = CMPXMessage::NewL(); |
646 CleanupStack::PushL( msg ); |
623 CleanupStack::PushL( msg ); |
647 |
624 |
648 msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplaySyncMessage ); |
625 msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplayMessage ); |
649 msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd ); |
626 msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd ); |
650 msg->SetTObjectValueL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId, aSurfaceId ); |
627 msg->SetTObjectValueL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId, aSurfaceId ); |
651 msg->SetTObjectValueL<TRect>( KMPXMediaVideoDisplayCropRect, aCropRect ); |
628 msg->SetTObjectValueL<TRect>( KMPXMediaVideoDisplayCropRect, aCropRect ); |
652 msg->SetTObjectValueL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio, aAspectRatio ); |
629 msg->SetTObjectValueL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio, aAspectRatio ); |
653 |
630 |
654 iVideoPlaybackController->iMPXPluginObs->HandlePlaybackSyncMessage( *msg ); |
631 iVideoPlaybackController->iMPXPluginObs->HandlePlaybackMessage( *msg ); |
655 |
632 |
656 CleanupStack::PopAndDestroy( msg ); |
633 CleanupStack::PopAndDestroy( msg ); |
657 } |
634 } |
658 } |
635 } |
659 |
636 |