equal
deleted
inserted
replaced
744 { |
744 { |
745 // Clear out any completed requests |
745 // Clear out any completed requests |
746 for ( TInt ii = 0 ; ii < iRequests.Count() ; ii++ ) |
746 for ( TInt ii = 0 ; ii < iRequests.Count() ; ii++ ) |
747 { |
747 { |
748 CReadWriteRequest* request = iRequests[ii]; |
748 CReadWriteRequest* request = iRequests[ii]; |
749 delete request; |
749 if(!request->Processing()) |
750 iRequests.Remove(ii); |
750 { |
751 ii--; |
751 delete request; |
|
752 iRequests.Remove(ii); |
|
753 ii--; |
|
754 } |
752 } |
755 } |
753 } |
756 } |
754 |
757 |
755 |
758 |
756 /** |
759 /** |
820 } |
823 } |
821 |
824 |
822 return iFile->SetAgentProperty(aProperty, aValue); |
825 return iFile->SetAgentProperty(aProperty, aValue); |
823 } |
826 } |
824 |
827 |
825 /* |
|
826 * Returns ETrue if the request can safely be deleted. |
|
827 */ |
|
828 TBool CReadWriteRequest::Completed() |
|
829 { |
|
830 return iCompleted ; |
|
831 } |
|
832 |
|
833 TInt CReadWriteRequest::SetStatus(TBool aStatus) |
|
834 { |
|
835 iCompleted = aStatus; |
|
836 return KErrNone; |
|
837 } |
|
838 |
828 |
839 TBool CReadWriteRequest::SourceType() |
829 TBool CReadWriteRequest::SourceType() |
840 { |
830 { |
841 return iSourceType ; |
831 return iSourceType ; |
842 } |
832 } |
897 /* |
887 /* |
898 * For the moment at least... Canceled requests may be deleted |
888 * For the moment at least... Canceled requests may be deleted |
899 */ |
889 */ |
900 void CReadWriteRequest::DoCancel() |
890 void CReadWriteRequest::DoCancel() |
901 { |
891 { |
902 iCompleted = ETrue ; |
892 iState = ECompleted; |
903 } |
893 } |
904 |
894 |
905 /* |
895 /* |
906 * Called when errors in RunL force Leave. For the moment just mark the request deletable |
896 * Called when errors in RunL force Leave. For the moment just mark the request deletable |
907 */ |
897 */ |
908 TInt CReadWriteRequest::RunError( TInt aError ) |
898 TInt CReadWriteRequest::RunError( TInt aError ) |
909 { |
899 { |
910 //RunL can leave. |
900 //RunL can leave. |
911 iCompleted = ETrue ; |
901 iState = ECompleted; |
912 iError = aError; //keep this error internally for now |
902 iError = aError; //keep this error internally for now |
913 return KErrNone ; |
903 return KErrNone ; |
914 } |
904 } |
915 |
905 |
916 /* |
906 /* |
917 * On completion of read request call back to the MDataSink |
907 * On completion of read request call back to the MDataSink |
918 */ |
908 */ |
919 void CReadRequest::RunL() |
909 void CReadRequest::RunL() |
920 { |
910 { |
|
911 iState = EProcessing; |
921 //Copy the data from the normal buffer into the Transfer buffer |
912 //Copy the data from the normal buffer into the Transfer buffer |
922 if(iTransferBufferCopy) |
913 if(iTransferBufferCopy) |
923 { |
914 { |
924 //must specify the size here as the dest may be smaller than the source. |
915 //must specify the size here as the dest may be smaller than the source. |
925 TDes8& destDesc = STATIC_CAST(CMMFDataBuffer*, iBuffer)->Data(); |
916 TDes8& destDesc = STATIC_CAST(CMMFDataBuffer*, iBuffer)->Data(); |
927 |
918 |
928 iTransferBufferCopy->SetInUse(EFalse); |
919 iTransferBufferCopy->SetInUse(EFalse); |
929 } |
920 } |
930 |
921 |
931 STATIC_CAST(CProgDLMultimediaSource*,iParent)->ReadRequestStatus(STATIC_CAST(CReadWriteRequest*,this),iStatus); |
922 STATIC_CAST(CProgDLMultimediaSource*,iParent)->ReadRequestStatus(STATIC_CAST(CReadWriteRequest*,this),iStatus); |
|
923 iState = ECompleted; |
932 } |
924 } |
933 |
925 |
934 // From CMultimediaDataSource begins |
926 // From CMultimediaDataSource begins |
935 TInt CProgDLMultimediaSource::SetObserver( MMultimediaDataSourceObserver& aObserver ) |
927 TInt CProgDLMultimediaSource::SetObserver( MMultimediaDataSourceObserver& aObserver ) |
936 { |
928 { |
1120 case EEXECUTING: |
1112 case EEXECUTING: |
1121 case EBUFFERING: |
1113 case EBUFFERING: |
1122 { |
1114 { |
1123 TInt pos = 0; |
1115 TInt pos = 0; |
1124 CancelRequests(); |
1116 CancelRequests(); |
|
1117 // Since the requests will not be deleted if it is still inside RunL() (iState is EProcessing), |
|
1118 // iReadRequestPending should not be initialized to 0 always |
|
1119 iReadRequestPending = iRequests.Count(); |
1125 delete iFile; |
1120 delete iFile; |
1126 iFile = NULL; |
1121 iFile = NULL; |
1127 //iDLFileSize = -1; |
1122 //iDLFileSize = -1; |
1128 iSnkBytes=pos; |
1123 iSnkBytes=pos; |
1129 iBufferedDataSize = 0; |
1124 iBufferedDataSize = 0; |
1691 break; |
1686 break; |
1692 } |
1687 } |
1693 } |
1688 } |
1694 } |
1689 } |
1695 |
1690 |
1696 aRequest->SetStatus(ETrue); |
|
1697 return KErrNone; |
1691 return KErrNone; |
1698 } |
1692 } |
1699 } |
1693 } |
1700 |
1694 |
1701 |
1695 |