|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Collection Helper with Caching |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMPXCOLLECTIONCACHEDHELPER_H |
|
20 #define CMPXCOLLECTIONCACHEDHELPER_H |
|
21 |
|
22 #include <f32file.h> |
|
23 #include <apgcli.h> |
|
24 #include "mpxcollectionhelperimp.h" |
|
25 #include "mpxitemid.h" |
|
26 #include <mpxcollectiontype.h> |
|
27 |
|
28 // FORWARD DECLARATION |
|
29 class CMPXMediaArray; |
|
30 class CMPXMetadataExtractor; |
|
31 |
|
32 /** |
|
33 * Extended collection helper with caching capabilities |
|
34 * |
|
35 * @lib mpxcollectionhelper |
|
36 * @since S60 v3.1 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CMPXCollectionCachedHelper ) : public CMPXCollectionHelperImp |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 static CMPXCollectionCachedHelper* NewL(); |
|
44 |
|
45 static CMPXCollectionCachedHelper* NewLC(); |
|
46 |
|
47 virtual ~CMPXCollectionCachedHelper(); |
|
48 |
|
49 protected: |
|
50 |
|
51 /** |
|
52 * Add a song or a playlist to the cache. This method will leave if |
|
53 * failed to add it to the cache. If this song or playlist fails to |
|
54 * be added to the collection when the cache is committed, client is |
|
55 * NOT notified. Failure to provide the required attributes will |
|
56 * result in such a failure. |
|
57 * |
|
58 * @param aMedia, media to be added. |
|
59 * |
|
60 * To add a song to the collection, the media provided MUST |
|
61 * contain the following attributes: |
|
62 * KMPXMediaGeneralType: |
|
63 * must be EMPXItem |
|
64 * |
|
65 * KMPXMediaGeneralCategory: |
|
66 * must be EMPXSong |
|
67 * |
|
68 * KMPXMediaGeneralUri: |
|
69 * full path of the song. Only supporting local path, i.e. path |
|
70 * must starts with a drive letter. |
|
71 * |
|
72 * Client must provide the metadata by filling other attributes. This |
|
73 * song will be registered with Harvester so that it will not be |
|
74 * unnecessarily scanned during the next scan/refresh. |
|
75 * |
|
76 * To add a playlist to the collection, the media provided MUST |
|
77 * contain the following attributes: |
|
78 * KMPXMediaGeneralType: |
|
79 * must be EMPXItem |
|
80 * |
|
81 * KMPXMediaGeneralCategory: |
|
82 * must be EMPXPlaylist |
|
83 * |
|
84 * KMPXMediaGeneralUri: |
|
85 * Provide full path of the playlist if there is an associated |
|
86 * physical playlist file.; otherwise, provide the path and |
|
87 * directory where the playlist should be located (e.g. e:\playlists\). |
|
88 * In the later case, playlist will be created in the collection |
|
89 * as a virtual playlist and URI will be generated. If client is |
|
90 * interested in this generated URI, client can perform a search |
|
91 * based on the returned Id. Only supporting local path, i.e. path |
|
92 * must starts with a drive letter. |
|
93 * |
|
94 * KMPXMediaGeneralTitle: |
|
95 * Title of the playlist is NOT enforced be unique within the |
|
96 * music collection. |
|
97 * |
|
98 * KMPXMediaArrayCount: |
|
99 * KMPXMediaArrayContents: |
|
100 * This playlist can be an empty playlist. If this is the case, |
|
101 * KMPXMediaArrayContents will be a CMPXMediaArray that doesn't |
|
102 * contain any media and KMPXMediaArrayCount will be 0. |
|
103 * |
|
104 * Each CMPXMedia contained in the media array represents |
|
105 * a song. Each song must contain the following attributes: |
|
106 * KMPXMediaGeneralType: |
|
107 * must be EMPXItem |
|
108 * |
|
109 * KMPXMediaGeneralCategory: |
|
110 * must be EMPXSong |
|
111 * |
|
112 * For songs that already exist in the collection, client |
|
113 * must provide either KMPXMediaGeneralId or KMPXMediaGeneralUri. |
|
114 * |
|
115 * For songs that do not exist in the collection, client |
|
116 * must provide KMPXMediaGeneralUri and its metadata. |
|
117 * These songs will be added to the music collection when |
|
118 * the playlist is added. These songs added to the collection |
|
119 * are NOT registered with Harvester; hence, during next |
|
120 * scan/refresh, these songs will be scanned and updated in |
|
121 * the collection unnecessarily and cause scan/refresh |
|
122 * performance degradation. If any metadata of these songs is |
|
123 * changed in the collection before next scan/refresh, it will |
|
124 * be lost after scan/refresh. |
|
125 * |
|
126 * WARNING: |
|
127 * Client must add the songs to the collection prior to adding |
|
128 * the playlist. |
|
129 * |
|
130 * WARNING: |
|
131 * This playlist is NOT registered with Harvester. If client |
|
132 * creates a physical playlist file, Harvester will re-parse |
|
133 * and update the playlist in the collection during the next |
|
134 * scan/refresh unnecessarily and cause scan/refresh performance |
|
135 * degradation. If this playlist is edited, the physical |
|
136 * playlist file is NOT updated to reflect the changes. |
|
137 * |
|
138 * This API does not support adding songs to a saved playlist. |
|
139 * |
|
140 */ |
|
141 void AddL( CMPXMedia* aMedia ); |
|
142 |
|
143 /** |
|
144 * Remove a song or a playlist from the collection. The correlating |
|
145 * file is not removed from the file system but this file is |
|
146 * de-registered with Harvester; hence, if the file isn't deleted |
|
147 * from the file system before the next scan/refresh, it will be |
|
148 * added back to the collection when scan/refresh is performed. |
|
149 * |
|
150 * This API implementation is dedicated to MTP. Records in the |
|
151 * collection will be deleted instead of being marked as deleted. |
|
152 * |
|
153 * @param aFile, file to remove. |
|
154 * @param aItemCat, category of the media to be removed. Either |
|
155 * EMPXSong or EMPXPlaylist. Other categories, e.g. EMPXArtist, |
|
156 * EMPXAlbum, EMPXGenre, and EMPXComposer cannot be removed |
|
157 * from the collection with this method, they need to be removed |
|
158 * from the collection via collection path. |
|
159 */ |
|
160 void RemoveL( const TDesC& aFile, TMPXGeneralCategory aItemCat = EMPXSong ); //lint !e1735 |
|
161 |
|
162 /** |
|
163 * Delete all records that have been marked as deleted. |
|
164 * |
|
165 * This API implementation is dedicated to MTP. |
|
166 */ |
|
167 void CleanupDeletedMediasL(); |
|
168 |
|
169 /** |
|
170 * Add an updated song or playlist to the cache. This method will leave if |
|
171 * failed to add it to the cache. If this song or playlist fails to |
|
172 * be updated in the collection when the cache is committed, client is |
|
173 * NOT notified. Failure to provide the required attributes will |
|
174 * result in such a failure. |
|
175 * |
|
176 * For performance consideration, it is recommended that client only |
|
177 * sets the attribute that needs to be updated. |
|
178 * |
|
179 * @param aMedia, media to be updated. |
|
180 * |
|
181 * To update a song in the collection, the media provided MUST |
|
182 * contain the following attributes: |
|
183 * KMPXMediaGeneralType: |
|
184 * must be EMPXItem |
|
185 * |
|
186 * KMPXMediaGeneralCategory: |
|
187 * must be EMPXSong |
|
188 * |
|
189 * KMPXMediaGeneralUri: |
|
190 * full path of the song. Only supporting local path, |
|
191 * i.e. path must starts with a drive letter. |
|
192 * |
|
193 * Additionally, this media should provide one or more of the |
|
194 * following attributes for update: |
|
195 * KMPXMediaGeneralTitle |
|
196 * KMPXMediaGeneralComment |
|
197 * KMPXMediaGeneralSynchronized |
|
198 * KMPXMediaGeneralDeleted |
|
199 * KMPXMediaGeneralModified |
|
200 * KMPXMediaGeneralCopyright |
|
201 * KMPXMediaGeneralDuration |
|
202 * KMPXMediaGeneralFlags |
|
203 * KMPXMediaGeneralPlayCount |
|
204 * KMPXMediaGeneralLastPlaybackTime |
|
205 * KMPXMediaIdMusic: |
|
206 * KMPXMediaMusicArtist |
|
207 * KMPXMediaMusicAlbum |
|
208 * KMPXMediaMusicAlbumTrack |
|
209 * KMPXMediaMusicGenre |
|
210 * KMPXMediaMusicComposer |
|
211 * KMPXMediaMusicYear |
|
212 * KMPXMediaMusicRating |
|
213 * KMPXMediaMusicAlbumArtFileName |
|
214 * KMPXMediaMusicURL |
|
215 * KMPXMediaIdAudio: |
|
216 * KMPXMediaAudioSamplerate |
|
217 * KMPXMediaAudioBitrate |
|
218 * KMPXMediaAudioNumberOfChannels |
|
219 * KMPXMediaIdDrm: |
|
220 * KMPXMediaDrmType |
|
221 * KMPXMediaIdMTP: |
|
222 * KMPXMediaMTPDrmStatus |
|
223 * |
|
224 * To update a playlist in the collection, the media provided MUST |
|
225 * contain the following attributes: |
|
226 * KMPXMediaGeneralType: |
|
227 * must be EMPXItem |
|
228 * |
|
229 * KMPXMediaGeneralCategory: |
|
230 * must be EMPXPlaylist |
|
231 * |
|
232 * KMPXMediaGeneralUri: |
|
233 * full path of the playlist. Only supporting local path, |
|
234 * i.e. path must starts with a drive letter. |
|
235 * |
|
236 * If the media contains KMPXMediaArrayContents attribute, the |
|
237 * content of the playlist will be overwritten with the new media |
|
238 * array. If this attribute contains a CMPXMediaArray of 0 element, |
|
239 * all songs in this playlist will be removed from the playlist |
|
240 * (songs will remain in the collection and file system). |
|
241 * e.g. |
|
242 * 1) "Playlist" originally contains "Song1", "Song2", and "Song3". |
|
243 * If KMPXMediaArrayContents contains a CMPXMediaArray that |
|
244 * contains "Song3" and "Song4", "Playlist" will be updated to |
|
245 * contain "Song3" and "Song4". |
|
246 * 2) "Playlist" originally contains "Song1", "Song2", and "Song3". |
|
247 * If KMPXMediaArrayContents contains a CMPXMediaArray that |
|
248 * contains 0 element, "Playlist" will be updated so that it |
|
249 * doesn't contain any songs. "Song1", "Song2", and "Song3" |
|
250 * will remain in the collection. |
|
251 * |
|
252 * If the media contains any of the following attributes, the |
|
253 * playlist will be updated accordingly: |
|
254 * KMPXMediaGeneralTitle |
|
255 * KMPXMediaGeneralSynchronized |
|
256 * KMPXMediaGeneralDeleted (DEPRECATED) |
|
257 * KMPXMediaGeneralModified (DEPRECATED) |
|
258 * |
|
259 * NOTE: If a client wishes to change the playlist title and modify |
|
260 * its contents (i.e. the songs it includes), client needs to |
|
261 * perform two separate SetL operations; one to update the |
|
262 * playlist title providing KMPXMediaGeneralTitle attribute |
|
263 * and the other to update its contents by providing |
|
264 * KMPXMediaArrayContents. |
|
265 * |
|
266 */ |
|
267 void SetL( CMPXMedia*& aMedia ); |
|
268 |
|
269 /** |
|
270 * Changes the URI of a song or a playlist. |
|
271 * |
|
272 * @param aOldUri exiting URI of the song or playlist |
|
273 * @param aNewUri of the song or playlist |
|
274 * |
|
275 * If a client requests the URI of a song to be changed, the corresponding |
|
276 * song file will NOT be moved to the new location. Harvester's file registration |
|
277 * will be updated, as well as the collection. Client MUST ensure that there |
|
278 * is not already a file at the specified new location in the file system |
|
279 * (Same restrictions as RFs::Rename) and the collection. |
|
280 * |
|
281 * WARNING: For virtual playlists (i.e. playlists created from the device. |
|
282 * They are referred to as virtual because there is no physical |
|
283 * playlist file created), client MUST ensure the new URI doesn't |
|
284 * clash with any existing playlist in the collection, as well as |
|
285 * in the file system. Changing their filenames is NOT recommended. |
|
286 * If a client wishes to change the extension of the virtual playlist, |
|
287 * it's recommended the extension is changed to an extension that's |
|
288 * not supported by any playlist plugin exists in the system. |
|
289 * |
|
290 * Upon successful completion of this operation, the Id of the song/playlist |
|
291 * will be changed in the collection. If client is interested in the Id of |
|
292 * this media hereafter, GetL or FindAllL can be performed (search by new URI). |
|
293 * |
|
294 * @param aItemCat category of the file, either EMPXSong or EMPXPlaylist; |
|
295 * otherwise, this method leaves with KErrArgument if the media |
|
296 * isn't currently in the cache. If the media is currently in the |
|
297 * cache, the media will fail to be added/updated in the collection |
|
298 * and client is NOT notified. |
|
299 */ |
|
300 void RenameL( const TDesC& aOldUri, |
|
301 const TDesC& aNewUri, |
|
302 TMPXGeneralCategory aItemCat ); |
|
303 |
|
304 /** |
|
305 * Gets the media for the song or playlist via its URI |
|
306 * |
|
307 * WARNING: Subsequent calls to this method will void the |
|
308 * returned object reference. For example, client |
|
309 * should avoid the following: |
|
310 * CMPXMedia& song1 = GetL(***); |
|
311 * CMPXMedia& song2 = GetL(***); |
|
312 * song1.IsSupported(***); |
|
313 * song2.IsSupported(***); |
|
314 * |
|
315 * @param aFile, path of the song/playlist |
|
316 * |
|
317 * @param aItemCat category of the file, either EMPXSong or |
|
318 * EMPXPlaylist; otherwise, this method leaves with |
|
319 * KErrArgument. |
|
320 * |
|
321 * @return media object representing the given file with |
|
322 * the following attributes: |
|
323 * KMPXMediaGeneralTitle |
|
324 * KMPXMediaGeneralDate |
|
325 * KMPXMediaGeneralDuration |
|
326 * KMPXMediaGeneralComment |
|
327 * KMPXMediaMusicArtist |
|
328 * KMPXMediaMusicAlbum |
|
329 * KMPXMediaMusicAlbumTrack |
|
330 * KMPXMediaMusicComposer |
|
331 * KMPXMediaMusicYear |
|
332 * KMPXMediaMusicGenre |
|
333 * KMPXMediaMTPDrmStatus |
|
334 * KMPXMediaAudioNumberOfChannels |
|
335 * KMPXMediaAudioBitrate |
|
336 * KMPXMediaAudioSamplerate |
|
337 * KMPXMediaAudioAudioCodec |
|
338 * |
|
339 * Note that the playlist media object does not |
|
340 * contain songs included in the playlist. If client |
|
341 * is interested in finding the songs in the playlist, |
|
342 * FindAllL can be used (please see #2 in FindAllL). |
|
343 */ |
|
344 const CMPXMedia& GetL( const TDesC& aFile, |
|
345 TMPXGeneralCategory aItemCat ); |
|
346 |
|
347 /** |
|
348 * Find media(s) in music collection. |
|
349 * |
|
350 * @param aCriteria, criteria to search upon |
|
351 * |
|
352 * 1) To find all songs in the collection, here are the mandatory attributes: |
|
353 * KMPXMediaGeneralType: |
|
354 * must be EMPXGroup |
|
355 * |
|
356 * KMPXMediaGeneralCategory: |
|
357 * must be EMPXSong |
|
358 * |
|
359 * If the following optional attributes are provided, the search results |
|
360 * are narrowed down further: (these attributes can be combined) |
|
361 * KMPXMediaGeneralTitle |
|
362 * ==> songs with the specified title |
|
363 * KMPXMediaGeneralDrive |
|
364 * ==> songs in the specified drive |
|
365 * KMPXMediaGeneralSynchronized |
|
366 * ==> songs that are/are not synchronized through MTP |
|
367 * KMPXMediaGeneralDeleted |
|
368 * ==> songs that are/are not marked as deleted since the last MTP |
|
369 * session |
|
370 * KMPXMediaGeneralModified |
|
371 * ==> songs that are/are not modified since the last MTP session |
|
372 * |
|
373 * 2) To find all songs for a particular artist/album/genre/composer/playlist |
|
374 * in the collection, here are the mandatory attributes: |
|
375 * KMPXMediaGeneralType: |
|
376 * must be EMPXGroup |
|
377 * |
|
378 * KMPXMediaGeneralCategory: |
|
379 * must be EMPXSong |
|
380 * |
|
381 * KMPXMediaIdGeneralId: |
|
382 * the Id of the artist/album/genre/composer/playlist |
|
383 * |
|
384 * NOTE: Songs in an album are sorted by album track, then title, except |
|
385 * for songs in the unknown album. Songs in the unknown album are |
|
386 * sorted by title. |
|
387 * |
|
388 * 3) To find all songs for a particular album of an artist in the collection, |
|
389 * here are the mandatory attributes: |
|
390 * KMPXMediaGeneralType: |
|
391 * must be EMPXGroup |
|
392 * |
|
393 * KMPXMediaGeneralCategory: |
|
394 * must be EMPXSong |
|
395 * |
|
396 * KMPXMediaIdGeneralId: |
|
397 * the Id of the album |
|
398 * |
|
399 * KMPXMediaGeneralContainerId: |
|
400 * the Id of the artist |
|
401 * |
|
402 * NOTE: These songs are sorted by album track, then title, except |
|
403 * for songs in the unknown album. Songs in the unknown album are |
|
404 * sorted by title. |
|
405 * |
|
406 * 4)To find a particular song, here are the mandatory attributes: |
|
407 * KMPXMediaGeneralType: |
|
408 * must be EMPXItem |
|
409 * |
|
410 * KMPXMediaGeneralCategory: |
|
411 * must be EMPXSong |
|
412 * |
|
413 * And one or all of the following attributes: |
|
414 * KMPXMediaGeneralUri |
|
415 * KPXMediaIdGeneralId |
|
416 * |
|
417 * 5) To find all artists/albums/genres/composers/playlists in the |
|
418 * collection, here are the mandatory attributes: |
|
419 * KMPXMediaGeneralType: |
|
420 * must be EMPXGroup |
|
421 * |
|
422 * KMPXMediaGeneralCategory: |
|
423 * must be EMPXArtist for artists |
|
424 * EMPXAlbum for albums |
|
425 * EMPXGenre for genres |
|
426 * EMPXComposer for composers |
|
427 * EMPXPlaylist for playlists |
|
428 * |
|
429 * If the following optional attributes are provided for playlists, |
|
430 * the search results are narrowed down further: (these attributes |
|
431 * can be combined) |
|
432 * KMPXMediaGeneralDrive |
|
433 * ==> playlists in the specified drive |
|
434 * KMPXMediaGeneralSynchronized |
|
435 * ==> playlists that are/are not synchronized through MTP |
|
436 * KMPXMediaGeneralDeleted (DEPRECATED) |
|
437 * ==> playlists that are/are not marked as deleted since the last MTP |
|
438 * session |
|
439 * KMPXMediaGeneralModified (DEPRECATED) |
|
440 * ==> playlists that are/are not modified since the last MTP session |
|
441 * |
|
442 * NOTE: results returned do not contain songs included in |
|
443 * the category. To obtain songs included in the category, |
|
444 * please refer to 2 and/or 3. |
|
445 * |
|
446 * 6) To find a particular playlist in the collection, here are the mandatory |
|
447 * attributes: |
|
448 * KMPXMediaGeneralType: |
|
449 * must be EMPXItem |
|
450 * |
|
451 * KMPXMediaGeneralCategory: |
|
452 * must be EMPXPlaylist |
|
453 * |
|
454 * And one or all of the following attributes: |
|
455 * KMPXMediaGeneralUri |
|
456 * KMPXMediaGeneralTitle |
|
457 * KMPXMediaIdGeneralId |
|
458 * |
|
459 * NOTE: results returned do not contain songs included in the playlist. |
|
460 * To obtain songs included in the playlist, please refer to 2. |
|
461 * |
|
462 * 7) To find a particular artist/album/genre/composer in the collection, here |
|
463 * are the mandatory attributes: |
|
464 * KMPXMediaGeneralType: |
|
465 * must be EMPXItem |
|
466 * |
|
467 * KMPXMediaGeneralCategory: |
|
468 * must be EMPXArtist for artist |
|
469 * EMPXAlbum for album |
|
470 * EMPXGenre for genre |
|
471 * EMPXComposer for composer |
|
472 * |
|
473 * And one or all of the following attributes: |
|
474 * KMPXMediaGeneralTitle |
|
475 * KMPXMediaIdGeneralId |
|
476 * |
|
477 * NOTE: |
|
478 * a) results returned do not contain songs included in the category. |
|
479 * To obtain songs included in the category, please refer to 2. |
|
480 * b) unknown artist/album/genre/composer will be the last item in |
|
481 * the result array |
|
482 * |
|
483 * @param aAttrs, attributes to return |
|
484 * Supported attributes for songs are: |
|
485 * KMPXMediaIdGeneral: |
|
486 * KMPXMediaGeneralId |
|
487 * KMPXMediaGeneralTitle |
|
488 * KMPXMediaGeneralUri |
|
489 * KMPXMediaGeneralDrive |
|
490 * KMPXMediaGeneralDuration |
|
491 * KMPXMediaGeneralDate |
|
492 * KMPXMediaGeneralComment |
|
493 * KMPXMediaGeneralMimeType |
|
494 * KMPXMediaGeneralSynchronized |
|
495 * KMPXMediaGeneralDeleted |
|
496 * KMPXMediaGeneralModified |
|
497 * KMPXMediaGeneralCopyright |
|
498 * KMPXMediaGeneralFlags |
|
499 * KMPXMediaGeneralPlayCount |
|
500 * KMPXMediaGeneralLastPlaybackTime |
|
501 * KMPXMediaIdMusic: |
|
502 * KMPXMediaMusicArtist |
|
503 * KMPXMediaMusicAlbum |
|
504 * KMPXMediaMusicAlbumTrack |
|
505 * KMPXMediaMusicGenre |
|
506 * KMPXMediaMusicComposer |
|
507 * KMPXMediaMusicYear |
|
508 * KMPXMediaMusicRating |
|
509 * KMPXMediaMusicAlbumArtFileName |
|
510 * KMPXMediaMusicURL |
|
511 * KMPXMediaIdAudio: |
|
512 * KMPXMediaAudioSamplerate |
|
513 * KMPXMediaAudioBitrate |
|
514 * KMPXMediaAudioNumberOfChannels |
|
515 * KMPXMediaAudioCodec |
|
516 * KMPXMediaIdMTP: |
|
517 * KMPXMediaMTPDrmStatus |
|
518 * |
|
519 * Supported attributes for playlists are: |
|
520 * KMPXMediaIdGeneral: |
|
521 * KMPXMediaGeneralId |
|
522 * KMPXMediaGeneralCollectionId |
|
523 * KMPXMediaGeneralTitle |
|
524 * KMPXMediaGeneralUri |
|
525 * KMPXMediaGeneralDrive |
|
526 * KMPXMediaGeneralSynchronized |
|
527 * KMPXMediaGeneralDeleted (DEPRECATED) |
|
528 * KMPXMediaGeneralModified (DEPRECATED) |
|
529 * KMPXMediaGeneralFlags |
|
530 * KMPXMediaGeneralCount |
|
531 * KMPXMediaGeneralDate |
|
532 * |
|
533 * Supported attributes for artists/albums/genres/composers are: |
|
534 * KMPXMediaIdGeneral: |
|
535 * KMPXMediaGeneralId |
|
536 * KMPXMediaGeneralTitle |
|
537 * |
|
538 * @return search results. The returned media contains the following |
|
539 * attributes: |
|
540 * KMPXMediaGeneralType: |
|
541 * EMPXGroup |
|
542 * |
|
543 * KMPXMediaGeneralCategory: |
|
544 * the category of the found media(s), e.g. EMPXSong for |
|
545 * scenarios 1-4. |
|
546 * |
|
547 * KMPXMediaArrayCount: |
|
548 * the number of matching media(s). 0 if no match found. |
|
549 * |
|
550 * KMPXMediaArrayContents: |
|
551 * this array contains the found media(s). If client |
|
552 * was looking for songs, each media in the array |
|
553 * represents a song, similarly for artists, albums, genres, |
|
554 * composers, and playlists. Each media contains |
|
555 * KMPXMediaGeneralType: |
|
556 * EMPXItem |
|
557 * KMPXMediaGeneralCategory: |
|
558 * category of the found media |
|
559 * |
|
560 * The rest of the attributes returned are as specified |
|
561 * by the aAttrs parameter. |
|
562 */ |
|
563 CMPXMedia* FindAllL( CMPXMedia& aCriteria, |
|
564 const TArray<TMPXAttribute>& aAttrs ); |
|
565 |
|
566 /** |
|
567 * Frees this object |
|
568 */ |
|
569 void Close(); |
|
570 |
|
571 protected: |
|
572 |
|
573 /** |
|
574 * Commits the transactions still left in the caching array |
|
575 */ |
|
576 void Commit(); |
|
577 |
|
578 private: |
|
579 |
|
580 /** |
|
581 * Appends General Media Type information |
|
582 * @param aSrc source media to copy attributes from |
|
583 * @param aDestination destination media to copt attributes to |
|
584 */ |
|
585 void DoAppendGeneralL( CMPXMedia& aSrc, CMPXMedia& aDestination ); |
|
586 |
|
587 /** |
|
588 * Appends Music Type information |
|
589 * @param aSrc source media to copy attributes from |
|
590 * @param aDestination destination media to copt attributes to |
|
591 */ |
|
592 void DoAppendMusicL( CMPXMedia& aSrc, CMPXMedia& aDestination ); |
|
593 |
|
594 /** |
|
595 * Appends Audio Type information |
|
596 * @param aSrc source media to copy attributes from |
|
597 * @param aDestination destination media to copt attributes to |
|
598 */ |
|
599 void DoAppendAudioL( CMPXMedia& aSrc, CMPXMedia& aDestination ); |
|
600 |
|
601 /** |
|
602 * Appends DRM Type information |
|
603 * @param aSrc source media to copy attributes from |
|
604 * @param aDestination destination media to copt attributes to |
|
605 */ |
|
606 void DoAppendDRML( CMPXMedia& aSrc, CMPXMedia& aDestination ); |
|
607 |
|
608 /** |
|
609 * Appends array information |
|
610 * @param aSrc source media to copy attributes from |
|
611 * @param aDestination destination media to copt attributes to |
|
612 */ |
|
613 void DoAppendContainerL( CMPXMedia& aSrc, CMPXMedia& aDestination ); |
|
614 |
|
615 /** |
|
616 * Appends MTP information |
|
617 * @param aSrc source media to copy attributes from |
|
618 * @param aDestination destination media to copt attributes to |
|
619 */ |
|
620 void DoAppendMTPL( CMPXMedia& aSrc, CMPXMedia& aDestination ); |
|
621 |
|
622 #ifdef RD_MPX_COLLECTION_CACHE |
|
623 |
|
624 /* |
|
625 * Gets the media for the song or playlist via its URI |
|
626 * Note. This is used in conjunction with exported GetL |
|
627 * This method does not perform cache capability but only returns |
|
628 * the media object requested. |
|
629 * |
|
630 * @param aFile, path of the song/playlist |
|
631 * |
|
632 * @param aItemCat category of the file, either EMPXSong or |
|
633 * EMPXPlaylist; otherwise, this method leaves with |
|
634 * KErrArgument. |
|
635 * |
|
636 * @return void |
|
637 * the result of iFoundMedia media object representing the given file with |
|
638 * the following attributes: |
|
639 * KMPXMediaGeneralTitle |
|
640 * KMPXMediaGeneralDate |
|
641 * KMPXMediaGeneralDuration |
|
642 * KMPXMediaGeneralComment |
|
643 * KMPXMediaMusicArtist |
|
644 * KMPXMediaMusicAlbum |
|
645 * KMPXMediaMusicAlbumTrack |
|
646 * KMPXMediaMusicComposer |
|
647 * KMPXMediaMusicYear |
|
648 * KMPXMediaMusicGenre |
|
649 * KMPXMediaMTPDrmStatus |
|
650 * KMPXMediaAudioNumberOfChannels |
|
651 * KMPXMediaAudioBitrate |
|
652 * KMPXMediaAudioSamplerate |
|
653 */ |
|
654 void GetSongL( const TDesC& aFile, TMPXGeneralCategory aItemCat, TUid aCollectionUId ); |
|
655 |
|
656 /* |
|
657 * Gets the artist id of the media object inthe currect context (result of GetL()) |
|
658 * |
|
659 * @param aCollectionUid TUid |
|
660 * |
|
661 * @return void |
|
662 * the result of iFoundMedia media object representing the given file with |
|
663 */ |
|
664 TMPXItemId GetArtistIdL( const TDesC& aArtist, TUid aCollectionUId ); |
|
665 |
|
666 |
|
667 /* |
|
668 * Gets all the songs that are belongs to the same artist id supplied |
|
669 * |
|
670 * @param id TMPXItemId indicates the id for requesting artist |
|
671 * @param aCollectionUid TUid |
|
672 * @param aUnknownArtist TBool indicates if this is for unknown artist or not |
|
673 * |
|
674 * @return void |
|
675 * the result of iCachedArtistArray media object |
|
676 */ |
|
677 void GetSongsL( TMPXItemId id, TUid aCollectionUId, TBool aUnknownArtist ); |
|
678 |
|
679 #endif //RD_MPX_COLLECTION_CACHE |
|
680 |
|
681 |
|
682 private: |
|
683 |
|
684 enum TCachedOp |
|
685 { |
|
686 EAdd, |
|
687 ESet |
|
688 }; |
|
689 |
|
690 private: |
|
691 |
|
692 CMPXCollectionCachedHelper(); |
|
693 |
|
694 void ConstructL(); |
|
695 |
|
696 private: // data |
|
697 |
|
698 CMPXMedia* iFoundMedia; |
|
699 CMPXMediaArray* iCache; |
|
700 RArray<TCachedOp> iOp; |
|
701 #ifdef RD_MPX_COLLECTION_CACHE |
|
702 CMPXMediaArray* iCachedArtistArray; |
|
703 CMPXMediaArray* iCachedUnknownArtistArray; |
|
704 TBool iNotInCache; |
|
705 TInt iHitFoundMedia; |
|
706 TInt iNotHitInCache; |
|
707 TInt iLookingInCache; |
|
708 TInt iLookingInUnknowCache; |
|
709 #endif //RD_MPX_COLLECTION_CACHE |
|
710 CMPXMetadataExtractor* iMetadataExtractor; |
|
711 RFs iFs; |
|
712 RApaLsSession iAppArc; |
|
713 RPointerArray<CMPXCollectionType> iSupportedTypes; |
|
714 }; |
|
715 |
|
716 #endif // C_MPXCOLLECTIONCACHEDHELPER_H |