|
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: Harvester image plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <e32math.h> |
|
21 #include <locationdatatype.h> |
|
22 #include <harvesterdata.h> |
|
23 |
|
24 #include "harvesterlog.h" |
|
25 #include "mdsutils.h" |
|
26 #include "harvesterexifutil.h" |
|
27 #include "harvesterimageplugin.h" |
|
28 #include "mdeobjectwrapper.h" |
|
29 |
|
30 using namespace MdeConstants; |
|
31 |
|
32 // image mime types |
|
33 _LIT( KJpegMime, "image/jpeg" ); |
|
34 _LIT( KJpeg2000Mime, "image/jp2" ); |
|
35 _LIT( KJpeg2000_2Mime, "image/jpx" ); |
|
36 _LIT( KTiffMime, "image/tiff" ); |
|
37 _LIT( KMsmMime, "application/x-msmetafile" ); |
|
38 _LIT( KGifMime, "image/gif" ); |
|
39 _LIT( KXbmpMime, "image/x-bmp" ); |
|
40 _LIT( KBmpMime, "image/bmp" ); |
|
41 _LIT( KPngMime, "image/png" ); |
|
42 _LIT( KMbmMime, "image/x-epoc-mbm" ); |
|
43 _LIT( KOtaMime, "image/vnd.nokia.ota-bitmap" ); |
|
44 _LIT( KXotaMime, "image/x-ota-bitmap" ); |
|
45 _LIT( KWbmpMime, "image/vnd.wap.wbmp" ); |
|
46 _LIT( KWmfMime, "image/x-wmf" ); |
|
47 _LIT( KOtbMime, "image/vnd.nokia.ota-bitmap" ); |
|
48 |
|
49 _LIT( KExtJpg, "JPG" ); |
|
50 _LIT( KExtJpeg, "JPEG" ); |
|
51 _LIT( KExtJp2, "JP2" ); |
|
52 _LIT( KExtJ2k, "J2K" ); |
|
53 _LIT( KExtJpx, "JPX" ); |
|
54 _LIT( KExtJpf, "JPF" ); |
|
55 _LIT( KExtMbm, "MBM" ); |
|
56 _LIT( KExtPng, "PNG" ); |
|
57 _LIT( KExtGif, "GIF" ); |
|
58 _LIT( KExtBmp, "BMP" ); |
|
59 _LIT( KExtTif, "TIF" ); |
|
60 _LIT( KExtTiff, "TIFF" ); |
|
61 _LIT( KExtOta, "OTA" ); |
|
62 _LIT( KExtWbmp, "WBMP" ); |
|
63 _LIT( KExtWmf, "WMF" ); |
|
64 _LIT( KExtOtb, "OTB" ); |
|
65 |
|
66 #ifdef MDS_MULTIPLE_STAGE_IMAGE_PROCESSING |
|
67 const TUid KBGPSUid = { 0x0ADC2480 }; |
|
68 #endif |
|
69 |
|
70 CHarvesterImagePluginPropertyDefs::CHarvesterImagePluginPropertyDefs() : CBase() |
|
71 { |
|
72 } |
|
73 |
|
74 void CHarvesterImagePluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef) |
|
75 { |
|
76 CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef(); |
|
77 |
|
78 // Image property definitions |
|
79 CMdEObjectDef& objectDef = nsDef.GetObjectDefL( Object::KBaseObject ); |
|
80 iCreationDatePropertyDef = &objectDef.GetPropertyDefL( Object::KCreationDateProperty ); |
|
81 iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty ); |
|
82 iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty ); |
|
83 iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty ); |
|
84 iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty ); |
|
85 |
|
86 // Media property definitions |
|
87 CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject ); |
|
88 iWidthPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KWidthProperty ); |
|
89 iHeightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KHeightProperty ); |
|
90 iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDescriptionProperty ); |
|
91 iCommentPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCommentProperty ); |
|
92 iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty ); |
|
93 iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCopyrightProperty ); |
|
94 iCaptureDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCaptureDateProperty ); |
|
95 iResolutionUnitPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KResolutionUnitProperty ); |
|
96 iArtistPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KArtistProperty ); |
|
97 |
|
98 // Image property definitions |
|
99 CMdEObjectDef& imageDef = nsDef.GetObjectDefL( Image::KImageObject ); |
|
100 iPixelYDimensionPropertyDef = &imageDef.GetPropertyDefL( Image::KPixelYDimensionProperty ); |
|
101 iPixelXDimensionPropertyDef = &imageDef.GetPropertyDefL( Image::KPixelXDimensionProperty ); |
|
102 iBitsPerSamplePropertyDef = &imageDef.GetPropertyDefL( Image::KBitsPerSampleProperty ); |
|
103 iFrameCountPropertyDef = &imageDef.GetPropertyDefL( Image::KFrameCountProperty ); |
|
104 iDateTimeOriginalPropertyDef = &imageDef.GetPropertyDefL( Image::KDateTimeOriginalProperty ); |
|
105 iDateTimeDigitizedPropertyDef = &imageDef.GetPropertyDefL( Image::KDateTimeDigitizedProperty ); |
|
106 iDateTimePropertyDef = &imageDef.GetPropertyDefL( Image::KDateTimeProperty ); |
|
107 iWhiteBalancePropertyDef = &imageDef.GetPropertyDefL( Image::KWhiteBalanceProperty ); |
|
108 iFlashPropertyDef = &imageDef.GetPropertyDefL( Image::KFlashProperty ); |
|
109 iExposureProgramPropertyDef = &imageDef.GetPropertyDefL( Image::KExposureProgramProperty ); |
|
110 iMakePropertyDef = &imageDef.GetPropertyDefL( Image::KMakeProperty ); |
|
111 iModelPropertyDef = &imageDef.GetPropertyDefL( Image::KModelProperty ); |
|
112 iOrientationPropertyDef = &imageDef.GetPropertyDefL( Image::KOrientationProperty ); |
|
113 iXResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KXResolutionProperty ); |
|
114 iYResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KYResolutionProperty ); |
|
115 iYCbCrPositioningPropertyDef = &imageDef.GetPropertyDefL( Image::KYCbCrPositioningProperty ); |
|
116 iExposureTimePropertyDef = &imageDef.GetPropertyDefL( Image::KExposureTimeProperty ); |
|
117 iFNumberPropertyDef = &imageDef.GetPropertyDefL( Image::KFNumberProperty ); |
|
118 iExifVersionPropertyDef = &imageDef.GetPropertyDefL( Image::KExifVersionProperty ); |
|
119 iShutterSpeedValuePropertyDef = &imageDef.GetPropertyDefL( Image::KShutterSpeedValueProperty ); |
|
120 iApertureValuePropertyDef = &imageDef.GetPropertyDefL( Image::KApertureValueProperty ); |
|
121 iFocalLengthPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalLengthProperty ); |
|
122 iFlashPixVersionPropertyDef = &imageDef.GetPropertyDefL( Image::KFlashPixVersionProperty ); |
|
123 iColourSpacePropertyDef = &imageDef.GetPropertyDefL( Image::KColourSpaceProperty ); |
|
124 iISOSpeedRatingsPropertyDef = &imageDef.GetPropertyDefL( Image::KISOSpeedRatingsProperty ); |
|
125 iComponentsConfigurationPropertyDef = &imageDef.GetPropertyDefL( Image::KComponentsConfigurationProperty ); |
|
126 iExposureBiasValuePropertyDef = &imageDef.GetPropertyDefL( Image::KExposureBiasValueProperty ); |
|
127 iSamplesPerPixelPropertyDef = &imageDef.GetPropertyDefL( Image::KSamplesPerPixelProperty ); |
|
128 iThumbCompressionPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbCompressionProperty ); |
|
129 iThumbXResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbXResolutionProperty ); |
|
130 iThumbYResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbYResolutionProperty ); |
|
131 iThumbResolutionUnitPropertyDef = &imageDef.GetPropertyDefL( Image::KThumbResolutionUnitProperty ); |
|
132 iFocalLengthIn35mmFilmPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalLengthIn35mmFilmProperty ); |
|
133 iMeteringModePropertyDef = &imageDef.GetPropertyDefL( Image::KMeteringModeProperty ); |
|
134 iRelatedSoundFilePropertyDef = &imageDef.GetPropertyDefL( Image::KRelatedSoundFileProperty ); |
|
135 iFocalPlaneResolutionUnitPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalPlaneResolutionUnitProperty ); |
|
136 iFocalPlaneXResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalPlaneXResolutionProperty ); |
|
137 iFocalPlaneYResolutionPropertyDef = &imageDef.GetPropertyDefL( Image::KFocalPlaneYResolutionProperty ); |
|
138 iDraftPropertyDef = &imageDef.GetPropertyDefL( Image::KDraftProperty ); |
|
139 } |
|
140 |
|
141 CHarvesterImagePluginPropertyDefs* CHarvesterImagePluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef) |
|
142 { |
|
143 CHarvesterImagePluginPropertyDefs* self = |
|
144 new (ELeave) CHarvesterImagePluginPropertyDefs(); |
|
145 CleanupStack::PushL( self ); |
|
146 self->ConstructL( aObjectDef ); |
|
147 CleanupStack::Pop( self ); |
|
148 return self; |
|
149 } |
|
150 |
|
151 /** |
|
152 * Default constructor |
|
153 */ |
|
154 CHarvesterImagePlugin::CHarvesterImagePlugin() : CHarvesterPlugin(), |
|
155 iExifUtil( NULL ), iDecoder( NULL ), iPropDefs( NULL ) |
|
156 { |
|
157 } |
|
158 |
|
159 /** |
|
160 * Construction |
|
161 * @return Harvester image plugin |
|
162 */ |
|
163 CHarvesterImagePlugin* CHarvesterImagePlugin::NewL() |
|
164 { |
|
165 WRITELOG( "CHarvesterImagePlugin::NewL()" ); |
|
166 CHarvesterImagePlugin* self = new (ELeave) CHarvesterImagePlugin(); |
|
167 CleanupStack::PushL( self ); |
|
168 self->ConstructL(); |
|
169 CleanupStack::Pop( self ); |
|
170 |
|
171 return self; |
|
172 } |
|
173 |
|
174 /** |
|
175 * Destruction |
|
176 */ |
|
177 CHarvesterImagePlugin::~CHarvesterImagePlugin() |
|
178 { |
|
179 WRITELOG( "CHarvesterImagePlugin::~CHarvesterImagePlugin()" ); |
|
180 |
|
181 if (iDecoder) |
|
182 { |
|
183 iDecoder->Reset(); |
|
184 delete iDecoder; |
|
185 } |
|
186 |
|
187 if (iExifUtil) |
|
188 { |
|
189 delete iExifUtil; |
|
190 } |
|
191 |
|
192 delete iPropDefs; |
|
193 |
|
194 iFbs.Disconnect(); |
|
195 } |
|
196 |
|
197 /** |
|
198 * 2nd phase constructor |
|
199 */ |
|
200 void CHarvesterImagePlugin::ConstructL() |
|
201 { |
|
202 WRITELOG( "CHarvesterImagePlugin::ConstructL()" ); |
|
203 iDecoder = CBufferedImageDecoder::NewL( iFs ); |
|
204 iExifUtil = CHarvesterExifUtil::NewL(); |
|
205 User::LeaveIfError( iFbs.Connect() ); |
|
206 |
|
207 TLinearOrder< TMimeTypeMapping<TImageMetadataHandling> > cmp( |
|
208 TMimeTypeMapping<TImageMetadataHandling>::CompareFunction); |
|
209 |
|
210 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
211 KExtJpg(), KJpegMime(), EJpegHandling ), cmp ) ); |
|
212 |
|
213 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
214 KExtJpeg(), KJpegMime(), EJpegHandling ), cmp ) ); |
|
215 |
|
216 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
217 KExtGif(), KGifMime(), EGifHandling ), cmp ) ); |
|
218 |
|
219 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
220 KExtBmp(), KBmpMime(), EOtherHandling ), cmp ) ); |
|
221 |
|
222 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
223 KExtJpf(), KJpeg2000_2Mime(), EOtherHandling ), cmp ) ); |
|
224 |
|
225 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
226 KExtJpx(), KJpeg2000_2Mime(), EOtherHandling ), cmp ) ); |
|
227 |
|
228 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
229 KExtJp2(), KJpeg2000Mime(), EOtherHandling ), cmp ) ); |
|
230 |
|
231 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
232 KExtJ2k(), KJpeg2000Mime(), EOtherHandling ), cmp ) ); |
|
233 |
|
234 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
235 KExtMbm(), KMbmMime(), EOtherHandling ), cmp ) ); |
|
236 |
|
237 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
238 KExtOta(), KOtaMime(), EOtherHandling ), cmp ) ); |
|
239 |
|
240 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
241 KExtPng(), KPngMime(), EOtherHandling ), cmp ) ); |
|
242 |
|
243 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
244 KExtTif(), KTiffMime(), EOtherHandling ), cmp ) ); |
|
245 |
|
246 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
247 KExtTiff(), KTiffMime(), EOtherHandling ), cmp ) ); |
|
248 |
|
249 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
250 KExtWbmp(), KWbmpMime(), EOtherHandling ), cmp ) ); |
|
251 |
|
252 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
253 KExtWmf(), KWmfMime(), EOtherHandling ), cmp ) ); |
|
254 |
|
255 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
|
256 KExtOtb(), KOtbMime(), EOtherHandling ), cmp ) ); |
|
257 } |
|
258 |
|
259 void CHarvesterImagePlugin::HarvestL( CHarvesterData* aHD ) |
|
260 { |
|
261 WRITELOG( "CHarvesterImagePlugin::HarvestL()" ); |
|
262 CMdEObject& mdeObject = aHD->MdeObject(); |
|
263 |
|
264 CFileData* fileData = CFileData::NewL(); |
|
265 CleanupStack::PushL( fileData ); |
|
266 CHarvestData* harvestData = CHarvestData::NewL(); |
|
267 CleanupStack::PushL( harvestData ); |
|
268 |
|
269 const TInt errorCode = GatherDataL( mdeObject, *fileData, *harvestData ); |
|
270 if ( errorCode == KErrNone || errorCode == KErrCompletion ) // ok, something got harvested |
|
271 { |
|
272 if ( mdeObject.Id() == 0 || mdeObject.Placeholder() ) // is a new object or placeholder |
|
273 { |
|
274 TRAP_IGNORE( HandleObjectPropertiesL( *harvestData, *fileData, *aHD, ETrue ) ); |
|
275 } |
|
276 else // not a new object |
|
277 { |
|
278 TRAP_IGNORE( HandleObjectPropertiesL( *harvestData, *fileData, *aHD, EFalse ) ); |
|
279 } |
|
280 |
|
281 if( harvestData->iStoreGpsLatitudeAndLongitude || |
|
282 harvestData->iStoreGpsAltitude ) |
|
283 { |
|
284 TLocationData* locData = new (ELeave) TLocationData(); |
|
285 |
|
286 if( harvestData->iStoreGpsAltitude ) |
|
287 { |
|
288 locData->iPosition.SetCoordinate( |
|
289 harvestData->iGpsLatitude, harvestData->iGpsLongitude, |
|
290 harvestData->iGpsAltitude); |
|
291 } |
|
292 else |
|
293 { |
|
294 locData->iPosition.SetCoordinate( |
|
295 harvestData->iGpsLatitude, harvestData->iGpsLongitude); |
|
296 } |
|
297 |
|
298 // remove unnessesary values |
|
299 locData->iNetworkInfo.iAreaKnown = EFalse; |
|
300 |
|
301 TRealX nanX; |
|
302 nanX.SetNaN(); |
|
303 nanX.GetTReal( locData->iQuality ); |
|
304 |
|
305 aHD->SetLocationData( locData ); |
|
306 } |
|
307 } |
|
308 else |
|
309 { |
|
310 WRITELOG1( "CHarvesterImagePlugin::HarvestL() - other error: %d", errorCode ); |
|
311 TInt convertedError = KErrNone; |
|
312 MdsUtils::ConvertTrapError( errorCode, convertedError ); |
|
313 aHD->SetErrorCode( convertedError ); |
|
314 WRITELOG1( "CHarvesterImagePlugin::HarvestL() - returning: %d", convertedError ); |
|
315 } |
|
316 |
|
317 // Delete image data. |
|
318 CleanupStack::PopAndDestroy( 2, fileData ); |
|
319 } |
|
320 |
|
321 // --------------------------------------------------------------------------- |
|
322 // GatherData |
|
323 // --------------------------------------------------------------------------- |
|
324 // |
|
325 TInt CHarvesterImagePlugin::GatherDataL( CMdEObject& aMetadataObject, |
|
326 CFileData& aFileData, CHarvestData& aHarvestData ) |
|
327 { |
|
328 #ifdef _DEBUG |
|
329 TTime dStart, dStop; |
|
330 dStart.UniversalTime(); |
|
331 dStop.UniversalTime(); |
|
332 WRITELOG1( "CHarvesterImagePlugin::GatherData() start %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() ); |
|
333 #endif |
|
334 |
|
335 WRITELOG( "CHarvesterImagePlugin::GatherData()" ); |
|
336 |
|
337 TBool dataExtracted( aMetadataObject.Id() == 0 || aMetadataObject.Placeholder() ); |
|
338 aFileData.iImageDef = &aMetadataObject.Def(); |
|
339 |
|
340 if( dataExtracted ) |
|
341 { |
|
342 CMdEProperty* prop = NULL; |
|
343 CMdEObjectDef& objectDef = *aFileData.iImageDef; |
|
344 |
|
345 if( !iPropDefs ) |
|
346 { |
|
347 iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( objectDef ); |
|
348 } |
|
349 |
|
350 aMetadataObject.Property( *iPropDefs->iSizePropertyDef, prop ); |
|
351 if( prop ) |
|
352 { |
|
353 aFileData.iFileSize = prop->Uint32ValueL(); |
|
354 } |
|
355 else |
|
356 { |
|
357 dataExtracted = EFalse; |
|
358 } |
|
359 |
|
360 aMetadataObject.Property( *iPropDefs->iLastModifiedDatePropertyDef, prop ); |
|
361 if( prop ) |
|
362 { |
|
363 aFileData.iModified = prop->TimeValueL(); |
|
364 } |
|
365 else |
|
366 { |
|
367 dataExtracted = EFalse; |
|
368 } |
|
369 } |
|
370 |
|
371 const TDesC& uri = aMetadataObject.Uri(); |
|
372 |
|
373 if( !dataExtracted ) |
|
374 { |
|
375 TEntry entry; |
|
376 const TInt errorcode = iFs.Entry( uri, entry ); |
|
377 |
|
378 if ( errorcode != KErrNone ) |
|
379 { |
|
380 return errorcode; // metadata cannot be gathered! |
|
381 } |
|
382 |
|
383 aFileData.iModified = entry.iModified; |
|
384 aFileData.iFileSize = (TUint)entry.iSize; |
|
385 } |
|
386 |
|
387 TPtrC imageFile = uri; |
|
388 |
|
389 aFileData.iUri = &imageFile; |
|
390 aFileData.iFrameCount = 1; |
|
391 |
|
392 TRAPD( readError, DataFromImageFileL( aFileData ) ); |
|
393 |
|
394 if ( readError != KErrNone ) |
|
395 { |
|
396 WRITELOG1( "CHarvesterImagePlugin::GatherData() - error reading image data, error: %d", readError ); |
|
397 return KErrCompletion; // metadata item still can be created, thus KErrCompletion |
|
398 } |
|
399 |
|
400 TInt err = KErrNone; |
|
401 if ( aFileData.iExifSupported ) |
|
402 { |
|
403 TRAP( err, iExifUtil->ReadExifDataL( aHarvestData, aFileData ) ); |
|
404 } |
|
405 if( !aFileData.iExifSupported || err != KErrNone ) |
|
406 { |
|
407 // Exif couldn't be found. Open the image with ICL decoder instead. |
|
408 WRITELOG( "CHarvesterImagePlugin::GatherData() - Exif could not be read. Using ICL." ); |
|
409 |
|
410 iDecoder->Reset(); |
|
411 |
|
412 TPtr8 imageDataPtr = aFileData.iImageData->Des(); |
|
413 TRAP( err, iDecoder->OpenL(imageDataPtr, aFileData.iMime8, |
|
414 CImageDecoder::TOptions( CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionIgnoreExifMetaData ) ) ); |
|
415 WRITELOG( "CHarvesterImagePlugin::GatherData() - Image decoder has opened the file." ); |
|
416 |
|
417 if ( err != KErrNone ) |
|
418 { |
|
419 WRITELOG1( "CHarvesterImagePlugin::GatherData() - ERROR: Decoder could not open image data! Code %d", err ); |
|
420 return KErrCompletion; // metadata item still can be created, thus KErrCompletion |
|
421 } |
|
422 |
|
423 if ( !iDecoder->ValidDecoder() ) |
|
424 { |
|
425 // read all remaining data from file |
|
426 TInt64 additionalDataSize = aFileData.iFileSize - aFileData.iImageDataSize; |
|
427 if( additionalDataSize < 0 ) |
|
428 { |
|
429 additionalDataSize = 0; |
|
430 } |
|
431 |
|
432 HBufC8* additionalData = HBufC8::NewLC( additionalDataSize ); |
|
433 if ( additionalData ) |
|
434 { |
|
435 TPtr8 addPtr = additionalData->Des(); |
|
436 TInt readStatus = iFs.ReadFileSection( |
|
437 *aFileData.iUri, aFileData.iImageDataSize, addPtr, additionalDataSize ); |
|
438 if ( readStatus != KErrNone ) |
|
439 { |
|
440 CleanupStack::PopAndDestroy( additionalData ); |
|
441 return KErrCompletion; |
|
442 } |
|
443 |
|
444 // append all remaining data to image decoder |
|
445 TRAP( err, iDecoder->AppendDataL( addPtr ) ); |
|
446 if ( err == KErrNone ) |
|
447 { |
|
448 TRAP( err, iDecoder->ContinueOpenL() ); |
|
449 } |
|
450 CleanupStack::PopAndDestroy( additionalData ); |
|
451 } |
|
452 |
|
453 if ( err || !iDecoder->ValidDecoder() ) |
|
454 { |
|
455 WRITELOG( "CHarvesterImagePlugin::GatherData() - ERROR: no valid decoder" ); |
|
456 return KErrCompletion; // metadata item still can be created, thus KErrCompletion |
|
457 } |
|
458 } |
|
459 |
|
460 // Get image width, frame count, height and bits per pixel from image decoder. |
|
461 const TFrameInfo info = iDecoder->FrameInfo( 0 ); |
|
462 const TSize imageSize = info.iOverallSizeInPixels; |
|
463 const TInt framecount = iDecoder->FrameCount(); |
|
464 aFileData.iFrameCount = framecount; |
|
465 aFileData.iImageWidth = imageSize.iWidth; |
|
466 aFileData.iImageHeight = imageSize.iHeight; |
|
467 aFileData.iBitsPerPixel = info.iBitsPerPixel; |
|
468 } |
|
469 |
|
470 WRITELOG( "CHarvesterImagePlugin::GatherData() - end" ); |
|
471 |
|
472 #ifdef _DEBUG |
|
473 dStop.UniversalTime(); |
|
474 WRITELOG1( "CHarvesterImagePlugin::GatherData() end %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() ); |
|
475 #endif |
|
476 |
|
477 return KErrNone; |
|
478 } |
|
479 |
|
480 ///--------------------------------------------------------------------------- |
|
481 /// DataFromImageFile |
|
482 ///--------------------------------------------------------------------------- |
|
483 void CHarvesterImagePlugin::DataFromImageFileL( CFileData& aFileData ) |
|
484 { |
|
485 WRITELOG( "CHarvesterImagePlugin::DataFromImageFileL()" ); |
|
486 |
|
487 TPtrC ext; |
|
488 if( !MdsUtils::GetExt( *aFileData.iUri, ext ) ) |
|
489 { |
|
490 User::Leave( KErrNotSupported ); |
|
491 } |
|
492 |
|
493 TMimeTypeMapping<TImageMetadataHandling> finder(ext); |
|
494 TLinearOrder< TMimeTypeMapping<TImageMetadataHandling> > cmp( |
|
495 TMimeTypeMapping<TImageMetadataHandling>::CompareFunction); |
|
496 |
|
497 TInt pos = iMimeTypeMappings.FindInOrder( finder, cmp ); |
|
498 |
|
499 TImageMetadataHandling handler( EOtherHandling ); |
|
500 |
|
501 if ( pos != KErrNotFound ) |
|
502 { |
|
503 handler = iMimeTypeMappings[pos].iHandler; |
|
504 } |
|
505 |
|
506 switch( handler ) |
|
507 { |
|
508 case EJpegHandling: |
|
509 { |
|
510 aFileData.iJpeg = ETrue; |
|
511 const TInt K64Kb = 65536; |
|
512 aFileData.iImageDataSize = K64Kb; |
|
513 WRITELOG( "CHarvesterImagePlugin::DataFromImageFileL() - read first 64Kb from JPEG" ); |
|
514 break; |
|
515 } |
|
516 case EGifHandling: |
|
517 { |
|
518 aFileData.iJpeg = EFalse; |
|
519 aFileData.iImageDataSize = aFileData.iFileSize; |
|
520 WRITELOG( "CHarvesterImagePlugin::DataFromImageFileL() - read whole GIF file" ); |
|
521 break; |
|
522 } |
|
523 default: |
|
524 { |
|
525 aFileData.iJpeg = EFalse; |
|
526 const TInt K4Kb = 4096; |
|
527 aFileData.iImageDataSize = K4Kb; |
|
528 WRITELOG1( "CHarvesterImagePlugin::DataFromImageFileL() - read first %d bytes from image", aFileData.iImageDataSize ); |
|
529 } |
|
530 } |
|
531 |
|
532 aFileData.iImageData = HBufC8::NewL( aFileData.iImageDataSize ); |
|
533 TPtr8 myImagePtr = aFileData.iImageData->Des(); |
|
534 |
|
535 const TInt readStatus = iFs.ReadFileSection( |
|
536 *aFileData.iUri, 0, myImagePtr, aFileData.iImageDataSize ); |
|
537 if ( readStatus != KErrNone ) |
|
538 { |
|
539 WRITELOG( "CHarvesterImagePlugin::DataFromImageFileL() - ERROR: file could not be read!" ); |
|
540 User::Leave( readStatus ); |
|
541 } |
|
542 |
|
543 // extension was in mapping list, so use that |
|
544 if ( pos != KErrNotFound ) |
|
545 { |
|
546 aFileData.iMime8.Copy( iMimeTypeMappings[pos].iMimeType ); |
|
547 aFileData.iMime16.Copy( aFileData.iMime8 ); |
|
548 } |
|
549 // otherwise try to recognize using image decoder |
|
550 else |
|
551 { |
|
552 CImageDecoder::GetMimeTypeDataL( myImagePtr, aFileData.iMime8 ); |
|
553 aFileData.iMime16.Copy( aFileData.iMime8 ); |
|
554 |
|
555 // Check if MIME type is supported |
|
556 User::LeaveIfError( CheckIfMimeSupported( aFileData.iMime16 ) ); |
|
557 } |
|
558 |
|
559 // If is jpeg get EXIF data |
|
560 if ( aFileData.iJpeg ) |
|
561 { |
|
562 if( iExifUtil->IsValidExifData(myImagePtr) ) |
|
563 { |
|
564 WRITELOG( "CHarvesterImagePlugin::DataFromImageFileL() - exif data found!" ); |
|
565 aFileData.iExifSupported = ETrue; |
|
566 } |
|
567 else |
|
568 { |
|
569 WRITELOG( "CHarvesterImagePlugin::DataFromImageFileL() - no exif data!" ); |
|
570 aFileData.iImageDataSize = aFileData.iFileSize; |
|
571 aFileData.iExifSupported = EFalse; |
|
572 } |
|
573 } |
|
574 |
|
575 WRITELOG( "CHarvesterImagePlugin::DataFromImageFileL() - reading IMAGE file done!" ); |
|
576 } |
|
577 |
|
578 // --------------------------------------------------------------------------- |
|
579 // HandleNewObjectL |
|
580 // --------------------------------------------------------------------------- |
|
581 // |
|
582 void CHarvesterImagePlugin::HandleObjectPropertiesL( |
|
583 CHarvestData& aHd, |
|
584 CFileData& aFileData, |
|
585 CHarvesterData& aHarvesterData, |
|
586 TBool aIsAdd ) |
|
587 { |
|
588 WRITELOG( "CHarvesterImagePlugin::HandleObjectPropertiesL() - New MdE object" ); |
|
589 |
|
590 CMdEObject& mdeObject = aHarvesterData.MdeObject(); |
|
591 |
|
592 if( !iPropDefs ) |
|
593 { |
|
594 iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( mdeObject.Def() ); |
|
595 } |
|
596 |
|
597 TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset(); |
|
598 |
|
599 TTime localModifiedDate = aFileData.iModified + timeOffsetSeconds; |
|
600 |
|
601 // Object - Creation date |
|
602 if( ! mdeObject.Placeholder() ) |
|
603 { |
|
604 if ( aFileData.iExifSupported && aHd.iDateOriginal8 ) |
|
605 { |
|
606 TTime originalTime = iExifUtil->ConvertExifDateTimeToSymbianTimeL( |
|
607 aHd.iDateOriginal8->Des() ); |
|
608 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCreationDatePropertyDef, &originalTime, aIsAdd ); |
|
609 } |
|
610 else if ( aIsAdd ) |
|
611 { |
|
612 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCreationDatePropertyDef, &localModifiedDate, aIsAdd ); |
|
613 } |
|
614 } |
|
615 |
|
616 // Object - last aFileData.iModified date |
|
617 if( ! mdeObject.Placeholder() ) |
|
618 { |
|
619 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iLastModifiedDatePropertyDef, &aFileData.iModified, aIsAdd ); |
|
620 } |
|
621 |
|
622 if( aFileData.iJpeg ) |
|
623 { |
|
624 // Time offset |
|
625 TInt16 timeOffsetMinutes = timeOffsetSeconds.Int() / 60; |
|
626 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTimeOffsetPropertyDef, &timeOffsetMinutes, aIsAdd ); |
|
627 } |
|
628 |
|
629 // Object - Size |
|
630 if( ! mdeObject.Placeholder() ) |
|
631 { |
|
632 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iSizePropertyDef, &aFileData.iFileSize, aIsAdd ); |
|
633 } |
|
634 |
|
635 // Item Type |
|
636 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iItemTypePropertyDef, &aFileData.iMime16, aIsAdd ); |
|
637 |
|
638 // MediaObject - Width |
|
639 if ( aFileData.iExifSupported ) |
|
640 { |
|
641 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iWidthPropertyDef, &aHd.iImageWidthExif, aIsAdd ); |
|
642 |
|
643 // If pixelXDimension tag is found, save its value to both Width and PixelXDimension in DB. |
|
644 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iPixelXDimensionPropertyDef, &aHd.iImageWidthExif, aIsAdd ); |
|
645 } |
|
646 else if (aFileData.iImageWidth != 0) |
|
647 { |
|
648 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iWidthPropertyDef, &aFileData.iImageWidth, aIsAdd ); |
|
649 } |
|
650 |
|
651 // MediaObject - Height |
|
652 if ( aFileData.iExifSupported ) |
|
653 { |
|
654 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iHeightPropertyDef, &aHd.iImageHeightExif, aIsAdd ); |
|
655 |
|
656 // If pixelYDimension tag is found, save its value to both Height and PixelYDimension in DB. |
|
657 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iPixelYDimensionPropertyDef, &aHd.iImageHeightExif, aIsAdd ); |
|
658 } |
|
659 else if (aFileData.iImageHeight != 0) |
|
660 { |
|
661 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iHeightPropertyDef, &aFileData.iImageHeight, aIsAdd ); |
|
662 } |
|
663 |
|
664 #ifdef MDS_MULTIPLE_STAGE_IMAGE_PROCESSING |
|
665 TBool draftVal = ETrue; |
|
666 if( aIsAdd ) |
|
667 { |
|
668 if( aHarvesterData.Origin() != MdeConstants::Object::ECamera ) |
|
669 { |
|
670 draftVal = EFalse; |
|
671 } |
|
672 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDraftPropertyDef, &draftVal, aIsAdd ); |
|
673 } |
|
674 else |
|
675 { |
|
676 if( aHarvesterData.ClientId() == KBGPSUid ) |
|
677 { |
|
678 draftVal = EFalse; |
|
679 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDraftPropertyDef, &draftVal, aIsAdd ); |
|
680 } |
|
681 } |
|
682 #endif |
|
683 |
|
684 // Image - Bits per Sample |
|
685 if (aFileData.iBitsPerPixel != 0) |
|
686 { |
|
687 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitsPerSamplePropertyDef, &aFileData.iBitsPerPixel, aIsAdd ); |
|
688 } |
|
689 |
|
690 // Image - Framecount |
|
691 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFrameCountPropertyDef, &aFileData.iFrameCount, aIsAdd ); |
|
692 |
|
693 // If is jpeg write EXIF data |
|
694 if ( aFileData.iExifSupported ) |
|
695 { |
|
696 // MediaObject - Description |
|
697 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, aHd.iDescription16, aIsAdd ); |
|
698 |
|
699 // MediaObject - Comment (user comment) |
|
700 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCommentPropertyDef, aHd.iComment16, aIsAdd ); |
|
701 |
|
702 // MediaObject - Release date |
|
703 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iReleaseDatePropertyDef, &localModifiedDate, aIsAdd ); |
|
704 |
|
705 // MediaObject - Copyright |
|
706 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aHd.iCopyright16, aIsAdd ); |
|
707 |
|
708 // Data & time original |
|
709 if ( aHd.iDateOriginal8 ) |
|
710 { |
|
711 TTime originalTime = iExifUtil->ConvertExifDateTimeToSymbianTimeL( aHd.iDateOriginal8->Des() ); |
|
712 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDateTimeOriginalPropertyDef, &originalTime, aIsAdd ); |
|
713 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCaptureDatePropertyDef, &originalTime, aIsAdd ); |
|
714 if( originalTime.Int64() == 0 ) |
|
715 { |
|
716 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCreationDatePropertyDef, &localModifiedDate, EFalse ); |
|
717 } |
|
718 else |
|
719 { |
|
720 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCreationDatePropertyDef, &originalTime, EFalse ); |
|
721 } |
|
722 } |
|
723 |
|
724 // Date & time digitized |
|
725 if ( aHd.iDateDigitized8 ) |
|
726 { |
|
727 TTime digitizedTime = iExifUtil->ConvertExifDateTimeToSymbianTimeL( aHd.iDateDigitized8->Des() ); |
|
728 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDateTimeDigitizedPropertyDef, &digitizedTime, aIsAdd ); |
|
729 } |
|
730 |
|
731 // Date & time aFileData.iModified (DateTime tag) |
|
732 if ( aHd.iDateModified8 ) |
|
733 { |
|
734 TTime modifiedTime = iExifUtil->ConvertExifDateTimeToSymbianTimeL( |
|
735 aHd.iDateModified8->Des() ); |
|
736 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDateTimePropertyDef, &modifiedTime, aIsAdd ); |
|
737 } |
|
738 |
|
739 // Artist |
|
740 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iArtistPropertyDef, aHd.iArtist, aIsAdd ); |
|
741 |
|
742 // Image - White balance |
|
743 if ( aHd.iStoreWhiteBalance ) |
|
744 { |
|
745 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iWhiteBalancePropertyDef, &aHd.iWhiteBalance, aIsAdd ); |
|
746 } |
|
747 |
|
748 // Image - Flash |
|
749 if ( aHd.iStoreFlash ) |
|
750 { |
|
751 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFlashPropertyDef, &aHd.iFlash, aIsAdd ); |
|
752 } |
|
753 |
|
754 // Image - Exposure program |
|
755 if ( aHd.iStoreExposureProgram ) |
|
756 { |
|
757 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iExposureProgramPropertyDef, &aHd.iExposureProgram, aIsAdd ); |
|
758 } |
|
759 |
|
760 // Make string |
|
761 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iMakePropertyDef, aHd.iMake, aIsAdd ); |
|
762 |
|
763 // Model string |
|
764 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iModelPropertyDef, aHd.iModel, aIsAdd ); |
|
765 |
|
766 // Orientation |
|
767 if ( aHd.iStoreOrientation ) |
|
768 { |
|
769 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iOrientationPropertyDef, &aHd.iOrientation, aIsAdd ); |
|
770 } |
|
771 |
|
772 // X resolution |
|
773 if ( aHd.iStoreXResolution ) |
|
774 { |
|
775 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iXResolutionPropertyDef, &aHd.iXResolution, aIsAdd ); |
|
776 } |
|
777 |
|
778 // Y resolution |
|
779 if ( aHd.iStoreYResolution ) |
|
780 { |
|
781 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iYResolutionPropertyDef, &aHd.iYResolution, aIsAdd ); |
|
782 } |
|
783 |
|
784 // Resolution unit |
|
785 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iResolutionUnitPropertyDef, &aHd.iResolutionUnit, aIsAdd ); |
|
786 |
|
787 // YCbCrPositioning |
|
788 if ( aHd.iStoreYCbCrPositioning ) |
|
789 { |
|
790 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iYCbCrPositioningPropertyDef, &aHd.iYCbCrPositioning, aIsAdd ); |
|
791 } |
|
792 |
|
793 // Exposure time |
|
794 if ( aHd.iStoreExposureTime ) |
|
795 { |
|
796 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iExposureTimePropertyDef, &aHd.iExposureTime, aIsAdd ); |
|
797 } |
|
798 |
|
799 // F number |
|
800 if ( aHd.iStoreFNumber ) |
|
801 { |
|
802 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFNumberPropertyDef, &aHd.iFNumber, aIsAdd ); |
|
803 } |
|
804 |
|
805 // EXIF version |
|
806 if ( aHd.iStoreExifVersion ) |
|
807 { |
|
808 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iExifVersionPropertyDef, &aHd.iExifVersion, aIsAdd ); |
|
809 } |
|
810 |
|
811 // Shutter speed |
|
812 if ( aHd.iStoreShutterSpeed ) |
|
813 { |
|
814 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iShutterSpeedValuePropertyDef, &aHd.iShutterSpeed, aIsAdd ); |
|
815 } |
|
816 |
|
817 // Aperture |
|
818 if ( aHd.iStoreAperture ) |
|
819 { |
|
820 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iApertureValuePropertyDef, &aHd.iAperture, aIsAdd ); |
|
821 } |
|
822 |
|
823 // Focal length |
|
824 if ( aHd.iStoreFocalLength ) |
|
825 { |
|
826 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFocalLengthPropertyDef, &aHd.iFocalLength, aIsAdd ); |
|
827 } |
|
828 |
|
829 // FlashPix version |
|
830 if ( aHd.iStoreFlashPixVersion ) |
|
831 { |
|
832 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFlashPixVersionPropertyDef, &aHd.iFlashPixVersion, aIsAdd ); |
|
833 } |
|
834 |
|
835 // Colour space |
|
836 if ( aHd.iStoreColourSpace ) |
|
837 { |
|
838 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iColourSpacePropertyDef, &aHd.iColourSpace, aIsAdd ); |
|
839 } |
|
840 |
|
841 // ISO speed rating |
|
842 if ( aHd.iStoreIsoSpeedRating ) |
|
843 { |
|
844 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iISOSpeedRatingsPropertyDef, &aHd.iIsoSpeedRating, aIsAdd ); |
|
845 } |
|
846 |
|
847 // Components configuration |
|
848 if ( aHd.iStoreComponentsConfig ) |
|
849 { |
|
850 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iComponentsConfigurationPropertyDef, &aHd.iComponentsConfiguration, aIsAdd ); |
|
851 } |
|
852 |
|
853 // Exposure bias value |
|
854 if ( aHd.iStoreExposureBias ) |
|
855 { |
|
856 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iExposureBiasValuePropertyDef, &aHd.iExposureBias, aIsAdd ); |
|
857 } |
|
858 |
|
859 // Samples per pixel |
|
860 if ( aHd.iStoreSamplesPerPixel ) |
|
861 { |
|
862 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iSamplesPerPixelPropertyDef, &aHd.iSamplesPerPixel, aIsAdd ); |
|
863 } |
|
864 |
|
865 // Thumbnail compression |
|
866 if ( aHd.iStoreThumbCompression ) |
|
867 { |
|
868 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iThumbCompressionPropertyDef, &aHd.iThumbCompression, aIsAdd ); |
|
869 } |
|
870 |
|
871 // Thumbnail X resolution |
|
872 if ( aHd.iStoreThumbXResolution ) |
|
873 { |
|
874 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iThumbXResolutionPropertyDef, &aHd.iThumbXResolution, aIsAdd ); |
|
875 } |
|
876 |
|
877 // Thumbnail Y resolution |
|
878 if ( aHd.iStoreThumbYResolution ) |
|
879 { |
|
880 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iThumbYResolutionPropertyDef, &aHd.iThumbYResolution, aIsAdd ); |
|
881 } |
|
882 |
|
883 // Thumbnail resolution unit |
|
884 if ( aHd.iStoreThumbResolutionUnit ) |
|
885 { |
|
886 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iThumbResolutionUnitPropertyDef, &aHd.iThumbResolutionUnit, aIsAdd ); |
|
887 } |
|
888 |
|
889 // Focal length in 35 mm |
|
890 if ( aHd.iStoreFocalLengthIn35 ) |
|
891 { |
|
892 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFocalLengthIn35mmFilmPropertyDef, &aHd.iFocalLengthIn35mm, aIsAdd ); |
|
893 } |
|
894 |
|
895 // Metering mode |
|
896 if ( aHd.iStoreMeteringMode ) |
|
897 { |
|
898 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iMeteringModePropertyDef, &aHd.iMeteringMode, aIsAdd ); |
|
899 } |
|
900 |
|
901 // Related soundfile |
|
902 if ( aHd.iRelatedSoundFile && aHd.iRelatedSoundFile->Length() > 0 ) |
|
903 { |
|
904 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iRelatedSoundFilePropertyDef, aHd.iRelatedSoundFile, aIsAdd ); |
|
905 } |
|
906 |
|
907 // Focal plane resolution unit |
|
908 if ( aHd.iStoreFocalPlaneResolutionUnit ) |
|
909 { |
|
910 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFocalPlaneResolutionUnitPropertyDef, &aHd.iFocalPlaneResolutionUnit, aIsAdd ); |
|
911 } |
|
912 |
|
913 // Focal plane X resolution |
|
914 if ( aHd.iStoreFocalPlaneXResolution ) |
|
915 { |
|
916 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFocalPlaneXResolutionPropertyDef, &aHd.iFocalPlaneXResolution, aIsAdd ); |
|
917 } |
|
918 |
|
919 // Focal plane Y resolution |
|
920 if ( aHd.iStoreFocalPlaneYResolution ) |
|
921 { |
|
922 CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iFocalPlaneYResolutionPropertyDef, &aHd.iFocalPlaneYResolution, aIsAdd ); |
|
923 } |
|
924 WRITELOG( "CHarvesterImagePlugin::HandleObjectPropertiesL() - All EXIF tags added." ); |
|
925 } |
|
926 } |
|
927 |
|
928 //--------------------------------------------------------------------------- |
|
929 // CheckIfMimeSupported |
|
930 //--------------------------------------------------------------------------- |
|
931 // |
|
932 TInt CHarvesterImagePlugin::CheckIfMimeSupported(const TDesC& aMimeBuf) |
|
933 { |
|
934 if ( MdsUtils::Compare(KJpegMime, aMimeBuf) == 0 |
|
935 || MdsUtils::Compare(KJpeg2000Mime, aMimeBuf) == 0 |
|
936 || MdsUtils::Compare(KJpeg2000_2Mime, aMimeBuf) == 0 |
|
937 || MdsUtils::Compare(KPngMime, aMimeBuf) == 0 |
|
938 || MdsUtils::Compare(KGifMime, aMimeBuf) == 0 |
|
939 || MdsUtils::Compare(KBmpMime, aMimeBuf) == 0 |
|
940 || MdsUtils::Compare(KMsmMime, aMimeBuf) == 0 |
|
941 || MdsUtils::Compare(KXbmpMime, aMimeBuf) == 0 |
|
942 || MdsUtils::Compare(KWbmpMime, aMimeBuf) == 0 |
|
943 || MdsUtils::Compare(KMbmMime, aMimeBuf) == 0 |
|
944 || MdsUtils::Compare(KTiffMime, aMimeBuf) == 0 |
|
945 || MdsUtils::Compare(KOtaMime, aMimeBuf) == 0 |
|
946 || MdsUtils::Compare(KXotaMime, aMimeBuf) == 0 |
|
947 || MdsUtils::Compare(KWmfMime, aMimeBuf) == 0 ) |
|
948 |
|
949 { |
|
950 return KErrNone; |
|
951 } |
|
952 |
|
953 return KErrNotSupported; |
|
954 } |