46 * information. |
46 * information. |
47 */ |
47 */ |
48 class MMPXDbMusicObserver |
48 class MMPXDbMusicObserver |
49 { |
49 { |
50 public: |
50 public: |
|
51 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
52 /** |
|
53 * Called when a new category item has to be added to a category table. |
|
54 * @param aCategory category type |
|
55 * @param aName name string |
|
56 * @param aDrive drive to add the category to |
|
57 * @param aItemChangedMessages changed mesages array to be updated or NULL |
|
58 * @param aItemExist Out parameter, ETrue if the item already exist before the add, |
|
59 * EFalse otherwise |
|
60 * @param aAlbumArtist AlbumArtist string |
|
61 * @param aGenre Genre string |
|
62 * @return the ID of the category item (new or existing) |
|
63 */ |
|
64 virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName, |
|
65 TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aAlbumArtist=KNullDesC, |
|
66 const TDesC& aGenre=KNullDesC) = 0; |
|
67 #else |
51 /** |
68 /** |
52 * Called when a new category item has to be added to a category table. |
69 * Called when a new category item has to be added to a category table. |
53 * @param aCategory category type |
70 * @param aCategory category type |
54 * @param aName name string |
71 * @param aName name string |
55 * @param aDrive drive to add the category to |
72 * @param aDrive drive to add the category to |
58 * EFalse otherwise |
75 * EFalse otherwise |
59 * @return the ID of the category item (new or existing) |
76 * @return the ID of the category item (new or existing) |
60 */ |
77 */ |
61 virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName, |
78 virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName, |
62 TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0; |
79 TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0; |
63 |
80 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
64 // for Album and Artist table |
81 // for Album and Artist table |
65 virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName, |
82 virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName, |
66 TUint32 aArtistId, const TDesC& aArt, |
83 TUint32 aArtistId, const TDesC& aArt, |
67 TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0; |
84 TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0; |
68 /** |
85 /** |
69 * Called when the ID of a category item changed for a Music record, for example when |
86 * Called when the ID of a category item changed for a Music record, for example when |
70 * the artist name changed for a song. The implementation is supposed to update the |
87 * the artist name changed for a song. The implementation is supposed to update the |
71 * category record and add corresponding item changed messages to the array parameter. |
88 * category record and add corresponding item changed messages to the array parameter. |
72 * @param aCategory category type |
89 * @param aCategory category type |
100 * @param aCategoryId old category item ID |
117 * @param aCategoryId old category item ID |
101 * @param aDrive drive the category item is on |
118 * @param aDrive drive the category item is on |
102 * @param aMedia media data |
119 * @param aMedia media data |
103 * @param aItemChangedMessages changed mesages array to be updated or NULL |
120 * @param aItemChangedMessages changed mesages array to be updated or NULL |
104 */ |
121 */ |
105 virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId, |
122 virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId, |
106 const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages) = 0; |
123 const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages) = 0; |
107 }; |
124 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
125 /** |
|
126 * Get title from the Id |
|
127 * @param Id to search for |
|
128 * @return name matching the ID |
|
129 */ |
|
130 virtual HBufC* HandleGetAlbumNameFromIdL( TUint32 aId ) = 0; |
|
131 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
132 }; |
108 |
133 |
109 /** |
134 /** |
110 * Responsible for managing the Music table |
135 * Responsible for managing the Music table |
111 * |
136 * |
112 * @lib MPXDbPlugin.lib |
137 * @lib MPXDbPlugin.lib |
208 * @param aSongId ID of the song |
233 * @param aSongId ID of the song |
209 * @return Song drive |
234 * @return Song drive |
210 */ |
235 */ |
211 TInt GetDriveL(TUint32 aSongId); |
236 TInt GetDriveL(TUint32 aSongId); |
212 |
237 |
|
238 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
239 /** |
|
240 * Get the drive and category IDs for a specified song |
|
241 * @param aSongId song to be retrieved |
|
242 * @param aArtistId returns the artist ID |
|
243 * @param aAlbumId returns the artist ID |
|
244 * @param aGenreId returns the artist ID |
|
245 * @param aComposerId returns the artist ID |
|
246 * @param aAbstractAlbumId returns the AbstractAlbum ID |
|
247 * @param aDriveId returns the song drive |
|
248 * @return song URI. The ownership is transferred. |
|
249 */ |
|
250 HBufC* GetSongInfoL(TUint32 aSongId, TUint32& aArtistId, TUint32& aAlbumId, |
|
251 TUint32& aGenreId, TUint32& aComposerId, TUint32& aAbstractAlbumId, TInt& aDriveId); |
|
252 #else |
213 /** |
253 /** |
214 * Get the drive and category IDs for a specified song |
254 * Get the drive and category IDs for a specified song |
215 * @param aSongId song to be retrieved |
255 * @param aSongId song to be retrieved |
216 * @param aArtistId returns the artist ID |
256 * @param aArtistId returns the artist ID |
217 * @param aAlbumId returns the artist ID |
257 * @param aAlbumId returns the artist ID |
220 * @param aDriveId returns the song drive |
260 * @param aDriveId returns the song drive |
221 * @return song URI. The ownership is transferred. |
261 * @return song URI. The ownership is transferred. |
222 */ |
262 */ |
223 HBufC* GetSongInfoL(TUint32 aSongId, TUint32& aArtistId, TUint32& aAlbumId, |
263 HBufC* GetSongInfoL(TUint32 aSongId, TUint32& aArtistId, TUint32& aAlbumId, |
224 TUint32& aGenreId, TUint32& aComposerId, TInt& aDriveId); |
264 TUint32& aGenreId, TUint32& aComposerId, TInt& aDriveId); |
225 |
265 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
226 /** |
266 /** |
227 * Get the song Id, title, URI, and general flags from the given song Id and/or URI |
267 * Get the song Id, title, URI, and general flags from the given song Id and/or URI |
228 * @param aCriteria search the media by song Id and/or URI |
268 * @param aCriteria search the media by song Id and/or URI |
229 * @param aMedia returns the song details |
269 * @param aMedia returns the song details |
230 * @return error code KErrNotFound if unable to find the specified song in the |
270 * @return error code KErrNotFound if unable to find the specified song in the |
377 * @param aMediaArray returns the song attributes. |
417 * @param aMediaArray returns the song attributes. |
378 */ |
418 */ |
379 void GetSongsForComposerL(TUint aComposerId, const TArray<TMPXAttribute>& aAttrs, |
419 void GetSongsForComposerL(TUint aComposerId, const TArray<TMPXAttribute>& aAttrs, |
380 CMPXMediaArray& aMediaArray); |
420 CMPXMediaArray& aMediaArray); |
381 |
421 |
|
422 |
|
423 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
424 /** |
|
425 * Returns all songs for a given abstractalbum. |
|
426 * @param aDrive drive ID AbstractAlbum stored |
|
427 * @param aAbstractAlbumId abstractalbum to get the songs for |
|
428 * @param aAttrs attributes to be retrieved |
|
429 * @param aMediaArray returns the song attributes. |
|
430 */ |
|
431 void GetAllSongsForAbstractAlbumL(TInt aDrive, TInt aAbstractAlbumId, |
|
432 const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray); |
|
433 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
382 /** |
434 /** |
383 * Returns the duration of all songs. |
435 * Returns the duration of all songs. |
384 * @return the duration value |
436 * @return the duration value |
385 */ |
437 */ |
386 TInt AllSongsDurationL(); |
438 TInt AllSongsDurationL(); |
471 void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords, |
523 void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords, |
472 CDesCArray& aUriArr, TInt& aLastID); |
524 CDesCArray& aUriArr, TInt& aLastID); |
473 |
525 |
474 /** |
526 /** |
475 * Get the ID of Artist which belongs to the specified Album |
527 * Get the ID of Artist which belongs to the specified Album |
476 * @param aId, the ID of Album |
528 * @param aId, the ID of Album |
477 */ |
529 */ |
478 TUint32 CMPXDbMusic::ArtistForAlbumL(const TUint32 aId); |
530 TUint32 CMPXDbMusic::ArtistForAlbumL(const TUint32 aId); |
479 |
531 |
480 /** |
532 /** |
481 * Signals the start of a refresh operation |
533 * Signals the start of a refresh operation |
639 */ |
691 */ |
640 TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, |
692 TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, |
641 const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId, |
693 const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId, |
642 CMPXMessageArray* aItemChangedMessages, TUint32& aItemId); |
694 CMPXMessageArray* aItemChangedMessages, TUint32& aItemId); |
643 |
695 |
644 TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, |
696 TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, |
645 const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId, |
697 const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId, |
646 CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, TUint32 aArtistId); |
698 CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, TUint32 aArtistId); |
647 /** |
699 /** |
648 * Checks if extra attributes are required. The "standard attribute set includes: |
700 * Checks if extra attributes are required. The "standard attribute set includes: |
649 * EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory, |
701 * EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory, |
650 * EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags |
702 * EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags |
651 * @param aAttrs attributes to be checked |
703 * @param aAttrs attributes to be checked |
694 private: |
746 private: |
695 |
747 |
696 /** |
748 /** |
697 * Column indexes in the music table |
749 * Column indexes in the music table |
698 */ |
750 */ |
699 enum TMusicColumns |
751 enum TMusicColumns |
700 { |
752 { |
701 EMusicUniqueId = KMPXTableDefaultIndex, |
753 EMusicUniqueId = KMPXTableDefaultIndex, |
702 EMusicDbFlag, |
754 EMusicDbFlag, |
703 EMusicVolumeId, |
755 EMusicVolumeId, |
704 EMusicTitle, |
756 EMusicTitle, |
705 EMusicArtist, |
757 EMusicArtist, |
706 EMusicArt, |
758 EMusicArt, |
707 EMusicDeleted, |
759 EMusicDeleted, |
708 EMusicLocation, |
760 EMusicLocation, |
709 EMusicAlbumTrack, |
761 EMusicAlbumTrack, |
710 EMusicPlayCount, |
762 EMusicPlayCount, |
711 EMusicTimeAdded, |
763 EMusicTimeAdded, |
712 EMusicTimePlayed, |
764 EMusicTimePlayed, |
713 EMusicDuration, |
765 EMusicDuration, |
714 EMusicSync, |
766 EMusicSync, |
715 EMusicModified, |
767 EMusicModified, |
716 EMusicAlbum, |
768 EMusicAlbum, |
717 EMusicGenre, |
769 EMusicGenre, |
718 EMusicComposer, |
770 EMusicComposer, |
719 EMusicReleaseDate, |
771 EMusicReleaseDate, |
720 EMusicRating, |
772 EMusicRating, |
721 EMusicComment, |
773 EMusicComment, |
722 EMusicCopyright, |
774 EMusicCopyright, |
723 EMusicUrl, |
775 EMusicUrl, |
724 EMusicDRM, |
776 EMusicDRM, |
725 EMusicLastPlayPosition, |
777 EMusicLastPlayPosition, |
726 EMusicSampleRate, |
778 EMusicSampleRate, |
727 EMusicBitRate, |
779 EMusicBitRate, |
728 EMusicNumChannels, |
780 EMusicNumChannels, |
729 EMusicCodec, |
781 EMusicCodec, |
730 EMusicMimeType, |
782 EMusicMimeType, |
731 EMusicMTPDrmStatus, |
783 EMusicMTPDrmStatus, |
732 EMusicArtistName, |
784 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
733 EMusicAlbumName, |
785 EMusicAlbumArtist, |
734 EMusicGenreName, |
786 EMusicContainEmbeddedArt, |
735 EMusicComposerName, |
787 EMusicAbstractAlbum, |
736 EMusicFieldCount |
788 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
737 }; |
789 EMusicArtistName, |
|
790 EMusicAlbumName, |
|
791 EMusicGenreName, |
|
792 EMusicComposerName, |
|
793 EMusicFieldCount |
|
794 }; |
738 |
795 |
739 /* |
796 /* |
740 * Unique ID for Queries with a lifetime |
797 * Unique ID for Queries with a lifetime |
741 */ |
798 */ |
742 enum TMusicStatements |
799 enum TMusicStatements |