1072 |
1079 |
1073 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::AddSongL" ) ); |
1080 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::AddSongL" ) ); |
1074 } |
1081 } |
1075 |
1082 |
1076 // ----------------------------------------------------------------------------- |
1083 // ----------------------------------------------------------------------------- |
1077 // CMmMtpDpMetadataMpxAccess::AddPlaylistL |
1084 // CMmMtpDpMetadataMpxAccess::AddAbstractMediaL |
1078 // Adds Playlist to Mpx DB |
1085 // Adds abstract media to Mpx DB |
1079 // ----------------------------------------------------------------------------- |
1086 // ----------------------------------------------------------------------------- |
1080 // |
1087 // |
1081 void CMmMtpDpMetadataMpxAccess::AddPlaylistL( const TDesC& aFullFileName ) |
1088 void CMmMtpDpMetadataMpxAccess::AddAbstractMediaL( const TDesC& aFullFileName, TMPXGeneralCategory aCategory ) |
1082 { |
1089 { |
1083 PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::AddPlaylistL aFullFileName = %S" ), &aFullFileName ); |
1090 PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::AddAbstractMediaL aFullFileName = %S" ), &aFullFileName ); |
1084 |
1091 |
1085 // Does a record already exist for this playlist? |
1092 // Does a record already exist for this AbstractMedia? |
1086 RArray<TInt> contentIDs; |
1093 RArray<TInt> contentIDs; |
1087 CleanupClosePushL( contentIDs ); // + contentIDs |
1094 CleanupClosePushL( contentIDs ); // + contentIDs |
1088 contentIDs.AppendL( KMPXMediaIdGeneral ); |
1095 contentIDs.AppendL( KMPXMediaIdGeneral ); |
1089 |
1096 |
1090 CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); |
1097 CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); |
1091 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
1098 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
1092 CleanupStack::PushL( searchMedia ); // + searchMedia |
1099 CleanupStack::PushL( searchMedia ); // + searchMedia |
1093 |
1100 |
1094 searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); |
1101 searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); |
1095 searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); |
1102 searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, aCategory ); |
1096 searchMedia->SetTextValueL( KMPXMediaGeneralUri, aFullFileName ); |
1103 searchMedia->SetTextValueL( KMPXMediaGeneralUri, aFullFileName ); |
1097 |
1104 |
1098 RArray<TMPXAttribute> playlistAttributes; |
1105 RArray<TMPXAttribute> abstractMediaAttributes; |
1099 CleanupClosePushL( playlistAttributes ); // + playlistAttributes |
1106 CleanupClosePushL( abstractMediaAttributes ); // + abstractMediaAttributes |
1100 playlistAttributes.AppendL( KMPXMediaGeneralId ); |
1107 abstractMediaAttributes.AppendL( KMPXMediaGeneralId ); |
1101 playlistAttributes.AppendL( KMPXMediaGeneralTitle ); |
1108 abstractMediaAttributes.AppendL( KMPXMediaGeneralTitle ); |
1102 playlistAttributes.AppendL( KMPXMediaGeneralUri ); |
1109 if ( aCategory == EMPXPlaylist ) |
1103 |
1110 { |
1104 PERFLOGSTART(KMpxCollectionFindAllLBeforeAdd); |
1111 abstractMediaAttributes.AppendL( KMPXMediaGeneralUri ); |
|
1112 } |
|
1113 |
|
1114 PERFLOGSTART( KMpxCollectionFindAllLBeforeAdd ); |
1105 CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, |
1115 CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, |
1106 playlistAttributes.Array() ); |
1116 abstractMediaAttributes.Array() ); |
1107 PERFLOGSTOP(KMpxCollectionFindAllLBeforeAdd); |
1117 PERFLOGSTOP( KMpxCollectionFindAllLBeforeAdd ); |
1108 |
1118 |
1109 CleanupStack::PopAndDestroy( &playlistAttributes ); // - playlistAttributes |
1119 CleanupStack::PopAndDestroy( &abstractMediaAttributes ); // - abstractMediaAttributes |
1110 CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia |
1120 CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia |
1111 CleanupStack::PushL( foundMedia ); // + foundMedia |
1121 CleanupStack::PushL( foundMedia ); // + foundMedia |
1112 |
1122 |
1113 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
1123 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
1114 User::Leave( KErrNotSupported ); |
1124 User::Leave( KErrNotSupported ); |
1115 |
1125 |
1116 TInt foundItemCount = *foundMedia->Value<TInt>( KMPXMediaArrayCount ); |
1126 TInt foundItemCount = *foundMedia->Value<TInt>( KMPXMediaArrayCount ); |
1117 |
1127 |
1118 if ( foundItemCount != 0 ) |
1128 if ( foundItemCount != 0 ) |
1119 { |
1129 { |
1120 PRINT( _L( "MM MTP <> Playlist Media already exists in the collection" ) ); |
1130 PRINT( _L( "MM MTP <> Abstract Media already exists in the collection" ) ); |
1121 } |
1131 } |
1122 else |
1132 else |
1123 { |
1133 { |
1124 // Creat media properties for the playlist |
1134 // Creat media properties for the abstractMedia |
1125 PRINT( _L( "MM MTP <> Create playlist media properties" ) ); |
1135 PRINT( _L( "MM MTP <> Create abstract media properties" ) ); |
1126 RArray<TInt> contentIDs; |
1136 RArray<TInt> contentIDs; |
1127 CleanupClosePushL( contentIDs ); // + contentIDs |
1137 CleanupClosePushL( contentIDs ); // + contentIDs |
1128 contentIDs.AppendL( KMPXMediaIdGeneral ); |
1138 contentIDs.AppendL( KMPXMediaIdGeneral ); |
1129 |
1139 |
1130 CMPXMedia* media = CMPXMedia::NewL( contentIDs.Array() ); |
1140 CMPXMedia* media = CMPXMedia::NewL( contentIDs.Array() ); |
1131 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
1141 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
1132 CleanupStack::PushL( media ); // + media |
1142 CleanupStack::PushL( media ); // + media |
1133 |
1143 |
1134 CMPXMediaArray* playlistArray = CMPXMediaArray::NewL(); |
1144 CMPXMediaArray* abstractMediaArray = CMPXMediaArray::NewL(); |
1135 CleanupStack::PushL( playlistArray ); // + playlistArray; |
1145 CleanupStack::PushL( abstractMediaArray ); // + abstractMediaArray; |
1136 |
1146 |
1137 // MPXMedia default types |
1147 // MPXMedia default types |
1138 media->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, |
1148 media->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, |
1139 EMPXItem ); |
1149 EMPXItem ); |
1140 media->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, |
1150 media->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, |
1141 EMPXPlaylist ); |
1151 aCategory ); |
1142 // File Path |
1152 // File Path |
1143 // |
1153 // |
1144 media->SetTextValueL( KMPXMediaGeneralUri, aFullFileName ); |
1154 media->SetTextValueL( KMPXMediaGeneralUri, aFullFileName ); |
1145 |
1155 |
1146 TParsePtrC parse( aFullFileName ); |
1156 TParsePtrC parse( aFullFileName ); |
1147 |
1157 |
1148 media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1158 media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1149 media->SetTextValueL( KMPXMediaGeneralTitle, parse.Name() ); |
1159 if ( aCategory == EMPXPlaylist ) |
|
1160 { |
|
1161 media->SetTextValueL( KMPXMediaGeneralTitle, parse.Name() ); |
|
1162 } |
1150 media->SetTObjectValueL<TBool>( KMPXMediaGeneralSynchronized, ETrue ); |
1163 media->SetTObjectValueL<TBool>( KMPXMediaGeneralSynchronized, ETrue ); |
1151 media->SetCObjectValueL( KMPXMediaArrayContents, playlistArray ); |
1164 media->SetCObjectValueL( KMPXMediaArrayContents, abstractMediaArray ); |
1152 media->SetTObjectValueL( KMPXMediaArrayCount, playlistArray->Count() ); |
1165 media->SetTObjectValueL( KMPXMediaArrayCount, abstractMediaArray->Count() ); |
1153 |
1166 |
1154 PERFLOGSTART(KMpxCollectionAddL); |
1167 PERFLOGSTART( KMpxCollectionAddL ); |
1155 CollectionHelperL()->AddL( media ); |
1168 CollectionHelperL()->AddL( media ); |
1156 PERFLOGSTOP(KMpxCollectionAddL); |
1169 PERFLOGSTOP( KMpxCollectionAddL ); |
1157 |
1170 |
1158 // Clear the array |
1171 // Clear the array |
1159 CleanupStack::PopAndDestroy( playlistArray ); // - playlistArray |
1172 CleanupStack::PopAndDestroy( abstractMediaArray ); // - abstractMediaArray |
1160 |
1173 |
1161 CleanupStack::PopAndDestroy( media ); // - media |
1174 CleanupStack::PopAndDestroy( media ); // - media |
1162 } |
1175 } |
1163 |
1176 |
1164 CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia |
1177 CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia |
1165 |
1178 |
1166 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::AddPlaylistL" ) ); |
1179 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::AddAbstractMediaL" ) ); |
1167 } |
1180 } |
1168 |
1181 |
1169 // ----------------------------------------------------------------------------- |
1182 // ----------------------------------------------------------------------------- |
1170 // CMmMtpDpMetadataMpxAccess::SetPlaylistL |
1183 // CMmMtpDpMetadataMpxAccess::SetAbstractMediaL |
1171 // Set playlist to DB |
1184 // Set abstract media to DB |
1172 // ----------------------------------------------------------------------------- |
1185 // ----------------------------------------------------------------------------- |
1173 // |
1186 // |
1174 void CMmMtpDpMetadataMpxAccess::SetPlaylistL( const TDesC& aPlaylistFileName, |
1187 void CMmMtpDpMetadataMpxAccess::SetAbstractMediaL( const TDesC& aAbstractMediaFileName, |
1175 CDesCArray& aRefFileArray ) |
1188 CDesCArray& aRefFileArray, TMPXGeneralCategory aCategory ) |
1176 { |
1189 { |
1177 PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetPlaylistL" ) ); |
1190 PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::SetAbstractMediaL" ) ); |
1178 CMPXMediaArray* playlistArray = CMPXMediaArray::NewL(); |
1191 CMPXMediaArray* abstractMediaArray = CMPXMediaArray::NewL(); |
1179 CleanupStack::PushL( playlistArray ); // + playlistArray |
1192 CleanupStack::PushL( abstractMediaArray ); // + abstractMediaArray |
1180 |
1193 |
1181 TUint count = aRefFileArray.Count(); |
1194 TUint count = aRefFileArray.Count(); |
1182 for ( TUint j = 0; j < count; j++ ) |
1195 for ( TUint j = 0; j < count; j++ ) |
1183 { |
1196 { |
1184 // if the file is video, skip it and continue |
1197 // if the file is video, skip it and continue |
1209 TParsePtrC parse( aRefFileArray[j] ); |
1222 TParsePtrC parse( aRefFileArray[j] ); |
1210 media->SetTextValueL( KMPXMediaGeneralUri, aRefFileArray[j] ); |
1223 media->SetTextValueL( KMPXMediaGeneralUri, aRefFileArray[j] ); |
1211 media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1224 media->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1212 |
1225 |
1213 // Add media into array contents |
1226 // Add media into array contents |
1214 playlistArray->AppendL( media ); |
1227 abstractMediaArray->AppendL( media ); |
1215 |
1228 |
1216 CleanupStack::Pop( media ); // - media |
1229 CleanupStack::Pop( media ); // - media |
1217 } |
1230 } |
1218 |
1231 |
1219 RArray<TInt> contentIDs; |
1232 RArray<TInt> contentIDs; |
1220 CleanupClosePushL( contentIDs ); // + contentIDs |
1233 CleanupClosePushL( contentIDs ); // + contentIDs |
1221 contentIDs.AppendL( KMPXMediaIdGeneral ); |
1234 contentIDs.AppendL( KMPXMediaIdGeneral ); |
1222 |
1235 |
1223 CMPXMedia* playlistMedia = CMPXMedia::NewL( contentIDs.Array() ); |
1236 CMPXMedia* abstractMedia = CMPXMedia::NewL( contentIDs.Array() ); |
1224 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
1237 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
1225 CleanupStack::PushL( playlistMedia ); // + playlistMedia |
1238 CleanupStack::PushL( abstractMedia ); // + abstractMedia |
1226 |
1239 |
1227 playlistMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); |
1240 abstractMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); |
1228 |
1241 |
1229 playlistMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); |
1242 abstractMedia->SetTObjectValueL( KMPXMediaGeneralCategory, aCategory ); |
1230 |
1243 |
1231 playlistMedia->SetTextValueL( KMPXMediaGeneralUri, aPlaylistFileName ); |
1244 abstractMedia->SetTextValueL( KMPXMediaGeneralUri, aAbstractMediaFileName ); |
1232 |
1245 |
1233 TParsePtrC parse( aPlaylistFileName ); |
1246 TParsePtrC parse( aAbstractMediaFileName ); |
1234 playlistMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1247 abstractMedia->SetTextValueL( KMPXMediaGeneralDrive, parse.Drive() ); |
1235 playlistMedia->SetTObjectValueL<TBool>( KMPXMediaGeneralSynchronized, |
1248 abstractMedia->SetTObjectValueL<TBool>( KMPXMediaGeneralSynchronized, |
1236 ETrue ); |
1249 ETrue ); |
1237 playlistMedia->SetCObjectValueL( KMPXMediaArrayContents, playlistArray ); |
1250 abstractMedia->SetCObjectValueL( KMPXMediaArrayContents, abstractMediaArray ); |
1238 playlistMedia->SetTObjectValueL( KMPXMediaArrayCount, |
1251 abstractMedia->SetTObjectValueL( KMPXMediaArrayCount, |
1239 playlistArray->Count() ); |
1252 abstractMediaArray->Count() ); |
1240 |
1253 |
1241 // Update the duplicate playlist(s) with the new playlist array |
1254 // Update the duplicate abstractMedia(s) with the new abstractMedia array |
1242 PERFLOGSTART(KMpxCollectionSetL); |
1255 PERFLOGSTART( KMpxCollectionSetReferenceL ); |
1243 CollectionHelperL()->SetL( playlistMedia ); |
1256 CollectionHelperL()->SetL( abstractMedia ); |
1244 PERFLOGSTOP(KMpxCollectionSetL); |
1257 PERFLOGSTOP( KMpxCollectionSetReferenceL ); |
1245 |
1258 |
1246 CleanupStack::PopAndDestroy( playlistMedia ); // - playlistMedia |
1259 CleanupStack::PopAndDestroy( abstractMedia ); // - abstractMedia |
1247 |
1260 |
1248 // Clear the array |
1261 // Clear the array |
1249 CleanupStack::PopAndDestroy( playlistArray ); // - playlistArray |
1262 CleanupStack::PopAndDestroy( abstractMediaArray ); // - abstractMediaArray |
1250 |
1263 |
1251 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetPlaylistL" ) ); |
1264 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetAbstractMediaL" ) ); |
1252 } |
1265 } |
1253 |
1266 |
1254 // --------------------------------------------------------------------------- |
1267 // --------------------------------------------------------------------------- |
1255 // CMmMtpDpMetadataMpxAccess::SetStorageRootL |
1268 // CMmMtpDpMetadataMpxAccess::SetStorageRootL |
1256 // Set storage root of the MPX DB |
1269 // Set storage root of the MPX DB |
1301 aMediaProp.SetTextValueL( KMPXMediaMusicComposer, KNullDesC ); |
1314 aMediaProp.SetTextValueL( KMPXMediaMusicComposer, KNullDesC ); |
1302 // Album artFilename |
1315 // Album artFilename |
1303 aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtFileName, KNullDesC ); |
1316 aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtFileName, KNullDesC ); |
1304 // URL |
1317 // URL |
1305 aMediaProp.SetTextValueL( KMPXMediaMusicURL, KNullDesC ); |
1318 aMediaProp.SetTextValueL( KMPXMediaMusicURL, KNullDesC ); |
|
1319 |
|
1320 // add below for P4S failed case, that get metadata from cached CMPXMedia object |
|
1321 // DateAdded |
|
1322 TTime time; |
|
1323 time.HomeTime(); |
|
1324 aMediaProp.SetTObjectValueL( KMPXMediaGeneralDate, time.Int64() ); |
|
1325 // SampleRate |
|
1326 aMediaProp.SetTObjectValueL<TUint32>( KMPXMediaAudioSamplerate, 0 ); |
|
1327 // AudioBitrate |
|
1328 aMediaProp.SetTObjectValueL<TUint32>( KMPXMediaAudioBitrate, 0 ); |
|
1329 // Duration |
|
1330 aMediaProp.SetTObjectValueL<TInt>( KMPXMediaGeneralDuration, 0 ); |
|
1331 // DrmStatus |
|
1332 aMediaProp.SetTObjectValueL<TUint16>( KMPXMediaMTPDrmStatus, 0 ); |
|
1333 // NumberOfChannels |
|
1334 aMediaProp.SetTObjectValueL<TUint32>( KMPXMediaAudioNumberOfChannels, 0 ); |
|
1335 // AudioCodec |
|
1336 aMediaProp.SetTObjectValueL<TUint32>( KMPXMediaAudioAudioCodec, 0 ); |
|
1337 |
1306 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetDefaultL" ) ); |
1338 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::SetDefaultL" ) ); |
1307 } |
1339 } |
1308 |
1340 |
1309 TMPXAttributeData CMmMtpDpMetadataMpxAccess::MpxAttribFromPropL( const CMPXMedia& aMedia, |
1341 TMPXAttributeData CMmMtpDpMetadataMpxAccess::MpxAttribFromPropL( const TUint16 aPropCode ) |
1310 const TUint16 aPropCode ) |
|
1311 { |
1342 { |
1312 const TMetadataTable KMetadataTable[] = |
1343 const TMetadataTable KMetadataTable[] = |
1313 { |
1344 { |
1314 { EMTPObjectPropCodeName, KMPXMediaGeneralTitle }, |
1345 { EMTPObjectPropCodeName, KMPXMediaGeneralTitle }, |
1315 { EMTPObjectPropCodeArtist, KMPXMediaMusicArtist }, |
1346 { EMTPObjectPropCodeArtist, KMPXMediaMusicArtist }, |
1316 { EMTPObjectPropCodeAlbumName, KMPXMediaMusicAlbum }, |
1347 { EMTPObjectPropCodeAlbumName, KMPXMediaMusicAlbum }, |
1317 { EMTPObjectPropCodeDateModified, KMPXMediaGeneralDate }, |
1348 { EMTPObjectPropCodeDateModified, KMPXMediaGeneralDate }, |
1318 { EMTPObjectPropCodeDateAdded, KMPXMediaGeneralDate }, |
1349 { EMTPObjectPropCodeDateAdded, KMPXMediaGeneralDate }, |
1319 { EMTPObjectPropCodeDuration, KMPXMediaGeneralDuration }, |
1350 { EMTPObjectPropCodeDuration, KMPXMediaGeneralDuration }, |
1320 { EMTPObjectPropCodeTrack, KMPXMediaMusicAlbumTrack }, |
1351 { EMTPObjectPropCodeTrack, KMPXMediaMusicAlbumTrack }, |
1321 { EMTPObjectPropCodeComposer, KMPXMediaMusicComposer }, |
1352 { EMTPObjectPropCodeComposer, KMPXMediaMusicComposer }, |
1322 { EMTPObjectPropCodeOriginalReleaseDate, KMPXMediaMusicYear }, |
1353 { EMTPObjectPropCodeOriginalReleaseDate, KMPXMediaMusicYear }, |
1323 { EMTPObjectPropCodeGenre, KMPXMediaMusicGenre }, |
1354 { EMTPObjectPropCodeGenre, KMPXMediaMusicGenre }, |
1324 { EMTPObjectPropCodeDRMStatus, KMPXMediaMTPDrmStatus }, |
1355 { EMTPObjectPropCodeDRMStatus, KMPXMediaMTPDrmStatus }, |
1325 { EMTPObjectPropCodeDescription, KMPXMediaGeneralComment }, |
1356 { EMTPObjectPropCodeDescription, KMPXMediaGeneralComment }, |
1326 { EMTPObjectPropCodeNumberOfChannels, KMPXMediaAudioNumberOfChannels }, |
1357 { EMTPObjectPropCodeNumberOfChannels, KMPXMediaAudioNumberOfChannels }, |
1327 { EMTPObjectPropCodeAudioBitRate, KMPXMediaAudioBitrate }, |
1358 { EMTPObjectPropCodeAudioBitRate, KMPXMediaAudioBitrate }, |
1328 { EMTPObjectPropCodeSampleRate, KMPXMediaAudioSamplerate }, |
1359 { EMTPObjectPropCodeSampleRate, KMPXMediaAudioSamplerate }, |
1329 { EMTPObjectPropCodeAudioWAVECodec, KMPXMediaAudioAudioCodec }, |
1360 { EMTPObjectPropCodeAudioWAVECodec, KMPXMediaAudioAudioCodec }, |
1330 { EMTPObjectPropCodeAlbumArtist, KMPXMediaMusicArtist } |
1361 { EMTPObjectPropCodeAlbumArtist, KMPXMediaMusicArtist } |
1331 }; |
1362 }; |
1332 |
1363 |
1333 TInt i = 0; |
1364 TInt i = 0; |
1334 TInt count = sizeof( KMetadataTable ) / sizeof( KMetadataTable[0] ); |
1365 TInt count = sizeof( KMetadataTable ) / sizeof( KMetadataTable[0] ); |
1335 while ( ( KMetadataTable[i].iPropCode != aPropCode ) |
1366 while ( ( KMetadataTable[i].iPropCode != aPropCode ) |
1336 && ( i < count ) ) |
1367 && ( i < count ) ) |
1367 CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); |
1398 CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); |
1368 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
1399 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
1369 CleanupStack::PushL( searchMedia ); // + searchMedia |
1400 CleanupStack::PushL( searchMedia ); // + searchMedia |
1370 |
1401 |
1371 searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); |
1402 searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); |
|
1403 searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, aCategory ); |
|
1404 searchMedia->SetTextValueL( KMPXMediaGeneralDrive, iStoreRoot ); |
|
1405 |
|
1406 RArray<TMPXAttribute> abstractMediaAttributes; |
|
1407 CleanupClosePushL( abstractMediaAttributes ); // + abstractMediaAttributes |
|
1408 abstractMediaAttributes.AppendL( KMPXMediaGeneralId ); |
|
1409 abstractMediaAttributes.AppendL( KMPXMediaGeneralTitle ); |
|
1410 if ( aCategory == EMPXPlaylist ) |
|
1411 { |
|
1412 abstractMediaAttributes.AppendL( KMPXMediaGeneralUri ); |
|
1413 } |
|
1414 |
|
1415 PERFLOGSTART( KMpxCollectionGetAbstractMedia ); |
|
1416 CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, |
|
1417 abstractMediaAttributes.Array() ); |
|
1418 PERFLOGSTOP( KMpxCollectionGetAbstractMedia ); |
|
1419 |
|
1420 CleanupStack::PopAndDestroy( &abstractMediaAttributes ); // - abstractMediaAttributes |
|
1421 CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia |
|
1422 CleanupStack::PushL( foundMedia ); // + foundMedia |
|
1423 |
|
1424 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
|
1425 { |
|
1426 User::Leave( KErrNotSupported ); |
|
1427 } |
|
1428 |
|
1429 TInt count = *foundMedia->Value<TInt>( KMPXMediaArrayCount ); |
|
1430 |
|
1431 PRINT1( _L("MM MTP <> CMmMtpDpMetadataMpxAccess::GetAllAbstractMediaL [%d] abstractMedias found in Database"), count ); |
|
1432 |
|
1433 if ( count > 0 ) |
|
1434 { |
|
1435 if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) |
|
1436 { |
|
1437 User::Leave( KErrNotSupported ); |
|
1438 } |
|
1439 |
|
1440 *aAbstractMedias = |
|
1441 CMPXMediaArray::NewL( *( foundMedia->Value<CMPXMediaArray> ( KMPXMediaArrayContents ) ) ); |
|
1442 } |
|
1443 |
|
1444 CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia |
|
1445 |
|
1446 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetAllAbstractMediaL" ) ); |
|
1447 } |
|
1448 |
|
1449 // --------------------------------------------------------------------------- |
|
1450 // CMmMtpDpMetadataMpxAccess::GetAllReferenceL |
|
1451 // Get all references of specified playlist |
|
1452 // --------------------------------------------------------------------------- |
|
1453 // |
|
1454 void CMmMtpDpMetadataMpxAccess::GetAllReferenceL( CMPXMedia* aAbstractMedia, |
|
1455 CDesCArray& aReferences ) |
|
1456 { |
|
1457 PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetAllReferenceL" ) ); |
|
1458 |
|
1459 __ASSERT_DEBUG( aAbstractMedia, User::Panic( KMtpMpxPanic, KErrArgument ) ); |
|
1460 |
|
1461 // Extract the playlist id from the found object |
|
1462 TUint32 abstractMediaId = *( *aAbstractMedia ).Value<TMPXItemId>( KMPXMediaGeneralId ); |
|
1463 |
|
1464 // find the media object that contains a list of songs in the playlist |
|
1465 RArray<TInt> contentIDs; |
|
1466 CleanupClosePushL( contentIDs ); // + contentIDs |
|
1467 contentIDs.AppendL( KMPXMediaIdGeneral ); |
|
1468 |
|
1469 CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); |
|
1470 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
|
1471 CleanupStack::PushL( searchMedia ); // + searchMedia |
|
1472 |
|
1473 searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup ); |
|
1474 searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); |
|
1475 searchMedia->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, abstractMediaId ); |
|
1476 |
|
1477 RArray<TMPXAttribute> songAttributes; |
|
1478 CleanupClosePushL( songAttributes ); // + songAttributes |
|
1479 songAttributes.AppendL( KMPXMediaGeneralId ); |
|
1480 songAttributes.AppendL( KMPXMediaGeneralUri ); |
|
1481 |
|
1482 PERFLOGSTART( KMpxCollectionGetReference ); |
|
1483 CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, |
|
1484 songAttributes.Array() ); |
|
1485 PERFLOGSTOP( KMpxCollectionGetReference ); |
|
1486 |
|
1487 CleanupStack::PopAndDestroy( &songAttributes ); // - songAttributes |
|
1488 CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia |
|
1489 CleanupStack::PushL( foundMedia ); // + foundMedia |
|
1490 |
|
1491 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
|
1492 { |
|
1493 User::Leave( KErrNotSupported ); |
|
1494 } |
|
1495 |
|
1496 // Number of references |
|
1497 TInt numOfRefs = *foundMedia->Value<TInt> ( KMPXMediaArrayCount ); |
|
1498 if ( numOfRefs > 0 ) |
|
1499 { |
|
1500 if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) |
|
1501 { |
|
1502 User::Leave( KErrNotSupported ); |
|
1503 } |
|
1504 |
|
1505 const CMPXMediaArray* refArray = foundMedia->Value<CMPXMediaArray> ( |
|
1506 KMPXMediaArrayContents ); |
|
1507 |
|
1508 // Import the references |
|
1509 for ( TInt i = 0; i < numOfRefs; i++ ) |
|
1510 { |
|
1511 const CMPXMedia* refMedia = ( *refArray )[i]; |
|
1512 |
|
1513 if ( !refMedia->IsSupported( KMPXMediaGeneralUri ) ) |
|
1514 { |
|
1515 User::Leave( KErrNotSupported ); |
|
1516 } |
|
1517 |
|
1518 // may replace the following 3 statements into the following: |
|
1519 // AppendL(refMedia->ValueText(KMPXMediaGeneralUri)); |
|
1520 HBufC* musicFileLocation = refMedia->ValueText( KMPXMediaGeneralUri ).AllocLC(); |
|
1521 aReferences.AppendL( *musicFileLocation ); |
|
1522 |
|
1523 PRINT1( _L("MM MTP <> CMmMtpDpMetadataMpxAccess::GetAllReferenceL, [%S] found from MPX db"), musicFileLocation ); |
|
1524 |
|
1525 CleanupStack::PopAndDestroy( musicFileLocation ); // - musicFileLocation |
|
1526 } |
|
1527 } |
|
1528 |
|
1529 CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia |
|
1530 |
|
1531 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetAllReferenceL" ) ); |
|
1532 } |
|
1533 |
|
1534 // --------------------------------------------------------------------------- |
|
1535 // CMmMtpDpMetadataMpxAccess::GetAbstractMediaNameL |
|
1536 // |
|
1537 // --------------------------------------------------------------------------- |
|
1538 // |
|
1539 HBufC* CMmMtpDpMetadataMpxAccess::GetAbstractMediaNameL( CMPXMedia* aAbstractMedia, |
|
1540 TMPXGeneralCategory aCategory ) |
|
1541 { |
|
1542 PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetAbstractMediaNameL" ) ); |
|
1543 HBufC* name = NULL; |
|
1544 if ( aCategory == EMPXPlaylist ) |
|
1545 { |
|
1546 if( !aAbstractMedia->IsSupported( KMPXMediaGeneralUri ) ) |
|
1547 { |
|
1548 User::Leave( KErrNotSupported ); |
|
1549 } |
|
1550 name = aAbstractMedia->ValueText( KMPXMediaGeneralUri ).AllocL(); |
|
1551 } |
|
1552 else |
|
1553 { |
|
1554 User::Leave( KErrNotSupported ); |
|
1555 } |
|
1556 |
|
1557 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetAbstractMediaNameL" ) ); |
|
1558 return name; |
|
1559 } |
|
1560 |
|
1561 // --------------------------------------------------------------------------- |
|
1562 // CMmMtpDpMetadataMpxAccess::GetModifiedContentL |
|
1563 // Get modified content |
|
1564 // --------------------------------------------------------------------------- |
|
1565 // |
|
1566 void CMmMtpDpMetadataMpxAccess::GetModifiedContentL( TInt& arrayCount, |
|
1567 CDesCArray& aModifiedcontent ) |
|
1568 { |
|
1569 PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetModifiedContentL" ) ); |
|
1570 CMPXMedia* foundMedia; |
|
1571 TInt foundItemCount( 0 ); |
|
1572 HBufC* musicFileLocation( NULL ); |
|
1573 |
|
1574 // Modified content |
|
1575 PRINT( _L( "MM MTP <> Modified contents are:" ) ); |
|
1576 |
|
1577 foundMedia = FindWMPMediaLC( KMPXMediaGeneralModified, ETrue ); // + foundMedia |
|
1578 |
|
1579 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
|
1580 { |
|
1581 User::Leave( KErrNotSupported ); |
|
1582 } |
|
1583 |
|
1584 foundItemCount = *foundMedia->Value<TInt>( KMPXMediaArrayCount ); |
|
1585 |
|
1586 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetModifiedContentL() found %d Media Objects" ), foundItemCount ); |
|
1587 |
|
1588 if ( foundItemCount ) |
|
1589 { |
|
1590 if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) |
|
1591 { |
|
1592 User::Leave( KErrNotSupported ); |
|
1593 } |
|
1594 |
|
1595 const CMPXMediaArray* foundArray = foundMedia->Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
1596 |
|
1597 for ( TInt j = 0; j < foundItemCount; j++ ) |
|
1598 { |
|
1599 CMPXMedia* media = CMPXMedia::NewL( *(*foundArray)[j] ); |
|
1600 CleanupStack::PushL( media ); // + media |
|
1601 |
|
1602 if ( !media->IsSupported( KMPXMediaGeneralUri ) ) |
|
1603 { |
|
1604 User::Leave( KErrNotSupported ); |
|
1605 } |
|
1606 |
|
1607 musicFileLocation = media->ValueText( KMPXMediaGeneralUri ).AllocLC(); // + musicFileLoaction |
|
1608 |
|
1609 aModifiedcontent.AppendL( *musicFileLocation ); |
|
1610 arrayCount++; |
|
1611 PRINT1( _L("arrayCount = %d"), arrayCount); |
|
1612 |
|
1613 CleanupStack::PopAndDestroy( musicFileLocation ); // - musicFileLocation |
|
1614 CleanupStack::PopAndDestroy( media ); // - media |
|
1615 } |
|
1616 } |
|
1617 |
|
1618 CleanupStack::PopAndDestroy( foundMedia ); // + foundMedia |
|
1619 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetModifiedContentL" ) ); |
|
1620 } |
|
1621 |
|
1622 // --------------------------------------------------------------------------- |
|
1623 // CMmMtpDpMetadataMpxAccess::IsExistL |
|
1624 // if the playlsit exist in the MPX DB |
|
1625 // --------------------------------------------------------------------------- |
|
1626 // |
|
1627 TBool CMmMtpDpMetadataMpxAccess::IsExistL( const TDesC& aSuid ) |
|
1628 { |
|
1629 PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::IsExist aSuid(%S)" ), &aSuid ); |
|
1630 RArray<TInt> contentIDs; |
|
1631 CleanupClosePushL( contentIDs ); // + contentIDs |
|
1632 contentIDs.AppendL( KMPXMediaIdGeneral ); |
|
1633 |
|
1634 CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); |
|
1635 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
|
1636 CleanupStack::PushL( searchMedia ); // + searchMedia |
|
1637 |
|
1638 searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); |
1372 searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); |
1639 searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); |
1373 searchMedia->SetTextValueL( KMPXMediaGeneralDrive, iStoreRoot ); |
1640 searchMedia->SetTextValueL( KMPXMediaGeneralUri, aSuid ); |
1374 |
1641 |
1375 RArray<TMPXAttribute> playlistAttributes; |
1642 RArray<TMPXAttribute> playlistAttributes; |
1376 CleanupClosePushL( playlistAttributes ); // + playlistAttributes |
1643 CleanupClosePushL( playlistAttributes ); // + playlistAttributes |
1377 playlistAttributes.AppendL( KMPXMediaGeneralId ); |
1644 playlistAttributes.AppendL( KMPXMediaGeneralId ); |
1378 playlistAttributes.AppendL( KMPXMediaGeneralTitle ); |
1645 playlistAttributes.AppendL( KMPXMediaGeneralTitle ); |
1379 playlistAttributes.AppendL( KMPXMediaGeneralUri ); |
1646 playlistAttributes.AppendL( KMPXMediaGeneralUri ); |
1380 |
1647 |
1381 PERFLOGSTART(KMpxCollectionGetPlaylist); |
|
1382 CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, |
1648 CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, |
1383 playlistAttributes.Array() ); |
1649 playlistAttributes.Array() ); |
1384 PERFLOGSTOP(KMpxCollectionGetPlaylist); |
|
1385 |
1650 |
1386 CleanupStack::PopAndDestroy( &playlistAttributes ); // - playlistAttributes |
1651 CleanupStack::PopAndDestroy( &playlistAttributes ); // - playlistAttributes |
1387 CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia |
1652 CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia |
1388 CleanupStack::PushL( foundMedia ); // + foundMedia |
|
1389 |
|
1390 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
|
1391 { |
|
1392 User::Leave( KErrNotSupported ); |
|
1393 } |
|
1394 |
|
1395 TInt count = *foundMedia->Value<TInt> ( KMPXMediaArrayCount ); |
|
1396 |
|
1397 PRINT1( _L("MM MTP <> CMmMtpDpMetadataMpxAccess::GetAllPlaylistL [%d] playlists found in Playlist Database"), count ); |
|
1398 |
|
1399 if ( count > 0 ) |
|
1400 { |
|
1401 if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) |
|
1402 { |
|
1403 User::Leave( KErrNotSupported ); |
|
1404 } |
|
1405 |
|
1406 *aPlaylists = CMPXMediaArray::NewL( *( foundMedia->Value<CMPXMediaArray> ( |
|
1407 KMPXMediaArrayContents ) ) ); |
|
1408 } |
|
1409 |
|
1410 CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia |
|
1411 |
|
1412 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetAllPlaylistL" ) ); |
|
1413 } |
|
1414 |
|
1415 // --------------------------------------------------------------------------- |
|
1416 // CMmMtpDpMetadataMpxAccess::GetAllReferenceL |
|
1417 // Get all references of specified playlist |
|
1418 // --------------------------------------------------------------------------- |
|
1419 // |
|
1420 void CMmMtpDpMetadataMpxAccess::GetAllReferenceL( CMPXMedia* aPlaylist, |
|
1421 CDesCArray& aReferences ) |
|
1422 { |
|
1423 PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetAllReferenceL" ) ); |
|
1424 |
|
1425 __ASSERT_DEBUG( aPlaylist, User::Panic( KMtpMpxPanic, KErrArgument ) ); |
|
1426 |
|
1427 // Extract the playlist id from the found object |
|
1428 TUint32 playlistId = *(*aPlaylist).Value<TMPXItemId> ( KMPXMediaGeneralId ); |
|
1429 |
|
1430 // find the media object that contains a list of songs in the playlist |
|
1431 RArray<TInt> contentIDs; |
|
1432 CleanupClosePushL( contentIDs ); // + contentIDs |
|
1433 contentIDs.AppendL( KMPXMediaIdGeneral ); |
|
1434 |
|
1435 CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); |
|
1436 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
|
1437 CleanupStack::PushL( searchMedia ); // + searchMedia |
|
1438 |
|
1439 searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup ); |
|
1440 searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); |
|
1441 searchMedia->SetTObjectValueL<TMPXItemId> ( KMPXMediaGeneralId, playlistId ); |
|
1442 |
|
1443 RArray<TMPXAttribute> songAttributes; |
|
1444 CleanupClosePushL( songAttributes ); // + songAttributes |
|
1445 songAttributes.AppendL( KMPXMediaGeneralId ); |
|
1446 songAttributes.AppendL( KMPXMediaGeneralUri ); |
|
1447 |
|
1448 PERFLOGSTART(KMpxCollectionGetReference); |
|
1449 CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, |
|
1450 songAttributes.Array() ); |
|
1451 PERFLOGSTOP(KMpxCollectionGetReference); |
|
1452 |
|
1453 CleanupStack::PopAndDestroy( &songAttributes ); // - songAttributes |
|
1454 CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia |
|
1455 CleanupStack::PushL( foundMedia ); // + foundMedia |
|
1456 |
|
1457 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
|
1458 { |
|
1459 User::Leave( KErrNotSupported ); |
|
1460 } |
|
1461 |
|
1462 // Number of references |
|
1463 TInt numOfRefs = *foundMedia->Value<TInt> ( KMPXMediaArrayCount ); |
|
1464 if ( numOfRefs > 0 ) |
|
1465 { |
|
1466 if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) |
|
1467 { |
|
1468 User::Leave( KErrNotSupported ); |
|
1469 } |
|
1470 |
|
1471 const CMPXMediaArray* refArray = foundMedia->Value<CMPXMediaArray> ( |
|
1472 KMPXMediaArrayContents ); |
|
1473 |
|
1474 // Import the references |
|
1475 for ( TInt i = 0; i < numOfRefs; i++ ) |
|
1476 { |
|
1477 const CMPXMedia* refMedia = ( *refArray )[i]; |
|
1478 |
|
1479 if ( !refMedia->IsSupported( KMPXMediaGeneralUri ) ) |
|
1480 { |
|
1481 User::Leave( KErrNotSupported ); |
|
1482 } |
|
1483 |
|
1484 // may replace the following 3 statements into the following: |
|
1485 // AppendL(refMedia->ValueText(KMPXMediaGeneralUri)); |
|
1486 HBufC* musicFileLocation = refMedia->ValueText( KMPXMediaGeneralUri ).AllocLC(); |
|
1487 aReferences.AppendL( *musicFileLocation ); |
|
1488 |
|
1489 PRINT1( _L("MM MTP <> CMmMtpDpMetadataMpxAccess::GetAllReferenceL, [%S] found from MPX db"), musicFileLocation ); |
|
1490 |
|
1491 CleanupStack::PopAndDestroy( musicFileLocation ); // - musicFileLocation |
|
1492 } |
|
1493 } |
|
1494 |
|
1495 CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia |
|
1496 |
|
1497 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetAllReferenceL" ) ); |
|
1498 } |
|
1499 |
|
1500 // --------------------------------------------------------------------------- |
|
1501 // CMmMtpDpMetadataMpxAccess::GetPlaylistNameL |
|
1502 // |
|
1503 // --------------------------------------------------------------------------- |
|
1504 // |
|
1505 void CMmMtpDpMetadataMpxAccess::GetPlaylistNameL( CMPXMedia* aPlaylist, |
|
1506 TDes& aPlaylistName ) |
|
1507 { |
|
1508 PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetPlaylistNameL" ) ); |
|
1509 |
|
1510 if ( !aPlaylist->IsSupported( KMPXMediaGeneralUri ) ) |
|
1511 { |
|
1512 User::Leave( KErrNotSupported ); |
|
1513 } |
|
1514 |
|
1515 aPlaylistName.Copy( aPlaylist->ValueText( KMPXMediaGeneralUri ) ); |
|
1516 |
|
1517 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetPlaylistNameL" ) ); |
|
1518 } |
|
1519 |
|
1520 // --------------------------------------------------------------------------- |
|
1521 // CMmMtpDpMetadataMpxAccess::GetModifiedContentL |
|
1522 // Get modified content |
|
1523 // --------------------------------------------------------------------------- |
|
1524 // |
|
1525 void CMmMtpDpMetadataMpxAccess::GetModifiedContentL( TInt& arrayCount, |
|
1526 CDesCArray& aModifiedcontent ) |
|
1527 { |
|
1528 PRINT( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::GetModifiedContentL" ) ); |
|
1529 CMPXMedia* foundMedia; |
|
1530 TInt foundItemCount( 0 ); |
|
1531 HBufC* musicFileLocation( NULL ); |
|
1532 |
|
1533 // Modified content |
|
1534 PRINT( _L( "MM MTP <> Modified contents are:" ) ); |
|
1535 |
|
1536 foundMedia = FindWMPMediaLC( KMPXMediaGeneralModified, ETrue ); // + foundMedia |
|
1537 |
|
1538 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
|
1539 { |
|
1540 User::Leave( KErrNotSupported ); |
|
1541 } |
|
1542 |
|
1543 foundItemCount = *foundMedia->Value<TInt>( KMPXMediaArrayCount ); |
|
1544 |
|
1545 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataMpxAccess::GetModifiedContentL() found %d Media Objects" ), foundItemCount ); |
|
1546 |
|
1547 if ( foundItemCount ) |
|
1548 { |
|
1549 if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) ) |
|
1550 { |
|
1551 User::Leave( KErrNotSupported ); |
|
1552 } |
|
1553 |
|
1554 const CMPXMediaArray* foundArray = foundMedia->Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
1555 |
|
1556 for ( TInt j = 0; j < foundItemCount; j++ ) |
|
1557 { |
|
1558 CMPXMedia* media = CMPXMedia::NewL( *(*foundArray)[j] ); |
|
1559 CleanupStack::PushL( media ); // + media |
|
1560 |
|
1561 if ( !media->IsSupported( KMPXMediaGeneralUri ) ) |
|
1562 { |
|
1563 User::Leave( KErrNotSupported ); |
|
1564 } |
|
1565 |
|
1566 musicFileLocation = media->ValueText( KMPXMediaGeneralUri ).AllocLC(); // + musicFileLoaction |
|
1567 |
|
1568 aModifiedcontent.AppendL( *musicFileLocation ); |
|
1569 arrayCount++; |
|
1570 PRINT1( _L("arrayCount = %d"), arrayCount); |
|
1571 |
|
1572 CleanupStack::PopAndDestroy( musicFileLocation ); // - musicFileLocation |
|
1573 CleanupStack::PopAndDestroy( media ); // - media |
|
1574 } |
|
1575 } |
|
1576 |
|
1577 CleanupStack::PopAndDestroy( foundMedia ); // + foundMedia |
|
1578 PRINT( _L( "MM MTP <= CMmMtpDpMetadataMpxAccess::GetModifiedContentL" ) ); |
|
1579 } |
|
1580 |
|
1581 // --------------------------------------------------------------------------- |
|
1582 // CMmMtpDpMetadataMpxAccess::IsExistL |
|
1583 // if the playlsit exist in the MPX DB |
|
1584 // --------------------------------------------------------------------------- |
|
1585 // |
|
1586 TBool CMmMtpDpMetadataMpxAccess::IsExistL( const TDesC& aSuid ) |
|
1587 { |
|
1588 PRINT1( _L( "MM MTP => CMmMtpDpMetadataMpxAccess::IsExist aSuid(%S)" ), &aSuid ); |
|
1589 RArray<TInt> contentIDs; |
|
1590 CleanupClosePushL( contentIDs ); // + contentIDs |
|
1591 contentIDs.AppendL( KMPXMediaIdGeneral ); |
|
1592 |
|
1593 CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() ); |
|
1594 CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs |
|
1595 CleanupStack::PushL( searchMedia ); // + searchMedia |
|
1596 |
|
1597 searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem ); |
|
1598 searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); |
|
1599 searchMedia->SetTextValueL( KMPXMediaGeneralUri, aSuid ); |
|
1600 |
|
1601 RArray<TMPXAttribute> playlistAttributes; |
|
1602 CleanupClosePushL( playlistAttributes ); // + playlistAttributes |
|
1603 playlistAttributes.AppendL( KMPXMediaGeneralId ); |
|
1604 playlistAttributes.AppendL( KMPXMediaGeneralTitle ); |
|
1605 playlistAttributes.AppendL( KMPXMediaGeneralUri ); |
|
1606 |
|
1607 CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *searchMedia, |
|
1608 playlistAttributes.Array() ); |
|
1609 |
|
1610 CleanupStack::PopAndDestroy( &playlistAttributes ); // - playlistAttributes |
|
1611 CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia |
|
1612 |
1653 |
1613 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
1654 if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) ) |
1614 User::Leave( KErrNotSupported ); |
1655 User::Leave( KErrNotSupported ); |
1615 |
1656 |
1616 TInt foundItemCount = *foundMedia->Value<TInt>( KMPXMediaArrayCount ); |
1657 TInt foundItemCount = *foundMedia->Value<TInt>( KMPXMediaArrayCount ); |