253 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
253 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
254 KExtWmf(), KWmfMime(), EOtherHandling ), cmp ) ); |
254 KExtWmf(), KWmfMime(), EOtherHandling ), cmp ) ); |
255 |
255 |
256 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
256 User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>( |
257 KExtOtb(), KOtbMime(), EOtherHandling ), cmp ) ); |
257 KExtOtb(), KOtbMime(), EOtherHandling ), cmp ) ); |
|
258 |
258 } |
259 } |
259 |
260 |
260 void CHarvesterImagePlugin::HarvestL( CHarvesterData* aHD ) |
261 void CHarvesterImagePlugin::HarvestL( CHarvesterData* aHD ) |
261 { |
262 { |
262 WRITELOG( "CHarvesterImagePlugin::HarvestL()" ); |
263 WRITELOG( "CHarvesterImagePlugin::HarvestL()" ); |
447 WRITELOG( "CHarvesterImagePlugin::GatherData() - Exif could not be read. Using ICL." ); |
448 WRITELOG( "CHarvesterImagePlugin::GatherData() - Exif could not be read. Using ICL." ); |
448 |
449 |
449 TPtr8 imageDataPtr = aFileData.iImageData->Des(); |
450 TPtr8 imageDataPtr = aFileData.iImageData->Des(); |
450 TRAP( err, iDecoder->OpenL(imageDataPtr, aFileData.iMime8, |
451 TRAP( err, iDecoder->OpenL(imageDataPtr, aFileData.iMime8, |
451 CImageDecoder::TOptions( CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionIgnoreExifMetaData ) ) ); |
452 CImageDecoder::TOptions( CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionIgnoreExifMetaData ) ) ); |
452 WRITELOG( "CHarvesterImagePlugin::GatherData() - Image decoder has opened the file." ); |
|
453 |
453 |
454 if ( err != KErrNone ) |
454 if ( err != KErrNone ) |
455 { |
455 { |
456 WRITELOG1( "CHarvesterImagePlugin::GatherData() - ERROR: Decoder could not open image data! Code %d", err ); |
456 WRITELOG1( "CHarvesterImagePlugin::GatherData() - ERROR: Decoder could not open image data! Code %d", err ); |
|
457 #ifdef _DEBUG |
|
458 if( err == KErrInUse || err == KErrLocked ) |
|
459 { |
|
460 TPtrC fileName( uri.Mid(2) ); |
|
461 WRITELOG1( "CHarvesterImagePlugin :: Checking open file handles to %S", &fileName ); |
|
462 |
|
463 CFileList* fileList = 0; |
|
464 TOpenFileScan fileScan( iFs ); |
|
465 |
|
466 fileScan.NextL( fileList ); |
|
467 |
|
468 while ( fileList ) |
|
469 { |
|
470 const TInt count( fileList->Count() ); |
|
471 for (TInt i = 0; i < count; i++ ) |
|
472 { |
|
473 if ( (*fileList)[i].iName == uri.Mid(2) ) |
|
474 { |
|
475 TFullName processName; |
|
476 TFindThread find(_L("*")); |
|
477 while( find.Next( processName ) == KErrNone ) |
|
478 { |
|
479 RThread thread; |
|
480 TInt err = thread.Open( processName ); |
|
481 |
|
482 if ( err == KErrNone ) |
|
483 { |
|
484 if ( thread.Id().Id() == fileScan.ThreadId() ) |
|
485 { |
|
486 processName = thread.Name(); |
|
487 thread.Close(); |
|
488 WRITELOG1( "CHarvesterImagePlugin:: %S has a file handle open", &processName ); |
|
489 break; |
|
490 } |
|
491 thread.Close(); |
|
492 } |
|
493 } |
|
494 } |
|
495 } |
|
496 fileScan.NextL( fileList ); |
|
497 } |
|
498 } |
|
499 #endif |
457 iDecoder->Reset(); |
500 iDecoder->Reset(); |
458 return KErrCompletion; // metadata item still can be created, thus KErrCompletion |
501 return KErrCompletion; // metadata item still can be created, thus KErrCompletion |
459 } |
502 } |
460 |
503 |
|
504 WRITELOG( "CHarvesterImagePlugin::GatherData() - Image decoder has opened the file." ); |
|
505 |
461 if ( !iDecoder->ValidDecoder() ) |
506 if ( !iDecoder->ValidDecoder() ) |
462 { |
507 { |
463 // read all remaining data from file |
508 // read all remaining data from file |
464 TInt64 additionalDataSize = aFileData.iFileSize - aFileData.iImageDataSize; |
509 TInt64 additionalDataSize = aFileData.iFileSize - aFileData.iImageDataSize; |
465 if( additionalDataSize < 0 ) |
510 if( additionalDataSize < 0 ) |