17 |
17 |
18 |
18 |
19 #ifndef CMMMTPDPMETADATAACCESSWRAPPER_H |
19 #ifndef CMMMTPDPMETADATAACCESSWRAPPER_H |
20 #define CMMMTPDPMETADATAACCESSWRAPPER_H |
20 #define CMMMTPDPMETADATAACCESSWRAPPER_H |
21 |
21 |
22 #include <mtp/cmtpobjectmetadata.h> |
|
23 #include <mtp/mtpprotocolconstants.h> |
|
24 #include <mpxmediageneraldefs.h> |
22 #include <mpxmediageneraldefs.h> |
25 #include <mtp/mmtpdataproviderframework.h> |
23 #include <badesca.h> |
26 |
24 |
27 // forward declacration |
25 // forward declacration |
28 class CMmMtpDpMetadataMpxAccess; |
26 class CMmMtpDpMetadataMpxAccess; |
29 class CMmMtpDpMetadataVideoAccess; |
27 class CMmMtpDpMetadataVideoAccess; |
30 |
28 |
31 class RFs; |
29 class RFs; |
32 class MMTPType; |
30 class MMTPType; |
33 class CMTPTypeObjectPropList; |
|
34 class CMPXMediaArray; |
31 class CMPXMediaArray; |
35 class CMPXMedia; |
32 class CMPXMedia; |
36 class MMTPDataProviderFramework; |
33 class MMTPDataProviderFramework; |
|
34 class CMTPObjectMetaData; |
37 |
35 |
38 class CMmMtpDpMetadataAccessWrapper : public CBase |
36 class CMmMtpDpMetadataAccessWrapper : public CBase |
39 { |
37 { |
40 public: |
38 public: |
41 static CMmMtpDpMetadataAccessWrapper* NewL( RFs& aRfs, |
39 static CMmMtpDpMetadataAccessWrapper* NewL( MMTPDataProviderFramework& aFramework ); |
42 MMTPDataProviderFramework& aFramework ); |
|
43 |
40 |
44 /** |
41 /** |
45 * Destructor |
42 * Destructor |
46 */ |
43 */ |
47 ~CMmMtpDpMetadataAccessWrapper(); |
44 ~CMmMtpDpMetadataAccessWrapper(); |
48 |
45 |
49 public: |
46 public: |
50 /** |
47 /** |
51 * Get all playlists from MPX database in the assigned store |
48 * Get all abstract medias from MPX database in the assigned store |
52 * @param aStoreRoot, specify in which drive playlists are stored |
49 * @param aStoreRoot, specify in which drive abstract medias are stored |
53 * @param aPlaylists, return result array |
50 * @param aAbstractMedias, return result array |
54 */ |
51 * @param aCategory, indicate the category of abstract medias |
55 IMPORT_C void GetAllPlaylistL( const TDesC& aStoreRoot, |
52 */ |
56 CMPXMediaArray** aPlaylists ); |
53 IMPORT_C void GetAllAbstractMediaL( const TDesC& aStoreRoot, |
57 |
54 CMPXMediaArray** aAbstractMedias, |
58 /** |
55 TMPXGeneralCategory aCategory ); |
59 * Get all references of specified playlist |
56 |
60 * @param aPlaylist, specify of which reference should be get |
57 /** |
|
58 * Get all references of specified abstract medias |
|
59 * @param aAbstractMedia, specify of which reference should be get |
61 * @param aReferences, return result array which stored handles of all references |
60 * @param aReferences, return result array which stored handles of all references |
62 */ |
61 */ |
63 IMPORT_C void GetAllReferenceL( CMPXMedia* aPlaylist, |
62 IMPORT_C void GetAllReferenceL( CMPXMedia* aAbstractMedia, |
64 CDesCArray& aReferences ); |
63 CDesCArray& aReferences ); |
65 |
64 |
66 /** |
65 /** |
67 * Get an playlist name from CMPXMedia object |
66 * Get an abstract media name from CMPXMedia object |
68 * @param aPlaylist, specify the source |
67 * @param aAbstractMedia, specify the source |
69 * @param aPlaylistName, return result |
68 * @param aCategory, specify the category |
70 */ |
69 * @return, name of the source, ownership transferred |
71 IMPORT_C void GetPlaylistNameL( CMPXMedia* aPlaylist, TDes& aPlaylistName ); |
70 */ |
72 |
71 IMPORT_C HBufC* GetAbstractMediaNameL( CMPXMedia* aAbstractMedia, |
73 /** |
72 TMPXGeneralCategory aCategory ); |
74 * Add object (music, video and playlist) info to DB |
73 /** |
|
74 * Add object (music, video, playlist and abstract album) info to DB |
75 * @param aFullFileName, full file name of file |
75 * @param aFullFileName, full file name of file |
76 * @return void |
76 * @return void |
77 */ |
77 */ |
78 void AddObjectL( const TDesC& aFullFileName, TBool aIsVideo = EFalse ); |
78 void AddObjectL( const CMTPObjectMetaData& aObject ); |
79 |
79 |
80 /** |
80 /** |
81 * Set playlist to DB |
81 * Set abstract media to DB |
82 * @param aPlaylistFileName, full file name of playlist file |
82 * @param aObject, |
83 * @param aRefFileArray, a array to store the full file name of media files |
83 * @param aRefFileArray, a array to store the full file name of media files |
84 * @return void |
84 * @return void |
85 */ |
85 */ |
86 IMPORT_C void SetPlaylistL( const TDesC& aPlaylistFileName, |
86 IMPORT_C void SetReferenceL( const CMTPObjectMetaData& aObject, |
87 CDesCArray& aRefFileArray ); |
87 CDesCArray& aRefFileArray ); |
88 |
88 |
89 /** |
89 /** |
90 * Gets a piece of metadata from the collection |
90 * Gets a piece of metadata from the collection |
91 * @param aPropCode, specify property code of aMediaProp |
91 * @param aPropCode, specify property code of aMediaProp |
112 const MMTPType& aNewData, |
112 const MMTPType& aNewData, |
113 const CMTPObjectMetaData& aObjectMetaData ); |
113 const CMTPObjectMetaData& aObjectMetaData ); |
114 |
114 |
115 /** |
115 /** |
116 * Renames the file part of a record in the collection database |
116 * Renames the file part of a record in the collection database |
117 * @param aFile, old full file name of Media file |
117 * @param aOldObject, object need to be renamed |
118 * @param aNewFileName, new file name need update |
118 * @param aNewFileName, new file name need update |
119 * @return void |
119 * @return void |
120 */ |
120 */ |
121 IMPORT_C void RenameObjectL( const TDesC& aOldFileName, const TDesC& aNewFileName ); |
121 IMPORT_C void RenameObjectL( const CMTPObjectMetaData& aOldObject, const TDesC& aNewFileName ); |
122 |
122 |
123 /** |
123 /** |
124 * Deletes metadata information associated with the object |
124 * Deletes metadata information associated with the object |
125 * @param aFullFileName, full file name of Media file |
125 * @param aObject, the object need to be deleted |
126 * @param aFormatCode, format code |
126 */ |
127 */ |
127 void DeleteObjectL( const CMTPObjectMetaData& aObject ); |
128 void DeleteObjectL( const TDesC& aFullFileName, const TUint aFormatCode ); |
|
129 |
128 |
130 /** |
129 /** |
131 * Set current drive info |
130 * Set current drive info |
132 * @param aStorageRoot, current drive info |
131 * @param aStorageRoot, current drive info |
133 */ |
132 */ |
137 * set image specific properties specific to videos |
136 * set image specific properties specific to videos |
138 * @param aFullFileName, the fullFileName of object |
137 * @param aFullFileName, the fullFileName of object |
139 * @param aWidth, the width of an object in pixels to set |
138 * @param aWidth, the width of an object in pixels to set |
140 * @parem aHeight, the height of an object in pixels to set |
139 * @parem aHeight, the height of an object in pixels to set |
141 */ |
140 */ |
142 void SetImageObjPropL( const TDesC& aFullFileName, |
141 void SetImageObjPropL( const CMTPObjectMetaData& aObject, |
143 const TUint32 aWidth, |
142 const TUint32 aWidth, |
144 const TUint32 aHeight ); |
143 const TUint32 aHeight ); |
145 |
144 |
146 /* |
145 /* |
147 * get image specific properties specific to videos |
146 * get image specific properties specific to videos |
148 * @param aFullFileName, the fullFileName of object |
147 * @param aFullFileName, the fullFileName of object |
149 * @param aWidth, the width of an object in pixels to get |
148 * @param aWidth, the width of an object in pixels to get |
150 * @parem aHeight, the height of an object in pixels to get |
149 * @parem aHeight, the height of an object in pixels to get |
151 */ |
150 */ |
152 void GetImageObjPropL( const TDesC& aFullFileName, |
151 void GetImageObjPropL( const CMTPObjectMetaData& aObject, |
153 TUint32& aWidth, |
152 TUint32& aWidth, |
154 TUint32& aHeight ); |
153 TUint32& aHeight ); |
155 |
154 |
156 /** |
155 /** |
157 * Get Modified object from DB |
156 * Get Modified object from DB |
158 * @param aStorageRoot, the root path of storage |
157 * @param aStorageRoot, the root path of storage |
159 * @param arrayCount, array count |
158 * @param arrayCount, array count |
160 * @param aRefFileArray, a array to store the full file name of media files |
159 * @param aRefFileArray, a array to store the full file name of media files |
161 * @return void |
160 * @return void |
162 */ |
161 */ |
163 IMPORT_C void GetModifiedContentL( const TDesC& aStorageRoot, |
162 IMPORT_C void GetModifiedContentL( const TDesC& aStorageRoot, |
164 TInt& arrayCount, |
163 TInt& arrayCount, |
165 CDesCArray& aRefFileArray ); |
164 CDesCArray& aRefFileArray ); |
166 |
165 |
167 /** |
166 /** |
168 * Updated Music DB |
167 * Updated Music DB |
169 * @return void |
168 * @return void |
170 */ |
169 */ |
171 IMPORT_C void UpdateMusicCollectionL(); |
170 IMPORT_C void UpdateMusicCollectionL(); |
172 |
171 |
173 /* |
172 /* |
174 * Called when the MTP session is initialised |
173 * Called when the MTP session is initialised |
175 */ |
174 */ |
176 void OpenSessionL(); |
175 void OpenSessionL(); |
177 |
176 |
178 /* |
177 /* |
179 * clean up db resource especially for video dp |
178 * clean up db resource especially for video dp |
180 */ |
179 */ |
181 void CloseSessionL(); |
180 void CloseSessionL(); |
182 |
181 |
183 /** |
182 /** |
184 * Cleanup database |
183 * Cleanup database |
185 */ |
184 */ |
186 IMPORT_C void CleanupDatabaseL(); |
185 IMPORT_C void CleanupDatabaseL(); |
187 |
186 |
188 /** |
187 /** |
189 * if the playlsit exist in the MPX DB |
188 * if the playlsit exist in the MPX DB |
190 * @param aSuid, the suid of playlsit |
189 * @param aSuid, the suid of playlsit |
191 */ |
190 */ |
192 TBool IsExistL( const TDesC& aSuid ); |
191 TBool IsExistL( const TDesC& aSuid ); |
193 |
192 |
194 // related to dummy files |
193 // related to dummy files |
195 /** |
194 /** |
196 * Add one dummy file to dummy files array |
195 * Add one dummy file to dummy files array |
197 */ |
196 */ |
198 IMPORT_C void AddDummyFileL( const TDesC& aDummyFileName ); |
197 IMPORT_C void AddDummyFileL( const TDesC& aDummyFileName ); |
199 |
198 |
200 /** |
199 /** |
201 * Delete one dummy file from dummy files array |
200 * Delete one dummy file from dummy files array |
202 */ |
201 */ |
203 IMPORT_C void DeleteDummyFile( const TDesC& aDummyFileName ); |
202 IMPORT_C void DeleteDummyFile( const TDesC& aDummyFileName ); |
204 |
203 |
205 /** |
204 /** |
206 * Create a Dummy File from the virtual playlist URI |
205 * Create a Dummy File from the virtual playlist URI |
207 * @param aPlaylistName, specify the filename of the dummy file |
206 * @param aPlaylistName, specify the filename of the dummy file |
208 */ |
207 */ |
209 IMPORT_C void CreateDummyFile( const TDesC& aPlaylistName ); |
208 IMPORT_C void CreateDummyFile( const TDesC& aPlaylistName ); |
210 |
209 |
|
210 TMPXGeneralCategory Category( const CMTPObjectMetaData& aObject ); |
|
211 |
211 private: |
212 private: |
212 |
213 |
213 CMmMtpDpMetadataAccessWrapper( RFs& aRfs, MMTPDataProviderFramework& aFramework ); |
214 CMmMtpDpMetadataAccessWrapper( MMTPDataProviderFramework& aFramework ); |
214 |
215 |
215 void ConstructL(); |
216 void ConstructL(); |
216 |
217 |
217 TMPXGeneralCategory Category( const TUint aFormatCode ); |
218 TMPXGeneralCategory ContainerCategory( const TDesC& aFullFileName ); |
218 |
219 |
219 /** |
220 /** |
220 * Remove all dummy file of which format is "pla", and leave the "m3u" |
221 * Remove all dummy file of which format is "pla", and leave the "m3u" |
221 */ |
222 */ |
222 void RemoveDummyFiles(); |
223 void RemoveDummyFiles(); |
223 |
224 |
224 private: |
225 private: |
225 // Data |
|
226 RFs& iRfs; |
|
227 CMmMtpDpMetadataMpxAccess* iMmMtpDpMetadataMpxAccess; |
226 CMmMtpDpMetadataMpxAccess* iMmMtpDpMetadataMpxAccess; |
228 CMmMtpDpMetadataVideoAccess* iMmMtpDpMetadataVideoAccess; |
227 CMmMtpDpMetadataVideoAccess* iMmMtpDpMetadataVideoAccess; |
229 TBool iOpenSession; |
228 TBool iOpenSession; |
230 |
229 |
231 MMTPDataProviderFramework& iFramework; |
230 MMTPDataProviderFramework& iFramework; |
232 |
231 RFs& iFs; // should not remove this member data!!! |
233 CDesCArray* iPlaylistArray; |
232 |
234 |
233 CDesCArray* iAbstractMediaArray; |
|
234 |
235 }; |
235 }; |
236 |
236 |
237 #endif // CMMMTPDPMETADATAACCESSWRAPPER_H |
237 #endif // CMMMTPDPMETADATAACCESSWRAPPER_H |