mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/src/mpxprogressdownloadsb.cpp
equal
deleted
inserted
replaced
336 if ( EPbDlStateDownloadCompleted == iDownloadState ) |
336 if ( EPbDlStateDownloadCompleted == iDownloadState ) |
337 { |
337 { |
338 if ( iConsumeStarted ) |
338 if ( iConsumeStarted ) |
339 { |
339 { |
340 ConsumeRights( ContentAccess::EStop ); |
340 ConsumeRights( ContentAccess::EStop ); |
341 iConsumeStarted = EFalse; |
|
342 } |
341 } |
343 if ( !iFileSaved ) |
342 if ( !iFileSaved ) |
344 { |
343 { |
345 iDrmMediaUtility->Close(); // release file handle so we can move file. |
344 iDrmMediaUtility->Close(); // release file handle so we can move file. |
346 MoveDownloadedFileToMusicFolder(); |
345 MoveDownloadedFileToMusicFolder(); |
352 if ( EPbDlStateDownloadCompleted == iDownloadState ) |
351 if ( EPbDlStateDownloadCompleted == iDownloadState ) |
353 { |
352 { |
354 if ( iConsumeStarted ) |
353 if ( iConsumeStarted ) |
355 { |
354 { |
356 ConsumeRights( ContentAccess::EStop ); |
355 ConsumeRights( ContentAccess::EStop ); |
357 iConsumeStarted = EFalse; |
|
358 } |
356 } |
359 if ( !iFileSaved ) |
357 if ( !iFileSaved ) |
360 { |
358 { |
361 iDrmMediaUtility->Close(); // release file handle so we can move file. |
359 iDrmMediaUtility->Close(); // release file handle so we can move file. |
362 MoveDownloadedFileToMusicFolder(); |
360 MoveDownloadedFileToMusicFolder(); |
1019 iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused, 0, event->GetErrorCode()); |
1017 iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused, 0, event->GetErrorCode()); |
1020 } |
1018 } |
1021 else if ( event->GetErrorCode() == KErrEof ) // Playback Complete |
1019 else if ( event->GetErrorCode() == KErrEof ) // Playback Complete |
1022 { |
1020 { |
1023 MPX_DEBUG2("CMPXProgressDownloadSB::Event:EStateChanged[PlaybackComplete] errorcode=%d",event->GetErrorCode()); |
1021 MPX_DEBUG2("CMPXProgressDownloadSB::Event:EStateChanged[PlaybackComplete] errorcode=%d",event->GetErrorCode()); |
1024 if ( iDownloadState == EPbDlStateDownloadCompleted && !iFileSaved ) |
1022 if ( iDownloadState == EPbDlStateDownloadCompleted ) |
1025 { |
1023 { |
1026 if ( event->GetErrorCode() == KErrEof ) |
1024 ConsumeRights( ContentAccess::EStop ); |
|
1025 if (!iFileSaved) |
1027 { |
1026 { |
1028 ConsumeRights( ContentAccess::EStop ); |
1027 iDrmMediaUtility->Close(); |
1029 } |
1028 MoveDownloadedFileToMusicFolder(); |
1030 else |
1029 } |
1031 { |
1030 iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlayComplete, 0, KErrNone); |
1032 ConsumeRights( ContentAccess::EPause ); |
|
1033 } |
|
1034 MoveDownloadedFileToMusicFolder(); |
|
1035 } |
1031 } |
1036 } |
1032 } |
1037 else if ( event->GetErrorCode() == KErrDied || event->GetErrorCode() == KErrInUse || |
1033 else if ( event->GetErrorCode() == KErrDied || event->GetErrorCode() == KErrInUse || |
1038 event->GetErrorCode() == KErrAccessDenied ) |
1034 event->GetErrorCode() == KErrAccessDenied ) |
1039 { |
1035 { |
1092 } |
1088 } |
1093 break; |
1089 break; |
1094 case MStreamControl::BUFFERING: |
1090 case MStreamControl::BUFFERING: |
1095 MPX_DEBUG2("CMPXProgressDownloadSB::Event:EStateChanged[Buffering] errorcode= %d",event->GetErrorCode()); |
1091 MPX_DEBUG2("CMPXProgressDownloadSB::Event:EStateChanged[Buffering] errorcode= %d",event->GetErrorCode()); |
1096 iStreamBuffering = ETrue; |
1092 iStreamBuffering = ETrue; |
1097 if ( iDownloadState != EPbDlStateDownloadPaused || |
1093 if ( iDownloadState == EPbDlStateDownloading) |
1098 iDownloadState != EPbDlStateDownloadCanceled || |
|
1099 iDownloadState != EPbDlStateDownloadError || |
|
1100 iDownloadState != EPbDlStateNotDownloading |
|
1101 ) |
|
1102 { |
1094 { |
1103 iDownloadState = EPbDlStateBuffering; |
1095 iDownloadState = EPbDlStateBuffering; |
1104 } |
1096 } |
1105 iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused, 0, event->GetErrorCode()); |
1097 iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused, 0, event->GetErrorCode()); |
1106 iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPDownloadStateChanged, iDownloadState, KErrNone); |
1098 iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPDownloadStateChanged, iDownloadState, KErrNone); |
1274 iFileSaved = ETrue; |
1266 iFileSaved = ETrue; |
1275 } |
1267 } |
1276 } |
1268 } |
1277 |
1269 |
1278 TRAP_IGNORE( iDrmMediaUtility->InitL( *iPdPath )); |
1270 TRAP_IGNORE( iDrmMediaUtility->InitL( *iPdPath )); |
1279 iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlayComplete, 0, KErrNone); |
1271 // iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlayComplete, 0, KErrNone); |
1280 |
1272 |
1281 if ( !fileMoveError || fileMoveError == KErrAlreadyExists ) |
1273 if ( !fileMoveError || fileMoveError == KErrAlreadyExists ) |
1282 { |
1274 { |
1283 iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadFileMoved, (TInt)iPdPath, KErrNone); |
1275 iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadFileMoved, (TInt)iPdPath, KErrNone); |
1284 } |
1276 } |
1497 // CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolderL |
1489 // CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolderL |
1498 // ----------------------------------------------------------------------------- |
1490 // ----------------------------------------------------------------------------- |
1499 // |
1491 // |
1500 void CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolder() |
1492 void CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolder() |
1501 { |
1493 { |
|
1494 |
|
1495 MPX_DEBUG1("CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolder() entering"); |
|
1496 |
1502 if ( iFileSaved || iPdPath == NULL || |
1497 if ( iFileSaved || iPdPath == NULL || |
1503 ( (*iPdPath).Length() == 0 ) || |
1498 ( (*iPdPath).Length() == 0 ) || |
1504 iMAudioProgDLSource->GetDownloadStatus() == MProgDLSource::EDeleted ) |
1499 iMAudioProgDLSource->GetDownloadStatus() == MProgDLSource::EDeleted ) |
1505 { |
1500 { |
1506 return; |
1501 return; |
1507 } |
1502 } |
1508 |
1503 |
1509 MPX_DEBUG1("CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolder() entering"); |
|
1510 TParse parse; |
1504 TParse parse; |
1511 parse.Set(*iPdPath,NULL,NULL); |
1505 parse.Set(*iPdPath,NULL,NULL); |
1512 TPtrC drive = parse.Drive(); |
1506 TPtrC drive = parse.Drive(); |
1513 |
1507 |
1514 iMovedFileName.Copy(drive); |
1508 iMovedFileName.Copy(drive); |
1536 MPX_DEBUG2("-->CMPXProgressDownloadSB::ConsumeRights(%d)", aIntent); |
1530 MPX_DEBUG2("-->CMPXProgressDownloadSB::ConsumeRights(%d)", aIntent); |
1537 if ( iDrmCustomCommand ) |
1531 if ( iDrmCustomCommand ) |
1538 { |
1532 { |
1539 switch ( aIntent ) |
1533 switch ( aIntent ) |
1540 { |
1534 { |
|
1535 case ContentAccess::EStop: |
|
1536 { |
|
1537 iPlaying = EFalse; |
|
1538 iConsumeStarted = EFalse; |
|
1539 break; |
|
1540 } |
1541 case ContentAccess::EPlay: |
1541 case ContentAccess::EPlay: |
1542 case ContentAccess::EStop: |
1542 { |
|
1543 iPlaying = ETrue; |
|
1544 break; |
|
1545 } |
1543 case ContentAccess::EPause: |
1546 case ContentAccess::EPause: |
1544 case ContentAccess::EContinue: |
1547 case ContentAccess::EContinue: |
1545 { |
1548 { |
1546 break; |
1549 break; |
1547 } |
1550 } |
1550 aIntent = ContentAccess::EUnknown; |
1553 aIntent = ContentAccess::EUnknown; |
1551 iConsumeStarted = EFalse; |
1554 iConsumeStarted = EFalse; |
1552 break; |
1555 break; |
1553 } |
1556 } |
1554 } |
1557 } |
1555 MPX_DEBUG2("-->CMPXProgressDownloadSB::ConsumeRights(): Executing intent %d", aIntent); |
1558 MPX_DEBUG2("-->CMPXProgressDownloadSB::ConsumeRights(): EvaluateIntent intent %d", aIntent); |
1556 iDrmCustomCommand->ExecuteIntent(aIntent); |
1559 if (iDrmCustomCommand->EvaluateIntent(aIntent) == KErrNone) |
|
1560 { |
|
1561 MPX_DEBUG2("-->CMPXProgressDownloadSB::ConsumeRights(): Executing intent %d", aIntent); |
|
1562 iDrmCustomCommand->ExecuteIntent(aIntent); |
|
1563 } |
1557 } |
1564 } |
1558 MPX_DEBUG2("<--CMPXProgressDownloadSB::ConsumeRights(%d)", aIntent); |
1565 MPX_DEBUG2("<--CMPXProgressDownloadSB::ConsumeRights(%d)", aIntent); |
1559 } |
1566 } |
1560 |
1567 |
1561 // End of file |
1568 // End of file |