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