227 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdClose")); |
228 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdClose")); |
228 |
229 |
229 // |
230 // |
230 // The display window must be removed before closing the playback plugin |
231 // The display window must be removed before closing the playback plugin |
231 // |
232 // |
232 if ( iDisplayHandler ) |
233 RemoveBackgroundSurfaceL(); |
233 { |
|
234 // |
|
235 // Remove the display window so the surface can be released |
|
236 // |
|
237 iDisplayHandler->RemoveDisplayWindow(); |
|
238 } |
|
239 |
234 |
240 CreateGeneralPlaybackCommandL( EPbCmdClose ); |
235 CreateGeneralPlaybackCommandL( EPbCmdClose ); |
241 break; |
236 break; |
242 } |
237 } |
243 case EMPXPbvCmdSeekForward: |
238 case EMPXPbvCmdSeekForward: |
431 // Observe the View Framework when the view is active |
431 // Observe the View Framework when the view is active |
432 // |
432 // |
433 iViewUtility->AddObserverL( this ); |
433 iViewUtility->AddObserverL( this ); |
434 |
434 |
435 // |
435 // |
436 // Create Video Playback Display Handler |
|
437 // |
|
438 iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility ); |
|
439 |
|
440 // |
|
441 // Disable tool bar in playback view |
436 // Disable tool bar in playback view |
442 // |
437 // |
443 AppUi()->CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); |
438 AppUi()->CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); |
444 |
439 |
445 if ( ! iContainer ) |
440 if ( ! iContainer ) |
449 iContainer = CMPXVideoPlaybackContainer::NewL( this ); |
444 iContainer = CMPXVideoPlaybackContainer::NewL( this ); |
450 |
445 |
451 AppUi()->AddToStackL( *this, iContainer ); |
446 AppUi()->AddToStackL( *this, iContainer ); |
452 |
447 |
453 iContainer->GetWindow().SetVisible( ETrue ); |
448 iContainer->GetWindow().SetVisible( ETrue ); |
454 } |
449 |
455 |
450 // |
456 // Deactivate the CBA set the LSK&RSK to empty |
451 // Create Video Playback Display Handler |
457 Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY); |
452 // |
|
453 iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, iContainer ); |
|
454 |
|
455 // |
|
456 // Delay the adding of the display window while the Real One Bitmap is being shown |
|
457 // |
|
458 if ( ! iContainer->IsRealOneBitmapTimerActive() ) |
|
459 { |
|
460 // |
|
461 // Setup the display window |
|
462 // |
|
463 iDisplayHandler->CreateDisplayWindowL( *(CCoeEnv::Static()->ScreenDevice()), |
|
464 iContainer->GetWindow() ); |
|
465 } |
|
466 } |
|
467 |
|
468 // |
|
469 // Deactivate the CBA set the LSK & RSK to empty |
|
470 // |
|
471 Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY ); |
458 |
472 |
459 // |
473 // |
460 // Determine if the playback is from a playlist on view activation |
474 // Determine if the playback is from a playlist on view activation |
461 // |
475 // |
462 MMPXSource* s = iPlaybackUtility->Source(); |
476 MMPXSource* s = iPlaybackUtility->Source(); |
541 TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground; |
555 TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground; |
542 |
556 |
543 if ( aForeground ) |
557 if ( aForeground ) |
544 { |
558 { |
545 videoCmd = EPbCmdHandleForeground; |
559 videoCmd = EPbCmdHandleForeground; |
546 iContainer->HandleEventL(EMPXControlCmdHandleForegroundEvent); |
560 iContainer->HandleEventL( EMPXControlCmdHandleForegroundEvent ); |
547 } |
561 } |
548 else |
562 else |
549 { |
563 { |
550 iContainer->HandleEventL(EMPXControlCmdHandleBackgroundEvent); |
564 iContainer->HandleEventL( EMPXControlCmdHandleBackgroundEvent ); |
551 } |
565 } |
552 |
566 |
553 // |
567 // |
554 // create command to pass to playback plugin |
568 // create command to pass to playback plugin |
555 // |
569 // |
757 { |
771 { |
758 HandleVideoPlaybackMessage( aMessage ); |
772 HandleVideoPlaybackMessage( aMessage ); |
759 } |
773 } |
760 else if ( KMPXMediaIdVideoDisplaySyncMessage == id ) |
774 else if ( KMPXMediaIdVideoDisplaySyncMessage == id ) |
761 { |
775 { |
762 if ( iDisplayHandler ) |
776 iDisplayHandler->HandleVideoDisplaySyncMessageL( aMessage ); |
763 { |
|
764 TMPXVideoDisplayCommand cmdId = iDisplayHandler->HandleVideoDisplayMessageL( aMessage ); |
|
765 |
|
766 if ( cmdId == EPbMsgVideoSurfaceCreated ) |
|
767 { |
|
768 // |
|
769 // Notify container that surface has been created to make window transparent |
|
770 // |
|
771 if ( iContainer ) |
|
772 { |
|
773 iContainer->HandleCommandL( EMPXPbvSurfaceCreated ); |
|
774 } |
|
775 } |
|
776 } |
|
777 |
|
778 // |
|
779 // Signal Sync Message handling is complete |
|
780 // |
|
781 iPlaybackUtility->CommandL( EPbCmdSyncMsgComplete ); |
|
782 } |
777 } |
783 } |
778 } |
784 |
779 |
785 // ------------------------------------------------------------------------------------------------- |
780 // ------------------------------------------------------------------------------------------------- |
786 // CMPXVideoBasePlaybackView::HandleGeneralPlaybackMessageL() |
781 // CMPXVideoBasePlaybackView::HandleGeneralPlaybackMessageL() |
790 { |
785 { |
791 TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) ); |
786 TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) ); |
792 TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) ); |
787 TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) ); |
793 TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) ); |
788 TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) ); |
794 |
789 |
795 MPX_DEBUG( |
790 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleGeneralPlaybackMessageL()"), |
796 _L("CMPXVideoBasePlaybackView::HandleGeneralPlaybackMessageL() event = %d type = %d value = %d"), |
791 _L("event = %d type = %d value = %d"), event, type, data ); |
797 event, type, data ); |
|
798 |
792 |
799 switch ( event ) |
793 switch ( event ) |
800 { |
794 { |
801 case TMPXPlaybackMessage::EStateChanged: |
795 case TMPXPlaybackMessage::EStateChanged: |
802 { |
796 { |
804 |
798 |
805 break; |
799 break; |
806 } |
800 } |
807 case TMPXPlaybackMessage::EPropertyChanged: |
801 case TMPXPlaybackMessage::EPropertyChanged: |
808 { |
802 { |
809 TMPXPlaybackProperty property( |
803 TMPXPlaybackProperty property( static_cast<TMPXPlaybackProperty>( type ) ); |
810 static_cast<TMPXPlaybackProperty>( type ) ); |
|
811 |
804 |
812 HandlePropertyL( property, data, KErrNone ); |
805 HandlePropertyL( property, data, KErrNone ); |
813 break; |
806 break; |
814 } |
807 } |
815 case TMPXPlaybackMessage::EDownloadPositionChanged: |
808 case TMPXPlaybackMessage::EDownloadPositionChanged: |
895 { |
880 { |
896 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()")); |
881 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()")); |
897 |
882 |
898 if ( IsMultiItemPlaylist() ) |
883 if ( IsMultiItemPlaylist() ) |
899 { |
884 { |
900 if ( iDisplayHandler ) |
885 RemoveBackgroundSurfaceL(); |
901 { |
|
902 // |
|
903 // Remove the display window so the surface can be released |
|
904 // |
|
905 iDisplayHandler->RemoveDisplayWindow(); |
|
906 } |
|
907 |
886 |
908 iPlaybackUtility->CommandL( EPbCmdNext ); |
887 iPlaybackUtility->CommandL( EPbCmdNext ); |
909 } |
888 } |
910 else |
889 else |
911 { |
890 { |
1004 switch ( aNewState ) |
983 switch ( aNewState ) |
1005 { |
984 { |
1006 case EPbStateInitialising: |
985 case EPbStateInitialising: |
1007 { |
986 { |
1008 // |
987 // |
1009 // Get playlist information |
988 // For multi item playlists, reset the container and controls for next |
1010 // Source if available once the plugin is initializing |
989 // item in playlist |
1011 // |
990 // |
1012 if ( iContainer ) |
991 if ( IsMultiItemPlaylist() && iContainer ) |
1013 { |
992 { |
1014 // |
993 // |
1015 // If transitioning from Not Initialized to Initialising there is |
994 // If transitioning from Not Initialized to Initialising there is |
1016 // no need to update the playback information that was gathered |
995 // no need to update the playback information that was gathered |
1017 // when the container was created |
996 // when the container was created |
1018 // |
997 // |
1019 if ( oldState != EPbStateNotInitialised ) |
998 if ( oldState != EPbStateNotInitialised ) |
1020 { |
999 { |
1021 iMediaRequested = EFalse; |
1000 iMediaRequested = EFalse; |
|
1001 |
1022 iContainer->HandleCommandL( EMPXPbvCmdResetControls ); |
1002 iContainer->HandleCommandL( EMPXPbvCmdResetControls ); |
|
1003 |
|
1004 // |
|
1005 // Delay the adding of the display window while the Real One Bitmap |
|
1006 // is being shown |
|
1007 // |
|
1008 if ( ! iContainer->IsRealOneBitmapTimerActive() && iDisplayHandler ) |
|
1009 { |
|
1010 // |
|
1011 // Setup the display window since it was destroyed to free the surface |
|
1012 // |
|
1013 iDisplayHandler->CreateDisplayWindowL( |
|
1014 *(CCoeEnv::Static()->ScreenDevice()), |
|
1015 iContainer->GetWindow() ); |
|
1016 } |
1023 |
1017 |
1024 if ( iFileDetails ) |
1018 if ( iFileDetails ) |
1025 { |
1019 { |
1026 if ( iFileDetailsDialog ) |
1020 if ( iFileDetailsDialog ) |
1027 { |
1021 { |
1092 { |
1086 { |
1093 MPX_ENTER_EXIT( _L("CMPXVideoBasePlaybackView::DoHandleErrorPlaybackMessageL()"), |
1087 MPX_ENTER_EXIT( _L("CMPXVideoBasePlaybackView::DoHandleErrorPlaybackMessageL()"), |
1094 _L("aError = %d"), aError ); |
1088 _L("aError = %d"), aError ); |
1095 |
1089 |
1096 iContainer->HandleCommandL( EMPXPbvCmdResetControls ); |
1090 iContainer->HandleCommandL( EMPXPbvCmdResetControls ); |
1097 HandlePluginErrorL(aError); |
1091 HandlePluginErrorL( aError ); |
1098 } |
1092 } |
1099 |
1093 |
1100 // ------------------------------------------------------------------------------------------------- |
1094 // ------------------------------------------------------------------------------------------------- |
1101 // CMPXVideoBasePlaybackView::HandlePlaybackCommandComplete() |
1095 // CMPXVideoBasePlaybackView::HandlePlaybackCommandComplete() |
1102 // ------------------------------------------------------------------------------------------------- |
1096 // ------------------------------------------------------------------------------------------------- |
1306 TReal displayAspectRatio = (TReal32)displayRect.Width() / (TReal32)displayRect.Height(); |
1300 TReal displayAspectRatio = (TReal32)displayRect.Width() / (TReal32)displayRect.Height(); |
1307 |
1301 |
1308 TInt newAspectRatio = iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, |
1302 TInt newAspectRatio = iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, |
1309 displayAspectRatio ); |
1303 displayAspectRatio ); |
1310 |
1304 |
1311 // |
|
1312 // Setup the display window and issue play command |
|
1313 // |
|
1314 iDisplayHandler->CreateDisplayWindowL( *(CCoeEnv::Static()->ScreenDevice()), |
|
1315 iContainer->GetWindow() ); |
|
1316 |
|
1317 iContainer->HandleEventL( EMPXControlCmdSetAspectRatio, newAspectRatio ); |
1305 iContainer->HandleEventL( EMPXControlCmdSetAspectRatio, newAspectRatio ); |
1318 } |
1306 } |
1319 |
1307 |
1320 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
1308 // |
|
1309 // Delay the play command while the Real One Bitmap is being shown |
|
1310 // |
|
1311 if ( iContainer->IsRealOneBitmapTimerActive() ) |
|
1312 { |
|
1313 iRealOneDelayedPlay = ETrue; |
|
1314 } |
|
1315 else |
|
1316 { |
|
1317 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
|
1318 } |
1321 } |
1319 } |
1322 } |
1320 } |
1323 |
1321 |
1324 // ------------------------------------------------------------------------------------------------- |
1322 // ------------------------------------------------------------------------------------------------- |
1325 // CMPXVideoBasePlaybackView::UpdatePbPluginMedia() |
1323 // CMPXVideoBasePlaybackView::UpdatePbPluginMedia() |
1528 { |
1526 { |
1529 // |
1527 // |
1530 // set attributes on the command |
1528 // set attributes on the command |
1531 // |
1529 // |
1532 aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
1530 aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
1533 |
|
1534 aCmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
1531 aCmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
1535 |
|
1536 aCmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
1532 aCmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
1537 EPbCmdInitView ); |
1533 EPbCmdInitView ); |
1538 |
1534 |
1539 iPlaybackUtility->CommandL( *aCmd ); |
1535 iPlaybackUtility->CommandL( *aCmd ); |
1540 } |
1536 } |
1802 iFileDetailsDialog = CMPFileDetailsDialog::NewL(); |
1797 iFileDetailsDialog = CMPFileDetailsDialog::NewL(); |
1803 |
1798 |
1804 CMPFileDetails* fileDetailsDialogParams = new (ELeave) CMPFileDetails(); |
1799 CMPFileDetails* fileDetailsDialogParams = new (ELeave) CMPFileDetails(); |
1805 CleanupStack::PushL( fileDetailsDialogParams ); |
1800 CleanupStack::PushL( fileDetailsDialogParams ); |
1806 |
1801 |
1807 if ( iFileDetails->iClipName ) |
1802 HBufC* fileName = iFileDetails->GenerateFileNameL(); |
1808 { |
1803 |
1809 fileDetailsDialogParams->iFileName = iFileDetails->iClipName->AllocL(); |
1804 if ( fileName && fileName->Length() ) |
1810 } |
1805 { |
1811 |
1806 fileDetailsDialogParams->iFileName = fileName; |
1812 if ( iFileDetails->iTitle ) |
1807 } |
|
1808 |
|
1809 if ( iFileDetails->iTitle && iFileDetails->iTitle->Length() ) |
1813 { |
1810 { |
1814 fileDetailsDialogParams->iTitle = iFileDetails->iTitle->AllocL(); |
1811 fileDetailsDialogParams->iTitle = iFileDetails->iTitle->AllocL(); |
1815 } |
1812 } |
1816 |
1813 |
1817 if ( iFileDetails->iArtist ) |
1814 if ( iFileDetails->iArtist && iFileDetails->iArtist->Length() ) |
1818 { |
1815 { |
1819 fileDetailsDialogParams->iArtist = iFileDetails->iArtist->AllocL(); |
1816 fileDetailsDialogParams->iArtist = iFileDetails->iArtist->AllocL(); |
1820 } |
1817 } |
1821 |
1818 |
1822 if ( iFileDetails->iMimeType ) |
1819 if ( iFileDetails->iMimeType && iFileDetails->iMimeType->Length() ) |
1823 { |
1820 { |
1824 fileDetailsDialogParams->iFormat = iFileDetails->iMimeType->AllocL(); |
1821 fileDetailsDialogParams->iFormat = iFileDetails->iMimeType->AllocL(); |
1825 } |
1822 } |
1826 |
1823 |
1827 fileDetailsDialogParams->iResolutionHeight = iFileDetails->iVideoHeight; |
1824 if ( iFileDetails->iVideoHeight && iFileDetails->iVideoWidth ) |
1828 fileDetailsDialogParams->iResolutionWidth = iFileDetails->iVideoWidth; |
1825 { |
1829 fileDetailsDialogParams->iDurationInSeconds = iFileDetails->iDuration / KPbMilliMultiplier; |
1826 fileDetailsDialogParams->iResolutionHeight = iFileDetails->iVideoHeight; |
1830 fileDetailsDialogParams->iBitrate = iFileDetails->iBitRate; |
1827 fileDetailsDialogParams->iResolutionWidth = iFileDetails->iVideoWidth; |
|
1828 } |
|
1829 |
|
1830 if ( iFileDetails->iDuration > 0 ) |
|
1831 { |
|
1832 fileDetailsDialogParams->iDurationInSeconds = iFileDetails->iDuration / KPbMilliMultiplier; |
|
1833 } |
|
1834 |
|
1835 if (iFileDetails->iBitRate > 0 ) |
|
1836 { |
|
1837 fileDetailsDialogParams->iBitrate = iFileDetails->iBitRate; |
|
1838 } |
1831 |
1839 |
1832 if ( iFileDetails->iDrmProtected ) |
1840 if ( iFileDetails->iDrmProtected ) |
1833 { |
1841 { |
1834 fileDetailsDialogParams->iDrmProtected = iFileDetails->iDrmProtected; |
1842 fileDetailsDialogParams->iDrmProtected = iFileDetails->iDrmProtected; |
1835 fileDetailsDialogParams->iFilePath = iFileDetails->iClipName->AllocL(); |
1843 fileDetailsDialogParams->iFilePath = iFileDetails->iClipName->AllocL(); |
2165 return openError; |
2173 return openError; |
2166 } |
2174 } |
2167 |
2175 |
2168 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
2176 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
2169 |
2177 |
|
2178 // ------------------------------------------------------------------------------------------------- |
|
2179 // CMPXVideoBasePlaybackView::RemoveBackgroundSurfaceL() |
|
2180 // ------------------------------------------------------------------------------------------------- |
|
2181 // |
|
2182 void CMPXVideoBasePlaybackView::RemoveBackgroundSurfaceL() |
|
2183 { |
|
2184 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::RemoveBackgroundSurfaceL()")); |
|
2185 |
|
2186 if ( iDisplayHandler ) |
|
2187 { |
|
2188 // |
|
2189 // Remove the display window so the surface can be released |
|
2190 // |
|
2191 iDisplayHandler->RemoveDisplayWindow(); |
|
2192 } |
|
2193 } |
|
2194 |
|
2195 // ------------------------------------------------------------------------------------------------- |
|
2196 // CMPXVideoBasePlaybackView::HandleRealOneBitmapTimeoutL() |
|
2197 // ------------------------------------------------------------------------------------------------- |
|
2198 // |
|
2199 void CMPXVideoBasePlaybackView::HandleRealOneBitmapTimeoutL() |
|
2200 { |
|
2201 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleRealOneBitmapTimeoutL()")); |
|
2202 |
|
2203 // |
|
2204 // Check if this clip has video |
|
2205 // If video exists, setup the display window |
|
2206 // If the video is not enabled, redraw container to remove Real One Bitmap |
|
2207 // |
|
2208 if ( iFileDetails && iFileDetails->iVideoEnabled ) |
|
2209 { |
|
2210 if ( iDisplayHandler ) |
|
2211 { |
|
2212 // |
|
2213 // Setup the display window |
|
2214 // |
|
2215 iDisplayHandler->CreateDisplayWindowL( *(CCoeEnv::Static()->ScreenDevice()), |
|
2216 iContainer->GetWindow() ); |
|
2217 } |
|
2218 } |
|
2219 else |
|
2220 { |
|
2221 iContainer->DrawNow(); |
|
2222 } |
|
2223 |
|
2224 if ( iRealOneDelayedPlay ) |
|
2225 { |
|
2226 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
|
2227 iRealOneDelayedPlay = EFalse; |
|
2228 } |
|
2229 } |
|
2230 |
2170 // EOF |
2231 // EOF |