924 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoHandleMediaL()"), |
938 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoHandleMediaL()"), |
925 _L("aError = %d"), aError ); |
939 _L("aError = %d"), aError ); |
926 |
940 |
927 if ( aError == KErrNone ) |
941 if ( aError == KErrNone ) |
928 { |
942 { |
929 if ( iFileDetails ) |
943 iMediaRequestStatus = MediaDelivered; |
930 { |
944 |
931 iFileDetails->clearFileDetails(); |
945 if ( ! iFileDetails ) |
932 } |
|
933 else |
|
934 { |
946 { |
935 iFileDetails = new QMPXVideoPlaybackViewFileDetails(); |
947 iFileDetails = new QMPXVideoPlaybackViewFileDetails(); |
936 } |
948 } |
937 |
949 |
938 // |
950 // |
939 // Read in the media data |
951 // Read in the media data |
940 // |
952 // |
941 ParseMetaDataL( aMedia ); |
953 ParseMetaDataL( aMedia ); |
942 |
954 |
|
955 // |
|
956 // If RN logo is still visible, wait for timeout of rn logo timer |
|
957 // If RN logo is not visible, issue play |
|
958 // |
|
959 if ( ! iControlsController->isRNLogoBitmapInControlList() ) |
|
960 { |
|
961 IssuePlayCommandL(); |
|
962 } |
|
963 } |
|
964 else |
|
965 { |
|
966 iMediaRequestStatus = MediaNotRequested; |
|
967 } |
|
968 } |
|
969 |
|
970 // ------------------------------------------------------------------------------------------------- |
|
971 // From MMPXPlaybackCallback |
|
972 // Handle media event. |
|
973 // Notes: The client is responsible for delete the object of aProperties. |
|
974 // ------------------------------------------------------------------------------------------------- |
|
975 // |
|
976 void CMPXVideoViewWrapper::HandleMediaL( const CMPXMedia& aMedia, TInt aError) |
|
977 { |
|
978 MPX_ENTER_EXIT(_L( "CMPXVideoViewWrapper::HandleMediaL()" )); |
|
979 |
|
980 if ( aMedia.IsSupported( KMPXMediaVideoError ) ) |
|
981 { |
|
982 TInt error = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoError ); |
|
983 // Reset the controls |
|
984 HandleCommandL( EMPXPbvCmdResetControls ); |
|
985 // Set the iMediaRequested flag to false |
|
986 iMediaRequestStatus = MediaNotRequested; |
|
987 // Reset the playback state to stopped |
|
988 iPlaybackState = EPbStateStopped; |
|
989 // Handle the plugin error |
|
990 iView->handlePluginError( error ); |
|
991 } |
|
992 else |
|
993 { |
|
994 DoHandleMediaL( aMedia, aError ); |
|
995 } |
|
996 } |
|
997 |
|
998 // ------------------------------------------------------------------------------------------------- |
|
999 // CMPXVideoViewWrapper::SetPropertyL() |
|
1000 // ------------------------------------------------------------------------------------------------- |
|
1001 // |
|
1002 void CMPXVideoViewWrapper::SetPropertyL( TMPXPlaybackProperty aProperty, TInt aValue ) |
|
1003 { |
|
1004 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::SetPropertyL"), |
|
1005 _L("aProperty = %d, aValue = %d"), aProperty, aValue ); |
|
1006 |
|
1007 iPlaybackUtility->SetL( aProperty, aValue ); |
|
1008 } |
|
1009 |
|
1010 // ------------------------------------------------------------------------------------------------- |
|
1011 // CMPXVideoViewWrapper::HandlePropertyL() |
|
1012 // ------------------------------------------------------------------------------------------------- |
|
1013 // |
|
1014 void |
|
1015 CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ) |
|
1016 { |
|
1017 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandlePropertyL - Error(%d)"), aError ); |
|
1018 |
|
1019 if ( aError == KErrNone ) |
|
1020 { |
|
1021 switch ( aProperty ) |
|
1022 { |
|
1023 case EPbPropertyPosition: |
|
1024 { |
|
1025 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL position(%d)"), aValue ); |
|
1026 |
|
1027 if ( iControlsController ) |
|
1028 { |
|
1029 iControlsController->handleEvent( EMPXControlCmdSetPosition, aValue ); |
|
1030 } |
|
1031 |
|
1032 break; |
|
1033 } |
|
1034 case EPbPropertyDuration: |
|
1035 { |
|
1036 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL duration(%d)"), aValue ); |
|
1037 |
|
1038 if ( iControlsController ) |
|
1039 { |
|
1040 iControlsController->handleEvent( EMPXControlCmdSetDuration, aValue ); |
|
1041 } |
|
1042 |
|
1043 break; |
|
1044 } |
|
1045 case EPbPropertyMaxVolume: |
|
1046 { |
|
1047 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL max volume(%d)"), aValue ); |
|
1048 |
|
1049 break; |
|
1050 } |
|
1051 case EPbPropertyVolume: |
|
1052 { |
|
1053 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL volume(%d)"), aValue ); |
|
1054 |
|
1055 if ( iControlsController ) |
|
1056 { |
|
1057 iControlsController->handleEvent( EMPXControlCmdSetVolume, aValue ); |
|
1058 } |
|
1059 |
|
1060 break; |
|
1061 } |
|
1062 case EPbPropertyMute: |
|
1063 { |
|
1064 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL mute(%d)"), aValue ); |
|
1065 |
|
1066 if ( iControlsController && aValue ) |
|
1067 { |
|
1068 iControlsController->handleEvent( EMPXControlCmdSetVolume, 0 ); |
|
1069 } |
|
1070 |
|
1071 break; |
|
1072 } |
|
1073 } |
|
1074 } |
|
1075 } |
|
1076 |
|
1077 // ------------------------------------------------------------------------------------------------- |
|
1078 // CMPXVideoViewWrapper::RetrieveFileNameAndModeL |
|
1079 // ------------------------------------------------------------------------------------------------- |
|
1080 // |
|
1081 void CMPXVideoViewWrapper::RetrieveFileNameAndModeL( CMPXCommand* aCmd ) |
|
1082 { |
|
1083 // |
|
1084 // set attributes on the command |
|
1085 // |
|
1086 aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1087 |
|
1088 aCmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1089 |
|
1090 aCmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
|
1091 EPbCmdInitView ); |
|
1092 |
|
1093 iPlaybackUtility->CommandL( *aCmd ); |
|
1094 } |
|
1095 |
|
1096 // ------------------------------------------------------------------------------------------------- |
|
1097 // CMPXVideoViewWrapper::ActivateClosePlayerActiveObject |
|
1098 // ------------------------------------------------------------------------------------------------- |
|
1099 // |
|
1100 void CMPXVideoViewWrapper::ActivateClosePlayerActiveObject() |
|
1101 { |
|
1102 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()")); |
|
1103 |
|
1104 if ( ! iCloseAO->IsActive() ) |
|
1105 { |
|
1106 iCloseAO->Start( TCallBack( CMPXVideoViewWrapper::ClosePlayerL, this ) ); |
|
1107 } |
|
1108 } |
|
1109 |
|
1110 // ------------------------------------------------------------------------------------------------- |
|
1111 // CMPXVideoViewWrapper::ClosePlayerL |
|
1112 // ------------------------------------------------------------------------------------------------- |
|
1113 // |
|
1114 TInt CMPXVideoViewWrapper::ClosePlayerL( TAny* aPtr ) |
|
1115 { |
|
1116 MPX_DEBUG(_L("CMPXVideoViewWrapper::ClosePlayerL()")); |
|
1117 |
|
1118 static_cast<CMPXVideoViewWrapper*>(aPtr)->DoClosePlayerL(); |
|
1119 return KErrNone; |
|
1120 } |
|
1121 |
|
1122 // ------------------------------------------------------------------------------------------------- |
|
1123 // CMPXVideoViewWrapper::DoClosePlayerL |
|
1124 // ------------------------------------------------------------------------------------------------- |
|
1125 // |
|
1126 void CMPXVideoViewWrapper::DoClosePlayerL() |
|
1127 { |
|
1128 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoClosePlayerL()")); |
|
1129 |
|
1130 iView->doClosePlayer(); |
|
1131 } |
|
1132 |
|
1133 // ------------------------------------------------------------------------------------------------- |
|
1134 // CMPXVideoViewWrapper::RetrievePdlInformationL |
|
1135 // ------------------------------------------------------------------------------------------------- |
|
1136 // |
|
1137 void CMPXVideoViewWrapper::RetrievePdlInformationL() |
|
1138 { |
|
1139 MPX_DEBUG(_L("CMPXVideoViewWrapper::RetrievePdlInformationL()")); |
|
1140 } |
|
1141 |
|
1142 // ------------------------------------------------------------------------------------------------- |
|
1143 // CMPXVideoViewWrapper::CreateVideoSpecificCmdL() |
|
1144 // ------------------------------------------------------------------------------------------------- |
|
1145 // |
|
1146 void CMPXVideoViewWrapper::CreateVideoSpecificCmdL( TMPXVideoPlaybackCommand aCmd ) |
|
1147 { |
|
1148 // |
|
1149 // create command to pass to playback plugin |
|
1150 // |
|
1151 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1152 CleanupStack::PushL( cmd ); |
|
1153 |
|
1154 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1155 |
|
1156 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1157 |
|
1158 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, aCmd ); |
|
1159 |
|
1160 iPlaybackUtility->CommandL( *cmd ); |
|
1161 |
|
1162 CleanupStack::PopAndDestroy( cmd ); |
|
1163 } |
|
1164 |
|
1165 // ------------------------------------------------------------------------------------------------- |
|
1166 // CMPXVideoViewWrapper::SetAspectRatioL() |
|
1167 // ------------------------------------------------------------------------------------------------- |
|
1168 // |
|
1169 void CMPXVideoViewWrapper::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ) |
|
1170 { |
|
1171 MPX_DEBUG(_L("CMPXVideoViewWrapper::SetAspectRatioL()")); |
|
1172 |
|
1173 TInt newAspectRatio = iDisplayHandler->SetAspectRatioL( aCmd ); |
|
1174 |
|
1175 if ( iControlsController ) |
|
1176 { |
|
1177 iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio ); |
|
1178 } |
|
1179 } |
|
1180 |
|
1181 // ------------------------------------------------------------------------------------------------- |
|
1182 // CMPXVideoViewWrapper::IsAppInFrontL() |
|
1183 // Returns true if app is foreground. Uses windowgroup id |
|
1184 // ------------------------------------------------------------------------------------------------- |
|
1185 // |
|
1186 TBool CMPXVideoViewWrapper::IsAppInFrontL() |
|
1187 { |
|
1188 TBool ret = EFalse; |
|
1189 RWsSession wsSession; |
|
1190 |
|
1191 User::LeaveIfError( wsSession.Connect() ); |
|
1192 |
|
1193 if( wsSession.Handle() ) |
|
1194 { |
|
1195 CArrayFixFlat<TInt>* wgList = |
|
1196 new (ELeave) CArrayFixFlat<TInt>( wsSession.NumWindowGroups() ); |
|
1197 |
|
1198 // check if our window is front or not |
|
1199 if ( wsSession.WindowGroupList( 0, wgList ) == KErrNone ) |
|
1200 { |
|
1201 ret = ( CEikonEnv::Static()->RootWin().Identifier() == wgList->At(0) ); |
|
1202 } |
|
1203 else |
|
1204 { |
|
1205 ret = EFalse; |
|
1206 } |
|
1207 |
|
1208 delete wgList; |
|
1209 } |
|
1210 |
|
1211 wsSession.Close(); |
|
1212 |
|
1213 MPX_DEBUG(_L("CMPXVideoViewWrapper::IsAppInFrontL (%d)" ), ret); |
|
1214 |
|
1215 return ret; |
|
1216 } |
|
1217 |
|
1218 // ------------------------------------------------------------------------------------------------- |
|
1219 // CMPXVideoViewWrapper::ClosePlaybackViewL() |
|
1220 // ------------------------------------------------------------------------------------------------- |
|
1221 // |
|
1222 void CMPXVideoViewWrapper::ClosePlaybackViewL() |
|
1223 { |
|
1224 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::closePlaybackView()")); |
|
1225 |
|
1226 iView->closePlaybackView(); |
|
1227 } |
|
1228 |
|
1229 // ------------------------------------------------------------------------------------------------- |
|
1230 // CMPXVideoViewWrapper::HandleVolumeCmdL() |
|
1231 // ------------------------------------------------------------------------------------------------- |
|
1232 // |
|
1233 void CMPXVideoViewWrapper::HandleVolumeCmdL( TMPXPlaybackCommand aCmd ) |
|
1234 { |
|
1235 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandleVolumeCmdL()")); |
|
1236 |
|
1237 // |
|
1238 // In case user try to change the volume via media key, rocker key or etc |
|
1239 // We need to show the controls though the volume level doesn't get changed |
|
1240 // For examples : - try to change the volume with a clip without audio track |
|
1241 // - try to reduce the volume with volume level 0 |
|
1242 // - try to increase the volume with max volume level |
|
1243 // |
|
1244 iControlsController->handleEvent( EMPXControlCmdShowVolumeControls ); |
|
1245 |
|
1246 switch( aCmd ) |
|
1247 { |
|
1248 case EPbCmdDecreaseVolume: |
|
1249 { |
|
1250 CreateVideoSpecificCmdL( EPbCmdHandleDecreaseVolume ); |
|
1251 break; |
|
1252 } |
|
1253 case EPbCmdIncreaseVolume: |
|
1254 { |
|
1255 CreateVideoSpecificCmdL( EPbCmdHandleIncreaseVolume ); |
|
1256 break; |
|
1257 } |
|
1258 default: |
|
1259 { |
|
1260 iPlaybackUtility->CommandL( aCmd ); |
|
1261 break; |
|
1262 } |
|
1263 } |
|
1264 } |
|
1265 |
|
1266 // ------------------------------------------------------------------------------------------------- |
|
1267 // CMPXVideoViewWrapper::HandleShortPressBackwardL() |
|
1268 // ------------------------------------------------------------------------------------------------- |
|
1269 // |
|
1270 void CMPXVideoViewWrapper::HandleShortPressBackwardL() |
|
1271 { |
|
1272 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleShortPressBackwardL()")); |
|
1273 |
|
1274 if( !iPlaylistView ) |
|
1275 { |
|
1276 SetPropertyL( EPbPropertyPosition, 0 ); |
|
1277 } |
|
1278 } |
|
1279 |
|
1280 // ------------------------------------------------------------------------------------------------- |
|
1281 // CMPXVideoViewWrapper::IssueVideoAppForegroundCmd() |
|
1282 // ------------------------------------------------------------------------------------------------- |
|
1283 // |
|
1284 void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground ) |
|
1285 { |
|
1286 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL()"), |
|
1287 _L("aForeground = %d"), aForeground ); |
|
1288 |
|
1289 TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground; |
|
1290 |
|
1291 if ( aForeground ) |
|
1292 { |
|
1293 videoCmd = EPbCmdHandleForeground; |
|
1294 } |
|
1295 |
|
1296 // |
|
1297 // create command to pass to playback plugin |
|
1298 // |
|
1299 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1300 CleanupStack::PushL( cmd ); |
|
1301 |
|
1302 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1303 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1304 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, videoCmd ); |
|
1305 cmd->SetTObjectValueL<TBool>( KMPXMediaVideoAppForeground, IsAppInFrontL() ); |
|
1306 |
|
1307 iPlaybackUtility->CommandL( *cmd ); |
|
1308 CleanupStack::PopAndDestroy( cmd ); |
|
1309 } |
|
1310 |
|
1311 // ------------------------------------------------------------------------------------------------- |
|
1312 // CMPXVideoViewWrapper::CreateControlsL() |
|
1313 // ------------------------------------------------------------------------------------------------- |
|
1314 // |
|
1315 void CMPXVideoViewWrapper::CreateControlsL() |
|
1316 { |
|
1317 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::CreateControlsL()")); |
|
1318 |
|
1319 // |
|
1320 // Query playback plugin for filename and mode |
|
1321 // |
|
1322 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1323 CleanupStack::PushL( cmd ); |
|
1324 |
|
1325 RetrieveFileNameAndModeL( cmd ); |
|
1326 |
|
1327 // |
|
1328 // Create a temporary file details that is populated with the |
|
1329 // file name and playback mode. This will be delete when |
|
1330 // plugin initialization is complete |
|
1331 // |
|
1332 if ( iFileDetails ) |
|
1333 { |
|
1334 delete iFileDetails; |
|
1335 iFileDetails = NULL; |
|
1336 } |
|
1337 |
|
1338 iFileDetails = new QMPXVideoPlaybackViewFileDetails(); |
|
1339 |
|
1340 TPtrC fileName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) ); |
|
1341 const QString qFilename( (QChar*)fileName.Ptr(), fileName.Length() ); |
|
1342 iFileDetails->mClipName = qFilename; |
|
1343 |
|
1344 iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode ); |
|
1345 |
|
1346 iFileDetails->mTvOutConnected = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected ); |
|
1347 |
|
1348 TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) ); |
|
1349 const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() ); |
|
1350 iFileDetails->mMimeType = qMimeType; |
|
1351 |
|
1352 // |
|
1353 // get playlist information and set mMultiItemPlaylist flag |
|
1354 // |
|
1355 TInt numItems = 1; |
|
1356 MMPXSource* s = iPlaybackUtility->Source(); |
|
1357 |
|
1358 if ( s ) |
|
1359 { |
|
1360 CMPXCollectionPlaylist* playlist = NULL; |
|
1361 |
|
1362 MPX_TRAPD( err, playlist = s->PlaylistL() ); |
|
1363 |
|
1364 if ( err == KErrNone && playlist ) |
|
1365 { |
|
1366 iPlaylistView = ETrue; |
|
1367 numItems = playlist->Count(); |
|
1368 delete playlist; |
|
1369 } |
|
1370 } |
|
1371 |
|
1372 iFileDetails->mMultiItemPlaylist = ( numItems > 1 ); |
|
1373 |
|
1374 CleanupStack::PopAndDestroy( cmd ); |
|
1375 |
|
1376 if ( iControlsController ) |
|
1377 { |
|
1378 delete iControlsController; |
|
1379 iControlsController = NULL; |
|
1380 } |
|
1381 |
|
1382 iControlsController = new QMPXVideoPlaybackControlsController( iView, this, iFileDetails ); |
|
1383 } |
|
1384 |
|
1385 // ------------------------------------------------------------------------------------------------- |
|
1386 // CMPXVideoViewWrapper::IsMultiItemPlaylist() |
|
1387 // ------------------------------------------------------------------------------------------------- |
|
1388 // |
|
1389 TBool CMPXVideoViewWrapper::IsMultiItemPlaylist() |
|
1390 { |
|
1391 |
|
1392 bool multiLinks( false ); |
|
1393 |
|
1394 if ( iFileDetails ) |
|
1395 { |
|
1396 multiLinks = iFileDetails->mMultiItemPlaylist; |
|
1397 } |
|
1398 |
|
1399 MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist() ret %d"), multiLinks ); |
|
1400 |
|
1401 return multiLinks; |
|
1402 } |
|
1403 |
|
1404 // ------------------------------------------------------------------------------------------------- |
|
1405 // CMPXVideoViewWrapper::UpdateVideoRect() |
|
1406 // ------------------------------------------------------------------------------------------------- |
|
1407 // |
|
1408 void CMPXVideoViewWrapper::UpdateVideoRect( |
|
1409 TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect ) |
|
1410 { |
|
1411 MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRect()")); |
|
1412 |
|
1413 TRect rect( TPoint( aX, aY ), TSize( aWidth, aHeight ) ); |
|
1414 TRAP_IGNORE( iDisplayHandler->UpdateVideoRectL( rect, transitionEffect ) ); |
|
1415 } |
|
1416 |
|
1417 // ------------------------------------------------------------------------------------------------- |
|
1418 // CMPXVideoViewWrapper::UpdateVideoRectDone() |
|
1419 // ------------------------------------------------------------------------------------------------- |
|
1420 // |
|
1421 void CMPXVideoViewWrapper::UpdateVideoRectDone() |
|
1422 { |
|
1423 MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRectDone()")); |
|
1424 |
|
1425 iControlsController->updateVideoRectDone(); |
|
1426 } |
|
1427 |
|
1428 // ------------------------------------------------------------------------------------------------- |
|
1429 // CMPXVideoViewWrapper::IssuePlayCommandL() |
|
1430 // ------------------------------------------------------------------------------------------------- |
|
1431 // |
|
1432 void CMPXVideoViewWrapper::IssuePlayCommandL() |
|
1433 { |
|
1434 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssuePlayCommandL()"), |
|
1435 _L("iMediaRequestStatus = %d"), iMediaRequestStatus ); |
|
1436 |
|
1437 if ( iMediaRequestStatus == MediaDelivered ) |
|
1438 { |
943 // |
1439 // |
944 // Create controls since file details are available |
1440 // Create controls since file details are available |
945 // |
1441 // |
946 if ( iControlsController ) |
1442 if ( iControlsController ) |
947 { |
1443 { |
986 |
1482 |
987 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
1483 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
988 } |
1484 } |
989 } |
1485 } |
990 |
1486 |
991 // ------------------------------------------------------------------------------------------------- |
|
992 // From MMPXPlaybackCallback |
|
993 // Handle media event. |
|
994 // Notes: The client is responsible for delete the object of aProperties. |
|
995 // ------------------------------------------------------------------------------------------------- |
|
996 // |
|
997 void CMPXVideoViewWrapper::HandleMediaL( const CMPXMedia& aMedia, TInt aError) |
|
998 { |
|
999 MPX_ENTER_EXIT(_L( "CMPXVideoViewWrapper::HandleMediaL()" )); |
|
1000 if ( aMedia.IsSupported( KMPXMediaVideoError ) ) |
|
1001 { |
|
1002 TInt error = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoError ); |
|
1003 // Reset the controls |
|
1004 HandleCommandL( EMPXPbvCmdResetControls ); |
|
1005 // Set the iMediaRequested flag to false |
|
1006 iMediaRequested = EFalse; |
|
1007 // Reset the playback state to stopped |
|
1008 iPlaybackState = EPbStateStopped; |
|
1009 // Handle the plugin error |
|
1010 iView->handlePluginError( error ); |
|
1011 } |
|
1012 else |
|
1013 { |
|
1014 DoHandleMediaL( aMedia, aError ); |
|
1015 } |
|
1016 } |
|
1017 |
|
1018 // ------------------------------------------------------------------------------------------------- |
|
1019 // CMPXVideoViewWrapper::SetPropertyL() |
|
1020 // ------------------------------------------------------------------------------------------------- |
|
1021 // |
|
1022 void CMPXVideoViewWrapper::SetPropertyL( TMPXPlaybackProperty aProperty, TInt aValue ) |
|
1023 { |
|
1024 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::SetPropertyL"), |
|
1025 _L("aProperty = %d, aValue = %d"), aProperty, aValue ); |
|
1026 |
|
1027 iPlaybackUtility->SetL( aProperty, aValue ); |
|
1028 } |
|
1029 |
|
1030 // ------------------------------------------------------------------------------------------------- |
|
1031 // CMPXVideoViewWrapper::HandlePropertyL() |
|
1032 // ------------------------------------------------------------------------------------------------- |
|
1033 // |
|
1034 void CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty, |
|
1035 TInt aValue, |
|
1036 TInt aError ) |
|
1037 { |
|
1038 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandlePropertyL - Error(%d)"), aError ); |
|
1039 |
|
1040 if ( aError == KErrNone ) |
|
1041 { |
|
1042 switch ( aProperty ) |
|
1043 { |
|
1044 case EPbPropertyPosition: |
|
1045 { |
|
1046 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL position(%d)"), aValue ); |
|
1047 |
|
1048 if ( iControlsController ) |
|
1049 { |
|
1050 iControlsController->handleEvent( EMPXControlCmdSetPosition, aValue ); |
|
1051 } |
|
1052 |
|
1053 break; |
|
1054 } |
|
1055 case EPbPropertyDuration: |
|
1056 { |
|
1057 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL duration(%d)"), aValue ); |
|
1058 |
|
1059 if ( iControlsController ) |
|
1060 { |
|
1061 iControlsController->handleEvent( EMPXControlCmdSetDuration, aValue ); |
|
1062 } |
|
1063 |
|
1064 break; |
|
1065 } |
|
1066 case EPbPropertyMaxVolume: |
|
1067 { |
|
1068 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL max volume(%d)"), aValue ); |
|
1069 |
|
1070 break; |
|
1071 } |
|
1072 case EPbPropertyVolume: |
|
1073 { |
|
1074 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL volume(%d)"), aValue ); |
|
1075 |
|
1076 if ( iControlsController ) |
|
1077 { |
|
1078 iControlsController->handleEvent( EMPXControlCmdSetVolume, aValue ); |
|
1079 } |
|
1080 |
|
1081 break; |
|
1082 } |
|
1083 case EPbPropertyMute: |
|
1084 { |
|
1085 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL mute(%d)"), aValue ); |
|
1086 |
|
1087 if ( iControlsController && aValue ) |
|
1088 { |
|
1089 iControlsController->handleEvent( EMPXControlCmdSetVolume, 0 ); |
|
1090 } |
|
1091 |
|
1092 break; |
|
1093 } |
|
1094 } |
|
1095 } |
|
1096 } |
|
1097 |
|
1098 // ------------------------------------------------------------------------------------------------- |
|
1099 // CMPXVideoViewWrapper::RetrieveFileNameAndModeL |
|
1100 // ------------------------------------------------------------------------------------------------- |
|
1101 // |
|
1102 void CMPXVideoViewWrapper::RetrieveFileNameAndModeL( CMPXCommand* aCmd ) |
|
1103 { |
|
1104 // |
|
1105 // set attributes on the command |
|
1106 // |
|
1107 aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1108 |
|
1109 aCmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1110 |
|
1111 aCmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
|
1112 EPbCmdInitView ); |
|
1113 |
|
1114 iPlaybackUtility->CommandL( *aCmd ); |
|
1115 } |
|
1116 |
|
1117 // ------------------------------------------------------------------------------------------------- |
|
1118 // CMPXVideoViewWrapper::ActivateClosePlayerActiveObject |
|
1119 // ------------------------------------------------------------------------------------------------- |
|
1120 // |
|
1121 void CMPXVideoViewWrapper::ActivateClosePlayerActiveObject() |
|
1122 { |
|
1123 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()")); |
|
1124 |
|
1125 if ( ! iCloseAO->IsActive() ) |
|
1126 { |
|
1127 iCloseAO->Start( TCallBack( CMPXVideoViewWrapper::ClosePlayerL, this ) ); |
|
1128 } |
|
1129 } |
|
1130 |
|
1131 // ------------------------------------------------------------------------------------------------- |
|
1132 // CMPXVideoViewWrapper::ClosePlayerL |
|
1133 // ------------------------------------------------------------------------------------------------- |
|
1134 // |
|
1135 TInt CMPXVideoViewWrapper::ClosePlayerL( TAny* aPtr ) |
|
1136 { |
|
1137 MPX_DEBUG(_L("CMPXVideoViewWrapper::ClosePlayerL()")); |
|
1138 |
|
1139 static_cast<CMPXVideoViewWrapper*>(aPtr)->DoClosePlayerL(); |
|
1140 return KErrNone; |
|
1141 } |
|
1142 |
|
1143 // ------------------------------------------------------------------------------------------------- |
|
1144 // CMPXVideoViewWrapper::DoClosePlayerL |
|
1145 // ------------------------------------------------------------------------------------------------- |
|
1146 // |
|
1147 void CMPXVideoViewWrapper::DoClosePlayerL() |
|
1148 { |
|
1149 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoClosePlayerL()")); |
|
1150 |
|
1151 iView->doClosePlayer(); |
|
1152 } |
|
1153 |
|
1154 // ------------------------------------------------------------------------------------------------- |
|
1155 // CMPXVideoViewWrapper::IssuePlayCommandL |
|
1156 // ------------------------------------------------------------------------------------------------- |
|
1157 // |
|
1158 void CMPXVideoViewWrapper::IssuePlayCommandL() |
|
1159 { |
|
1160 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssuePlayCommandL()")); |
|
1161 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
|
1162 } |
|
1163 |
|
1164 // ------------------------------------------------------------------------------------------------- |
|
1165 // CMPXVideoViewWrapper::RetrievePdlInformationL |
|
1166 // ------------------------------------------------------------------------------------------------- |
|
1167 // |
|
1168 void CMPXVideoViewWrapper::RetrievePdlInformationL() |
|
1169 { |
|
1170 MPX_DEBUG(_L("CMPXVideoViewWrapper::RetrievePdlInformationL()")); |
|
1171 } |
|
1172 |
|
1173 // ------------------------------------------------------------------------------------------------- |
|
1174 // CMPXVideoViewWrapper::CreateVideoSpecificCmdL() |
|
1175 // ------------------------------------------------------------------------------------------------- |
|
1176 // |
|
1177 void CMPXVideoViewWrapper::CreateVideoSpecificCmdL( TMPXVideoPlaybackCommand aCmd ) |
|
1178 { |
|
1179 // |
|
1180 // create command to pass to playback plugin |
|
1181 // |
|
1182 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1183 CleanupStack::PushL( cmd ); |
|
1184 |
|
1185 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1186 |
|
1187 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1188 |
|
1189 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, aCmd ); |
|
1190 |
|
1191 iPlaybackUtility->CommandL( *cmd ); |
|
1192 |
|
1193 CleanupStack::PopAndDestroy( cmd ); |
|
1194 } |
|
1195 |
|
1196 // ------------------------------------------------------------------------------------------------- |
|
1197 // CMPXVideoViewWrapper::SetAspectRatioL() |
|
1198 // ------------------------------------------------------------------------------------------------- |
|
1199 // |
|
1200 void CMPXVideoViewWrapper::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ) |
|
1201 { |
|
1202 MPX_DEBUG(_L("CMPXVideoViewWrapper::SetAspectRatioL()")); |
|
1203 |
|
1204 TInt newAspectRatio = iDisplayHandler->SetAspectRatioL( aCmd ); |
|
1205 |
|
1206 if ( iControlsController ) |
|
1207 { |
|
1208 iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio ); |
|
1209 } |
|
1210 } |
|
1211 |
|
1212 // ------------------------------------------------------------------------------------------------- |
|
1213 // CMPXVideoViewWrapper::IsAppInFrontL() |
|
1214 // Returns true if app is foreground. Uses windowgroup id |
|
1215 // ------------------------------------------------------------------------------------------------- |
|
1216 // |
|
1217 TBool CMPXVideoViewWrapper::IsAppInFrontL() |
|
1218 { |
|
1219 TBool ret = EFalse; |
|
1220 RWsSession wsSession; |
|
1221 |
|
1222 User::LeaveIfError( wsSession.Connect() ); |
|
1223 |
|
1224 if( wsSession.Handle() ) |
|
1225 { |
|
1226 CArrayFixFlat<TInt>* wgList = |
|
1227 new (ELeave) CArrayFixFlat<TInt>( wsSession.NumWindowGroups() ); |
|
1228 |
|
1229 // check if our window is front or not |
|
1230 if ( wsSession.WindowGroupList( 0, wgList ) == KErrNone ) |
|
1231 { |
|
1232 ret = ( CEikonEnv::Static()->RootWin().Identifier() == wgList->At(0) ); |
|
1233 } |
|
1234 else |
|
1235 { |
|
1236 ret = EFalse; |
|
1237 } |
|
1238 |
|
1239 delete wgList; |
|
1240 } |
|
1241 |
|
1242 wsSession.Close(); |
|
1243 |
|
1244 MPX_DEBUG(_L("CMPXVideoViewWrapper::IsAppInFrontL (%d)" ), ret); |
|
1245 |
|
1246 return ret; |
|
1247 } |
|
1248 |
|
1249 // ------------------------------------------------------------------------------------------------- |
|
1250 // CMPXVideoViewWrapper::ClosePlaybackViewL() |
|
1251 // ------------------------------------------------------------------------------------------------- |
|
1252 // |
|
1253 void CMPXVideoViewWrapper::ClosePlaybackViewL() |
|
1254 { |
|
1255 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::closePlaybackView()")); |
|
1256 |
|
1257 iView->closePlaybackView(); |
|
1258 } |
|
1259 |
|
1260 // ------------------------------------------------------------------------------------------------- |
|
1261 // CMPXVideoViewWrapper::HandleVolumeCmdL() |
|
1262 // ------------------------------------------------------------------------------------------------- |
|
1263 // |
|
1264 void CMPXVideoViewWrapper::HandleVolumeCmdL( TMPXPlaybackCommand aCmd ) |
|
1265 { |
|
1266 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandleVolumeCmdL()")); |
|
1267 |
|
1268 // |
|
1269 // In case user try to change the volume via media key, rocker key or etc |
|
1270 // We need to show the controls though the volume level doesn't get changed |
|
1271 // For examples : - try to change the volume with a clip without audio track |
|
1272 // - try to reduce the volume with volume level 0 |
|
1273 // - try to increase the volume with max volume level |
|
1274 // |
|
1275 iControlsController->handleEvent( EMPXControlCmdShowVolumeControls ); |
|
1276 |
|
1277 switch( aCmd ) |
|
1278 { |
|
1279 case EPbCmdDecreaseVolume: |
|
1280 { |
|
1281 CreateVideoSpecificCmdL( EPbCmdHandleDecreaseVolume ); |
|
1282 break; |
|
1283 } |
|
1284 case EPbCmdIncreaseVolume: |
|
1285 { |
|
1286 CreateVideoSpecificCmdL( EPbCmdHandleIncreaseVolume ); |
|
1287 break; |
|
1288 } |
|
1289 default: |
|
1290 { |
|
1291 iPlaybackUtility->CommandL( aCmd ); |
|
1292 break; |
|
1293 } |
|
1294 } |
|
1295 } |
|
1296 |
|
1297 // ------------------------------------------------------------------------------------------------- |
|
1298 // CMPXVideoViewWrapper::HandleShortPressBackwardL() |
|
1299 // ------------------------------------------------------------------------------------------------- |
|
1300 // |
|
1301 void CMPXVideoViewWrapper::HandleShortPressBackwardL() |
|
1302 { |
|
1303 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleShortPressBackwardL()")); |
|
1304 |
|
1305 if( !iPlaylistView ) |
|
1306 { |
|
1307 SetPropertyL( EPbPropertyPosition, 0 ); |
|
1308 } |
|
1309 } |
|
1310 |
|
1311 // ------------------------------------------------------------------------------------------------- |
|
1312 // CMPXVideoViewWrapper::IssueVideoAppForegroundCmd() |
|
1313 // ------------------------------------------------------------------------------------------------- |
|
1314 // |
|
1315 void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground ) |
|
1316 { |
|
1317 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL()"), |
|
1318 _L("aForeground = %d"), aForeground ); |
|
1319 |
|
1320 TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground; |
|
1321 |
|
1322 if ( aForeground ) |
|
1323 { |
|
1324 videoCmd = EPbCmdHandleForeground; |
|
1325 } |
|
1326 |
|
1327 // |
|
1328 // create command to pass to playback plugin |
|
1329 // |
|
1330 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1331 CleanupStack::PushL( cmd ); |
|
1332 |
|
1333 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1334 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1335 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, videoCmd ); |
|
1336 cmd->SetTObjectValueL<TBool>( KMPXMediaVideoAppForeground, IsAppInFrontL() ); |
|
1337 |
|
1338 iPlaybackUtility->CommandL( *cmd ); |
|
1339 CleanupStack::PopAndDestroy( cmd ); |
|
1340 } |
|
1341 |
|
1342 // ------------------------------------------------------------------------------------------------- |
|
1343 // CMPXVideoViewWrapper::CreateControlsL() |
|
1344 // ------------------------------------------------------------------------------------------------- |
|
1345 // |
|
1346 void CMPXVideoViewWrapper::CreateControlsL() |
|
1347 { |
|
1348 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::CreateControlsL()")); |
|
1349 |
|
1350 // |
|
1351 // Query playback plugin for filename and mode |
|
1352 // |
|
1353 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1354 CleanupStack::PushL( cmd ); |
|
1355 |
|
1356 RetrieveFileNameAndModeL( cmd ); |
|
1357 |
|
1358 // |
|
1359 // Create a temporary file details that is populated with the |
|
1360 // file name and playback mode. This will be delete when |
|
1361 // plugin initialization is complete |
|
1362 // |
|
1363 if ( iFileDetails ) |
|
1364 { |
|
1365 delete iFileDetails; |
|
1366 iFileDetails = NULL; |
|
1367 } |
|
1368 |
|
1369 iFileDetails = new QMPXVideoPlaybackViewFileDetails(); |
|
1370 |
|
1371 TPtrC fileName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) ); |
|
1372 const QString qFilename( (QChar*)fileName.Ptr(), fileName.Length() ); |
|
1373 iFileDetails->mClipName = qFilename; |
|
1374 |
|
1375 iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode ); |
|
1376 |
|
1377 iFileDetails->mTvOutConnected = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected ); |
|
1378 |
|
1379 TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) ); |
|
1380 const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() ); |
|
1381 iFileDetails->mMimeType = qMimeType; |
|
1382 |
|
1383 // |
|
1384 // get playlist information and set mMultiItemPlaylist flag |
|
1385 // |
|
1386 TInt numItems = 1; |
|
1387 MMPXSource* s = iPlaybackUtility->Source(); |
|
1388 |
|
1389 if ( s ) |
|
1390 { |
|
1391 CMPXCollectionPlaylist* playlist = NULL; |
|
1392 |
|
1393 MPX_TRAPD( err, playlist = s->PlaylistL() ); |
|
1394 |
|
1395 if ( err == KErrNone && playlist ) |
|
1396 { |
|
1397 iPlaylistView = ETrue; |
|
1398 numItems = playlist->Count(); |
|
1399 delete playlist; |
|
1400 } |
|
1401 } |
|
1402 |
|
1403 iFileDetails->mMultiItemPlaylist = ( numItems > 1 ); |
|
1404 |
|
1405 CleanupStack::PopAndDestroy( cmd ); |
|
1406 |
|
1407 if ( iControlsController ) |
|
1408 { |
|
1409 delete iControlsController; |
|
1410 iControlsController = NULL; |
|
1411 } |
|
1412 |
|
1413 iControlsController = new QMPXVideoPlaybackControlsController( iView, this, iFileDetails ); |
|
1414 } |
|
1415 |
|
1416 // ------------------------------------------------------------------------------------------------- |
|
1417 // CMPXVideoViewWrapper::IsMultiItemPlaylist() |
|
1418 // ------------------------------------------------------------------------------------------------- |
|
1419 // |
|
1420 TBool CMPXVideoViewWrapper::IsMultiItemPlaylist() |
|
1421 { |
|
1422 |
|
1423 bool multiLinks( false ); |
|
1424 |
|
1425 if ( iFileDetails ) |
|
1426 { |
|
1427 multiLinks = iFileDetails->mMultiItemPlaylist; |
|
1428 } |
|
1429 |
|
1430 MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist() ret %d"), multiLinks ); |
|
1431 |
|
1432 return multiLinks; |
|
1433 } |
|
1434 |
|
1435 // ------------------------------------------------------------------------------------------------- |
|
1436 // CMPXVideoViewWrapper::UpdateVideoRect() |
|
1437 // ------------------------------------------------------------------------------------------------- |
|
1438 // |
|
1439 void CMPXVideoViewWrapper::UpdateVideoRect( |
|
1440 TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect ) |
|
1441 { |
|
1442 MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRect()")); |
|
1443 |
|
1444 TRect rect( TPoint( aX, aY ), TSize( aWidth, aHeight ) ); |
|
1445 TRAP_IGNORE( iDisplayHandler->UpdateVideoRectL( rect, transitionEffect ) ); |
|
1446 } |
|
1447 |
|
1448 // ------------------------------------------------------------------------------------------------- |
|
1449 // CMPXVideoViewWrapper::UpdateVideoRectDone() |
|
1450 // ------------------------------------------------------------------------------------------------- |
|
1451 // |
|
1452 void CMPXVideoViewWrapper::UpdateVideoRectDone() |
|
1453 { |
|
1454 MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRectDone()")); |
|
1455 |
|
1456 iControlsController->updateVideoRectDone(); |
|
1457 } |
|
1458 |
|
1459 // EOF |
1487 // EOF |