|
1 /* |
|
2 * Copyright (c) 2006-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HARVESTERAUDIOPLUGIN_H |
|
20 #define HARVESTERAUDIOPLUGIN_H |
|
21 |
|
22 #include <harvesterplugin.h> |
|
23 #include <thumbnailmanager.h> |
|
24 #include <thumbnailmanagerobserver.h> |
|
25 |
|
26 #include "harvesteraudiopluginutils.h" |
|
27 #include "mdeobjectwrapper.h" |
|
28 |
|
29 // FORWARD DECLARATION |
|
30 class CMdEObjectDef; |
|
31 class CHarvestData; |
|
32 class MThumbnailData; |
|
33 |
|
34 /** |
|
35 * Helper class to hold all property definitions |
|
36 * (pointers are not owned) used in harvester audio plug-in. |
|
37 */ |
|
38 class CHarvesterAudioPluginPropertyDefs : public CBase |
|
39 { |
|
40 public: |
|
41 // Common property definitions |
|
42 CMdEPropertyDef* iCreationDatePropertyDef; |
|
43 CMdEPropertyDef* iLastModifiedDatePropertyDef; |
|
44 CMdEPropertyDef* iSizePropertyDef; |
|
45 CMdEPropertyDef* iItemTypePropertyDef; |
|
46 CMdEPropertyDef* iTitlePropertyDef; |
|
47 |
|
48 // Media property definitions |
|
49 CMdEPropertyDef* iRatingPropertyDef; |
|
50 CMdEPropertyDef* iGenrePropertyDef; |
|
51 CMdEPropertyDef* iArtistPropertyDef; |
|
52 CMdEPropertyDef* iDurationPropertyDef; |
|
53 CMdEPropertyDef* iCopyrightPropertyDef; |
|
54 CMdEPropertyDef* iThumbnailPropertyDef; |
|
55 CMdEPropertyDef* iDatePropertyDef; |
|
56 |
|
57 // Audio property definitions |
|
58 CMdEPropertyDef* iAlbumPropertyDef; |
|
59 CMdEPropertyDef* iComposerPropertyDef; |
|
60 CMdEPropertyDef* iOriginalArtistPropertyDef; |
|
61 CMdEPropertyDef* iTrackPropertyDef; |
|
62 |
|
63 private: |
|
64 CHarvesterAudioPluginPropertyDefs(); |
|
65 |
|
66 void ConstructL(CMdEObjectDef& aObjectDef); |
|
67 |
|
68 public: |
|
69 static CHarvesterAudioPluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef); |
|
70 }; |
|
71 |
|
72 class CHarvesterAudioPlugin : public CHarvesterPlugin, |
|
73 public MThumbnailManagerObserver |
|
74 { |
|
75 public: |
|
76 /** |
|
77 * Construction |
|
78 * @return Harvester audio plugin |
|
79 */ |
|
80 static CHarvesterAudioPlugin* NewL(); |
|
81 |
|
82 /** |
|
83 * Destruction |
|
84 */ |
|
85 virtual ~CHarvesterAudioPlugin(); |
|
86 |
|
87 private: |
|
88 // Default constructor |
|
89 CHarvesterAudioPlugin(); |
|
90 |
|
91 // 2nd phase constructor |
|
92 void ConstructL(); |
|
93 |
|
94 |
|
95 |
|
96 public: // from CHarvesterPlugin |
|
97 |
|
98 /** |
|
99 * Harvesting multiple files |
|
100 * @param aHarvesterData CHarvesterData datatype containing needed harvest data |
|
101 * @return None |
|
102 */ |
|
103 void HarvestL( CHarvesterData* aHD ); |
|
104 |
|
105 public: // from Thumbnail Observer |
|
106 |
|
107 void ThumbnailPreviewReady( MThumbnailData& aThumbnail, |
|
108 TThumbnailRequestId aId ); |
|
109 |
|
110 void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, |
|
111 TThumbnailRequestId aId ); |
|
112 |
|
113 private: |
|
114 |
|
115 /** |
|
116 * Harvesting multiple files |
|
117 * @param aHarvesterData CHarvesterData datatype containing needed harvest data |
|
118 * |
|
119 */ |
|
120 void DoHarvestL( CHarvesterData* aHD ); |
|
121 |
|
122 /** |
|
123 * Handles creation of new mde objects. |
|
124 */ |
|
125 void GetPropertiesL( CHarvesterData* aHarvesterData, TBool aIsAdd ); |
|
126 |
|
127 /** |
|
128 * Get placeholder properties (creation time, modify time and file size). |
|
129 */ |
|
130 void GetPlaceHolderPropertiesL( CHarvesterData* aHD, TBool aIsAdd ); |
|
131 |
|
132 /** |
|
133 * Get media file mime type (eg. "audio/mp3"). |
|
134 */ |
|
135 const TMimeTypeMapping<TAudioMetadataHandling>* GetMimeTypePropertyL( |
|
136 CHarvesterData* aHD, TBool aIsAdd ); |
|
137 |
|
138 /** |
|
139 * Get song name, artist, album, genre and composer from normal music |
|
140 * file (eg. mp3). |
|
141 */ |
|
142 void GetMusicPropertiesL( CHarvesterData* aHD, TBool aIsAdd ); |
|
143 |
|
144 private: |
|
145 CAudioMDParser* iAudioParser; |
|
146 |
|
147 CHarvesterAudioPluginPropertyDefs* iPropDefs; |
|
148 |
|
149 CThumbnailManager* iTNM; |
|
150 TBool iHarvestAlbumArt; |
|
151 }; |
|
152 |
|
153 |
|
154 #endif // HARVESTERAUDIOPLUGIN_H |
|
155 |