27 #include "mpxalbumartutilobserver.h" |
27 #include "mpxalbumartutilobserver.h" |
28 #include "mpximageutil.h" |
28 #include "mpximageutil.h" |
29 #include "mpxalbumartutil.h" |
29 #include "mpxalbumartutil.h" |
30 #include <thumbnaildata.h> |
30 #include <thumbnaildata.h> |
31 #include <thumbnailobjectsource.h> |
31 #include <thumbnailobjectsource.h> |
32 #include <centralrepository.h> |
|
33 |
|
34 #define THUMBNAIL_CENREP_UID 0x102830B0 |
|
35 |
|
36 const TUint32 KSizeAudioGridWidth = 0x12; |
|
37 const TUint32 KSizeAudioGridHeight = 0x13; |
|
38 const TUint32 KSizeAudioFullscreenWidth = 0x16; |
|
39 const TUint32 KSizeAudioFullscreenHeight = 0x17; |
|
40 |
|
41 |
32 |
42 _LIT( KMPXAlbumMimeType, "audio/mpeg3" ); |
33 _LIT( KMPXAlbumMimeType, "audio/mpeg3" ); |
|
34 |
43 // ============================== MEMBER FUNCTIONS ============================ |
35 // ============================== MEMBER FUNCTIONS ============================ |
44 |
36 |
45 // ---------------------------------------------------------------------------- |
37 // ---------------------------------------------------------------------------- |
46 // Create the playback utility object |
38 // Create the playback utility object |
47 // ---------------------------------------------------------------------------- |
39 // ---------------------------------------------------------------------------- |
88 // Constructor |
80 // Constructor |
89 // ---------------------------------------------------------------------------- |
81 // ---------------------------------------------------------------------------- |
90 // |
82 // |
91 void CMPXAlbumArtUtil::ConstructL() |
83 void CMPXAlbumArtUtil::ConstructL() |
92 { |
84 { |
93 MPX_FUNC("CMPXAlbumArtUtil::ConstructL()"); |
85 MPX_FUNC("CMPXAlbumArtUtil::ConstructL()"); |
94 iThumbnailManager = CThumbnailManager::NewL( *this ); |
86 iThumbnailManager = CThumbnailManager::NewL( *this ); |
95 iThumbnailManager->SetFlagsL( CThumbnailManager::EDefaultFlags ); |
87 iThumbnailManager->SetFlagsL( CThumbnailManager::EDefaultFlags ); |
96 iThumbnailManager->SetQualityPreferenceL( CThumbnailManager::EOptimizeForPerformance ); |
88 iThumbnailManager->SetQualityPreferenceL( CThumbnailManager::EOptimizeForPerformance ); |
97 //cenrep |
|
98 CRepository* repository; |
|
99 repository = CRepository::NewL( TUid::Uid(THUMBNAIL_CENREP_UID)); |
|
100 |
|
101 TInt xSize( 0 ); |
|
102 TInt ySize( 0 ); |
|
103 User::LeaveIfError( repository->Get( KSizeAudioGridWidth, xSize )); |
|
104 User::LeaveIfError( repository->Get( KSizeAudioGridHeight, ySize )); |
|
105 iGridViewImageSize.SetSize(xSize,ySize); |
|
106 |
|
107 User::LeaveIfError( repository->Get( KSizeAudioFullscreenWidth, xSize )); |
|
108 User::LeaveIfError( repository->Get( KSizeAudioFullscreenHeight, ySize )); |
|
109 iFullScreenImageSize.SetSize(xSize,ySize); |
|
110 delete repository; |
|
111 repository = NULL; |
|
112 } |
89 } |
113 |
90 |
114 // ---------------------------------------------------------------------------- |
91 // ---------------------------------------------------------------------------- |
115 // Create the playback utility object |
92 // Create the playback utility object |
116 // ---------------------------------------------------------------------------- |
93 // ---------------------------------------------------------------------------- |
117 // |
94 // |
118 EXPORT_C void CMPXAlbumArtUtil::ExtractAlbumArtL(const CMPXMedia& aMedia, |
95 EXPORT_C void CMPXAlbumArtUtil::ExtractAlbumArtL(const CMPXMedia& aMedia, |
119 MMPXAlbumArtUtilObserver& aObs, |
96 MMPXAlbumArtUtilObserver& aObs, |
120 const TSize& aSize, |
97 const TSize& aSize, |
|
98 TBool aLargestFromCache, |
121 TDisplayMode aDisplayMode /*= EColor64K*/) |
99 TDisplayMode aDisplayMode /*= EColor64K*/) |
122 { |
100 { |
123 MPX_DEBUG1("CMPXAlbumArtUtil::ExtractAlbumArtL(): Entering"); |
101 MPX_DEBUG1("CMPXAlbumArtUtil::ExtractAlbumArtL(): Entering"); |
124 MPX_DEBUG_THREAD("CMPXAlbumArtUtil::ExtractAlbumArtL()"); |
102 MPX_DEBUG_THREAD("CMPXAlbumArtUtil::ExtractAlbumArtL()"); |
125 if(iFilename) |
103 if(iFilename) |
148 |
126 |
149 if ( aMedia.IsSupported( KMPXMediaGeneralUri ) && |
127 if ( aMedia.IsSupported( KMPXMediaGeneralUri ) && |
150 aMedia.IsSupported( KMPXMediaMusicAlbumArtFileName )) |
128 aMedia.IsSupported( KMPXMediaMusicAlbumArtFileName )) |
151 { |
129 { |
152 iFilename = aMedia.ValueText( KMPXMediaMusicAlbumArtFileName ).AllocL(); |
130 iFilename = aMedia.ValueText( KMPXMediaMusicAlbumArtFileName ).AllocL(); |
153 if(aSize == iFullScreenImageSize) |
131 |
154 { |
132 if ( aLargestFromCache ) |
|
133 { |
155 iThumbnailManager->SetThumbnailSizeL(EAudioFullScreenThumbnailSize); |
134 iThumbnailManager->SetThumbnailSizeL(EAudioFullScreenThumbnailSize); |
156 } |
135 } |
157 else if(aSize == iGridViewImageSize) |
136 else |
158 { |
137 { |
159 iThumbnailManager->SetThumbnailSizeL(EAudioGridThumbnailSize); |
|
160 } |
|
161 else |
|
162 { |
|
163 iThumbnailManager->SetThumbnailSizeL(aSize); |
138 iThumbnailManager->SetThumbnailSizeL(aSize); |
164 } |
139 } |
|
140 |
165 ExtractThumbnailL(&aMedia); |
141 ExtractThumbnailL(&aMedia); |
166 } |
142 } |
167 else |
143 else |
168 { |
144 { |
169 User::Leave( KErrNotFound ); |
145 User::Leave( KErrNotFound ); |