# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273585232 -10800 # Node ID f56ec6ce2732c08dfb771ff3be93add4dc88e857 # Parent 4740b34b83ce6f541dacbfc3dd25415cb002baa2 Revision: 201017 Kit: 201019 diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/harvester/filehandler/src/mpxharvesterdbmanager.cpp --- a/mmappcomponents/harvester/filehandler/src/mpxharvesterdbmanager.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/harvester/filehandler/src/mpxharvesterdbmanager.cpp Tue May 11 16:40:32 2010 +0300 @@ -211,6 +211,7 @@ TInt index = FindDatabaseIndex ( aDrive ); if ( index == KErrNotFound ) { + index = iDatabases.Count(); db = CMPXHarvesterDB::NewL( aDrive, iFs ); CleanupStack::PushL( db ); iDatabases.AppendL( db ); @@ -407,8 +408,7 @@ void CMPXHarvesterDatabaseManager::RecreateDatabases() { MPX_DEBUG1("CMPXHarvesterDatabaseManager::RecreateDatabases <--"); - TInt count( iDatabases.Count() ); - for( TInt i=0; iDes().Append( mimeType ); // Continue to extract metadata even if fail. - TRAPD( metadataerror, iMetadataUtility->OpenFileL( iFile, *mimeType8 ) ); - MPX_DEBUG2("CMPXMetadataExtractor::CreateMediaL, error %d parsing metadata", - metadataerror ); + MPX_TRAPD( metadataerror, iMetadataUtility->OpenFileL( iFile, *mimeType8 ) ); CleanupStack::PopAndDestroy( mimeType8 ); + // Get MetadataUtility Container const CMetaDataFieldContainer& metaCont = iMetadataUtility->MetaDataFieldsL(); + + // Get DRM data + // Need the protected flag from metadataUtility Container + MPX_TRAPD( drmerror, SetDrmMediaPropertiesL( metaCont ) ); + MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, result=%d getting drm data", + drmerror ); + + // Get metadata fields TInt count( metaCont.Count() ); for( TInt i=0; iValueText( KMPXMediaGeneralMimeType ); - MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, mimeType = %S", &mimeType); + MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL, mimeType = %S", &mimeType); // Verify if WMA, get the duration if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) @@ -450,68 +457,6 @@ { MPX_FUNC("CMPXMetadataExtractor::SetExtMediaPropertiesL()"); - // DB Flags to set - // - TUint dbFlags(KMPXMediaGeneralFlagsSetOrUnsetBit); - - // File Path - // - TParsePtrC parse( iFileName ); - iMedia->SetTextValueL( KMPXMediaGeneralUri, iFileName ); - iMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); - - // DRM Rights - // - CMPXMedia* drm = NULL; - TRAPD( drmError, iDrmMediaUtility->InitL( iFileName ); - drm = CMPXMedia::NewL( *iDrmMediaUtility->GetMediaL( KMPXMediaDrmProtected.iAttributeId | - KMPXMediaDrmRightsStatus.iAttributeId ) ); - ); - - TBool prot(EFalse); - if( drm ) - { - CleanupStack::PushL( drm ); - MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL -- is a drm file"); - if( drm->IsSupported( KMPXMediaDrmProtected ) ) - { - prot = drm->ValueTObjectL( KMPXMediaDrmProtected ); - MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL protected %i", prot); - } - - TMPXMediaDrmRightsStatus status(EMPXDrmRightsFull); - if( drm->IsSupported( KMPXMediaDrmRightsStatus ) ) - { - status = drm->ValueTObjectL(KMPXMediaDrmRightsStatus); - iMedia->SetTObjectValueL(KMPXMediaDrmRightsStatus, status ); - MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL -- status %i", status); - } - - // Set DB flags - dbFlags |= KMPXMediaGeneralFlagsIsDrmProtected; - if( status != EMPXDrmRightsFull && status != EMPXDrmRightsRestricted && status != EMPXDrmRightsPreview ) - { - dbFlags |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid; - } - CleanupStack::PopAndDestroy( drm ); - } - - // Trapped PV DRM error. If -46, we know the file has no rights - // - if( drmError == KErrPermissionDenied ) - { - dbFlags |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid; - } - else - { - User::LeaveIfError( drmError ); - } - - iMedia->SetTObjectValueL( KMPXMediaDrmProtected, prot ); - iMedia->SetTObjectValueL( KMPXMediaMTPDrmStatus, (TUint16)prot ); - - iDrmMediaUtility->Close(); - // // File Size --- The following needs MMF support // @@ -520,6 +465,8 @@ { const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType ); MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, mimeType = %S", &mimeType); + iFile.Size( size ); + iMedia->SetTObjectValueL( KMPXMediaGeneralSize, size ); // Verify if WMA, skip getting info from MMF if( mimeType.Compare(KWmaMimeType) == 0 || mimeType.Compare(KWmaCafMimeType) == 0 ) @@ -530,14 +477,11 @@ else { MPX_DEBUG1("CMPXMetadataExtractor::SetExtMediaPropertiesL, get MMF controller"); - iFile.Size( size ); - iMedia->SetTObjectValueL( KMPXMediaGeneralSize, size ); - // Duration, bitrate, samplerate, etc // if( !iMetadataOnly ) { - TRAPD(err2, iFileInfoUtil->OpenFileL( + MPX_TRAPD(err2, iFileInfoUtil->OpenFileL( iFile, iMedia->ValueText(KMPXMediaGeneralMimeType))); MPX_DEBUG2("CMPXMetadataExtractor::SetExtMediaPropertiesL, file info util error %i", err2); @@ -558,14 +502,6 @@ } } } - else if( iFileOpenError == KErrNotFound || iFileOpenError == KErrPathNotFound ) - { - dbFlags |= KMPXMediaGeneralFlagsIsInvalid; - } - // Finally set the db flag - // - iMedia->SetTObjectValueL( KMPXMediaGeneralFlags, - dbFlags ); } // --------------------------------------------------------------------------- @@ -697,15 +633,37 @@ TPtrC ext( parse.Ext() ); if (ext.CompareF(KNonEmbeddedArtExt)== 0) { - #ifdef RD_MPX_TNM_INTEGRATION +#ifdef RD_MPX_TNM_INTEGRATION + //check if can send TN request, If thumbnail creation is ongoing, wait til it is done CheckBeforeSendRequest(); - CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( - path, KImageFileType ); - TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); - iArrayTNRequestId.Append( tnId ); - CleanupStack::PopAndDestroy( source ); - #endif // RD_MPX_TNM_INTEGRATION + + CThumbnailObjectSource* source( NULL ); + if (aMedia->IsSupported(KMPXMediaMTPSampleData)) + { + TBuf<20> mimeType(KImageFileType); + TInt sampleData = aMedia->ValueTObjectL(KMPXMediaMTPSampleData); + HBufC8* value8 = ((HBufC8*)sampleData)->Des().AllocLC(); // make a local copy of sampleData + source = CThumbnailObjectSource::NewLC( + value8, mimeType, path ); // give up ownership of value8 + + MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from buffer"); + TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); + iArrayTNRequestId.Append( tnId ); + CleanupStack::PopAndDestroy( source ); + CleanupStack::Pop( value8 ); + } + else + { + source = CThumbnailObjectSource::NewLC( + path, KImageFileType ); + + MPX_DEBUG1("CMPXMetadataExtractor::ExtractAlbumArtL source created from path"); + TThumbnailRequestId tnId = iTNManager->CreateThumbnails( *source ); + iArrayTNRequestId.Append( tnId ); + CleanupStack::PopAndDestroy( source ); + } +#endif // RD_MPX_TNM_INTEGRATION } else { @@ -722,12 +680,12 @@ MPX_DEBUG2("CMPXMetadataExtractor::ExtractAlbumArtL MimeType:%S ", &mimeType ); HBufC8* mimeType8 = HBufC8::NewLC( mimeType.Length() ); mimeType8->Des().Append( mimeType ); - TRAP( err, iMetadataUtility->OpenFileL( path, wantedFields, *mimeType8 ) ); + MPX_TRAP( err, iMetadataUtility->OpenFileL( path, wantedFields, *mimeType8 ) ); CleanupStack::PopAndDestroy( mimeType8 ); } else { - TRAP( err, iMetadataUtility->OpenFileL( path, wantedFields ) ); + MPX_TRAP( err, iMetadataUtility->OpenFileL( path, wantedFields ) ); } CleanupStack::PopAndDestroy( &wantedFields ); @@ -735,7 +693,7 @@ { //check if can send TN request, If thumbnail creation is ongoing, wait til it is done CheckBeforeSendRequest(); - TRAP( err, AddMediaAlbumArtL( *aMedia, path )); + MPX_TRAP( err, AddMediaAlbumArtL( *aMedia, path )); } // Reset the utility @@ -763,7 +721,7 @@ MPX_DEBUG1("CMPXMetadataExtractor::GetMediaAlbumArtL(): Album art exist."); #ifdef RD_MPX_TNM_INTEGRATION HBufC8* value8 = NULL; - TRAPD( err, value8 = data8.AllocL() ); + MPX_TRAPD( err, value8 = data8.AllocL() ); if ( KErrNone != err ) { MPX_DEBUG2("CMPXMetadataExtractor::GetMediaAlbumArtL - error jpeg = %i", err); @@ -1019,11 +977,14 @@ iArrayTasks.Reset(); if ( iFileOpenError == KErrNone ) { + // to avoid resources contention (i.e. accessing sql, file system, etc) + // Ordering the tasks - so no multiple tasks run at the same time + // put the longest running task at the last (i.e. thumbnailing) iArrayTasks.AppendL(ETaskCreateMedia); - iArrayTasks.AppendL(ETaskAddMetadata); + iArrayTasks.AppendL(ETaskAddExtMetadata); // Get the MMF first + iArrayTasks.AppendL(ETaskAddMetadata); // Get metadata & maybe drm data iArrayTasks.AppendL(ETaskCheckBeforeSend); - iArrayTasks.AppendL(ETaskAddAlbumArt); - iArrayTasks.AppendL(ETaskAddExtMetadata); + iArrayTasks.AppendL(ETaskAddAlbumArt); // Get album art / thumbnail last } else { @@ -1055,7 +1016,7 @@ iTaskTimer->Cancel(); // execute task at index 0 - TRAPD( error, ExecuteTaskL() ); + MPX_TRAPD( error, ExecuteTaskL() ); if ( error || iCancelled ) { // cleanup @@ -1102,3 +1063,106 @@ iFile.Close(); } + +// --------------------------------------------------------------------------- +// Sets DRRM media properties not returned by metadata utilities +// --------------------------------------------------------------------------- +// +void CMPXMetadataExtractor::SetDrmMediaPropertiesL(const CMetaDataFieldContainer& aMetaCont) + { + MPX_FUNC("CMPXMetadataExtractor::SetDrmMediaPropertiesL()"); + + TBool prot(EFalse); + // DB Flags to set + TUint dbFlags(KMPXMediaGeneralFlagsSetOrUnsetBit); + // Validate the objects to be used + MPX_ASSERT(iMedia); + MPX_ASSERT(iDrmMediaUtility); + + // File Path + TParsePtrC parse( iFileName ); + iMedia->SetTextValueL( KMPXMediaGeneralUri, iFileName ); + iMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); + MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL - Filename=%S", &iFileName); + + // get the protected flag from MetadataUtility Container + TPtrC ptr = aMetaCont.Field( EMetaDataProtected ); + MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL -- status=%S", &ptr); + _LIT( KNonProtected, "0" ); + if ( ptr.Compare( KNonProtected ) == 0 ) + { + // this is non-protected file + // prot = EFalse + MPX_DEBUG1("CMPXMetadataExtractor::SetDrmMediaPropertiesL - non protected"); + iMedia->SetTObjectValueL( KMPXMediaDrmProtected, prot ); + iMedia->SetTObjectValueL( KMPXMediaMTPDrmStatus, (TUint16)prot ); + } + else + { // DRM file + + // DRM Rights + // + CMPXMedia* drm = NULL; + MPX_TRAPD( drmError, iDrmMediaUtility->InitL( iFileName ); + drm = CMPXMedia::NewL( *iDrmMediaUtility->GetMediaL( KMPXMediaDrmProtected.iAttributeId | + KMPXMediaDrmRightsStatus.iAttributeId ) ); + ); + + TBool prot(EFalse); + if( drm ) + { + CleanupStack::PushL( drm ); + MPX_DEBUG1("CMPXMetadataExtractor::SetDrmMediaPropertiesL -- is a drm file"); + if( drm->IsSupported( KMPXMediaDrmProtected ) ) + { + prot = drm->ValueTObjectL( KMPXMediaDrmProtected ); + MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL protected %i", prot); + } + + TMPXMediaDrmRightsStatus status(EMPXDrmRightsFull); + if( drm->IsSupported( KMPXMediaDrmRightsStatus ) ) + { + status = drm->ValueTObjectL(KMPXMediaDrmRightsStatus); + iMedia->SetTObjectValueL(KMPXMediaDrmRightsStatus, status ); + MPX_DEBUG2("CMPXMetadataExtractor::SetDrmMediaPropertiesL -- status %i", status); + } + + // Set DB flags + dbFlags |= KMPXMediaGeneralFlagsIsDrmProtected; + if( status != EMPXDrmRightsFull && status != EMPXDrmRightsRestricted && status != EMPXDrmRightsPreview ) + { + dbFlags |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid; + } + CleanupStack::PopAndDestroy( drm ); + } + + // Trapped PV DRM error. If -46, we know the file has no rights + // + if( drmError == KErrPermissionDenied ) + { + dbFlags |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid; + } + else + { + User::LeaveIfError( drmError ); + } + + iMedia->SetTObjectValueL( KMPXMediaDrmProtected, prot ); + iMedia->SetTObjectValueL( KMPXMediaMTPDrmStatus, (TUint16)prot ); + + iDrmMediaUtility->Close(); + + } // DRM file + + + // verify the file open status + if( iFileOpenError == KErrNotFound || iFileOpenError == KErrPathNotFound ) + { + dbFlags |= KMPXMediaGeneralFlagsIsInvalid; + } + + // Finally set the db flag + // + iMedia->SetTObjectValueL( KMPXMediaGeneralFlags, dbFlags ); + + } diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/harvester/server/src/mpxharvesterserver.cpp --- a/mmappcomponents/harvester/server/src/mpxharvesterserver.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/harvester/server/src/mpxharvesterserver.cpp Tue May 11 16:40:32 2010 +0300 @@ -119,7 +119,7 @@ { iEngine = CMPXHarvesterEngine::NewL(); StartL(KMPXHarvesterServerName); - RProcess().SetPriority(::EPriorityLow); + RProcess().SetPriority(::EPriorityBackground); } // ---------------------------------------------------------------------------- diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadataaccesswrapper.h --- a/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadataaccesswrapper.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadataaccesswrapper.h Tue May 11 16:40:32 2010 +0300 @@ -165,9 +165,10 @@ /** * Updated Music DB + * @param aStorageRoot, the root path of storage * @return void */ - IMPORT_C void UpdateMusicCollectionL(); + IMPORT_C void UpdateMusicCollectionL( const TDesC& aStorageRoot ); /* * Called when the MTP session is initialised @@ -229,7 +230,7 @@ MMTPDataProviderFramework& iFramework; RFs& iFs; // should not remove this member data!!! - TInt iOpenCount; // introduce to fix CollectionHelper Flush problem + TInt iOpenCount; // introduce to fix CollectionHelper Flush problem CDesCArray* iAbstractMediaArray; diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatampxaccess.h --- a/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatampxaccess.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpmetadatampxaccess.h Tue May 11 16:40:32 2010 +0300 @@ -213,6 +213,7 @@ TBuf iStoreRoot; MMPXCollectionHelper* iCollectionHelper; + HBufC8* iSampleData; #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) CMmMtpDpPerfLog* iPerfLog; diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpperflog.inl --- a/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpperflog.inl Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/inc/cmmmtpdpperflog.inl Tue May 11 16:40:32 2010 +0300 @@ -72,7 +72,7 @@ VA_START( list, aFmt ); HBufC* buf = HBufC::New( KMtpLogBufferSize ); - if ( buf ) + if ( buf != NULL ) { buf->Des().AppendFormatList( aFmt, list, &iOverflowHandler ); Write( *buf ); diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/inc/mmmtpdpfiledefs.h --- a/mmappcomponents/mmmtpdataprovider/inc/mmmtpdpfiledefs.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/inc/mmmtpdpfiledefs.h Tue May 11 16:40:32 2010 +0300 @@ -47,29 +47,29 @@ _LIT( KTxtExtensionPLA, ".pla" ); _LIT( KTxtExtensionVIR, ".vir" ); // virtual playlist from MPX -_LIT(KFormatExtensionMP3, "0x3009:mp3"); -_LIT(KFormatExtensionWMA, "0xb901:wma"); -_LIT(KFormatExtensionMP4, "0xb982:mp4"); -_LIT(KFormatExtension3GP, "0xb984:3gp"); -_LIT(KFormatExtension3G2, "0xb984:3g2"); -_LIT(KFormatExtensionAAC, "0xb903:aac"); -_LIT(KFormatExtensionWAV, "0x3008:wav"); -_LIT(KFormatExtensionWMV, "0xb981:wmv"); -_LIT(KFormatExtensionASF, "0x300c:asf"); +_LIT(KFormatExtensionMP3, "0x3009:mp3::3"); +_LIT(KFormatExtensionWMA, "0xb901:wma::3"); +_LIT(KFormatExtensionMP4, "0xb982:mp4::3"); +_LIT(KFormatExtension3GP, "0xb984:3gp::3"); +_LIT(KFormatExtension3G2, "0xb984:3g2::3"); +_LIT(KFormatExtensionAAC, "0xb903:aac::3"); +_LIT(KFormatExtensionWAV, "0x3008:wav::3"); +_LIT(KFormatExtensionWMV, "0xb981:wmv::3"); +_LIT(KFormatExtensionASF, "0x300c:asf::3"); //ODF container -_LIT(KFormatExtensionODFAudio3GPP, "0xB984:ODF:audio/3gpp"); -_LIT(KFormatExtensionODFVideo3GPP, "0xB984:ODF:video/3gpp"); +_LIT(KFormatExtensionODFAudio3GPP, "0xB984:ODF:audio/3gpp:3"); +_LIT(KFormatExtensionODFVideo3GPP, "0xB984:ODF:video/3gpp:3"); -_LIT(KFormatExtensionM4A, "0xB982:m4a"); -_LIT(KFormatExtensionO4A, "0xB984:o4a"); -_LIT(KFormatExtensionO4V, "0xB984:o4v"); +_LIT(KFormatExtensionM4A, "0xB982:m4a::3"); +_LIT(KFormatExtensionO4A, "0xB984:o4a::3"); +_LIT(KFormatExtensionO4V, "0xB984:o4v::3"); //Abstract Album -_LIT(KFormatExtensionALB, "0xBA03:alb"); +_LIT(KFormatExtensionALB, "0xBA03:alb::3"); //Playlists -_LIT(KFormatExtensionM3U, "0xba11:m3u"); +_LIT(KFormatExtensionM3U, "0xba11:m3u::3"); _LIT(KFormatExtensionPLA, "0xBA05:pla"); _LIT(KFormatExtensionVIR, "0xBA05:vir"); //abstract audio & video playlist 0xBA05 //-------------------------------------------------------------------------------------------- diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderenumerator.h --- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderenumerator.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/inc/cabstractmediamtpdataproviderenumerator.h Tue May 11 16:40:32 2010 +0300 @@ -20,7 +20,6 @@ #define CABSTRACTMEDIAMTPDATAPROVIDERENUMERATOR_H #include -#include #include "mmmtpenumerationcallback.h" #include "cmmmtpdpperflog.h" @@ -29,8 +28,6 @@ class MMTPDataProviderFramework; class MMTPObjectMgr; class CAbstractMediaMtpDataProvider; -class CMTPObjectMetaData; -class CMmMtpDpMetadataAccessWrapper; class CMPXMediaArray; /** @@ -77,6 +74,7 @@ enum TEnumState { + EEnumNone, EEnumPlaylist, EEnumAbstractAlbum, EEnumCount @@ -128,12 +126,8 @@ /** Provides Callback mechanism for completion of enumeration*/ CAbstractMediaMtpDataProvider& iDataProvider; - TParse iPath; - TEntryArray iEntries; - TInt iFirstUnprocessed; RArray iStorages; TUint32 iStorageId; - TUint32 iParentHandle; CMPXMediaArray* iAbstractMedias; TInt iCount; diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderenumerator.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderenumerator.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataproviderenumerator.cpp Tue May 11 16:40:32 2010 +0300 @@ -25,13 +25,11 @@ #include #include -#include "abstractmediamtpdataproviderconst.h" #include "cabstractmediamtpdataproviderenumerator.h" #include "cabstractmediamtpdataprovider.h" #include "mmmtpdplogger.h" #include "mmmtpdputility.h" #include "cmmmtpdpmetadataaccesswrapper.h" -#include "cmmmtpdpmetadatampxaccess.h" const TInt KMTPDriveGranularity = 5; @@ -82,7 +80,7 @@ iAbstractMedias( NULL ), iCount( 0 ), iCurrentIndex( 0 ), - iEnumState ( EEnumPlaylist ) + iEnumState ( EEnumNone ) { PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::CAbstractMediaMtpDataProviderEnumerator, iDataProviderId = %d" ), iDataProviderId ); } @@ -150,9 +148,9 @@ } CleanupStack::PopAndDestroy( &storages ); // - storages } - else if ( aStorageId != KMTPNotSpecified32 ) + else if ( aStorageId != KMTPNotSpecified32 + && storageMgr.ValidStorageId( aStorageId ) ) { - __ASSERT_DEBUG( storageMgr.ValidStorageId( aStorageId ), User::Invariant() ); const CMTPStorageMetaData& storage( storageMgr.StorageL( aStorageId ) ); if ( storage.Uint( CMTPStorageMetaData::EStorageSystemType ) == @@ -181,11 +179,7 @@ // keep in mind for notification when enumeration complete iStorageId = aStorageId; - iEnumState = EEnumPlaylist; - if ( iStorages.Count() > 0 ) - { - InitStorageL(); - } + iEnumState = EEnumNone; ScanNextL(); PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::StartL" ) ); @@ -269,42 +263,41 @@ // void CAbstractMediaMtpDataProviderEnumerator::ScanNextL() { - while ( iStorages.Count() > 0 ) + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderEnumerator::ScanNextL" ) ); + + if ( iCurrentIndex >= iCount ) { - while ( iEnumState < EEnumCount ) + iEnumState++; + } + + if ( iEnumState >= EEnumCount ) + { + iEnumState = EEnumPlaylist; + iStorages.Remove( 0 ); + } + + if ( iStorages.Count() > 0 ) + { + if( iCurrentIndex >= iCount ) { - if ( iCurrentIndex < iCount ) - { - TRequestStatus* status = &iStatus; - User::RequestComplete( status, iStatus.Int() ); - SetActive(); - PRINT2( _L( "MM MTP <> Current storage is still being scanned, current index = %d, total AbstractMedia count = %d" ), - iCurrentIndex, - iCount ); - return; - } - ++iEnumState; - if ( iEnumState == EEnumCount ) - { - break; - } InitStorageL(); } - iStorages.Remove( 0 ); - if ( iStorages.Count() == 0 ) - { - break; - } - iEnumState = EEnumPlaylist; - InitStorageL(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); } - // We are done - PRINT( _L( "MM MTP <> Objects enumeration completed" ) ); - delete iAbstractMedias; - iAbstractMedias = NULL; - iStorages.Reset(); - SignalCompleteL( iDataProvider ); + else + { + // We are done + PRINT( _L( "MM MTP <> Objects enumeration completed" ) ); + delete iAbstractMedias; + iAbstractMedias = NULL; + iStorages.Reset(); + SignalCompleteL( iDataProvider ); + } + + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::ScanNextL" ) ); } // ----------------------------------------------------------------------------- @@ -314,43 +307,56 @@ // void CAbstractMediaMtpDataProviderEnumerator::RunL() { - // insert all abstract medias into handle db of framework - CMPXMedia* media = ( *iAbstractMedias )[iCurrentIndex]; - - // Increase the index first in case of leave - iCurrentIndex++; - TMPXGeneralCategory category = ( iEnumState == EEnumPlaylist ) ? EMPXPlaylist : EMPXAbstractAlbum; - HBufC* abstractMedia = iDataProvider.GetWrapperL().GetAbstractMediaNameL( media, category ); - CleanupStack::PushL( abstractMedia ); // + abstractMedia - TBool ret = ETrue; - if ( iEnumState == EEnumAbstractAlbum ) + PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderEnumerator::RunL" ) ); + if ( iCurrentIndex < iCount ) { - //The abstract album may be removed, check it first - ret = BaflUtils::FileExists( iFramework.Fs(), *abstractMedia ); - PRINT2( _L( "MM MTP <> BaflUtils::FileExists( RFs,%S ) ret = %d" ), abstractMedia, ret ); + PRINT2( _L( "MM MTP <> Current storage is still being scanned, current index = %d, total AbstractMedia count = %d" ), + iCurrentIndex, + iCount ); + // insert all abstract medias into handle db of framework + CMPXMedia* media = ( *iAbstractMedias )[iCurrentIndex]; + + // Increase the index first in case of leave + iCurrentIndex++; + TMPXGeneralCategory category = ( iEnumState == EEnumPlaylist ) ? EMPXPlaylist : EMPXAbstractAlbum; + HBufC* abstractMedia = iDataProvider.GetWrapperL().GetAbstractMediaNameL( media, category ); + CleanupStack::PushL( abstractMedia ); // + abstractMedia + + TBool ret = ETrue; + if ( iEnumState == EEnumAbstractAlbum ) + { + // The abstract album may be removed, check it first + ret = BaflUtils::FileExists( iFramework.Fs(), *abstractMedia ); + PRINT2( _L( "MM MTP <> BaflUtils::FileExists( RFs,%S ) ret = %d" ), abstractMedia, ret ); + } + else // EEnumPlaylist + { + // Add an object to the object store for DB based playlist + AddEntryL( *abstractMedia ); + } + + if ( ret ) + { + PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::RunL abstractMedia=%S" ), abstractMedia ); + + // find all reference of each abstract media + CDesCArray* references = new ( ELeave ) CDesCArrayFlat( KMTPDriveGranularity ); + CleanupStack::PushL( references ); // + references + + PERFLOGSTART( KMpxQueryAbstractMediaReference ); + iDataProvider.GetWrapperL().GetAllReferenceL( media, *references ); + PERFLOGSTOP( KMpxQueryAbstractMediaReference ); + + // insert references into reference db + AddReferencesL( *abstractMedia, *references ); + + CleanupStack::PopAndDestroy( references ); // - references + } + CleanupStack::PopAndDestroy( abstractMedia ); // - abstractMedia } - if ( ret ) - { - PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::RunL abstractMedia=%S" ), abstractMedia ); - AddEntryL( *abstractMedia ); - - // find all reference of each abstract media - CDesCArray* references = new ( ELeave ) CDesCArrayFlat( KMTPDriveGranularity ); - CleanupStack::PushL( references ); // + references - - PERFLOGSTART( KMpxQueryAbstractMediaReference ); - iDataProvider.GetWrapperL().GetAllReferenceL( media, *references ); - PERFLOGSTOP( KMpxQueryAbstractMediaReference ); - - // insert references into reference db - AddReferencesL( *abstractMedia, *references ); - - CleanupStack::PopAndDestroy( references ); // - references - } - CleanupStack::PopAndDestroy( abstractMedia ); // - abstractMedia - ScanNextL(); + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::RunL" ) ); } // ----------------------------------------------------------------------------- @@ -363,6 +369,7 @@ if ( aError != KErrNone ) PRINT1( _L( "MM MTP <> CAbstractMediaMtpDataProviderEnumerator::RunError with error %d" ), aError ); + TRAP_IGNORE( SignalCompleteL( iDataProvider ) ); return KErrNone; } @@ -427,24 +434,34 @@ if ( parentHandle != KMTPHandleNone ) { - object->SetUint( CMTPObjectMetaData::EParentHandle, parentHandle ); - - PERFLOGSTART( KObjectManagerInsert ); - iObjectMgr.InsertObjectL( *object ); - PERFLOGSTOP( KObjectManagerInsert ); + // Handle .m3u playlist like abstract playlist in two situations: + // 1. The .m3u file is not on the file system. + // 2. The .m3u file is hidden and 0 size + TBool add = ETrue; + if ( format == EMTPFormatCodeM3UPlaylist ) + { + TEntry entry; + TInt err = iFramework.Fs().Entry( aSuid, entry ); + add = ( err != KErrNone) || ( entry.iSize == 0 && entry.IsHidden() ); + } - CleanupStack::PopAndDestroy( object );// - object + if ( add ) + { + object->SetUint( CMTPObjectMetaData::EParentHandle, parentHandle ); - //Only remember the playlist file for clean up - if( iEnumState == EEnumPlaylist ) - { + PERFLOGSTART( KObjectManagerInsert ); + iObjectMgr.InsertObjectL( *object ); + PERFLOGSTOP( KObjectManagerInsert ); + + //Create the dummy file on file system iDataProvider.GetWrapperL().CreateDummyFile( aSuid ); - // remember the abstract media file for clean up iDataProvider.GetWrapperL().AddDummyFileL( aSuid ); } } + CleanupStack::PopAndDestroy( object );// - object + PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderEnumerator::AddEntryL" ) ); } diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataproviderdescriptionutility.h --- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataproviderdescriptionutility.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataproviderdescriptionutility.h Tue May 11 16:40:32 2010 +0300 @@ -51,6 +51,13 @@ CMTPTypeObjectPropDesc* NewSpecificPropDescL( TUint aFormatCode, TUint16 aPropCode ); private: + + /** + * Append WM Audio specific to interdpendent property description. + * @return None + */ + void AppendWMAudioInterdepentPropDescL(CMTPTypeInterdependentPropDesc* aInterdependentPropDesc); + /** * Construct audio wave codec property description. * @param aFormatCode diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataproviderenumerator.h --- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataproviderenumerator.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/cmediamtpdataproviderenumerator.h Tue May 11 16:40:32 2010 +0300 @@ -20,15 +20,11 @@ #define CMEDIAMTPDATAPROVIDERENUMERATOR_H #include -#include - #include "mmmtpenumerationcallback.h" #include "cmmmtpdpperflog.h" // Forward declarations class MMTPDataProviderFramework; -class MMTPObjectMgr; -class CMTPObjectMetaData; class CMediaMtpDataProvider; /** @@ -68,6 +64,9 @@ */ void DoCancel(); + /** + * Update the mpx db flag for round trip + */ void RunL(); /** @@ -92,85 +91,6 @@ void SignalCompleteL( MMTPEnumerationCallback& aCallback, TInt aError = KErrNone ); - void ScanStorageL( TUint32 aStorageId ); - - /** - * Scan next storage - */ - void ScanNextStorageL(); - - /** - * Scans directory at aPath recursing into subdirectories on a depth - * first basis. - * - * Directory entries are kept in iDirStack - which is a LIFO stack. - * The current path, needed since TEntries don't keep track of it, - * is kept in iPath. - * - * The algorithm works as follows: - * - * 1. Read directory entries. - * 2. ProcessEntriesL is called if no error occurs and >= 1 entries are - * read. - * 3. ProcessEntriesL adds entries to database, if entry is directory - * add to iDirStack. - * 4. When all entries are processed pop entry off the dirstack, - * if entry is empty TEntry remove one directory from iPath. - * 5. Append entry name onto iPath - to update path with new depth - * (parent/subdir). - * 6. Push an empty TEntry onto iDirStack - this tells us we have - * recursed one, think of it as pushing the '\' separator onto - * iDirStack. - * 7. Repeat 1-7 until iDirStack is empty. - */ - void ScanDirL(); - - /** - * Recurse into the next directory on the stack - * and scan it for entries. - */ - void ScanNextDirL(); - - /** - * Scan next sub dir - */ - void ScanNextSubdirL(); - - /** - * Iterates iEntries adding entries as needed to object manager and - * iDirStack. - */ - void ProcessEntriesL(); - - /** - * Add a file entry to the object store - * @param aFullFileName current scanned file path - */ - void AddEntryL( const TDesC& aFullFileName ); - - /** - * Returns a TMTPFormatCode for the requested object - */ - TMTPFormatCode GetObjectFormatCode( const TDesC& aFullFileName ); - - /** - * @param aFullFileName the object file name - * @return the file if needed to be enumeratored? - */ - TBool IsFileAccepted( const TDesC& aFullFileName ); - - /** - * start count system tick - */ - void StartEnumerationCount(); - - /** - * check if the system tick more than predefined value - * @retuan if more than the predefined value, return true - * else return false - */ - TBool IsOverThreshold(); - /** * Get modified content and report to Symbian MTP Framework */ @@ -181,27 +101,9 @@ /** MMTPDataProviderFramework used to access MTP components*/ MMTPDataProviderFramework& iFramework; - /** MTP Object Manager */ - MMTPObjectMgr& iObjectMgr; - - /** MTP Data Provider ID */ - TUint iDataProviderId; - CMediaMtpDataProvider& iDataProvider; - TParse iPath; - RDir iDir; - TEntryArray iEntries; - TInt iFirstUnprocessed; - RPointerArray iDirStack; RArray iStorages; TUint32 iStorageId; - TUint32 iParentHandle; - TMTPFormatCode iFormatCode; - TBool iScanningDir; - - // record the system tick - TUint iTickCountBegin; - TInt iTickPeriod; #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) CMmMtpDpPerfLog* iPerfLog; diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataproviderconst.h --- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataproviderconst.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataproviderconst.h Tue May 11 16:40:32 2010 +0300 @@ -46,10 +46,11 @@ // WAVECodec value enum TMmMtpWAVECodecValue { - EMTPAudioWAVECodecMP3 = 0x00000055, - EMTPAudioWAVECodecWMA = 0x00000161, - EMTPAudioWAVECodecAAC = 0x0000A106, - EMTPAudioWAVECodecPCM = 0x00000001 + EMTPAudioWAVECodecMP3 = 0x00000055, + EMTPAudioWAVECodecWMA = 0x00000161, + EMTPAudioWAVECodecWMAPro = 0x00000162, + EMTPAudioWAVECodecAAC = 0x0000A106, + EMTPAudioWAVECodecPCM = 0x00000001 }; // Bitrate value scope @@ -58,7 +59,9 @@ EMTPMP3MinBitrate = 0x00001F40, //8 kbps EMTPMP3MaxBitrate = 0x0004E200, //320 kbps EMTPWMAMinBitrate = 0x00001388, //5 kbps - EMTPWMAMaxBitrate = 0x0004E200, //320 kbps + EMTPWMAMaxBitrate = 0x0005DC00, //384 kbps + EMTPWMAProMinBitrate = 0x00001388, //5 kbps + EMTPWMAProMaxBitrate = 0x000BB800, //768 kbps EMTPAACMinBitrate = 0x00001F40, //8 kbps EMTPAACMaxBitrate = 0x0004E200, //320 kbps EMTPPCMMinBitrate = 0x00003E80, //16 kbps diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderdescriptionutility.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderdescriptionutility.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderdescriptionutility.cpp Tue May 11 16:40:32 2010 +0300 @@ -84,28 +84,125 @@ } CMTPTypeInterdependentPropDesc* interdependentPropDesc = CMTPTypeInterdependentPropDesc::NewL(); + CleanupStack::PushL( interdependentPropDesc ); // + interdependentPropDesc if ( audioWaveCodecSupported && audioBitRateSupported ) { - CMTPTypeInterdependentProperties* properties = CMTPTypeInterdependentProperties::NewL(); - properties->AppendL( NewAudioWaveCodecPropDescL( aFormatCode ) ); - properties->AppendL( NewAudioBitratePropDescL( aFormatCode ) ); - interdependentPropDesc->AppendL( properties ); + if ( ( aFormatCode == EMTPFormatCodeWMA ) + || ( aFormatCode == EMTPFormatCodeWMV ) + || ( aFormatCode == EMTPFormatCodeASF ) ) + { + AppendWMAudioInterdepentPropDescL( interdependentPropDesc ); + } + else + { + CMTPTypeInterdependentProperties* properties = CMTPTypeInterdependentProperties::NewL(); + CleanupStack::PushL( properties ); + + CMTPTypeObjectPropDesc* propertyDesc1 = NewAudioWaveCodecPropDescL( aFormatCode ); + CleanupStack::PushL( propertyDesc1 ); // + propertyDesc1 + properties->AppendL( propertyDesc1 ); + CleanupStack::Pop( propertyDesc1 ); // - propertyDesc1 + + CMTPTypeObjectPropDesc* propertyDesc2 = NewAudioBitratePropDescL( aFormatCode ); + CleanupStack::PushL( propertyDesc2 ); // + propertyDesc2 + properties->AppendL( propertyDesc2 ); + CleanupStack::Pop( propertyDesc2 ); // - propertyDesc2 + + interdependentPropDesc->AppendL( properties ); + CleanupStack::Pop( properties ); + } } if ( videoFourCcCodecSupported && videoBitRateSupported ) { CMTPTypeInterdependentProperties* properties = CMTPTypeInterdependentProperties::NewL(); - properties->AppendL( NewVideoFourCCCodecPropDescL( aFormatCode ) ); - properties->AppendL( NewVideoBitratePropDescL( aFormatCode ) ); + CleanupStack::PushL( properties ); // + properties + + CMTPTypeObjectPropDesc* propertyDesc1 = NewVideoFourCCCodecPropDescL( aFormatCode ); + CleanupStack::PushL( propertyDesc1 ); // + propertyDesc1 + properties->AppendL( propertyDesc1 ); + CleanupStack::Pop( propertyDesc1 ); // - propertyDesc1 + + CMTPTypeObjectPropDesc* propertyDesc2 = NewVideoBitratePropDescL( aFormatCode ); + CleanupStack::PushL( propertyDesc2 ); // + propertyDesc2 + properties->AppendL( propertyDesc2 ); + CleanupStack::Pop( propertyDesc2 ); // - propertyDesc2 + interdependentPropDesc->AppendL( properties ); + CleanupStack::Pop( properties ); // - properties } PRINT( _L( "MM MTP <= CMediaMtpDataProviderDescriptionUtility::NewInterdepentPropDescL" ) ); + CleanupStack::Pop( interdependentPropDesc ); // - interdependentPropDesc return interdependentPropDesc; } // ----------------------------------------------------------------------------- +// CMediaMtpDataProviderDescriptionUtility::NewWMAudioInterdepentPropDescL +// Append WM Audio specific to interdpendent property description. +// ----------------------------------------------------------------------------- +// +void CMediaMtpDataProviderDescriptionUtility::AppendWMAudioInterdepentPropDescL(CMTPTypeInterdependentPropDesc* aInterdependentPropDesc) + { + PRINT( _L( "MM MTP => CMediaMtpDataProviderDescriptionUtility::AppendWMAudioInterdepentPropDescL" ) ); + + CMTPTypeInterdependentProperties* properties1 = CMTPTypeInterdependentProperties::NewL(); + CleanupStack::PushL( properties1 ); // + properties1 + + CMTPTypeObjectPropDescEnumerationForm* form = CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT32 ); + CleanupStack::PushL( form ); // + form + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecWMA ) ); + + CMTPTypeObjectPropDesc* propertyDesc1 = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeAudioWAVECodec, *form ); + + CleanupStack::PopAndDestroy( form ); // - form + CleanupStack::PushL( propertyDesc1 ); // + propertyDesc1 + properties1->AppendL( propertyDesc1 ); + CleanupStack::Pop( propertyDesc1 ); // - propertyDesc1 + + CMTPTypeObjectPropDesc* propertyDesc2 = NewRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPWMAMinBitrate, + EMTPWMAMaxBitrate, + EMTPAudioBitrateStep ); + + CleanupStack::PushL( propertyDesc2 ); // + propertyDesc2 + properties1->AppendL( propertyDesc2 ); + CleanupStack::Pop( propertyDesc2 ); // - propertyDesc2 + + aInterdependentPropDesc->AppendL( properties1 ); + CleanupStack::Pop( properties1 ); // - properties1 + + CMTPTypeInterdependentProperties* properties2 = CMTPTypeInterdependentProperties::NewL(); + CleanupStack::PushL( properties2 ); // + properties2 + + form = CMTPTypeObjectPropDescEnumerationForm::NewL( EMTPTypeUINT32 ); + CleanupStack::PushL( form ); // + form + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecWMAPro ) ); + + CMTPTypeObjectPropDesc* propertyDesc3 = CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeAudioWAVECodec, *form ); + + CleanupStack::PopAndDestroy( form ); // - form + CleanupStack::PushL( propertyDesc3 ); // + propertyDesc3 + properties2->AppendL( propertyDesc3 ); + CleanupStack::Pop( propertyDesc3 ); // - propertyDesc3 + + CMTPTypeObjectPropDesc* propertyDesc4 = NewRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, + EMTPWMAProMinBitrate, + EMTPWMAProMaxBitrate, + EMTPAudioBitrateStep ); + + CleanupStack::PushL( propertyDesc4 ); // + propertyDesc4 + properties2->AppendL( propertyDesc4 ); + CleanupStack::Pop( propertyDesc4 ); // - propertyDesc4 + + aInterdependentPropDesc->AppendL( properties2 ); + CleanupStack::Pop( properties2 ); // - properties2 + + PRINT( _L( "MM MTP <= CMediaMtpDataProviderDescriptionUtility::AppendWMAudioInterdepentPropDescL" ) ); + } + +// ----------------------------------------------------------------------------- // CMediaMtpDataProviderDescriptionUtility::NewSpecificPropDescL // Construct media dp specific property description. // ----------------------------------------------------------------------------- @@ -236,6 +333,7 @@ case EMTPFormatCodeWMV: case EMTPFormatCodeASF: form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecWMA ) ); + form->AppendSupportedValueL( TMTPTypeUint32( EMTPAudioWAVECodecWMAPro ) ); break; case EMTPFormatCodeMP3: @@ -281,7 +379,7 @@ case EMTPFormatCodeASF: propertyDesc = NewRangeFormDescriptionL( EMTPObjectPropCodeAudioBitRate, EMTPWMAMinBitrate, - EMTPWMAMaxBitrate, + EMTPWMAProMaxBitrate, EMTPAudioBitrateStep ); break; @@ -383,7 +481,7 @@ ETrue ); } - PRINT( _L( "MM MTP <= MmMtpDpDescriptionUtiliNewviceVideoBitratePropDescL" ) ); + PRINT( _L( "MM MTP <= CMediaMtpDataProviderDescriptionUtility::NewVideoBitratePropDescL" ) ); return propertyDesc; } diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderenumerator.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderenumerator.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderenumerator.cpp Tue May 11 16:40:32 2010 +0300 @@ -20,27 +20,12 @@ #include #include #include -#include -#include "mediamtpdataproviderconst.h" #include "cmediamtpdataproviderenumerator.h" #include "cmediamtpdataprovider.h" #include "mmmtpdplogger.h" -#include "mmmtpdputility.h" -#include "cmmmtpdpaccesssingleton.h" #include "cmmmtpdpmetadataaccesswrapper.h" - -#if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) -_LIT( KDirectoryScan, "DirectoryScan" ); -_LIT( KFormatFilter, "FormatFilter" ); -_LIT( KObjectManagerObjectUid, "ObjectManagerObjectUid" ); -_LIT( KObjectManagerInsert, "ObjectManagerInsert" ); -#endif - -// Unit: microsecond -const TInt KThresholdOfEnumerationLoopDuration = 1000 * 1000; // microsecond - const TInt KMTPDriveGranularity = 5; const TInt KMediaDpArrayGranularity = 2; @@ -73,14 +58,10 @@ CMediaMtpDataProvider& aDataProvider ) : CActive( EPriorityLow ), // EPriorityStandard ? sure? iFramework( aFramework ), - iObjectMgr( aFramework.ObjectMgr() ), - iDataProviderId( aFramework.DataProviderId() ), iDataProvider( aDataProvider ), - iDirStack( KMediaDpArrayGranularity ), - iStorages( KMediaDpArrayGranularity ), - iScanningDir( EFalse ) + iStorages( KMediaDpArrayGranularity ) { - PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::CMediaMtpDataProviderEnumerator, iDataProviderId = %d" ), iDataProviderId ); + PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::CMediaMtpDataProviderEnumerator, DataProviderId = %d" ), iFramework.DataProviderId() ); } // ----------------------------------------------------------------------------- @@ -92,8 +73,6 @@ { PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::~CMediaMtpDataProviderEnumerator" ) ); Cancel(); - iDir.Close(); - iDirStack.Close(); iStorages.Close(); #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) @@ -129,10 +108,9 @@ } CleanupStack::PopAndDestroy( &storages ); // - storages } - else if ( aStorageId != KMTPNotSpecified32 ) + else if ( aStorageId != KMTPNotSpecified32 + && storageMgr.ValidStorageId( aStorageId ) ) { - __ASSERT_DEBUG( storageMgr.ValidStorageId( aStorageId ), User::Invariant() ); - const CMTPStorageMetaData& storage( storageMgr.StorageL( aStorageId ) ); if ( storage.Uint( CMTPStorageMetaData::EStorageSystemType ) @@ -157,15 +135,9 @@ } iStorageId = aStorageId; - - if ( iStorages.Count() > 0 ) - { - ScanStorageL( iStorages[0] ); - } - else - { - SignalCompleteL( iDataProvider ); - } + TRequestStatus* status = &iStatus; + User::RequestComplete( status, iStatus.Int() ); + SetActive(); PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::StartL" ) ); } @@ -177,243 +149,38 @@ // void CMediaMtpDataProviderEnumerator::DoCancel() { - iDir.Close(); - } - -// ----------------------------------------------------------------------------- -// CMediaMtpDataProviderEnumerator::ScanStorageL -// -// ----------------------------------------------------------------------------- -// -void CMediaMtpDataProviderEnumerator::ScanStorageL( TUint32 aStorageId ) - { - const CMTPStorageMetaData& storage( iFramework.StorageMgr().StorageL( aStorageId ) ); - - __ASSERT_DEBUG( ( storage.Uint( CMTPStorageMetaData::EStorageSystemType ) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem ), - User::Invariant() ); - - TFileName root( storage.DesC( CMTPStorageMetaData::EStorageSuid ) ); - PRINT2( _L("MM MTP <> CMediaMtpDataProviderEnumerator::ScanStorageL aStorageId = 0x%x, StorageSuid = %S"), aStorageId, &root ); - - iParentHandle = KMTPHandleNoParent; - iPath.Set( root, NULL, NULL); - iDir.Close(); - User::LeaveIfError( iDir.Open( iFramework.Fs(), - iPath.DriveAndPath(), - KEntryAttNormal | KEntryAttDir ) ); - ScanDirL(); - } - -// ----------------------------------------------------------------------------- -// CMediaMtpDataProviderEnumerator::ScanNextStorageL -// -// ----------------------------------------------------------------------------- -// -void CMediaMtpDataProviderEnumerator::ScanNextStorageL() - { - // If there are one or more unscanned storages left - // (the currently scanned one is still on the list) - if ( iStorages.Count() > 1 ) - { - // Round trip suppport - const CMTPStorageMetaData& storage( iFramework.StorageMgr().StorageL( iStorages[0] ) ); - TFileName root( storage.DesC( CMTPStorageMetaData::EStorageSuid ) ); - GetModifiedContentL( root ); - TRAPD( err, iDataProvider.GetWrapperL().UpdateMusicCollectionL() ); - if ( err != KErrNone ) - { - PRINT1( _L("MM MTP <> ScanNextStorageL, UpdateMusicCollectionL err =%d "), err ); - } - - iStorages.Remove( 0 ); - ScanStorageL( iStorages[0] ); - } - else - { - // Round trip suppport - const CMTPStorageMetaData& storage( iFramework.StorageMgr().StorageL( iStorages[0] ) ); - TFileName root( storage.DesC( CMTPStorageMetaData::EStorageSuid ) ); - GetModifiedContentL( root ); - - // We are done - iStorages.Reset(); - - SignalCompleteL( iDataProvider ); - } - } - -// ----------------------------------------------------------------------------- -// CMediaMtpDataProviderEnumerator::ScanDirL -// -// ----------------------------------------------------------------------------- -// -void CMediaMtpDataProviderEnumerator::ScanDirL() - { - PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::ScanDirL" ) ); - - StartEnumerationCount(); - - iFirstUnprocessed = 0; - - iScanningDir = ETrue; - PERFLOGSTART( KDirectoryScan ); - iDir.Read( iEntries, iStatus ); - SetActive(); - - PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::ScanDirL" ) ); - } - -// ----------------------------------------------------------------------------- -// CMediaMtpDataProviderEnumerator::ScanNextDirL -// Recurse into the next directory on the stack -// and scan it for entries. -// ----------------------------------------------------------------------------- -// -void CMediaMtpDataProviderEnumerator::ScanNextDirL() - { - TInt count = iDirStack.Count(); - - if ( count == 0 ) - { - // No more directories on the stack, try the next storage - ScanNextStorageL(); - } - else - { - TEntry* entry = iDirStack[count - 1]; - if ( entry != NULL ) - { - - // Empty TEntry, no more subdirectories in - // the current path - if ( entry->iName == KNullDesC ) - { - // Remove current dir from path - iPath.PopDir(); - iDirStack.Remove( count - 1 ); - delete entry; - entry = NULL; - iDir.Close(); - - // Scan the next directory of the parent - ScanNextDirL(); - } - // Going into a subdirectory of current - else - { - // Add directory to path - iPath.AddDir( entry->iName ); - // Remove directory so we don't think it's a subdirectory - iDirStack.Remove( count - 1 ); - delete entry; - entry = NULL; - ScanNextSubdirL(); - } - } - } - } - -// ----------------------------------------------------------------------------- -// CMediaMtpDataProviderEnumerator::ScanNextSubdirL -// Scan next sub dir -// ----------------------------------------------------------------------------- -// -void CMediaMtpDataProviderEnumerator::ScanNextSubdirL() - { - PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::ScanNextSubdirL" ) ); - - // A empty (non-constructed) TEntry is our marker telling us to pop a directory - // from iPath when we see this - TEntry* entry = new TEntry( TEntry() ); - - User::LeaveIfNull( entry ); - - iDirStack.AppendL( entry ); - - // Leave with KErrNotFound if we don't find the object handle since it shouldn't be on the - // dirstack if the entry wasn't added - TPtrC suid = iPath.DriveAndPath().Left( iPath.DriveAndPath().Length() ); - // Update the current parenthandle with object of the directory - PERFLOGSTART( KObjectManagerObjectUid ); - iParentHandle = iFramework.ObjectMgr().HandleL( suid ); - PERFLOGSTOP( KObjectManagerObjectUid ); - PRINT1( _L( "MM MTP <> iParentHandle = 0x%x" ), iParentHandle ); - - // Kick-off a scan of the next directory - iDir.Close(); - - TInt err = iDir.Open( iFramework.Fs(), - iPath.DriveAndPath(), - KEntryAttNormal | KEntryAttDir ); - - PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::ScanNextSubdirL, RDir::Open err = %d" ), err ); - - if ( err == KErrNone ) - ScanDirL(); - else - { - iEntries = TEntryArray(); - - TRequestStatus* status = &iStatus; - User::RequestComplete( status, iStatus.Int() ); - SetActive(); - } - - - PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::ScanNextSubdirL" ) ); } // ----------------------------------------------------------------------------- // CMediaMtpDataProviderEnumerator::RunL -// +// Update the mpx db flag for round trip // ----------------------------------------------------------------------------- // void CMediaMtpDataProviderEnumerator::RunL() { - if ( iScanningDir ) - { - PERFLOGSTOP( KDirectoryScan ); - } + PRINT1( _L( "MM MTP => CMediaMtpDataProviderEnumerator::RunL iStorages.Count() = %d" ), iStorages.Count() ); - iScanningDir = EFalse; - if ( iEntries.Count() == 0 ) + if ( iStorages.Count() > 0 ) { - // No entries to process, scan next dir or storage - ScanNextDirL(); - } - else if ( iFirstUnprocessed < iEntries.Count() ) - { - PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::RunL iFirstUnprocessed = %d" ), iFirstUnprocessed); - TRAPD( err, ProcessEntriesL();); + const CMTPStorageMetaData& storage( iFramework.StorageMgr().StorageL( iStorages[0] ) ); + const TDesC& root( storage.DesC( CMTPStorageMetaData::EStorageSuid ) ); + GetModifiedContentL( root ); + TRAPD( err, iDataProvider.GetWrapperL().UpdateMusicCollectionL( root ) ); if ( err != KErrNone ) { - iFirstUnprocessed++; + PRINT1( _L("MM MTP <> CMediaMtpDataProviderEnumerator::RunL, UpdateMusicCollectionL err =%d "), err ); } - - // Complete ourselves with current TRequestStatus - // since we need to run again to either scan a new dir or drive - // or process more entries + iStorages.Remove( 0 ); TRequestStatus* status = &iStatus; User::RequestComplete( status, iStatus.Int() ); SetActive(); } else { - switch ( iStatus.Int() ) - { - case KErrNone: - // There are still entries left to be read - ScanDirL(); - break; - - case KErrEof: - // There are no more entries - default: - // Error, ignore and continue with next dir - ScanNextDirL(); - break; - } + iStorages.Reset(); + SignalCompleteL( iDataProvider ); } + PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::RunL" ) ); } // ----------------------------------------------------------------------------- @@ -440,13 +207,6 @@ { CActiveScheduler::Add( this ); - TTimeIntervalMicroSeconds32 tickPeriod = 0; - TInt err = UserHal::TickPeriod(tickPeriod); - - PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::ConstructL, UserHal::TickPeriod err = %d" ), err); - User::LeaveIfError( err ); - iTickPeriod = tickPeriod.Int(); - #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) iPerfLog = CMmMtpDpPerfLog::NewL( _L( "MediaMtpDataProviderEnumerator" ) ); #endif @@ -465,159 +225,6 @@ } // ----------------------------------------------------------------------------- -// CMediaMtpDataProviderEnumerator::ProcessEntriesL -// Iterates iEntries adding entries as needed to object manager and iDirStack. -// ----------------------------------------------------------------------------- -// -void CMediaMtpDataProviderEnumerator::ProcessEntriesL() - { - PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::ProcessEntriesL" ) ); - - TFileName path = iPath.DriveAndPath(); - - while ( !IsOverThreshold() && iFirstUnprocessed < iEntries.Count() ) - { - const TEntry& entry = iEntries[iFirstUnprocessed]; - - TInt len = entry.iName.Length(); - - // Skip object with too long name - if ( KMaxFileName >= path.Length() + len ) - { - path.Append( entry.iName ); - PRINT1( _L( "MM MTP <> path = %S" ), &path ); - - if ( entry.IsDir() ) - { - path.Append( '\\' ); - ++len; - - // we don't need to process folder, just remember - // the folder - TEntry* dirEntry = new TEntry( entry ); - User::LeaveIfNull( dirEntry ); - iDirStack.AppendL( dirEntry ); - } - else if ( IsFileAccepted( path ) ) - { - AddEntryL( path ); - } - - // Remove filename part - path.SetLength( path.Length() - len ); - } - - iFirstUnprocessed++; - } - - StartEnumerationCount(); - PRINT( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::ProcessEntriesL" ) ); - } - -// ----------------------------------------------------------------------------- -// CMediaMtpDataProviderEnumerator::AddEntryL -// Add a file entry to the object store -// ----------------------------------------------------------------------------- -// -void CMediaMtpDataProviderEnumerator::AddEntryL( const TDesC& aFullFileName ) - { - PRINT1( _L( "MM MTP => CMediaDataProviderEnumerator::AddEntryL aFullFileName = %S" ), &aFullFileName ); - - CMTPObjectMetaData* object( CMTPObjectMetaData::NewLC( iDataProviderId, - iFormatCode, - iStorages[0], - aFullFileName ) ); // + object - - object->SetUint( CMTPObjectMetaData::EParentHandle, iParentHandle ); - - if ( ( iFormatCode == EMTPFormatCodeMP4Container ) - || ( iFormatCode == EMTPFormatCode3GPContainer ) - || ( iFormatCode == EMTPFormatCodeASF ) ) - { - TMmMtpSubFormatCode subFormatCode; - - // Note: Delay the file parsing until external enumeration phase to avoid time-out - subFormatCode = EMTPSubFormatCodeUnknown; - - object->SetUint( CMTPObjectMetaData::EFormatSubCode, (TUint)subFormatCode ); - } - - PERFLOGSTART( KObjectManagerInsert ); - iObjectMgr.InsertObjectL( *object ); - PERFLOGSTOP( KObjectManagerInsert ); - - CleanupStack::PopAndDestroy( object ); // - object - - PRINT1( _L( "MM MTP <= CMediaMtpDataProviderEnumerator::AddEntryL, entry inserted, iFormatCode = 0x%x" ), iFormatCode); - } - -// ----------------------------------------------------------------------------- -// CMediaMtpDataProviderEnumerator::GetObjectFormatCode -// Returns a TMTPFormatCode for the requested object -// ----------------------------------------------------------------------------- -// -TMTPFormatCode CMediaMtpDataProviderEnumerator::GetObjectFormatCode( const TDesC& aFullFileName ) - { - PRINT1( _L("MM MTP <> CMediaMtpDataProviderEnumerator::GetObjectFormatCodeL aFullFileName = %S"), &aFullFileName ); - TMTPFormatCode formatCode = MmMtpDpUtility::FormatFromFilename( aFullFileName ); - return formatCode; - } - -// ----------------------------------------------------------------------------- -// CMediaMtpDataProviderEnumerator::IsFileAccepted -// Is the file format is supported by this Dp -// ----------------------------------------------------------------------------- -// -TBool CMediaMtpDataProviderEnumerator::IsFileAccepted( const TDesC& aFullFileName ) - { - PERFLOGSTART( KFormatFilter ); - iFormatCode = GetObjectFormatCode( aFullFileName ); - PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::IsFileAcceptedL formatCode = 0x%x" ), iFormatCode ); - TBool accepted = EFalse; - TInt count = sizeof( KMediaMtpDataProviderSupportedFormats ) / sizeof( TUint16 ); - for ( TInt i = 0; i < count; i++ ) - { - if ( iFormatCode == KMediaMtpDataProviderSupportedFormats[i] ) - { - accepted = ETrue; - break; - } - } - - PERFLOGSTOP( KFormatFilter ); - return accepted; - } - -// ----------------------------------------------------------------------------- -// CMediaDpMtpEnumerator::StartEnumerationCount -// start record system tick -// ----------------------------------------------------------------------------- -// -void CMediaMtpDataProviderEnumerator::StartEnumerationCount() - { - iTickCountBegin = User::TickCount(); - } - -// ----------------------------------------------------------------------------- -// CMediaDpMtpEnumerator::IsOverThreshold -// Is system tick more than the predefined value? -// ----------------------------------------------------------------------------- -// -TBool CMediaMtpDataProviderEnumerator::IsOverThreshold() - { - TUint tcNow = User::TickCount(); - - if ( ( tcNow - iTickCountBegin ) * iTickPeriod >= KThresholdOfEnumerationLoopDuration ) - { - return ETrue; - } - else - { - return EFalse; - } - } - -// ----------------------------------------------------------------------------- // CMediaDpMtpEnumerator::GetModifiedContentL() // Get Modified Content and report to Framework // ----------------------------------------------------------------------------- @@ -638,7 +245,6 @@ CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC(); // + object for ( TInt i = 0; i < arrayCount; i++ ) { - if ( iFramework.ObjectMgr().ObjectL( ( *modifiedContents )[i], *object ) ) { object->SetUint( CMTPObjectMetaData::EObjectMetaDataUpdate , 1 ); @@ -661,7 +267,6 @@ // void CMediaMtpDataProviderEnumerator::SessionClosedL() { - iDataProvider.GetWrapperL().UpdateMusicCollectionL(); iDataProvider.GetWrapperL().CleanupDatabaseL(); } diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/bwins/mmmtpdprequestprocessoru.def --- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/bwins/mmmtpdprequestprocessoru.def Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/bwins/mmmtpdprequestprocessoru.def Tue May 11 16:40:32 2010 +0300 @@ -5,59 +5,59 @@ ?StartL@CRenameObject@@QAEXKABVTDesC16@@@Z @ 4 NONAME ; void CRenameObject::StartL(unsigned long, class TDesC16 const &) ??1CRequestUnknown@@UAE@XZ @ 5 NONAME ; CRequestUnknown::~CRequestUnknown(void) ?DeleteObjectL@CMmMtpDpMetadataAccessWrapper@@QAEXABVCMTPObjectMetaData@@@Z @ 6 NONAME ; void CMmMtpDpMetadataAccessWrapper::DeleteObjectL(class CMTPObjectMetaData const &) - ?Release@CRequestProcessor@@MAEXXZ @ 7 NONAME ; void CRequestProcessor::Release(void) - ?HandleRequestL@CRequestProcessor@@MAEHABVTMTPTypeRequest@@W4TMTPTransactionPhase@@@Z @ 8 NONAME ; int CRequestProcessor::HandleRequestL(class TMTPTypeRequest const &, enum TMTPTransactionPhase) - ??1CGetInterdependentPropDesc@@UAE@XZ @ 9 NONAME ; CGetInterdependentPropDesc::~CGetInterdependentPropDesc(void) - ?OpenSessionL@CMmMtpDpAccessSingleton@@SAXXZ @ 10 NONAME ; void CMmMtpDpAccessSingleton::OpenSessionL(void) - ?ServiceL@CGetPartialObject@@MAEXXZ @ 11 NONAME ; void CGetPartialObject::ServiceL(void) - ??0CGetObjectInfo@@AAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 12 NONAME ; CGetObjectInfo::CGetObjectInfo(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) - ?DoHandleResponsePhaseL@CRequestProcessor@@MAEHXZ @ 13 NONAME ; int CRequestProcessor::DoHandleResponsePhaseL(void) - ?NewL@CGetObjectPropDesc@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 14 NONAME ; class MMmRequestProcessor * CGetObjectPropDesc::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) - ??0CGetObjectPropValue@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 15 NONAME ; CGetObjectPropValue::CGetObjectPropValue(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) - ?CheckRequestL@CSetObjectPropList@@MAE?AW4TMTPResponseCode@@XZ @ 16 NONAME ; enum TMTPResponseCode CSetObjectPropList::CheckRequestL(void) - ?RunL@CRequestProcessor@@MAEXXZ @ 17 NONAME ; void CRequestProcessor::RunL(void) - ?ServiceL@CDeleteObject@@MAEXXZ @ 18 NONAME ; void CDeleteObject::ServiceL(void) - ?DoCancel@CSetObjectPropList@@MAEXXZ @ 19 NONAME ; void CSetObjectPropList::DoCancel(void) - ?CleanupDatabaseL@CMmMtpDpMetadataAccessWrapper@@QAEXXZ @ 20 NONAME ; void CMmMtpDpMetadataAccessWrapper::CleanupDatabaseL(void) - ?ServiceL@CGetObjectPropsSupported@@MAEXXZ @ 21 NONAME ; void CGetObjectPropsSupported::ServiceL(void) - ?NewL@CSetObjectReferences@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 22 NONAME ; class MMmRequestProcessor * CSetObjectReferences::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) - ?Release@CMmMtpDpAccessSingleton@@SAXXZ @ 23 NONAME ; void CMmMtpDpAccessSingleton::Release(void) - ?UsbDisconnect@CSendObject@@MAEXXZ @ 24 NONAME ; void CSendObject::UsbDisconnect(void) - ?ServiceL@CGetFormatCapabilities@@MAEXXZ @ 25 NONAME ; void CGetFormatCapabilities::ServiceL(void) - ?GetAllReferenceL@CMmMtpDpMetadataAccessWrapper@@QAEXPAVCMPXMedia@@AAVCDesC16Array@@@Z @ 26 NONAME ; void CMmMtpDpMetadataAccessWrapper::GetAllReferenceL(class CMPXMedia *, class CDesC16Array &) - ??1CSetObjectPropList@@UAE@XZ @ 27 NONAME ; CSetObjectPropList::~CSetObjectPropList(void) - ?ServiceL@CSetObjectPropList@@MAEXXZ @ 28 NONAME ; void CSetObjectPropList::ServiceL(void) - ??0CMoveObject@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 29 NONAME ; CMoveObject::CMoveObject(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) - ??0CRequestUnknown@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@@Z @ 30 NONAME ; CRequestUnknown::CRequestUnknown(class MMTPDataProviderFramework &, class MMTPConnection &) - ?ConstructL@CGetObjectPropList@@IAEXXZ @ 31 NONAME ; void CGetObjectPropList::ConstructL(void) - ??1CSendObject@@UAE@XZ @ 32 NONAME ; CSendObject::~CSendObject(void) - ?ServiceMetaDataFromWrapperL@CGetObjectPropValue@@IAEXGAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 33 NONAME ; void CGetObjectPropValue::ServiceMetaDataFromWrapperL(unsigned short, class MMTPType &, class CMTPObjectMetaData const &) - ?NewL@CGetObject@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 34 NONAME ; class MMmRequestProcessor * CGetObject::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) - ??1CGetObjectPropValue@@UAE@XZ @ 35 NONAME ; CGetObjectPropValue::~CGetObjectPropValue(void) - ?CreateL@CMmMtpDpAccessSingleton@@SAXAAVMMTPDataProviderFramework@@@Z @ 36 NONAME ; void CMmMtpDpAccessSingleton::CreateL(class MMTPDataProviderFramework &) - ??1CGetFormatCapabilities@@UAE@XZ @ 37 NONAME ; CGetFormatCapabilities::~CGetFormatCapabilities(void) - ?ServiceL@CSetObjectReferences@@EAEXXZ @ 38 NONAME ; void CSetObjectReferences::ServiceL(void) - ?DoHandleDataIToRPhaseL@CRequestProcessor@@MAEHXZ @ 39 NONAME ; int CRequestProcessor::DoHandleDataIToRPhaseL(void) - ??0CGetObjectPropList@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 40 NONAME ; CGetObjectPropList::CGetObjectPropList(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) - ?ConstructL@CCopyObject@@IAEXXZ @ 41 NONAME ; void CCopyObject::ConstructL(void) - ?SetMetaDataToWrapper@CPropertySettingUtility@@QAE?AW4TMTPResponseCode@@AAVMMmMtpDpConfig@@GAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 42 NONAME ; enum TMTPResponseCode CPropertySettingUtility::SetMetaDataToWrapper(class MMmMtpDpConfig &, unsigned short, class MMTPType &, class CMTPObjectMetaData const &) - ?ServiceL@CGetObjectPropValue@@MAEXXZ @ 43 NONAME ; void CGetObjectPropValue::ServiceL(void) - ??1CRenameObject@@UAE@XZ @ 44 NONAME ; CRenameObject::~CRenameObject(void) - ?Match@CRequestProcessor@@MBEHABVTMTPTypeEvent@@AAVMMTPConnection@@@Z @ 45 NONAME ; int CRequestProcessor::Match(class TMTPTypeEvent const &, class MMTPConnection &) const - ?DoHandleCompletingPhaseL@CSendObject@@MAEHXZ @ 46 NONAME ; int CSendObject::DoHandleCompletingPhaseL(void) - ?GetDrmStatus@MmMtpDpUtility@@SAHABVTDesC16@@@Z @ 47 NONAME ; int MmMtpDpUtility::GetDrmStatus(class TDesC16 const &) - ?RunL@CRenameObject@@MAEXXZ @ 48 NONAME ; void CRenameObject::RunL(void) - ??0CSetObjectReferences@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 49 NONAME ; CSetObjectReferences::CSetObjectReferences(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) - ??0CRequestProcessor@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@HPBUTMTPRequestElementInfo@@@Z @ 50 NONAME ; CRequestProcessor::CRequestProcessor(class MMTPDataProviderFramework &, class MMTPConnection &, int, struct TMTPRequestElementInfo const *) - ?ServiceL@CSendObject@@MAEXXZ @ 51 NONAME ; void CSendObject::ServiceL(void) - ?Request@CRequestProcessor@@MBEABVTMTPTypeRequest@@XZ @ 52 NONAME ; class TMTPTypeRequest const & CRequestProcessor::Request(void) const - ?DoCancel@CRequestProcessor@@MAEXXZ @ 53 NONAME ; void CRequestProcessor::DoCancel(void) - ?CheckRequestL@CGetPartialObject@@MAE?AW4TMTPResponseCode@@XZ @ 54 NONAME ; enum TMTPResponseCode CGetPartialObject::CheckRequestL(void) - ?NewL@CRequestUnknown@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@@Z @ 55 NONAME ; class MMmRequestProcessor * CRequestUnknown::NewL(class MMTPDataProviderFramework &, class MMTPConnection &) - ??0CGetFormatCapabilities@@AAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 56 NONAME ; CGetFormatCapabilities::CGetFormatCapabilities(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) - ?ConstructL@CGetObjectInfo@@AAEXXZ @ 57 NONAME ; void CGetObjectInfo::ConstructL(void) - ?UsbDisconnect@CRequestProcessor@@MAEXXZ @ 58 NONAME ; void CRequestProcessor::UsbDisconnect(void) - ?UpdateMusicCollectionL@CMmMtpDpMetadataAccessWrapper@@QAEXXZ @ 59 NONAME ; void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL(void) + ?UpdateMusicCollectionL@CMmMtpDpMetadataAccessWrapper@@QAEXABVTDesC16@@@Z @ 7 NONAME ; void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL(class TDesC16 const &) + ?Release@CRequestProcessor@@MAEXXZ @ 8 NONAME ; void CRequestProcessor::Release(void) + ?HandleRequestL@CRequestProcessor@@MAEHABVTMTPTypeRequest@@W4TMTPTransactionPhase@@@Z @ 9 NONAME ; int CRequestProcessor::HandleRequestL(class TMTPTypeRequest const &, enum TMTPTransactionPhase) + ??1CGetInterdependentPropDesc@@UAE@XZ @ 10 NONAME ; CGetInterdependentPropDesc::~CGetInterdependentPropDesc(void) + ?OpenSessionL@CMmMtpDpAccessSingleton@@SAXXZ @ 11 NONAME ; void CMmMtpDpAccessSingleton::OpenSessionL(void) + ?ServiceL@CGetPartialObject@@MAEXXZ @ 12 NONAME ; void CGetPartialObject::ServiceL(void) + ??0CGetObjectInfo@@AAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 13 NONAME ; CGetObjectInfo::CGetObjectInfo(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?DoHandleResponsePhaseL@CRequestProcessor@@MAEHXZ @ 14 NONAME ; int CRequestProcessor::DoHandleResponsePhaseL(void) + ?NewL@CGetObjectPropDesc@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 15 NONAME ; class MMmRequestProcessor * CGetObjectPropDesc::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??0CGetObjectPropValue@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 16 NONAME ; CGetObjectPropValue::CGetObjectPropValue(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?CheckRequestL@CSetObjectPropList@@MAE?AW4TMTPResponseCode@@XZ @ 17 NONAME ; enum TMTPResponseCode CSetObjectPropList::CheckRequestL(void) + ?RunL@CRequestProcessor@@MAEXXZ @ 18 NONAME ; void CRequestProcessor::RunL(void) + ?ServiceL@CDeleteObject@@MAEXXZ @ 19 NONAME ; void CDeleteObject::ServiceL(void) + ?DoCancel@CSetObjectPropList@@MAEXXZ @ 20 NONAME ; void CSetObjectPropList::DoCancel(void) + ?CleanupDatabaseL@CMmMtpDpMetadataAccessWrapper@@QAEXXZ @ 21 NONAME ; void CMmMtpDpMetadataAccessWrapper::CleanupDatabaseL(void) + ?ServiceL@CGetObjectPropsSupported@@MAEXXZ @ 22 NONAME ; void CGetObjectPropsSupported::ServiceL(void) + ?NewL@CSetObjectReferences@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 23 NONAME ; class MMmRequestProcessor * CSetObjectReferences::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?Release@CMmMtpDpAccessSingleton@@SAXXZ @ 24 NONAME ; void CMmMtpDpAccessSingleton::Release(void) + ?UsbDisconnect@CSendObject@@MAEXXZ @ 25 NONAME ; void CSendObject::UsbDisconnect(void) + ?ServiceL@CGetFormatCapabilities@@MAEXXZ @ 26 NONAME ; void CGetFormatCapabilities::ServiceL(void) + ?GetAllReferenceL@CMmMtpDpMetadataAccessWrapper@@QAEXPAVCMPXMedia@@AAVCDesC16Array@@@Z @ 27 NONAME ; void CMmMtpDpMetadataAccessWrapper::GetAllReferenceL(class CMPXMedia *, class CDesC16Array &) + ??1CSetObjectPropList@@UAE@XZ @ 28 NONAME ; CSetObjectPropList::~CSetObjectPropList(void) + ?ServiceL@CSetObjectPropList@@MAEXXZ @ 29 NONAME ; void CSetObjectPropList::ServiceL(void) + ??0CMoveObject@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 30 NONAME ; CMoveObject::CMoveObject(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??0CRequestUnknown@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@@Z @ 31 NONAME ; CRequestUnknown::CRequestUnknown(class MMTPDataProviderFramework &, class MMTPConnection &) + ?ConstructL@CGetObjectPropList@@IAEXXZ @ 32 NONAME ; void CGetObjectPropList::ConstructL(void) + ??1CSendObject@@UAE@XZ @ 33 NONAME ; CSendObject::~CSendObject(void) + ?ServiceMetaDataFromWrapperL@CGetObjectPropValue@@IAEXGAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 34 NONAME ; void CGetObjectPropValue::ServiceMetaDataFromWrapperL(unsigned short, class MMTPType &, class CMTPObjectMetaData const &) + ?NewL@CGetObject@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 35 NONAME ; class MMmRequestProcessor * CGetObject::NewL(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??1CGetObjectPropValue@@UAE@XZ @ 36 NONAME ; CGetObjectPropValue::~CGetObjectPropValue(void) + ?CreateL@CMmMtpDpAccessSingleton@@SAXAAVMMTPDataProviderFramework@@@Z @ 37 NONAME ; void CMmMtpDpAccessSingleton::CreateL(class MMTPDataProviderFramework &) + ??1CGetFormatCapabilities@@UAE@XZ @ 38 NONAME ; CGetFormatCapabilities::~CGetFormatCapabilities(void) + ?ServiceL@CSetObjectReferences@@EAEXXZ @ 39 NONAME ; void CSetObjectReferences::ServiceL(void) + ?DoHandleDataIToRPhaseL@CRequestProcessor@@MAEHXZ @ 40 NONAME ; int CRequestProcessor::DoHandleDataIToRPhaseL(void) + ??0CGetObjectPropList@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 41 NONAME ; CGetObjectPropList::CGetObjectPropList(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?ConstructL@CCopyObject@@IAEXXZ @ 42 NONAME ; void CCopyObject::ConstructL(void) + ?SetMetaDataToWrapper@CPropertySettingUtility@@QAE?AW4TMTPResponseCode@@AAVMMmMtpDpConfig@@GAAVMMTPType@@ABVCMTPObjectMetaData@@@Z @ 43 NONAME ; enum TMTPResponseCode CPropertySettingUtility::SetMetaDataToWrapper(class MMmMtpDpConfig &, unsigned short, class MMTPType &, class CMTPObjectMetaData const &) + ?ServiceL@CGetObjectPropValue@@MAEXXZ @ 44 NONAME ; void CGetObjectPropValue::ServiceL(void) + ??1CRenameObject@@UAE@XZ @ 45 NONAME ; CRenameObject::~CRenameObject(void) + ?Match@CRequestProcessor@@MBEHABVTMTPTypeEvent@@AAVMMTPConnection@@@Z @ 46 NONAME ; int CRequestProcessor::Match(class TMTPTypeEvent const &, class MMTPConnection &) const + ?DoHandleCompletingPhaseL@CSendObject@@MAEHXZ @ 47 NONAME ; int CSendObject::DoHandleCompletingPhaseL(void) + ?GetDrmStatus@MmMtpDpUtility@@SAHABVTDesC16@@@Z @ 48 NONAME ; int MmMtpDpUtility::GetDrmStatus(class TDesC16 const &) + ?RunL@CRenameObject@@MAEXXZ @ 49 NONAME ; void CRenameObject::RunL(void) + ??0CSetObjectReferences@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 50 NONAME ; CSetObjectReferences::CSetObjectReferences(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ??0CRequestProcessor@@IAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@HPBUTMTPRequestElementInfo@@@Z @ 51 NONAME ; CRequestProcessor::CRequestProcessor(class MMTPDataProviderFramework &, class MMTPConnection &, int, struct TMTPRequestElementInfo const *) + ?ServiceL@CSendObject@@MAEXXZ @ 52 NONAME ; void CSendObject::ServiceL(void) + ?Request@CRequestProcessor@@MBEABVTMTPTypeRequest@@XZ @ 53 NONAME ; class TMTPTypeRequest const & CRequestProcessor::Request(void) const + ?DoCancel@CRequestProcessor@@MAEXXZ @ 54 NONAME ; void CRequestProcessor::DoCancel(void) + ?CheckRequestL@CGetPartialObject@@MAE?AW4TMTPResponseCode@@XZ @ 55 NONAME ; enum TMTPResponseCode CGetPartialObject::CheckRequestL(void) + ?NewL@CRequestUnknown@@SAPAVMMmRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@@Z @ 56 NONAME ; class MMmRequestProcessor * CRequestUnknown::NewL(class MMTPDataProviderFramework &, class MMTPConnection &) + ??0CGetFormatCapabilities@@AAE@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@AAVMMmMtpDpConfig@@@Z @ 57 NONAME ; CGetFormatCapabilities::CGetFormatCapabilities(class MMTPDataProviderFramework &, class MMTPConnection &, class MMmMtpDpConfig &) + ?ConstructL@CGetObjectInfo@@AAEXXZ @ 58 NONAME ; void CGetObjectInfo::ConstructL(void) + ?UsbDisconnect@CRequestProcessor@@MAEXXZ @ 59 NONAME ; void CRequestProcessor::UsbDisconnect(void) ??1CMoveObject@@UAE@XZ @ 60 NONAME ; CMoveObject::~CMoveObject(void) ?CheckRequestL@CSendObject@@MAE?AW4TMTPResponseCode@@XZ @ 61 NONAME ; enum TMTPResponseCode CSendObject::CheckRequestL(void) ??1CRequestProcessor@@MAE@XZ @ 62 NONAME ; CRequestProcessor::~CRequestProcessor(void) diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/eabi/mmmtpdprequestprocessoru.def --- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/eabi/mmmtpdprequestprocessoru.def Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/eabi/mmmtpdprequestprocessoru.def Tue May 11 16:40:32 2010 +0300 @@ -193,7 +193,7 @@ _ZN29CMmMtpDpMetadataAccessWrapper19GetModifiedContentLERK7TDesC16RiR12CDesC16Array @ 192 NONAME _ZN29CMmMtpDpMetadataAccessWrapper20GetAllAbstractMediaLERK7TDesC16PP14CMPXMediaArray19TMPXGeneralCategory @ 193 NONAME _ZN29CMmMtpDpMetadataAccessWrapper21GetAbstractMediaNameLEP9CMPXMedia19TMPXGeneralCategory @ 194 NONAME - _ZN29CMmMtpDpMetadataAccessWrapper22UpdateMusicCollectionLEv @ 195 NONAME + _ZN29CMmMtpDpMetadataAccessWrapper22UpdateMusicCollectionLERK7TDesC16 @ 195 NONAME _ZN29CMmMtpDpMetadataAccessWrapper23GetObjectMetadataValueLEtR8MMTPTypeRK18CMTPObjectMetaData @ 196 NONAME _ZNK11CSendObject12HasDataphaseEv @ 197 NONAME _ZNK11CSendObject5MatchERK15TMTPTypeRequestR14MMTPConnection @ 198 NONAME diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csendobject.h --- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csendobject.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csendobject.h Tue May 11 16:40:32 2010 +0300 @@ -187,12 +187,6 @@ TBool IsTooLarge( TUint64 aObjectSize ) const; /** - * Check if we can store the file on the storage - * @return ETrue if yes, otherwise EFalse - */ - TBool CanStoreFileL( TUint32 aStorageId, TInt64 aObjectSize ) const; - - /** * Get the full path name of the object to be saved * @param aFileName, on entry, contains the file name of the object, * on return, contains the full path name of the object to be saved @@ -208,7 +202,7 @@ /** * Reserve object information before SendObject */ - void ReserveObjectL(); + TInt ReserveObjectL(); /** * Set protection status of object which could be read/write-only @@ -227,10 +221,13 @@ void AddMediaToStoreL(); /** - * delete the file, which transfer incompletely + * Rollback functions */ void Rollback(); + void UnreserveObjectL(); + void RemoveObjectFromDbL(); + void RemoveObjectFromFs(); private: enum TMTPSendingObjectState @@ -244,6 +241,8 @@ ESendObjectFail }; + typedef void ( CSendObject::*TMmMtpRollbackAction )(); + private: RFs& iFs; MMTPObjectMgr& iObjectMgr; @@ -282,7 +281,7 @@ // params which is needed for reserve handle TMTPTypeRequest iExpectedSendObjectRequest; - TBool iNoRollback; + RArray iRollbackList; TUint32 iPreviousTransactionID; TUint32 iPreviousOperation; diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cdeleteobject.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cdeleteobject.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cdeleteobject.cpp Tue May 11 16:40:32 2010 +0300 @@ -224,8 +224,6 @@ TFileName fileName( aObjectInfo.DesC( CMTPObjectMetaData::ESuid ) ); PRINT1( _L( "MM MTP <> CDeleteObject::DeleteObjectL fileName = %S" ), &fileName ); - iDpConfig.GetWrapperL().SetStorageRootL( fileName ); - // To capture special situation: After copy, move, rename playlist folder name, // record in MPX is not inlined with framework db, playlist should not be deleted // until next session. @@ -315,10 +313,14 @@ { SendResponseL( EMTPRespCodePartialDeletion ); } - else if( !iIsMultiDelete && iDeleteError == KErrAccessDenied ) + else if ( !iIsMultiDelete && iDeleteError == KErrAccessDenied ) { SendResponseL( EMTPRespCodeObjectWriteProtected ); } + else if ( iDeleteError == KErrInUse ) + { + SendResponseL( EMTPRespCodeDeviceBusy ); + } else { SendResponseL( EMTPRespCodeAccessDenied ); diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectproplist.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectproplist.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cgetobjectproplist.cpp Tue May 11 16:40:32 2010 +0300 @@ -354,8 +354,6 @@ else { CMTPObjectMetaData* meta( iRequestChecker->GetObjectInfo( iHandle ) ); - TPtrC suid( meta->DesC( CMTPObjectMetaData::ESuid ) ); - iDpConfig.GetWrapperL().SetStorageRootL( suid ); __ASSERT_DEBUG( meta, Panic( EMmMTPDpObjectNull ) ); diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cmoveobject.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cmoveobject.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cmoveobject.cpp Tue May 11 16:40:32 2010 +0300 @@ -515,7 +515,6 @@ iObjectInfo->SetUint( CMTPObjectMetaData::EParentHandle, iNewParentHandle ); iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo); - iDpConfig.GetWrapperL().SetStorageRootL( aNewFileName ); iDpConfig.GetWrapperL().AddObjectL( *iObjectInfo ); if ( formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csendobject.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csendobject.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csendobject.cpp Tue May 11 16:40:32 2010 +0300 @@ -32,6 +32,8 @@ #include "cpropertysettingutility.h" #include "cmmmtpdpmetadataaccesswrapper.h" +const TInt KMtpRollbackFuncCnt = 3; + // Verification data for the SendObjectInfo request const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] = { @@ -79,12 +81,8 @@ // EXPORT_C CSendObject::~CSendObject() { - if ( !iNoRollback ) - { - // Not finished SendObjectInfo \ SendObject pair detected. - Rollback(); - PRINT( _L( "MM MTP <> CSendObject::~CSendObject, Rollback" ) ); - } + Rollback(); + iRollbackList.Close(); delete iFileReceived; delete iParentSuid; @@ -107,7 +105,8 @@ CRequestProcessor( aFramework, aConnection, 0, NULL ), iFs( iFramework.Fs() ), iObjectMgr( iFramework.ObjectMgr() ), - iDpConfig( aDpConfig ) + iDpConfig( aDpConfig ), + iRollbackList( KMtpRollbackFuncCnt ) { PRINT( _L( "Operation: SendObjectInfo/SendObject/SendObjectPropList(0x100C/0x100D/0x9808)" ) ); } @@ -130,8 +129,6 @@ PRINT1( _L( "MM MTP <> CSendObject::ConstructL DataProviderId = 0x%x" ), iFramework.DataProviderId()); - iNoRollback = EFalse; - SetPSStatus(); PRINT( _L( "MM MTP <= CSendObject::ConstructL" ) ); } @@ -300,11 +297,6 @@ { responseCode = EMTPRespCodeObjectTooLarge; } - - if ( ( responseCode != EMTPRespCodeOK ) && !CanStoreFileL( iStorageId, iObjectSize ) ) - { - responseCode = EMTPRespCodeStoreFull; - } } } @@ -392,22 +384,7 @@ void CSendObject::ServiceObjectL() { PRINT( _L( "MM MTP => CSendObject::ServiceObjectL" ) ); - - delete iFileReceived; - iFileReceived = NULL; - - PRINT2( _L( "MM MTP <> CSendObject::ServiceObjectL, iFullPath is %S, iObjectSize: %Lu" ), &iFullPath, iObjectSize ); - TRAPD( err, iFileReceived = CMTPTypeFile::NewL( iFs, - iFullPath, - EFileWrite ) ); - - PRINT1( _L("MM MTP <> CSendObject::ServiceObjectL, Leave Code is: %d"), err ); - User::LeaveIfError( err ); - - iFileReceived->SetSizeL( iObjectSize ); - ReceiveDataL( *iFileReceived ); - iProgress = ESendObjectInProgress; PRINT( _L( "MM MTP <= CSendObject::ServiceObjectL" ) ); @@ -479,12 +456,7 @@ if ( IsTooLarge( iObjectSize ) ) { SendResponseL( EMTPRespCodeObjectTooLarge ); - result = EFalse; - } - - if ( result && !CanStoreFileL( iStorageId, iObjectSize ) ) - { - SendResponseL( EMTPRespCodeStoreFull ); + Rollback(); result = EFalse; } @@ -496,6 +468,7 @@ && iProtectionStatus != EMTPProtectionReadOnly ) { SendResponseL( EMTPRespCodeParameterNotSupported ); + Rollback(); result = EFalse; } } @@ -507,6 +480,7 @@ { // File and/or parent pathname invalid. SendResponseL( EMTPRespCodeInvalidDataset ); + Rollback(); } } @@ -514,16 +488,19 @@ { if ( ExistsL( iFullPath ) ) { - // Object with the same name already exists. - iNoRollback = ETrue; SendResponseL( EMTPRespCodeAccessDenied ); + Rollback(); result = EFalse; } } if ( result ) - ReserveObjectL(); - + { + if ( KErrNone != ReserveObjectL() ) + { + result = EFalse; + } + } PRINT1( _L( "MM MTP <= CSendObject::DoHandleResponsePhaseInfoL result = %d" ), result ); return result; @@ -542,6 +519,7 @@ TInt invalidParameterIndex = KErrNotFound; responseCode = VerifyObjectPropListL( invalidParameterIndex ); + TInt err = KErrNone; if ( responseCode != EMTPRespCodeOK ) { @@ -551,18 +529,18 @@ parameters[2] = 0; parameters[3] = invalidParameterIndex; SendResponseL( responseCode, 4, parameters ); + Rollback(); } else if ( ExistsL( iFullPath ) ) { - // Object with the same name already exists. - iNoRollback = ETrue; SendResponseL( EMTPRespCodeAccessDenied ); + Rollback(); } else - ReserveObjectL(); + err = ReserveObjectL(); PRINT( _L( "MM MTP <= CSendObject::DoHandleResponsePhasePropListL" ) ); - return ( responseCode == EMTPRespCodeOK ); + return ( responseCode == EMTPRespCodeOK && err == KErrNone); } // ----------------------------------------------------------------------------- @@ -576,60 +554,56 @@ TBool result = ETrue; + TEntry fileEntry; + User::LeaveIfError( iFs.Entry( iFullPath, fileEntry ) ); + if ( fileEntry.FileSize() != iObjectSize ) + { + iFs.Delete( iFullPath ); + iObjectMgr.UnreserveObjectHandleL( *iReceivedObjectInfo ); + TMTPResponseCode responseCode = EMTPRespCodeObjectTooLarge; + if ( fileEntry.FileSize() < iObjectSize ) + { + responseCode = EMTPRespCodeIncompleteTransfer; + } + SendResponseL( responseCode ); + Rollback(); + result = EFalse; + } + // SendObject is cancelled or connection is dropped. - if ( iCancelled ) + if ( result && iCancelled ) { - // In SendObject response phase, unregister is not necessary. - // But there's no harm, still keep it here. + iFramework.RouteRequestUnregisterL( iExpectedSendObjectRequest, + iConnection ); + SendResponseL( EMTPRespCodeTransactionCancelled ); + Rollback(); + } + else if ( result && !iCancelled ) + { + if ( iObjectSize > 0 ) // media file + { + TRAPD( err, AddMediaToStoreL() ); + PRINT1( _L( "MM MTP <= CSendObject::DoHandleResponsePhaseObjectL err = %d" ), err ); + + if ( ( iPreviousOperation == EMTPOpCodeSendObjectPropList ) + && ( err == KErrNone ) ) + { + // Only leave when getting proplist element from data received by fw. + // It should not happen after ReceiveDataL in which construction of proplist already succeed. + SetObjectPropListL(); + } + + // Commits into MTP data object enumeration store the object handle and + // storage space previously reserved for the specified object. + iFramework.ObjectMgr().CommitReservedObjectHandleL( *iReceivedObjectInfo ); + iRollbackList.Append( RemoveObjectFromDbL ); + } + + // Commit object to MTP data store iFramework.RouteRequestUnregisterL( iExpectedSendObjectRequest, iConnection ); - Rollback(); - SendResponseL( EMTPRespCodeTransactionCancelled ); - } - else - { - TEntry fileEntry; - User::LeaveIfError( iFs.Entry( iFullPath, fileEntry ) ); - - if ( fileEntry.FileSize() != iObjectSize ) - { - Rollback(); - TMTPResponseCode responseCode = EMTPRespCodeObjectTooLarge; - if ( fileEntry.FileSize() < iObjectSize ) - { - responseCode = EMTPRespCodeIncompleteTransfer; - } - SendResponseL( responseCode ); - result = EFalse; - } - else - { - if ( iObjectSize > 0 ) // media file - { - TRAPD( err, AddMediaToStoreL() ); - PRINT1( _L( "MM MTP <> CSendObject::DoHandleResponsePhaseObjectL err = %d" ), err ); - - if ( ( iPreviousOperation == EMTPOpCodeSendObjectPropList ) - && ( err == KErrNone ) ) - { - // Only leave when getting proplist element from data received by fw. - // It should not happen after ReceiveDataL in which construction of proplist already succeed. - SetObjectPropListL(); - } - - // Commits into MTP data object enumeration store the object handle and - // storage space previously reserved for the specified object. - iFramework.ObjectMgr().CommitReservedObjectHandleL( *iReceivedObjectInfo ); - } - - // In SendObject response phase, unregister is not necessary. - // But there's no harm, still keep it here. - iFramework.RouteRequestUnregisterL( iExpectedSendObjectRequest, - iConnection ); - - SendResponseL( EMTPRespCodeOK ); - } + SendResponseL( EMTPRespCodeOK ); } PRINT1( _L( "MM MTP <= CSendObject::DoHandleResponsePhaseObjectL result = %d" ), result ); @@ -661,6 +635,9 @@ result = EFalse; } + if ( result ) + iRollbackList.Reset(); + PRINT2( _L( "MM MTP <= CSendObject::DoHandleCompletingPhaseL iProgress= %d, result = %d" ), iProgress, result ); @@ -1042,31 +1019,6 @@ return ret; } -// ----------------------------------------------------------------------------- -// CSendObject::CanStoreFileL -// Check if we can store the file on the storage -// @return ETrue if yes, otherwise EFalse -// ----------------------------------------------------------------------------- -// -TBool CSendObject::CanStoreFileL( TUint32 aStorageId, - TInt64 aObjectSize ) const - { - PRINT( _L( "MM MTP => CSendObject::CanStoreFileL" ) ); - - TBool result = ETrue; - TVolumeInfo volumeInfo; - TInt driveNo = iFramework.StorageMgr().DriveNumber( aStorageId ); - User::LeaveIfError( iFs.Volume( volumeInfo, driveNo ) ); - - if ( volumeInfo.iFree < aObjectSize ) - { - result = EFalse; - } - - PRINT1( _L( "MM MTP <= CSendObject::CanStoreFileL , result = %d" ), result ); - - return result; - } // ----------------------------------------------------------------------------- // CSendObject::GetFullPathNameL @@ -1171,7 +1123,7 @@ // CSendObject::ReserveObjectL // ----------------------------------------------------------------------------- // -void CSendObject::ReserveObjectL() +TInt CSendObject::ReserveObjectL() { PRINT( _L( "MM MTP => CSendObject::ReserveObjectL" ) ); TInt err = KErrNone; @@ -1187,15 +1139,42 @@ // by the specified object information record. TRAP( err, iObjectMgr.ReserveObjectHandleL( *iReceivedObjectInfo, iObjectSize ) ); + iRollbackList.Append( UnreserveObjectL ); PRINT2( _L( "MM MTP => CSendObject::ReserveObjectL iObjectsize = %Lu, Operation: 0x%x" ), iObjectSize, iOperationCode ); if ( err != KErrNone ) - PRINT1( _L( "MM MTP <> CSendObject::ReserveObjectL err = %d" ), err ); - if ( iObjectSize == 0 ) + { + PRINT1( _L( "MM MTP <> ReserveObjectHandleL err = %d" ), err ); + } + + if ( err == KErrNone ) + { + delete iFileReceived; + iFileReceived = NULL; + PRINT2( _L( "MM MTP <> CSendObject::ServiceObjectL, iFullPath is %S, iObjectSize: %Lu" ), &iFullPath, iObjectSize ); + iRollbackList.Append( RemoveObjectFromFs ); + TRAP( err, iFileReceived = CMTPTypeFile::NewL( iFs, iFullPath, EFileWrite ) ); + + PRINT1( _L("MM MTP <> CMTPTypeFile::NewL Leave Code is: %d"), err ); + } + + if ( err == KErrNone ) + { + TRAP( err, iFileReceived->SetSizeL( iObjectSize ) ); + PRINT1( _L( "MM MTP <> SetSizeL leave code:%d" ), err ); + if ( err == KErrDiskFull ) + { + SendResponseL( EMTPRespCodeStoreFull ); + Rollback(); + return err; + } + } + + if ( err == KErrNone && iObjectSize == 0 ) { // Already trapped inside SaveEmptyFileL. SaveEmptyFileL(); - if( iOperationCode == EMTPOpCodeSendObjectPropList ) + if ( iOperationCode == EMTPOpCodeSendObjectPropList ) { // Only leave when getting proplist element from data received by fw. // It should not happen after ReceiveDataL in which construction of proplist already succeed. @@ -1203,19 +1182,28 @@ } iObjectMgr.CommitReservedObjectHandleL( *iReceivedObjectInfo ); + iRollbackList.Reset(); } - iExpectedSendObjectRequest.SetUint32( TMTPTypeRequest::ERequestSessionID, - iSessionId ); - iFramework.RouteRequestRegisterL( iExpectedSendObjectRequest, iConnection ); + if ( err == KErrNone ) + { + iExpectedSendObjectRequest.SetUint32( TMTPTypeRequest::ERequestSessionID, iSessionId ); + iFramework.RouteRequestRegisterL( iExpectedSendObjectRequest, iConnection ); - TUint32 parameters[3]; - parameters[0] = iStorageId; - parameters[1] = iParentHandle; - parameters[2] = iReceivedObjectInfo->Uint( CMTPObjectMetaData::EHandle ); - SendResponseL( EMTPRespCodeOK, 3, parameters ); + TUint32 parameters[3]; + parameters[0] = iStorageId; + parameters[1] = iParentHandle; + parameters[2] = iReceivedObjectInfo->Uint( CMTPObjectMetaData::EHandle ); + SendResponseL( EMTPRespCodeOK, 3, parameters ); + } + else + { + SendResponseL( EMTPRespCodeGeneralError ); + Rollback(); + } PRINT( _L( "MM MTP <= CSendObject::ReserveObjectL" ) ); + return err; } // ----------------------------------------------------------------------------- @@ -1248,8 +1236,13 @@ } // Close the file after SetProtectionStatus to make sure other process won't open // the file successfully right at the time calling RFile::SetAtt. - delete iFileReceived; - iFileReceived = NULL; + if ( iObjectSize > 0 ) + { + delete iFileReceived; + iFileReceived = NULL; + } + else + iFileReceived->File().Close(); } PRINT( _L( "MM MTP <= CSendObject::SetProtectionStatus" ) ); @@ -1263,30 +1256,24 @@ { PRINT( _L( "MM MTP => CSendObject::SaveEmptyFileL" ) ); - RFile file; - User::LeaveIfError( file.Create( iFs, iFullPath, EFileWrite ) ); - CleanupClosePushL( file ); // + file - if ( EMTPFormatCodeAbstractAudioVideoPlaylist == iObjectFormat ) { - TInt err = KErrNone; - err = file.SetAtt( KEntryAttSystem | KEntryAttHidden, + TInt err = iFileReceived->File().SetAtt( KEntryAttSystem | KEntryAttHidden, KEntryAttReadOnly | KEntryAttNormal ); if ( err != KErrNone ) PRINT1( _L( "MM MTP <> CSendObject::SaveEmptyFileL err = %d" ), err ); iDpConfig.GetWrapperL().AddDummyFileL( iFullPath ); } - CleanupStack::PopAndDestroy( &file ); // - file // add playlist to MPX DB TRAPD( err, AddMediaToStoreL() ); if ( err != KErrNone ) - { - // Ignore err even add into MPX get failed. - } + iRollbackList.Append( RemoveObjectFromDbL ); + else + iRollbackList.Reset(); - PRINT1( _L( "MM MTP <= CSendObject::SaveEmptyFileLerr = %d" ), err ); + PRINT1( _L( "MM MTP <= CSendObject::SaveEmptyFileL err = %d" ), err ); } // ----------------------------------------------------------------------------- @@ -1303,7 +1290,6 @@ // Might need to set dateadded and datemodify for further extension. SetProtectionStatus(); - iDpConfig.GetWrapperL().SetStorageRootL( iFullPath ); PRINT1( _L( "MM MTP <> CSendObject::AddMediaToStoreL iFullPath = %S" ), &iFullPath ); iDpConfig.GetWrapperL().AddObjectL( *iReceivedObjectInfo ); @@ -1331,20 +1317,49 @@ // void CSendObject::Rollback() { - // Delete this object from file system. - if ( iProgress == ESendObjectInProgress ) - // || iProgress == EObjectInfoSucceed // this line is to be commented out until SetSize is done in SendObjectInfo/SendObjectPropList - //||iProgress == EObjectInfoFail ) + PRINT( _L("MM MTP => CSendObject::Rollback") ); + + TInt count = iRollbackList.Count(); + PRINT1( _L("MM MTP => CSendObject::Rollback, iRollbackList.Count() = %d"), iRollbackList.Count() ); + + for ( TInt i = 0; i < count; i++ ) { - PRINT1( _L( "MM MTP <> CSendObject::Rollback ROLLBACK_FILE %S" ), &iFullPath ); - // Close the interrupted transfer file by delete iFileReceived object - delete iFileReceived; - iFileReceived = NULL; + TMmMtpRollbackAction tmp = iRollbackList[i]; + ( this->*((TMmMtpRollbackAction)(iRollbackList[i])))(); + } + iRollbackList.Reset(); + + PRINT( _L("MM MTP <= CSendObject::Rollback") ); + } + +void CSendObject::UnreserveObjectL() + { + PRINT( _L("MM MTP => CSendObject::UnreserveObjectL") ); + iFramework.ObjectMgr().UnreserveObjectHandleL( *iReceivedObjectInfo ); + PRINT( _L("MM MTP <= CSendObject::UnreserveObjectL") ); + } - iFramework.Fs().Delete( iFullPath ); - TRAP_IGNORE( iFramework.ObjectMgr().UnreserveObjectHandleL( *iReceivedObjectInfo ) ); - iProgress = EObjectNone; +void CSendObject::RemoveObjectFromDbL() + { + PRINT( _L("MM MTP => CSendObject::RemoveObjectFromDbL") ); + iFramework.ObjectMgr().RemoveObjectL( iReceivedObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); + iDpConfig.GetWrapperL().DeleteObjectL( *iReceivedObjectInfo ); + PRINT( _L("MM MTP <= CSendObject::RemoveObjectFromDbL") ); + } + +void CSendObject::RemoveObjectFromFs() + { + PRINT( _L("MM MTP => CSendObject::RemoveObjectFromFs") ); + + delete iFileReceived; + iFileReceived = NULL; + + TInt err = iFramework.Fs().Delete( iFullPath ); + if ( err != KErrNone ) + { + PRINT1( _L("MM MTP <> CSendObject::RemoveObjectFromFs err = %d"), err ); } + PRINT( _L("MM MTP <= CSendObject::RemoveObjectFromFs") ); } // end of file diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectproplist.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectproplist.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectproplist.cpp Tue May 11 16:40:32 2010 +0300 @@ -245,6 +245,10 @@ object->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); iFramework.ObjectMgr().ModifyObjectL( *object ); } + else if ( KErrInUse == err ) // object file is being used by other program + { + responseCode = EMTPRespCodeDeviceBusy; + } else { responseCode = EMTPRespCodeGeneralError; diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectpropvalue.cpp --- a/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectpropvalue.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/csetobjectpropvalue.cpp Tue May 11 16:40:32 2010 +0300 @@ -300,6 +300,10 @@ iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); } + else if ( KErrInUse == err ) // object file is being used by other program + { + responseCode = EMTPRespCodeDeviceBusy; + } else { responseCode = EMTPRespCodeGeneralError; diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadataaccesswrapper.cpp --- a/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadataaccesswrapper.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadataaccesswrapper.cpp Tue May 11 16:40:32 2010 +0300 @@ -291,21 +291,6 @@ PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::DeleteObjectL" ) ); } -// --------------------------------------------------------------------------- -// CMmMtpDpMetadataAccessWrapper::SetStorageRootL -// Sets current Drive info -// --------------------------------------------------------------------------- -// -void CMmMtpDpMetadataAccessWrapper::SetStorageRootL( const TDesC& aStorageRoot ) - { - PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetStorageRootL" ) ); - - iMmMtpDpMetadataVideoAccess->SetStorageRootL( aStorageRoot ); - iMmMtpDpMetadataMpxAccess->SetStorageRootL( aStorageRoot ); - - PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetStorageRootL" ) ); - } - // ----------------------------------------------------------------------------- // CMmMtpDpMetadataMpxAccess::SetImageObjPropL // set image specific properties specific to videos @@ -583,8 +568,6 @@ // TBool CMmMtpDpMetadataAccessWrapper::IsExistL( const TDesC& aSuid ) { - TParsePtrC parse( aSuid ); - iMmMtpDpMetadataMpxAccess->SetStorageRootL( parse.Drive() ); return iMmMtpDpMetadataMpxAccess->IsExistL( aSuid ); } @@ -627,26 +610,22 @@ { PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::CreateDummyFile, filename = %S" ), &aPlaylistName ); - if ( MmMtpDpUtility::FormatFromFilename( aPlaylistName ) == - EMTPFormatCodeAbstractAudioVideoPlaylist ) + RFile newfile; + TInt err = newfile.Replace( iFs, aPlaylistName, EFileWrite ); + + if ( err != KErrNone ) { - RFile newfile; - TInt err = newfile.Replace( iFs, aPlaylistName, EFileWrite ); - + newfile.Close(); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile err = %d" ), err ); + } + else // File created OK + { + err = newfile.Flush(); + newfile.Close(); + err = iFs.SetAtt( aPlaylistName, KEntryAttSystem | KEntryAttHidden, + KEntryAttReadOnly | KEntryAttNormal ); if ( err != KErrNone ) - { - newfile.Close(); - PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile err = %d" ), err ); - } - else // File created OK - { - err = newfile.Flush(); - newfile.Close(); - err = iFs.SetAtt( aPlaylistName, KEntryAttSystem | KEntryAttHidden, - KEntryAttReadOnly | KEntryAttNormal ); - if ( err != KErrNone ) - PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile Dummy Playlist file created. err = %d" ), err ); - } + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile Dummy Playlist file created. err = %d" ), err ); } } @@ -685,7 +664,7 @@ PRINT3( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile filename = %S, err %d, entry.iSize = %d" ), &fileName, err, entry.iSize ); } - else if ( format != EMTPFormatCodeM3UPlaylist ) + else { TInt err = iFs.Delete( fileName ); @@ -693,11 +672,6 @@ &fileName, err ); } - else - { - // leave the Imported playlist in the file system - PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile, Don't delete m3u file [%S]" ), &fileName ); - } } PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) ); } @@ -707,8 +681,9 @@ // Update Music collection // --------------------------------------------------------------------------- // -EXPORT_C void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL() +EXPORT_C void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL( const TDesC& aStorageRoot ) { + iMmMtpDpMetadataMpxAccess->SetStorageRootL( aStorageRoot ); iMmMtpDpMetadataMpxAccess->UpdateMusicCollectionL( ); } diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatampxaccess.cpp --- a/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatampxaccess.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatampxaccess.cpp Tue May 11 16:40:32 2010 +0300 @@ -62,6 +62,8 @@ _LIT( KMpxCollectionGetReference, "MpxCollectionGetReference" ); _LIT( KMpxCollectionFindAllLValidate, "MpxCollectionValidate" ); _LIT( KMpxCollectionFindAllLBeforeAdd, "MpxCollectionFindAllLBeforeAdd" ); +_LIT( KMpxCollectionFindAllLModified, "MpxCollectionFindAllLModified" ); +_LIT( KMpxCollectionCleanupDeletedMediasL, "KMpxCollectionCleanupDeletedMediasL" ); _LIT( KSetMetadataValue, "SetMetadataValueL" ); #endif @@ -80,7 +82,8 @@ } CMmMtpDpMetadataMpxAccess::CMmMtpDpMetadataMpxAccess( RFs& aRfs ): - iRfs( aRfs ) + iRfs( aRfs ), + iSampleData( NULL ) { // Do nothing } @@ -111,6 +114,8 @@ iCollectionHelper = NULL; } + delete iSampleData; + // for performance measurement purpose #if defined(_DEBUG) || defined(MMMTPDP_PERFLOG) delete iPerfLog; @@ -393,7 +398,10 @@ searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); searchMedia->SetTObjectValueL( KMPXMediaGeneralId, KMtpInvalidSongID ); - searchMedia->SetTextValueL( KMPXMediaGeneralDrive, iStoreRoot ); + if ( iStoreRoot.Length() > 0 ) + { + searchMedia->SetTextValueL( KMPXMediaGeneralDrive, iStoreRoot ); + } RArray songAttributes; CleanupClosePushL( songAttributes ); // + songAttributes @@ -455,8 +463,10 @@ PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::FindWMPMediaLC searchMedia setup with no problems" ) ); + PERFLOGSTART(KMpxCollectionFindAllLModified); CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, songAttributes.Array() ); + PERFLOGSTOP(KMpxCollectionFindAllLModified); PRINT( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::FindWMPMediaLC foundMedia assigned from FindAllL" ) ); CleanupStack::PopAndDestroy( &songAttributes ); // - songAttributes @@ -587,7 +597,9 @@ // as there is NOT a separate database for deleted files. PRINT( _L( "MM MTP <> Deleting metadata for deleted files" ) ); + PERFLOGSTART( KMpxCollectionCleanupDeletedMediasL ); CollectionHelperL()->CleanupDeletedMediasL(); + PERFLOGSTOP( KMpxCollectionCleanupDeletedMediasL ); PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::UpdateMusicCollectionL" ) ); } @@ -685,6 +697,9 @@ CollectionHelperL()->SetL( media ); PERFLOGSTOP( KMpxCollectionSetL ); + delete iSampleData; + iSampleData = NULL; + CleanupStack::PopAndDestroy( 2, &contentIDs ); // - media, contentIDs PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetObjectMetadataValueL" ) ); @@ -881,16 +896,19 @@ const TDesC& suid = aMediaProp.ValueText( KMPXMediaGeneralUri ); PRINT2( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL SampleData numElements = %d, suid = %S" ), numElements, &suid ); - HBufC8* sampleData = HBufC8::NewLC( numElements * sizeof( TUint8 ) ); - TPtr8 samplePtr = sampleData->Des(); + delete iSampleData; + iSampleData = NULL; + + iSampleData = HBufC8::NewL( numElements * sizeof( TUint8 ) ); + TPtr8 samplePtr = iSampleData->Des(); mtpTypeArray.ToDes( samplePtr ); RFile sampleFile; CleanupClosePushL( sampleFile ); User::LeaveIfError( sampleFile.Replace( iRfs, suid, EFileWrite ) ); User::LeaveIfError( sampleFile.Write( samplePtr ) ); + aMediaProp.SetTObjectValueL( KMPXMediaMTPSampleData, (TInt)iSampleData ); + aMediaProp.SetTObjectValueL( attrib, ETrue ); CleanupStack::PopAndDestroy( &sampleFile ); - CleanupStack::PopAndDestroy( sampleData ); - aMediaProp.SetTObjectValueL( attrib, ETrue ); PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::SetMetadataValueL SampleData is ready = %u" ), 1 ); } break; @@ -926,7 +944,9 @@ searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); searchMedia->SetTextValueL( KMPXMediaGeneralUri, aFullFileName ); - searchMedia->SetTextValueL( KMPXMediaGeneralDrive, iStoreRoot ); + + TParsePtrC parse( aFullFileName ); + searchMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); RArray songAttributes; CleanupClosePushL( songAttributes ); // + songAttributes @@ -1158,7 +1178,7 @@ TParsePtrC parse( aRefFileArray[j] ); media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); media->SetTObjectValueL( KMPXMediaGeneralModified, EFalse ); - + // Add media into array contents abstractMediaArray->AppendL( media ); @@ -1568,7 +1588,9 @@ searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); searchMedia->SetTextValueL( KMPXMediaGeneralUri, aSuid ); - searchMedia->SetTextValueL( KMPXMediaGeneralDrive, iStoreRoot ); + + TParsePtrC parse( aSuid ); + searchMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); RArray playlistAttributes; CleanupClosePushL( playlistAttributes ); // + playlistAttributes diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp --- a/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp Tue May 11 16:40:32 2010 +0300 @@ -100,7 +100,8 @@ #endif // __WINDOWS_MEDIA else if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 ) { - HBufC8* mime = MmMtpDpUtility::OdfMimeTypeL( file.FullName() ); + HBufC8* mime(NULL); + TRAP_IGNORE( mime = MmMtpDpUtility::OdfMimeTypeL( file.FullName() ) ); if ( mime != NULL ) { // 3GP diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/playlistengine/group/bld.inf --- a/mmappcomponents/playlistengine/group/bld.inf Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/playlistengine/group/bld.inf Tue May 11 16:40:32 2010 +0300 @@ -23,9 +23,12 @@ PRJ_EXPORTS ../rom/mpxplaylistengine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxplaylistengine.iby) -../rom/mpxplaylistrecognizerplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxplaylistrecognizerplugin.iby) + +//MMMW has a generic recognizer that takes care of m3u files +//../rom/mpxplaylistrecognizerplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpxplaylistrecognizerplugin.iby) PRJ_MMPFILES -mpxplaylistrecognizer.mmp +//MMMW has a generic recognizer that takes care of m3u files +//mpxplaylistrecognizer.mmp mpxplaylistengine.mmp diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/playlistengine/inc/mpxplaylistrecognizer.h --- a/mmappcomponents/playlistengine/inc/mpxplaylistrecognizer.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/playlistengine/inc/mpxplaylistrecognizer.h Tue May 11 16:40:32 2010 +0300 @@ -29,6 +29,8 @@ class CMPXPluginHandlerBase; /** +* Deprecated. replaced by playlist recognizer in mw/mmmw. +* * Concrete implementation of the recognizer API used to recognize playlist files. * * This is used by the application framework, as well as CMPXPlaylistEngine to diff -r 4740b34b83ce -r f56ec6ce2732 mmappcomponents/playlistengine/src/mpxplaylistengine.cpp --- a/mmappcomponents/playlistengine/src/mpxplaylistengine.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappcomponents/playlistengine/src/mpxplaylistengine.cpp Tue May 11 16:40:32 2010 +0300 @@ -59,7 +59,6 @@ #include "mpxplaylistenginedefs.hrh" #include "mpxplaylistplugin.h" #include "mpxplaylistengine.h" -#include "mpxplaylistrecognizer.h" // ============================ CONSTANTS ===================================== const TInt KMPXBufExpandSize = 0x40; diff -r 4740b34b83ce -r f56ec6ce2732 mmappfw_plat/harvester_metadata_extractor_api/inc/mpxmetadataextractor.h --- a/mmappfw_plat/harvester_metadata_extractor_api/inc/mpxmetadataextractor.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappfw_plat/harvester_metadata_extractor_api/inc/mpxmetadataextractor.h Tue May 11 16:40:32 2010 +0300 @@ -19,14 +19,17 @@ #ifndef CMPXMETADATAEXTRACTOR_H #define CMPXMETADATAEXTRACTOR_H +#include +#include + +// FORWARD DECLARATION class CMPXMedia; class CMPXCollectionPath; -class CMetaDataUtility; class CMPXFileInfoUtility; class CMPXDrmMediaUtility; class MMPXMetadataExtractorObserver; -#include -#include +class CMetaDataUtility; +class CMetaDataFieldContainer; /** * Extracts metadata from a file. @@ -230,6 +233,13 @@ * @since 9.2 */ void CleanUp(); + + /** + * Sets drm media properties + * @since 9.2 + */ + void SetDrmMediaPropertiesL(const CMetaDataFieldContainer& aMetaCont); + private: diff -r 4740b34b83ce -r f56ec6ce2732 mmappfw_plat/mpx_common_api/inc/mpxmediamtpdefs.h --- a/mmappfw_plat/mpx_common_api/inc/mpxmediamtpdefs.h Tue Apr 27 17:09:22 2010 +0300 +++ b/mmappfw_plat/mpx_common_api/inc/mpxmediamtpdefs.h Tue May 11 16:40:32 2010 +0300 @@ -35,6 +35,7 @@ */ const TMPXAttributeData KMPXMediaMTPDrmStatus = {KMPXMediaIdMTP, 0x0001}; // TUint16 const TMPXAttributeData KMPXMediaMTPSampleDataFlag = {KMPXMediaIdMTP, 0x0002}; // TBool +const TMPXAttributeData KMPXMediaMTPSampleData = {KMPXMediaIdMTP, 0x0004}; // HBufC8* const TMPXAttributeData KMPXMediaMTPAll = {KMPXMediaIdMTP, 0xffffffff}; #endif // MPXMEDIAMTPDEFS_H diff -r 4740b34b83ce -r f56ec6ce2732 mpx/collectionframework/collectionutility/src/mpxcollectionplaylist.cpp --- a/mpx/collectionframework/collectionutility/src/mpxcollectionplaylist.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mpx/collectionframework/collectionutility/src/mpxcollectionplaylist.cpp Tue May 11 16:40:32 2010 +0300 @@ -1256,6 +1256,19 @@ if( changeType == EMPXItemDeleted ) { refresh = ETrue; + MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- current item deleted"); + + TBool lastItemDeleted( iItemIndex == 0 && iItemIndexes.Count() == 1 ); + + if ( lastItemDeleted ) // playlist is now empty, notify observer immediately + { + MPX_DEBUG1("CMPXCollectionPlaylist::DoHandleCollectionChangeMessageL -- last playlist item deleted"); + Invalidate(); + if ( iPlObs ) + { + iPlObs->HandleCollectionPlaylistChange(KErrEof); + } + } } // Modified else if( changeType == EMPXItemModified ) @@ -1333,7 +1346,8 @@ } } - if (iAutoPlaylist && refresh) + // update playlist immediately when item is deleted in order to detect deletion of the last item in the playlist + if ( refresh && iItemIndexes.Count() > 0 ) { // For autoplaylist, affected by the event. // Path clip will never happen for autoplaylist diff -r 4740b34b83ce -r f56ec6ce2732 mpx/commonframework/common/src/mpxpluginmonitor.cpp --- a/mpx/commonframework/common/src/mpxpluginmonitor.cpp Tue Apr 27 17:09:22 2010 +0300 +++ b/mpx/commonframework/common/src/mpxpluginmonitor.cpp Tue May 11 16:40:32 2010 +0300 @@ -145,8 +145,11 @@ MPX_DEBUG3("CMPXPluginMonitor::RunError interface id 0x%08x, error", iInterfaceUid.iUid, aError); // Restart observer - iECs.NotifyOnChange(iStatus); - SetActive(); + if ( !IsActive() ) + { + iECs.NotifyOnChange(iStatus); + SetActive(); + } return KErrNone; }