harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h
changeset 0 c53acadfccc6
child 8 6752808b2036
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     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 __CHARVESTERIMAGEPLUGIN_H__
       
    20 #define __CHARVESTERIMAGEPLUGIN_H__
       
    21 
       
    22 #include <mdeobject.h>
       
    23 #include <fbs.h>
       
    24 #include <imageconversion.h>
       
    25 #include <harvesterplugin.h>
       
    26 #include <monitorplugin.h>
       
    27 
       
    28 #include "mimetypemapping.h"
       
    29 
       
    30 // FORWARD DECLARATION
       
    31 class CFileData;
       
    32 class CHarvestData;
       
    33 class CHarvesterExifUtil;
       
    34 
       
    35 /**
       
    36  * Helper class to hold all property definitions 
       
    37  * (pointers are not owned) used in harvester image plug-in.
       
    38  */
       
    39 class CHarvesterImagePluginPropertyDefs : public CBase
       
    40 	{
       
    41 	public:
       
    42 		// Common property definitions
       
    43 		CMdEPropertyDef* iCreationDatePropertyDef;
       
    44 		CMdEPropertyDef* iLastModifiedDatePropertyDef;
       
    45 		CMdEPropertyDef* iSizePropertyDef;
       
    46 		CMdEPropertyDef* iTimeOffsetPropertyDef;
       
    47 		CMdEPropertyDef* iItemTypePropertyDef;
       
    48 	
       
    49 		// Media property definitions
       
    50 		CMdEPropertyDef* iWidthPropertyDef;
       
    51 		CMdEPropertyDef* iHeightPropertyDef;
       
    52 		CMdEPropertyDef* iDescriptionPropertyDef;
       
    53 		CMdEPropertyDef* iCommentPropertyDef;
       
    54 		CMdEPropertyDef* iReleaseDatePropertyDef;
       
    55 		CMdEPropertyDef* iCopyrightPropertyDef;
       
    56 		CMdEPropertyDef* iCaptureDatePropertyDef;
       
    57 		CMdEPropertyDef* iResolutionUnitPropertyDef;
       
    58 		CMdEPropertyDef* iArtistPropertyDef;
       
    59 		
       
    60 		// Image property definitions
       
    61 		CMdEPropertyDef* iPixelYDimensionPropertyDef;
       
    62 		CMdEPropertyDef* iPixelXDimensionPropertyDef;
       
    63 		CMdEPropertyDef* iBitsPerSamplePropertyDef;
       
    64 		CMdEPropertyDef* iFrameCountPropertyDef;
       
    65 		CMdEPropertyDef* iDateTimeOriginalPropertyDef;
       
    66 		CMdEPropertyDef* iDateTimeDigitizedPropertyDef;
       
    67 		CMdEPropertyDef* iDateTimePropertyDef;
       
    68 		CMdEPropertyDef* iWhiteBalancePropertyDef;
       
    69 		CMdEPropertyDef* iFlashPropertyDef;
       
    70 		CMdEPropertyDef* iExposureProgramPropertyDef;
       
    71 		CMdEPropertyDef* iMakePropertyDef;
       
    72 		CMdEPropertyDef* iModelPropertyDef;
       
    73 		CMdEPropertyDef* iOrientationPropertyDef;
       
    74 		CMdEPropertyDef* iXResolutionPropertyDef;
       
    75 		CMdEPropertyDef* iYResolutionPropertyDef;
       
    76 		CMdEPropertyDef* iYCbCrPositioningPropertyDef;
       
    77 		CMdEPropertyDef* iExposureTimePropertyDef;
       
    78 		CMdEPropertyDef* iFNumberPropertyDef;
       
    79 		CMdEPropertyDef* iExifVersionPropertyDef;
       
    80 		CMdEPropertyDef* iShutterSpeedValuePropertyDef;
       
    81 		CMdEPropertyDef* iApertureValuePropertyDef;
       
    82 		CMdEPropertyDef* iFocalLengthPropertyDef;
       
    83 		CMdEPropertyDef* iFlashPixVersionPropertyDef;
       
    84 		CMdEPropertyDef* iColourSpacePropertyDef;
       
    85 		CMdEPropertyDef* iISOSpeedRatingsPropertyDef;
       
    86 		CMdEPropertyDef* iComponentsConfigurationPropertyDef;
       
    87 		CMdEPropertyDef* iExposureBiasValuePropertyDef;
       
    88 		CMdEPropertyDef* iSamplesPerPixelPropertyDef;
       
    89 		CMdEPropertyDef* iThumbCompressionPropertyDef;
       
    90 		CMdEPropertyDef* iThumbXResolutionPropertyDef;
       
    91 		CMdEPropertyDef* iThumbYResolutionPropertyDef;
       
    92 		CMdEPropertyDef* iThumbResolutionUnitPropertyDef;
       
    93 		CMdEPropertyDef* iFocalLengthIn35mmFilmPropertyDef;
       
    94 		CMdEPropertyDef* iMeteringModePropertyDef;
       
    95 		CMdEPropertyDef* iRelatedSoundFilePropertyDef;
       
    96 		CMdEPropertyDef* iFocalPlaneResolutionUnitPropertyDef;
       
    97 		CMdEPropertyDef* iFocalPlaneXResolutionPropertyDef;
       
    98 		CMdEPropertyDef* iFocalPlaneYResolutionPropertyDef;
       
    99         CMdEPropertyDef* iDraftPropertyDef;
       
   100 
       
   101 	private:
       
   102 		CHarvesterImagePluginPropertyDefs();
       
   103 	
       
   104 		void ConstructL(CMdEObjectDef& aObjectDef);
       
   105 
       
   106 	public:	
       
   107 		static CHarvesterImagePluginPropertyDefs* NewL(CMdEObjectDef& aObjectDef);
       
   108 	};
       
   109 
       
   110 class CHarvesterImagePlugin : public CHarvesterPlugin
       
   111 	{
       
   112 	public:
       
   113 
       
   114 		/**
       
   115 		* Construction
       
   116 		* @return Harvester image plugin
       
   117 		*/
       
   118 		static CHarvesterImagePlugin* NewL();
       
   119 
       
   120 		/**
       
   121 		* Destruction
       
   122 		*/
       
   123 		virtual ~CHarvesterImagePlugin();
       
   124 
       
   125 		/**
       
   126 		* Harvesting multiple files
       
   127 		* @param aHarvesterData  CHarvesterData datatype containing needed harvest data
       
   128  		* @param aClientData  TAny* to client specific data
       
   129 		*/
       
   130 		void HarvestL( CHarvesterData* aHD );
       
   131 
       
   132 	private:
       
   133 	    /**
       
   134 	     * The method that actually extracts the metadata.
       
   135 	     * @param aMetadataObject  Metadata object which is filled with metadata
       
   136 	     * @param aFileData  File data to be filled
       
   137 	     * @param aHarvestData  Harvested data to be filled
       
   138 	     * @return Error code which indicates status of the operation
       
   139 	     */                
       
   140 		TInt GatherDataL( CMdEObject& aMetadataObject, CFileData& aFileData,
       
   141 				CHarvestData& aHarvestData );
       
   142 
       
   143 		/**
       
   144 		 * Checks if the MIME type of current file is supported.
       
   145 		 * @param aMimeBuf mime string
       
   146 		 * @return KErrNone if MIME type is supported, KErrNotSupported if not
       
   147 		 */
       
   148 		TInt CheckIfMimeSupported( const TDesC& aMimeBuf );
       
   149 		 
       
   150 		/**
       
   151 		 * Reads file data from image file.
       
   152 		 */
       
   153 		void DataFromImageFileL( CFileData& aFileData );
       
   154 		
       
   155 		/**
       
   156 		 * Handles creation of new mde objects.
       
   157 		 */
       
   158 		void HandleObjectPropertiesL( CHarvestData& aHd, CFileData& aFileData,
       
   159 		 		CHarvesterData& aHarvesterData, TBool aIsAdd );
       
   160 
       
   161 		// Default constructor
       
   162 		CHarvesterImagePlugin();
       
   163 		
       
   164 		// 2nd phase constructor
       
   165 		void ConstructL();
       
   166 	
       
   167 	private:
       
   168 	
       
   169 		enum TImageMetadataHandling
       
   170 			{
       
   171 			EJpegHandling,
       
   172 			EGifHandling,
       
   173 			EOtherHandling
       
   174 			};
       
   175 		
       
   176 		/** */
       
   177         CHarvesterExifUtil* iExifUtil;
       
   178         
       
   179         /**
       
   180          *  Buffered image decoder (so that we don't have to create decoders all the time)
       
   181          */        
       
   182         CBufferedImageDecoder *iDecoder;
       
   183          
       
   184         /**
       
   185          *  Session to Font and Bitmap server. For some reason WMF-harvesting needs this
       
   186          */
       
   187         RFbsSession iFbs;
       
   188         
       
   189         
       
   190         /**
       
   191          *  Mime type mapper for extension/mimetype pairs
       
   192          */
       
   193         RArray< TMimeTypeMapping<TImageMetadataHandling> > iMimeTypeMappings;
       
   194         
       
   195         CHarvesterImagePluginPropertyDefs* iPropDefs;
       
   196 	};
       
   197 
       
   198 #endif
       
   199