1 /* |
|
2 * Copyright (c) 2006-2007 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: Thumbnail manager constants |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef THUMBNAILMANAGERCONSTANTS_H |
|
20 #define THUMBNAILMANAGERCONSTANTS_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <gdi.h> |
|
24 #include <etel3rdparty.h> |
|
25 #include <mdccommon.h> |
|
26 #include <apmstd.h> |
|
27 |
|
28 #include "thumbnailmanager.h" // TThumbnailFlags |
|
29 |
|
30 class CThumbnailServerSession; |
|
31 |
|
32 // P&S stuff |
|
33 static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy); |
|
34 static _LIT_SECURITY_POLICY_C1(KPowerMgmtPolicy,ECapabilityPowerMgmt); |
|
35 |
|
36 const TUid KTMPSNotification = { 0x102830AB }; |
|
37 const TUid KTAGDPSNotification = { 0x2001FD51 }; |
|
38 const TUid KMdSPSShutdown = { 0x20022E94 }; |
|
39 const TUid KServerIdle = { 0x102830AB }; |
|
40 const TUid KDaemonUid = { 0x2001FD51 }; |
|
41 |
|
42 const TInt KShutdown = 0x00000001; |
|
43 const TInt KMdSShutdown = 0x00000002; |
|
44 //used to signal from server side when it's idle |
|
45 const TInt KIdle = 0x00000004; |
|
46 //daemon exposes items in processing queues |
|
47 const TInt KItemsleft = 0x00000008; |
|
48 const TInt KForceBackgroundGeneration = 0x00000010; |
|
49 const TInt KMPXHarvesting = 0x00000020; |
|
50 const TInt KDaemonProcessing = 0x00000040; |
|
51 |
|
52 //insert to temp table first wo indexing and move data to main table as batch |
|
53 //actual batch size will vary and will be between min...max batch size values below |
|
54 |
|
55 //minimum batch size |
|
56 const TUint KMInBatchItems = 6; |
|
57 //maximum batch size |
|
58 const TUint KMaxBatchItems = 60; |
|
59 //Max allowed flush time ms |
|
60 const TUint KMaxFlushDelay = 3000; // 3 sec |
|
61 //Max allowed flush time on MTP/music collection refresh |
|
62 const TUint KMaxMTPFlushDelay = 15000; // 15 seconds |
|
63 |
|
64 //how many items daemon will query at once from MDS |
|
65 const TUint KMaxQueryItems = 100; |
|
66 // max items for PH & AllItems query |
|
67 const TUint KMaxQueryBatchSize = 100; |
|
68 |
|
69 // maximum number of active client side queue requests |
|
70 const TUint KMaxClientRequests = 2; |
|
71 |
|
72 #ifdef __RETRY_ON_SERVERCRASH |
|
73 // maximum number of request retry |
|
74 const TUint KMaxRequestRetryCount = 2; |
|
75 #endif |
|
76 |
|
77 // maximum number of active daemon requests |
|
78 const TUint KMaxDaemonRequests = 2; |
|
79 |
|
80 const TUint KMdEReconnect = 1*1000*1000; //1 second |
|
81 |
|
82 const TUint KUnmountTimerTimeout = 5*1000*1000; //5 seconds |
|
83 |
|
84 const TUint KClientRequestTimeout = 60000000; //60 sec |
|
85 const TUint KClientRequestStartErrorTimeout = 100000; //100 ms |
|
86 |
|
87 const TUint KThumbnailServerMajorVersionNumber = 0; |
|
88 const TUint KThumbnailServerMinorVersionNumber = 1; |
|
89 const TUint KThumbnailServerBuildVersionNumber = 1; |
|
90 |
|
91 const TInt KThumbnailErrThumbnailNotFound = -62000; |
|
92 |
|
93 //give MDS some to settle before starting generating TNs |
|
94 const TInt KHarvestingCompleteTimeout = 10000000; //10 sec |
|
95 |
|
96 //after MMC mount wait while before count is calculated |
|
97 const TInt KMountTimeout = 5*1000*1000; //5 sec |
|
98 |
|
99 const TInt KPSKeyTimeout = 10000000; //10 sec |
|
100 //Store's auto flush timeout |
|
101 const TInt KAutoFlushTimeout = 65; //65 sec |
|
102 |
|
103 // minimum background generation idle time seconds |
|
104 const TInt KBackgroundGenerationIdle = 60; |
|
105 // minimum store maintenance idle time seconds |
|
106 const TInt KStoreMaintenanceIdle = 65; // 65 sec |
|
107 // interval for store maintenance rounds |
|
108 const TInt KStoreMaintenancePeriodic = 100000; //100 ms |
|
109 |
|
110 // maximum number of rows deleted in one transaction |
|
111 const TInt KStoreMaintenanceDeleteLimit = 10; |
|
112 // maximum number of thumbs checked for source file existance |
|
113 const TInt KStoreMaintenanceExistLimit = 50; |
|
114 |
|
115 // video decoder timeout |
|
116 const TInt KVideoDecoderTimeout = 12000000; // 12 seconds |
|
117 |
|
118 const TDisplayMode KThumbnailDefaultDisplayMode = EColor64K; |
|
119 |
|
120 //default displaymode (bpp - bits per pixel) for TNs in DB |
|
121 //this makes possible to provide all colour depths up to 16M aka 24 -bit full colour |
|
122 //Symbian^4 EColor16MAP |
|
123 const TDisplayMode KStoreDisplayMode = EColor16MAP; |
|
124 |
|
125 //required amount of memory to keep bitmaps on RAM in bits |
|
126 const TInt KMemoryNeed = 5000000; |
|
127 |
|
128 const TInt64 KDiskFullThreshold = 1024*1024*10; // 10 MB |
|
129 |
|
130 _LIT( KThumbnailServerName, "ThumbnailServer" ); |
|
131 _LIT( KThumbnailServerProcess, "*ThumbnailServer*" ); |
|
132 _LIT( KThumbnailServerExe, "thumbnailserver.exe" ); |
|
133 _LIT( KThumbnailServerShutdown, "Thumbnailserver_Shutdown" ); |
|
134 |
|
135 _LIT( KTAGDaemonName, "ThumbAGDaemon" ); |
|
136 _LIT( KTAGDaemonProcess, "*ThumbAGDaemon*" ); |
|
137 _LIT( KTAGDaemonExe, "thumbagdaemon.exe" ); |
|
138 |
|
139 // server message slots, -1 doesn't reserve fixed amount from global but uses free available amount instead |
|
140 const TInt KMessageSlots = -1; |
|
141 |
|
142 const TInt KMinPriority = KMinTInt; |
|
143 const TInt KMinPlaceholderPriority = (KMinTInt +1000); |
|
144 const TInt KLowPriority = -1000; |
|
145 const TInt KNormalPriority = 0; |
|
146 const TInt KHighPriority = 1000; |
|
147 const TInt KMaxGeneratePriority = (KMaxTInt -1000); |
|
148 const TInt KMaxPriority = KMaxTInt; // For scaling tasks |
|
149 const TInt KImeiBufferSize = CTelephony::KPhoneSerialNumberSize; |
|
150 const TInt KCheckValue = 123456; |
|
151 |
|
152 _LIT8( KJpegMime, "image/jpeg" ); _LIT( KJpegExt, ".jpeg" ); |
|
153 _LIT8( KJpeg2000Mime, "image/jp2" ); _LIT( KJpeg2000Ext, ".jp2" ); |
|
154 _LIT8( KJpgMime, "image/jpeg" ); _LIT( KJpgExt, ".jpg" ); |
|
155 _LIT8( KGifMime, "image/gif" ); _LIT( KGifExt, ".gif" ); |
|
156 _LIT8( KPngMime, "image/png" ); _LIT( KPngExt, ".png" ); |
|
157 _LIT8( KSvgMime, "image/svg+xml" ); _LIT( KSvgExt, ".svg" ); |
|
158 _LIT8( KMpgMime1, "video/mpeg"); _LIT( KMpgExt1, ".mpg" ); |
|
159 _LIT8( KMpeg4Mime, "video/mpeg4" ); _LIT( KMpeg4Ext,".mpeg4" ); |
|
160 _LIT8( KMp4Mime, "video/mp4" ); _LIT( KMp4Ext, ".mp4" ); _LIT( KM4vExt, ".m4v" ); |
|
161 _LIT8( KAviMime, "video/x-msvideo" ); _LIT( KAviExt, ".avi" ); |
|
162 _LIT8( KMp3Mime, "audio/mpeg" ); _LIT( KMp3Ext, ".mp3" ); |
|
163 _LIT8( KNonEmbeddArtMime, "audio/mpeg" ); _LIT( KNonEmbeddArtExt, ".alb" ); |
|
164 _LIT8( KM4aMime, "audio/mp4" ); _LIT( KM4aExt, ".m4a" ); |
|
165 _LIT8( KAacMime, "audio/aac" ); _LIT( KAacExt, ".aac" ); |
|
166 _LIT8( KWmaMime, "audio/x-ms-wma" ); _LIT( KWmaExt, ".wma" ); |
|
167 _LIT8( KBmpMime, "image/bmp" ); _LIT( KBmpExt, ".bmp" ); |
|
168 _LIT8( KAudio3gppMime, "audio/3gpp" ); |
|
169 _LIT8( KVideo3gppMime, "video/3gpp" ); _LIT( K3gpExt, ".3gp" ); _LIT( K3gppExt, ".3gpp" ); |
|
170 _LIT8( KAudioAmrMime, "audio/AMR" ); _LIT( KAmrExt, ".amr" ); |
|
171 _LIT8( KVideoWmvMime, "video/x-ms-wmv" ); _LIT( KWmvExt, ".wmv" ); |
|
172 _LIT8( KRealAudioMime, "audio/vnd.rn-realaudio" ); _LIT( KRealAudioExt, ".ra" ); |
|
173 _LIT8( KPmRealAudioPluginMime, "audio/x-pn-realaudio-plugin" ); _LIT( KPmRealAudioPluginExt, ".rpm" ); |
|
174 _LIT8( KPmRealVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVideoPluginExt, ".rm" ); |
|
175 _LIT8( KPmRealVbVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVbVideoPluginExt, ".rmvb" ); |
|
176 _LIT8( KPmRealAudioMime, "audio/x-pn-realaudio" ); _LIT( KPmRealAudioExt, ".ra" ); |
|
177 _LIT8( KRealVideoMime, "video/vnd.rn-realvideo" ); _LIT( KRealVideoExt, ".rv" ); |
|
178 _LIT8( KFlashVideoMime, "video/x-flv" ); _LIT( KFlashVideoExt, ".flv" ); |
|
179 _LIT8( KMatroskaVideoMime, "video/x-matroska" ); _LIT( KMatroskaVideoExt, ".mkv" ); |
|
180 _LIT8( KContactMime, "contact/x-vcard" ); _LIT( KContactExt, ".vcf" ); |
|
181 |
|
182 _LIT( KNonEmbeddedArtExt, ".alb" ); |
|
183 |
|
184 _LIT8( KAlbumArtMime, "audio/albumart" ); _LIT( KAlbumArtExt, ".maa" ); |
|
185 |
|
186 _LIT( KImageMime, "image/*" ); |
|
187 _LIT( KVideoMime, "video/*" ); |
|
188 _LIT( KAudioMime, "audio/*" ); |
|
189 |
|
190 _LIT( KPrivateFolder, ":\\private\\"); |
|
191 _LIT( KSysFolder, ":\\sys\\"); |
|
192 |
|
193 _LIT( KDrv, ":"); |
|
194 _LIT( KBackSlash, "\\"); |
|
195 |
|
196 const TInt KExtLength = 4; |
|
197 |
|
198 /** |
|
199 * Control flags set by the server for handling specific situations |
|
200 * (for example for distinguishing between preview thumbnails and |
|
201 * final thumbnails). |
|
202 * |
|
203 * @since S60 v5.0 |
|
204 */ |
|
205 enum TThumbnailControlFlags |
|
206 { |
|
207 /** |
|
208 * Default value. No flags set. |
|
209 */ |
|
210 EThumbnailNoControlFlags = 0, |
|
211 |
|
212 /** |
|
213 * Set by the server when the request is completed and it is only the |
|
214 * first part of a two-phase request |
|
215 */ |
|
216 EThumbnailPreviewThumbnail = 1, |
|
217 |
|
218 /** |
|
219 * Set by the client to inform server to create only missing persistent sizes thumbnails |
|
220 */ |
|
221 EThumbnailGeneratePersistentSizesOnly = 2 |
|
222 }; |
|
223 |
|
224 |
|
225 /** |
|
226 * Thumbnail request parameters used for client-server communication. |
|
227 * |
|
228 * @since S60 v5.0 |
|
229 */ |
|
230 struct TThumbnailRequestParams |
|
231 { |
|
232 public: |
|
233 /** |
|
234 * Bitmap handle for completed requests |
|
235 */ |
|
236 TInt iBitmapHandle; |
|
237 |
|
238 /** |
|
239 * Flags for new requests. |
|
240 */ |
|
241 CThumbnailManager::TThumbnailFlags iFlags; |
|
242 |
|
243 /** |
|
244 * Quality-preference value for new requests. |
|
245 */ |
|
246 CThumbnailManager::TThumbnailQualityPreference iQualityPreference; |
|
247 |
|
248 /** |
|
249 * Priority for new requests. |
|
250 */ |
|
251 TInt iPriority; |
|
252 |
|
253 /** |
|
254 * Requested thumbnail size new requests. |
|
255 */ |
|
256 TSize iSize; |
|
257 |
|
258 /** |
|
259 * Requested display mode new requests. |
|
260 */ |
|
261 TDisplayMode iDisplayMode; |
|
262 |
|
263 /** |
|
264 * Full path to object file for new requests. Should be set even |
|
265 * when file handles are used. |
|
266 */ |
|
267 TFileName iFileName; |
|
268 |
|
269 /** |
|
270 * Full path to object to which the imported thumb is to be linked. |
|
271 */ |
|
272 TFileName iTargetUri; |
|
273 |
|
274 /** |
|
275 * Thumbnail ID |
|
276 */ |
|
277 TThumbnailId iThumbnailId; |
|
278 |
|
279 /** |
|
280 * Relative thumbnail size |
|
281 */ |
|
282 TThumbnailSize iThumbnailSize; |
|
283 |
|
284 /** |
|
285 * MIME type |
|
286 */ |
|
287 TDataType iMimeType; |
|
288 |
|
289 /** |
|
290 * Image buffer used to create & set the thumbnail |
|
291 */ |
|
292 TDesC8* iBuffer; |
|
293 |
|
294 /** |
|
295 * Session specific request ID allocated by the client. |
|
296 */ |
|
297 TThumbnailRequestId iRequestId; |
|
298 |
|
299 /** |
|
300 * Control flags set by the server for handling specific situations |
|
301 * (for example for distinguishing between preview thumbnails and |
|
302 * final thumbnails). |
|
303 * Control flags may be modified by server to signal client side what actually was done, like preview TN |
|
304 */ |
|
305 TThumbnailControlFlags iControlFlags; |
|
306 |
|
307 /** |
|
308 * Original control flags set by the server for handling specific situations |
|
309 * (for example for distinguishing between preview thumbnails and |
|
310 * final thumbnails). |
|
311 */ |
|
312 TThumbnailControlFlags iOriginalControlFlags; |
|
313 |
|
314 /** |
|
315 * Thumbnail's modify timestamp |
|
316 */ |
|
317 TInt64 iModified; |
|
318 |
|
319 /** |
|
320 * Thumbnail's orientation |
|
321 */ |
|
322 TInt iOrientation; |
|
323 |
|
324 /** |
|
325 * Overwrite old thumbs (SetThumbnailL) |
|
326 */ |
|
327 TBool iOverwrite; |
|
328 |
|
329 /** |
|
330 * URI is virtual |
|
331 */ |
|
332 TBool iVirtualUri; |
|
333 |
|
334 /** |
|
335 * Target differs from source |
|
336 */ |
|
337 TBool iImport; |
|
338 }; |
|
339 |
|
340 |
|
341 typedef TPckg < TThumbnailRequestParams > TThumbnailRequestParamsPckg; |
|
342 typedef TPckgBuf < TThumbnailRequestParams > TThumbnailRequestParamsPckgBuf; |
|
343 |
|
344 |
|
345 /** |
|
346 * Request ID class used on the server side. Consists of a pointer to a |
|
347 * session and a session specific ID. |
|
348 * |
|
349 * @since S60 v5.0 |
|
350 */ |
|
351 struct TThumbnailServerRequestId |
|
352 { |
|
353 /** |
|
354 * Default C++ constructor |
|
355 * |
|
356 * @since S60 v5.0 |
|
357 */ |
|
358 inline TThumbnailServerRequestId(): iSession( NULL ), iRequestId( 0 ){} |
|
359 |
|
360 /** |
|
361 * C++ constructor |
|
362 * |
|
363 * @since S60 v5.0 |
|
364 * @param aSession Pointer to the server-side session object, which |
|
365 * created the request. |
|
366 * @param aRequestId Session specific request ID as allocated by the |
|
367 * client. |
|
368 */ |
|
369 inline TThumbnailServerRequestId( CThumbnailServerSession* aSession, |
|
370 TThumbnailRequestId aRequestId ): iSession( aSession ), iRequestId( |
|
371 aRequestId ){} |
|
372 |
|
373 /** |
|
374 * Compare request IDs. Both session and client-side request ID must |
|
375 * match. |
|
376 * |
|
377 * @param aRequestId Another TThumbnailServerRequestId to compare to |
|
378 * @since S60 v5.0 |
|
379 */ |
|
380 inline TBool operator == ( const TThumbnailServerRequestId& aRequestId ) |
|
381 const |
|
382 { |
|
383 return aRequestId.iSession == iSession && aRequestId.iRequestId == |
|
384 iRequestId; |
|
385 } |
|
386 |
|
387 public: |
|
388 /** |
|
389 * Pointer to the server-side session object, which created the request. |
|
390 * Not own. |
|
391 */ |
|
392 CThumbnailServerSession* iSession; |
|
393 |
|
394 /** |
|
395 * Session specific request ID as allocated by the client. |
|
396 */ |
|
397 TThumbnailRequestId iRequestId; |
|
398 }; |
|
399 |
|
400 /** |
|
401 * Client-server message IDs |
|
402 * |
|
403 * @since S60 v5.0 |
|
404 * Start from 0 so that TPolicy range matches to function count. |
|
405 */ |
|
406 enum TThumbnailServerRequest |
|
407 { |
|
408 /** |
|
409 * Thumbnail request using file path. A TThumbnailRequestParams |
|
410 * struct is passed as a parameter. |
|
411 * @see TThumbnailRequestParams |
|
412 */ |
|
413 ERequestThumbByPathAsync = 0, |
|
414 |
|
415 /** |
|
416 * Thumbnail request using file path. A TThumbnailRequestParams |
|
417 * struct is passed as a parameter as well as the file handle using |
|
418 * TransferToServer()/AdoptFromClient(). |
|
419 * @see TThumbnailRequestParams |
|
420 */ |
|
421 ERequestThumbByFileHandleAsync, |
|
422 |
|
423 /** |
|
424 * Release a bitmap after the client callback has returned. Bitmap |
|
425 * handle is passed as a parameter. |
|
426 */ |
|
427 EReleaseBitmap, |
|
428 |
|
429 /** |
|
430 * Cancel a thumbnail request. Session specific request ID is passed |
|
431 * as a parameter. |
|
432 */ |
|
433 ECancelRequest, |
|
434 |
|
435 /** |
|
436 * Change the priority of a thumbnail request. Session specific request |
|
437 * ID and new priority value are passed as parameters. |
|
438 */ |
|
439 EChangePriority, |
|
440 |
|
441 /** |
|
442 * Deprecated |
|
443 * |
|
444 */ |
|
445 ECreateThumbnails, |
|
446 |
|
447 /** |
|
448 * Delete existing thumbnails for a file. File path is passed as a |
|
449 * parameter. |
|
450 */ |
|
451 EDeleteThumbnails, |
|
452 |
|
453 /** |
|
454 * Get the required size (in characters) for a buffer that contains the |
|
455 * list of supported MIME types. Size in integers is returned in the |
|
456 * first parameter. |
|
457 */ |
|
458 EGetMimeTypeBufferSize, |
|
459 |
|
460 /** |
|
461 * Get the list of supported MIME types and store them as the first |
|
462 * parameter. The first parameter should be allocated by the client |
|
463 * to be large enough (using EGetMimeTypeBufferSize). |
|
464 */ |
|
465 EGetMimeTypeList, |
|
466 |
|
467 /** |
|
468 * Thumbnail request using ID. |
|
469 */ |
|
470 ERequestThumbByIdAsync, |
|
471 |
|
472 ERequestThumbByBufferAsync, |
|
473 |
|
474 /** |
|
475 * Request to set thumbnail created from buffered image |
|
476 */ |
|
477 ERequestSetThumbnailByBuffer, |
|
478 |
|
479 /** |
|
480 * Delete existing thumbnails. Id as parameter. |
|
481 */ |
|
482 EDeleteThumbnailsById, |
|
483 |
|
484 ERenameThumbnails, |
|
485 |
|
486 /** |
|
487 * Update thumbnails by given Id. |
|
488 */ |
|
489 EUpdateThumbnails, |
|
490 |
|
491 /** |
|
492 * Request to set thumbnail created from given bitmap |
|
493 */ |
|
494 ERequestSetThumbnailByBitmap, |
|
495 |
|
496 /** |
|
497 * Do not remove and keep as last item! Holds count of functions supported. |
|
498 */ |
|
499 EThumbnailServerRequestCount |
|
500 }; |
|
501 |
|
502 /** |
|
503 * Thumbnail format in storage |
|
504 * |
|
505 * @since S60 v5.0 |
|
506 */ |
|
507 enum TThumbnailFormat |
|
508 { |
|
509 /** |
|
510 * Symbian internal bitmap format, usually as extranlized BLOB in the db. |
|
511 */ |
|
512 EThumbnailFormatFbsBitmap, |
|
513 /** |
|
514 * Stantard JPEG |
|
515 */ |
|
516 EThumbnailFormatJpeg |
|
517 }; |
|
518 |
|
519 |
|
520 /** |
|
521 * MDS query modes used during thumbnail generation |
|
522 * |
|
523 * @since S60 v5.0 |
|
524 */ |
|
525 enum TMDSQueryType |
|
526 { |
|
527 /** |
|
528 * Query Path by Id |
|
529 */ |
|
530 EURI |
|
531 }; |
|
532 |
|
533 #endif // THUMBNAILMANAGERCONSTANTS_H |
|