10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
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: 13 % |
18 // Version : %version: e003sa33#19 % |
19 |
19 |
20 |
20 |
21 #include <AudioPreference.h> |
21 #include <AudioPreference.h> |
22 #include <mmf/server/mmffile.h> |
22 #include <mmf/server/mmffile.h> |
23 #include <caf/caftypes.h> |
23 #include <caf/caftypes.h> |
64 CMpxVideoPlayerUtility::~CMpxVideoPlayerUtility() |
64 CMpxVideoPlayerUtility::~CMpxVideoPlayerUtility() |
65 { |
65 { |
66 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::~CMpxVideoPlayerUtility()")); |
66 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::~CMpxVideoPlayerUtility()")); |
67 |
67 |
68 Close(); |
68 Close(); |
69 |
|
70 delete iControllerEventMonitor; |
|
71 } |
69 } |
72 |
70 |
73 void CMpxVideoPlayerUtility::Close() |
71 void CMpxVideoPlayerUtility::Close() |
74 { |
72 { |
75 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::Close()")); |
73 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::Close()")); |
79 iControllerEventMonitor->Cancel(); |
77 iControllerEventMonitor->Cancel(); |
80 delete iControllerEventMonitor; |
78 delete iControllerEventMonitor; |
81 iControllerEventMonitor = NULL; |
79 iControllerEventMonitor = NULL; |
82 } |
80 } |
83 |
81 |
|
82 if ( ! iSurfaceId.IsNull() ) |
|
83 { |
|
84 MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoRemoveDisplayWindow ) ); |
|
85 iSurfaceId = TSurfaceId::CreateNullId(); |
|
86 } |
|
87 |
84 iController.Close(); |
88 iController.Close(); |
85 iDirectScreenAccessAbort = EFalse; |
89 iDirectScreenAccessAbort = EFalse; |
86 } |
90 } |
87 |
91 |
88 void CMpxVideoPlayerUtility::Reset() |
92 void CMpxVideoPlayerUtility::Reset() |
89 { |
93 { |
90 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::Reset()")); |
94 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::Reset()")); |
91 |
95 |
92 Close(); |
96 Close(); |
93 OpenControllerL(); |
97 MPX_TRAPD( err, OpenControllerL() ); |
94 } |
98 } |
95 |
99 |
96 void CMpxVideoPlayerUtility::OpenControllerL() |
100 void CMpxVideoPlayerUtility::OpenControllerL() |
97 { |
101 { |
98 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::OpenControllerL()")); |
102 MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::OpenControllerL()")); |
224 return iVideoControllerCustomCommands.GetVideoMimeType( aMimeType ); |
228 return iVideoControllerCustomCommands.GetVideoMimeType( aMimeType ); |
225 } |
229 } |
226 |
230 |
227 TUint32 CMpxVideoPlayerUtility::FourCCCode() const |
231 TUint32 CMpxVideoPlayerUtility::FourCCCode() const |
228 { |
232 { |
229 TFourCC aFourCC( 0 ); |
233 TFourCC aFourCC( 0 ); |
230 iVideoControllerCustomCommands.GetAudioCodec( aFourCC ); |
234 iVideoControllerCustomCommands.GetAudioCodec( aFourCC ); |
231 |
235 |
232 return aFourCC.FourCC(); |
236 return aFourCC.FourCC(); |
233 } |
237 } |
234 |
238 |
235 void CMpxVideoPlayerUtility::RefreshFrameL() |
239 void CMpxVideoPlayerUtility::RefreshFrameL() |
236 { |
240 { |
271 { |
275 { |
272 User::LeaveIfError( |
276 User::LeaveIfError( |
273 iVideoPlayControllerCustomCommands.DirectScreenAccessEvent( EResumeDSA ) ); |
277 iVideoPlayControllerCustomCommands.DirectScreenAccessEvent( EResumeDSA ) ); |
274 |
278 |
275 iDirectScreenAccessAbort = EFalse; |
279 iDirectScreenAccessAbort = EFalse; |
|
280 } |
|
281 } |
|
282 |
|
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(); |
276 } |
295 } |
277 } |
296 } |
278 |
297 |
279 TBool CMpxVideoPlayerUtility::AudioEnabledL() const |
298 TBool CMpxVideoPlayerUtility::AudioEnabledL() const |
280 { |
299 { |
576 // |
588 // |
577 TInt CMpxVideoPlayerUtility::RemoveSurface() |
589 TInt CMpxVideoPlayerUtility::RemoveSurface() |
578 { |
590 { |
579 TInt error = KErrNone; |
591 TInt error = KErrNone; |
580 |
592 |
581 if ( iSurfaceId.IsNull() ) |
593 if ( !iSurfaceId.IsNull() ) |
582 { |
594 { |
583 error = KErrNotFound; |
595 // |
584 } |
596 // Send command to view to remove the surface |
585 |
597 // |
586 // |
598 MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceRemoved ) ); |
587 // Send command to view to remove the surface |
599 |
588 // |
600 error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( iSurfaceId ); |
589 MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceRemoved ) ); |
601 |
590 |
602 iSurfaceId = TSurfaceId::CreateNullId(); |
591 error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( iSurfaceId ); |
603 } |
592 |
|
593 iSurfaceId = TSurfaceId::CreateNullId(); |
|
594 |
604 |
595 return error; |
605 return error; |
596 } |
606 } |
597 |
607 |
598 // ------------------------------------------------------------------------------------------------- |
608 // ------------------------------------------------------------------------------------------------- |
607 if ( iVideoPlaybackController->iMPXPluginObs ) |
617 if ( iVideoPlaybackController->iMPXPluginObs ) |
608 { |
618 { |
609 CMPXMessage* msg = CMPXMessage::NewL(); |
619 CMPXMessage* msg = CMPXMessage::NewL(); |
610 CleanupStack::PushL( msg ); |
620 CleanupStack::PushL( msg ); |
611 |
621 |
612 msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplayMessage ); |
622 msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplaySyncMessage ); |
613 msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd ); |
623 msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd ); |
614 |
624 |
615 iVideoPlaybackController->iMPXPluginObs->HandlePlaybackMessage( msg, KErrNone ); |
625 iVideoPlaybackController->iMPXPluginObs->HandlePlaybackSyncMessage( *msg ); |
616 |
626 |
617 CleanupStack::PopAndDestroy( msg ); |
627 CleanupStack::PopAndDestroy( msg ); |
618 } |
628 } |
619 } |
629 } |
620 |
630 |
633 if ( iVideoPlaybackController->iMPXPluginObs ) |
643 if ( iVideoPlaybackController->iMPXPluginObs ) |
634 { |
644 { |
635 CMPXMessage* msg = CMPXMessage::NewL(); |
645 CMPXMessage* msg = CMPXMessage::NewL(); |
636 CleanupStack::PushL( msg ); |
646 CleanupStack::PushL( msg ); |
637 |
647 |
638 msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplayMessage ); |
648 msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplaySyncMessage ); |
639 msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd ); |
649 msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd ); |
640 msg->SetTObjectValueL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId, aSurfaceId ); |
650 msg->SetTObjectValueL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId, aSurfaceId ); |
641 msg->SetTObjectValueL<TRect>( KMPXMediaVideoDisplayCropRect, aCropRect ); |
651 msg->SetTObjectValueL<TRect>( KMPXMediaVideoDisplayCropRect, aCropRect ); |
642 msg->SetTObjectValueL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio, aAspectRatio ); |
652 msg->SetTObjectValueL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio, aAspectRatio ); |
643 |
653 |
644 iVideoPlaybackController->iMPXPluginObs->HandlePlaybackMessage( msg, KErrNone ); |
654 iVideoPlaybackController->iMPXPluginObs->HandlePlaybackSyncMessage( *msg ); |
645 |
655 |
646 CleanupStack::PopAndDestroy( msg ); |
656 CleanupStack::PopAndDestroy( msg ); |
647 } |
657 } |
648 } |
658 } |
649 |
659 |