88 // |
88 // |
89 void CMPXVideoViewWrapper::ConstructL() |
89 void CMPXVideoViewWrapper::ConstructL() |
90 { |
90 { |
91 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ConstructL()")); |
91 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ConstructL()")); |
92 |
92 |
93 iPlaybackUtility = |
93 iPlaybackUtility = |
94 MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault ); |
94 MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault ); |
95 iPlaybackUtility->AddObserverL( *this ); |
95 iPlaybackUtility->AddObserverL( *this ); |
96 iPlaybackUtility->SetPrimaryClientL(); |
96 iPlaybackUtility->SetPrimaryClientL(); |
97 |
97 |
98 // |
98 // |
99 // Create Active Object for closing player |
99 // Create Active Object for closing player |
100 // |
100 // |
101 iCloseAO = CIdle::NewL( CActive::EPriorityStandard ); |
101 iCloseAO = CIdle::NewL( CActive::EPriorityStandard ); |
102 |
102 |
103 // |
103 // |
104 // Create Video Playback Display Handler |
104 // Create Video Playback Display Handler |
105 // |
105 // |
106 iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this ); |
106 iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this ); |
107 |
107 |
193 // ------------------------------------------------------------------------------------------------- |
193 // ------------------------------------------------------------------------------------------------- |
194 // |
194 // |
195 void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( TMPXPlaybackCommand aCmd, TBool aDoSync ) |
195 void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( TMPXPlaybackCommand aCmd, TBool aDoSync ) |
196 { |
196 { |
197 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::CreateGeneralPlaybackCommandL()"), |
197 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::CreateGeneralPlaybackCommandL()"), |
198 _L("aCmd = %d, aDoSync, = %d"), aCmd, aDoSync ); |
198 _L("aCmd = %d, aDoSync, = %d"), aCmd, aDoSync ); |
199 |
199 |
200 CMPXCommand* cmd = CMPXCommand::NewL(); |
200 CMPXCommand* cmd = CMPXCommand::NewL(); |
201 CleanupStack::PushL( cmd ); |
201 CleanupStack::PushL( cmd ); |
202 |
202 |
203 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, aDoSync ); |
203 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, aDoSync ); |
204 cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue ); |
204 cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue ); |
328 HandleShortPressBackwardL(); |
337 HandleShortPressBackwardL(); |
329 break; |
338 break; |
330 } |
339 } |
331 case EMPXPbvCmdResetControls: |
340 case EMPXPbvCmdResetControls: |
332 { |
341 { |
|
342 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdResetControls")); |
|
343 |
333 CreateControlsL(); |
344 CreateControlsL(); |
334 iView->retrievePdlInformation(); |
345 iView->retrievePdlInformation(); |
335 break; |
346 break; |
336 } |
347 } |
337 case EMPXPbvCmdNextListItem: |
348 case EMPXPbvCmdNextListItem: |
338 { |
349 { |
|
350 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdNextListItem")); |
|
351 |
339 if ( iPlaylistView && iFileDetails->mMultiItemPlaylist ) |
352 if ( iPlaylistView && iFileDetails->mMultiItemPlaylist ) |
340 { |
353 { |
341 iPlaybackUtility->CommandL( EPbCmdNext ); |
354 iPlaybackUtility->CommandL( EPbCmdNext ); |
342 } |
355 } |
343 break; |
356 else |
344 } |
357 { |
345 case EMPXPbvCmdPreviousListItem: |
358 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem")); |
346 { |
359 } |
|
360 |
|
361 break; |
|
362 } |
|
363 case EMPXPbvCmdPreviousListItem: |
|
364 { |
|
365 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPreviousListItem")); |
|
366 |
347 if ( iPlaylistView && iFileDetails->mMultiItemPlaylist ) |
367 if ( iPlaylistView && iFileDetails->mMultiItemPlaylist ) |
348 { |
368 { |
349 // |
369 // |
350 // the command is being sent twice on purpose |
370 // the command is being sent twice on purpose |
351 // one EMPXPbvCmdPreviousListItem command only sets the position to 0 |
371 // one EMPXPbvCmdPreviousListItem command only sets the position to 0 |
352 // the second cmd actually goes to the previous item in the list |
372 // the second cmd actually goes to the previous item in the list |
353 // |
373 // |
354 iPlaybackUtility->CommandL( EPbCmdPrevious ); |
374 iPlaybackUtility->CommandL( EPbCmdPrevious ); |
355 iPlaybackUtility->CommandL( EPbCmdPrevious ); |
375 iPlaybackUtility->CommandL( EPbCmdPrevious ); |
356 } |
376 } |
|
377 else |
|
378 { |
|
379 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem")); |
|
380 } |
|
381 |
357 break; |
382 break; |
358 } |
383 } |
359 case EMPXPbvCmdEndOfClip: |
384 case EMPXPbvCmdEndOfClip: |
360 { |
385 { |
361 CreateVideoSpecificCmdL( EPbCmdEndofClipReached ); |
386 CreateVideoSpecificCmdL( EPbCmdEndofClipReached ); |
857 // |
882 // |
858 if ( aMedia.IsSupported( KMPXMediaVideoDrmProtected ) ) |
883 if ( aMedia.IsSupported( KMPXMediaVideoDrmProtected ) ) |
859 { |
884 { |
860 iFileDetails->mDrmProtected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoDrmProtected ); |
885 iFileDetails->mDrmProtected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoDrmProtected ); |
861 } |
886 } |
862 |
887 |
863 // |
888 // |
864 // Description |
889 // Description |
865 // |
890 // |
866 if ( aMedia.IsSupported( KMPXMediaVideoDescription ) ) |
891 if ( aMedia.IsSupported( KMPXMediaVideoDescription ) ) |
867 { |
892 { |
868 TPtrC description( aMedia.ValueText( KMPXMediaVideoDescription ) ); |
893 TPtrC description( aMedia.ValueText( KMPXMediaVideoDescription ) ); |
869 const QString qDescription( (QChar*)description.Ptr(), description.Length() ); |
894 const QString qDescription( (QChar*)description.Ptr(), description.Length() ); |
870 iFileDetails->mDescription = qDescription; |
895 iFileDetails->mDescription = qDescription; |
871 } |
896 } |
872 |
897 |
873 // |
898 // |
874 // Location |
899 // Location |
875 // |
900 // |
876 if ( aMedia.IsSupported( KMPXMediaVideoLocation ) ) |
901 if ( aMedia.IsSupported( KMPXMediaVideoLocation ) ) |
877 { |
902 { |
878 TPtrC location( aMedia.ValueText( KMPXMediaVideoLocation ) ); |
903 TPtrC location( aMedia.ValueText( KMPXMediaVideoLocation ) ); |
879 const QString qLocation( (QChar*)location.Ptr(), location.Length() ); |
904 const QString qLocation( (QChar*)location.Ptr(), location.Length() ); |
880 iFileDetails->mLocation = qLocation; |
905 iFileDetails->mLocation = qLocation; |
881 } |
906 } |
882 |
907 |
883 // |
908 // |
884 // Copyright |
909 // Copyright |
885 // |
910 // |
886 if ( aMedia.IsSupported( KMPXMediaVideoCopyright ) ) |
911 if ( aMedia.IsSupported( KMPXMediaVideoCopyright ) ) |
887 { |
912 { |
888 TPtrC copyright( aMedia.ValueText( KMPXMediaVideoCopyright ) ); |
913 TPtrC copyright( aMedia.ValueText( KMPXMediaVideoCopyright ) ); |
889 const QString qCopyright( (QChar*)copyright.Ptr(), copyright.Length() ); |
914 const QString qCopyright( (QChar*)copyright.Ptr(), copyright.Length() ); |
890 iFileDetails->mCopyright = qCopyright; |
915 iFileDetails->mCopyright = qCopyright; |
891 } |
916 } |
892 |
917 |
893 // |
918 // |
894 // Language |
919 // Language |
895 // |
920 // |
896 if ( aMedia.IsSupported( KMPXMediaVideoLanguage ) ) |
921 if ( aMedia.IsSupported( KMPXMediaVideoLanguage ) ) |
897 { |
922 { |
898 TPtrC language( aMedia.ValueText( KMPXMediaVideoLanguage ) ); |
923 TPtrC language( aMedia.ValueText( KMPXMediaVideoLanguage ) ); |
899 const QString qLanguage( (QChar*)language.Ptr(), language.Length() ); |
924 const QString qLanguage( (QChar*)language.Ptr(), language.Length() ); |
900 iFileDetails->mLanguage = qLanguage; |
925 iFileDetails->mLanguage = qLanguage; |
901 } |
926 } |
902 |
927 |
903 // |
928 // |
904 // Keywords |
929 // Keywords |
905 // |
930 // |
906 if ( aMedia.IsSupported( KMPXMediaVideoKeywords ) ) |
931 if ( aMedia.IsSupported( KMPXMediaVideoKeywords ) ) |
907 { |
932 { |
908 TPtrC keywords( aMedia.ValueText( KMPXMediaVideoKeywords ) ); |
933 TPtrC keywords( aMedia.ValueText( KMPXMediaVideoKeywords ) ); |
909 const QString qKeywords( (QChar*)keywords.Ptr(), keywords.Length() ); |
934 const QString qKeywords( (QChar*)keywords.Ptr(), keywords.Length() ); |
910 iFileDetails->mKeywords = qKeywords; |
935 iFileDetails->mKeywords = qKeywords; |
911 } |
936 } |
912 |
937 |
913 // |
938 // |
914 // Creation date/time |
939 // Creation date/time |
915 // |
940 // |
916 if ( aMedia.IsSupported( KMPXMediaVideoCreated ) ) |
941 if ( aMedia.IsSupported( KMPXMediaVideoCreated ) ) |
917 { |
942 { |
918 iFileDetails->mCreationTime = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoCreated ); |
943 iFileDetails->mCreationTime = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoCreated ); |
919 } |
944 } |
920 |
945 |
921 // |
946 // |
922 // Last Modified date/time |
947 // Last Modified date/time |
923 // |
948 // |
924 if ( aMedia.IsSupported( KMPXMediaVideoLastModified ) ) |
949 if ( aMedia.IsSupported( KMPXMediaVideoLastModified ) ) |
925 { |
950 { |
926 iFileDetails->mModificationTime = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoLastModified ); |
951 iFileDetails->mModificationTime = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoLastModified ); |
927 } |
952 } |
928 |
953 |
929 } |
954 } |
930 |
955 |
931 // ------------------------------------------------------------------------------------------------- |
956 // ------------------------------------------------------------------------------------------------- |
932 // Handle media properties. |
957 // Handle media properties. |
933 // Notes: The client is responsible for delete the object of aProperties. |
958 // Notes: The client is responsible for delete the object of aProperties. |
1009 |
1034 |
1010 // ------------------------------------------------------------------------------------------------- |
1035 // ------------------------------------------------------------------------------------------------- |
1011 // CMPXVideoViewWrapper::HandlePropertyL() |
1036 // CMPXVideoViewWrapper::HandlePropertyL() |
1012 // ------------------------------------------------------------------------------------------------- |
1037 // ------------------------------------------------------------------------------------------------- |
1013 // |
1038 // |
1014 void |
1039 void |
1015 CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ) |
1040 CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ) |
1016 { |
1041 { |
1017 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandlePropertyL - Error(%d)"), aError ); |
1042 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandlePropertyL - Error(%d)"), aError ); |
1018 |
1043 |
1019 if ( aError == KErrNone ) |
1044 if ( aError == KErrNone ) |
1335 iFileDetails = NULL; |
1360 iFileDetails = NULL; |
1336 } |
1361 } |
1337 |
1362 |
1338 iFileDetails = new QMPXVideoPlaybackViewFileDetails(); |
1363 iFileDetails = new QMPXVideoPlaybackViewFileDetails(); |
1339 |
1364 |
1340 TPtrC fileName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) ); |
1365 TPtrC fileName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) ); |
1341 const QString qFilename( (QChar*)fileName.Ptr(), fileName.Length() ); |
1366 const QString qFilename( (QChar*)fileName.Ptr(), fileName.Length() ); |
1342 iFileDetails->mClipName = qFilename; |
1367 iFileDetails->mClipName = qFilename; |
1343 |
1368 |
1344 iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode ); |
1369 iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode ); |
1345 |
1370 |
1346 iFileDetails->mTvOutConnected = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected ); |
1371 iFileDetails->mTvOutConnected = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected ); |
1347 |
1372 |
1348 TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) ); |
1373 TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) ); |
1349 const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() ); |
1374 const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() ); |
1350 iFileDetails->mMimeType = qMimeType; |
1375 iFileDetails->mMimeType = qMimeType; |
1351 |
1376 |
1352 // |
1377 // |
1353 // get playlist information and set mMultiItemPlaylist flag |
1378 // get playlist information and set mMultiItemPlaylist flag |
1354 // |
1379 // |
1355 TInt numItems = 1; |
1380 TInt numItems = 1; |
1356 MMPXSource* s = iPlaybackUtility->Source(); |
1381 MMPXSource* s = iPlaybackUtility->Source(); |
1357 |
1382 |
1358 if ( s ) |
1383 if ( s ) |
1359 { |
1384 { |
1360 CMPXCollectionPlaylist* playlist = NULL; |
1385 CMPXCollectionPlaylist* playlist = NULL; |
1361 |
1386 |
1362 MPX_TRAPD( err, playlist = s->PlaylistL() ); |
1387 MPX_TRAPD( err, playlist = s->PlaylistL() ); |
1363 |
1388 |
1364 if ( err == KErrNone && playlist ) |
1389 if ( err == KErrNone && playlist ) |
1365 { |
1390 { |
1366 iPlaylistView = ETrue; |
1391 iPlaylistView = ETrue; |
1367 numItems = playlist->Count(); |
1392 numItems = playlist->Count(); |
1368 delete playlist; |
1393 delete playlist; |
1369 } |
1394 } |
1370 } |
1395 } |
1371 |
1396 |
1372 iFileDetails->mMultiItemPlaylist = ( numItems > 1 ); |
1397 iFileDetails->mMultiItemPlaylist = ( numItems > 1 ); |
1373 |
1398 |
1374 CleanupStack::PopAndDestroy( cmd ); |
1399 CleanupStack::PopAndDestroy( cmd ); |
1375 |
1400 |
1376 if ( iControlsController ) |
1401 if ( iControlsController ) |
1377 { |
1402 { |
1378 delete iControlsController; |
1403 delete iControlsController; |
1386 // CMPXVideoViewWrapper::IsMultiItemPlaylist() |
1411 // CMPXVideoViewWrapper::IsMultiItemPlaylist() |
1387 // ------------------------------------------------------------------------------------------------- |
1412 // ------------------------------------------------------------------------------------------------- |
1388 // |
1413 // |
1389 TBool CMPXVideoViewWrapper::IsMultiItemPlaylist() |
1414 TBool CMPXVideoViewWrapper::IsMultiItemPlaylist() |
1390 { |
1415 { |
1391 |
1416 |
1392 bool multiLinks( false ); |
1417 bool multiLinks( false ); |
1393 |
1418 |
1394 if ( iFileDetails ) |
1419 if ( iFileDetails ) |
1395 { |
1420 { |
1396 multiLinks = iFileDetails->mMultiItemPlaylist; |
1421 multiLinks = iFileDetails->mMultiItemPlaylist; |
1397 } |
1422 } |
1398 |
1423 |
1399 MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist() ret %d"), multiLinks ); |
1424 MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist() ret %d"), multiLinks ); |
1400 |
1425 |
1401 return multiLinks; |
1426 return multiLinks; |
1402 } |
1427 } |
1403 |
1428 |
1404 // ------------------------------------------------------------------------------------------------- |
1429 // ------------------------------------------------------------------------------------------------- |
1405 // CMPXVideoViewWrapper::UpdateVideoRect() |
1430 // CMPXVideoViewWrapper::UpdateVideoRect() |
1406 // ------------------------------------------------------------------------------------------------- |
1431 // ------------------------------------------------------------------------------------------------- |
1407 // |
1432 // |
1408 void CMPXVideoViewWrapper::UpdateVideoRect( |
1433 void CMPXVideoViewWrapper::UpdateVideoRect( |
1409 TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect ) |
1434 TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect ) |
1410 { |
1435 { |
1411 MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRect()")); |
1436 MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRect()")); |
1412 |
1437 |
1413 TRect rect( TPoint( aX, aY ), TSize( aWidth, aHeight ) ); |
1438 TRect rect( TPoint( aX, aY ), TSize( aWidth, aHeight ) ); |
1439 // |
1464 // |
1440 // Create controls since file details are available |
1465 // Create controls since file details are available |
1441 // |
1466 // |
1442 if ( iControlsController ) |
1467 if ( iControlsController ) |
1443 { |
1468 { |
1444 iControlsController->addFileDetails( iFileDetails ); |
1469 iControlsController->addFileDetails( iFileDetails ); |
1445 } |
1470 } |
1446 |
1471 |
1447 if ( iFileDetails->mVideoEnabled ) |
1472 if ( iFileDetails->mVideoEnabled ) |
1448 { |
1473 { |
1449 // |
1474 // |
1450 // get window size |
1475 // get window size |
1451 // |
1476 // |
1452 RWindow *window = iView->getWindow(); |
1477 RWindow *window = iView->getWindow(); |
1453 TRect displayRect = TRect( TPoint( window->Position() ), TSize( window->Size() ) ); |
1478 TRect displayRect = TRect( TPoint( window->Position() ), TSize( window->Size() ) ); |
1454 |
1479 |
1455 // |
1480 // |
1456 // get window aspect ratio |
1481 // get window aspect ratio |
1457 // if device is in landscape mode, width > height |
1482 // if device is in landscape mode, width > height |
1458 // if device is in portrait mode, width < height |
1483 // if device is in portrait mode, width < height |
1459 // |
1484 // |
1460 TReal32 width = (TReal32) displayRect.Width(); |
1485 TReal32 width = (TReal32) displayRect.Width(); |
1461 TReal32 height = (TReal32) displayRect.Height(); |
1486 TReal32 height = (TReal32) displayRect.Height(); |
1462 TReal32 displayAspectRatio = (width > height)? (width / height) : (height / width); |
1487 TReal32 displayAspectRatio = (width > height)? (width / height) : (height / width); |
1463 |
1488 |
1464 // |
1489 // |
1465 // get new aspect ratio |
1490 // get new aspect ratio |
1466 TInt newAspectRatio = |
1491 TInt newAspectRatio = |
1467 iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, displayAspectRatio ); |
1492 iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, displayAspectRatio ); |
1468 |
1493 |
1469 // |
1494 // |
1470 // Setup the display window and issue play command |
1495 // Setup the display window and issue play command |
1471 // |
1496 // |