155 // |
155 // |
156 if( iCache->Count() >= KCacheCount) |
156 if( iCache->Count() >= KCacheCount) |
157 { |
157 { |
158 Commit(); |
158 Commit(); |
159 } |
159 } |
160 |
160 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
161 TBool extract = ETrue; |
|
162 if( aMedia->IsSupported( KMPXMediaMTPSampleDataFlag ) ) |
|
163 { |
|
164 |
|
165 extract = aMedia->ValueTObjectL<TBool>( KMPXMediaMTPSampleDataFlag ); |
|
166 MPX_DEBUG2("CMPXCollectionCachedHelper::AddL KMPXMediaMTPSampleDataFlag is set. extract=%d", extract ); |
|
167 } |
|
168 |
|
169 if( extract ) |
|
170 { |
|
171 // Extract album art from the file |
|
172 iMetadataExtractor->ExtractAlbumArtL( aMedia ); |
|
173 } |
|
174 #else |
161 // Extract album art from the file |
175 // Extract album art from the file |
162 iMetadataExtractor->ExtractAlbumArtL( aMedia ); |
176 iMetadataExtractor->ExtractAlbumArtL( aMedia ); |
|
177 #endif |
163 |
178 |
164 CMPXMedia* copy = CMPXMedia::NewL( *aMedia ); |
179 CMPXMedia* copy = CMPXMedia::NewL( *aMedia ); |
165 CleanupStack::PushL( copy ); |
180 CleanupStack::PushL( copy ); |
166 iCache->AppendL( copy ); // ownership x-fer |
181 iCache->AppendL( copy ); // ownership x-fer |
167 CleanupStack::Pop( copy ); |
182 CleanupStack::Pop( copy ); |
330 // --------------------------------------------------------------------------- |
345 // --------------------------------------------------------------------------- |
331 // |
346 // |
332 void CMPXCollectionCachedHelper::SetL( CMPXMedia*& aMedia ) |
347 void CMPXCollectionCachedHelper::SetL( CMPXMedia*& aMedia ) |
333 { |
348 { |
334 MPX_DEBUG1("CMPXCollectionCachedHelper::::SetL <--"); |
349 MPX_DEBUG1("CMPXCollectionCachedHelper::::SetL <--"); |
335 |
350 |
|
351 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
352 if( aMedia->IsSupported( KMPXMediaMTPSampleDataFlag ) ) |
|
353 { |
|
354 TBool flag = aMedia->ValueTObjectL<TBool>( KMPXMediaMTPSampleDataFlag ); |
|
355 MPX_DEBUG2("CMPXCollectionCachedHelper::SetL KMPXMediaMTPSampleDataFlag is set. flag=%d", flag ); |
|
356 if( flag ) |
|
357 { |
|
358 iMetadataExtractor->ExtractAlbumArtL( aMedia ); |
|
359 } |
|
360 return; |
|
361 } |
|
362 #endif |
|
363 |
336 const TDesC& newUri = aMedia->ValueText( KMPXMediaGeneralUri ); |
364 const TDesC& newUri = aMedia->ValueText( KMPXMediaGeneralUri ); |
337 TInt count( iCache->Count() ); |
365 TInt count( iCache->Count() ); |
338 |
366 |
339 // Take advantage that MTP always try to access the most recent item |
367 // Take advantage that MTP always try to access the most recent item |
340 // |
368 // |
717 |
745 |
718 #else //RD_MPX_COLLECTION_CACHE |
746 #else //RD_MPX_COLLECTION_CACHE |
719 |
747 |
720 MPX_DEBUG1("CMPXCollectionCachedHelper::GetL <--"); |
748 MPX_DEBUG1("CMPXCollectionCachedHelper::GetL <--"); |
721 |
749 |
|
750 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
751 if (aItemCat != EMPXSong && aItemCat != EMPXPlaylist && aItemCat != EMPXAbstractAlbum) |
|
752 #else |
722 if (aItemCat != EMPXSong && aItemCat != EMPXPlaylist) |
753 if (aItemCat != EMPXSong && aItemCat != EMPXPlaylist) |
|
754 #endif |
723 { |
755 { |
724 User::Leave(KErrArgument); |
756 User::Leave(KErrArgument); |
725 } |
757 } |
726 |
758 |
727 // Do reverse search on cache |
759 // Do reverse search on cache |
749 attributes.AppendL( |
781 attributes.AppendL( |
750 TMPXAttribute(KMPXMediaIdGeneral, |
782 TMPXAttribute(KMPXMediaIdGeneral, |
751 EMPXMediaGeneralTitle | EMPXMediaGeneralDate | |
783 EMPXMediaGeneralTitle | EMPXMediaGeneralDate | |
752 EMPXMediaGeneralDuration | EMPXMediaGeneralComment | |
784 EMPXMediaGeneralDuration | EMPXMediaGeneralComment | |
753 EMPXMediaGeneralUri )); |
785 EMPXMediaGeneralUri )); |
|
786 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
754 attributes.AppendL( |
787 attributes.AppendL( |
755 TMPXAttribute(KMPXMediaIdMusic, |
788 TMPXAttribute(KMPXMediaIdMusic, |
756 EMPXMediaMusicArtist | EMPXMediaMusicAlbum | |
789 EMPXMediaMusicArtist | EMPXMediaMusicAlbum | |
757 EMPXMediaMusicAlbumTrack | EMPXMediaMusicComposer | |
790 EMPXMediaMusicAlbumTrack | EMPXMediaMusicComposer | |
758 EMPXMediaMusicYear | EMPXMediaMusicGenre)); |
791 EMPXMediaMusicYear | EMPXMediaMusicGenre | |
|
792 EMPXMediaMusicAlbumArtist)); |
|
793 #else |
|
794 attributes.AppendL( |
|
795 TMPXAttribute(KMPXMediaIdMusic, |
|
796 EMPXMediaMusicArtist | EMPXMediaMusicAlbum | |
|
797 EMPXMediaMusicAlbumTrack | EMPXMediaMusicComposer | |
|
798 EMPXMediaMusicYear | EMPXMediaMusicGenre)); |
|
799 #endif |
759 attributes.AppendL(KMPXMediaAudioAudioAll); |
800 attributes.AppendL(KMPXMediaAudioAudioAll); |
760 attributes.AppendL(KMPXMediaMTPAll); |
801 attributes.AppendL(KMPXMediaMTPAll); |
761 |
802 |
762 iFoundMedia = CMPXCollectionHelperImp::GetL( aFile, attributes.Array(), aItemCat ); |
803 iFoundMedia = CMPXCollectionHelperImp::GetL( aFile, attributes.Array(), aItemCat ); |
763 |
804 |
995 { |
1036 { |
996 aDestination.SetTObjectValueL( KMPXMediaMusicRating, |
1037 aDestination.SetTObjectValueL( KMPXMediaMusicRating, |
997 aSrc.ValueTObjectL<TInt>( KMPXMediaMusicRating ) |
1038 aSrc.ValueTObjectL<TInt>( KMPXMediaMusicRating ) |
998 ); |
1039 ); |
999 } |
1040 } |
|
1041 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1042 if( atts&EMPXMediaMusicAlbumArtist ) // Text |
|
1043 { |
|
1044 aDestination.SetTextValueL( KMPXMediaMusicAlbumArtist, |
|
1045 aSrc.ValueText(KMPXMediaMusicAlbumArtist ) |
|
1046 ); |
|
1047 } |
|
1048 #endif |
1000 MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendMusicL -->"); |
1049 MPX_DEBUG1("CMPXCollectionCachedHelper::DoAppendMusicL -->"); |
1001 } |
1050 } |
1002 |
1051 |
1003 // --------------------------------------------------------------------------- |
1052 // --------------------------------------------------------------------------- |
1004 // Copies Audio media information |
1053 // Copies Audio media information |