harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
branchRCL_3
changeset 27 4a4892eec172
parent 26 9f21bab39f42
child 30 3e156c80c15d
equal deleted inserted replaced
26:9f21bab39f42 27:4a4892eec172
    19 #include <e32std.h>
    19 #include <e32std.h>
    20 #include <3gplibrary/mp4lib.h>
    20 #include <3gplibrary/mp4lib.h>
    21 #include <hxmetadatautil.h>
    21 #include <hxmetadatautil.h>
    22 #include <hxmetadatakeys.h>
    22 #include <hxmetadatakeys.h>
    23 #include <caf/caf.h>
    23 #include <caf/caf.h>
       
    24 #include <pathinfo.h>
    24 
    25 
    25 #include "mdsutils.h"
    26 #include "mdsutils.h"
    26 #include "harvestervideoplugin.h"
    27 #include "harvestervideoplugin.h"
    27 #include "harvesterlog.h"
    28 #include "harvesterlog.h"
    28 #include "harvesterblacklist.h"
    29 #include "harvesterblacklist.h"
    96 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty );
    97 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty );
    97 	iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty );
    98 	iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty );
    98 	iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty );
    99 	iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty );
    99 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty );
   100 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty );
   100 	iTitlePropertyDef = &objectDef.GetPropertyDefL( Object::KTitleProperty );
   101 	iTitlePropertyDef = &objectDef.GetPropertyDefL( Object::KTitleProperty );
       
   102 	iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( Object::KInDefaultFolder );
   101 
   103 
   102 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject );
   104 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject );
   103 	iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty );
   105 	iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty );
   104 	iCaptureDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCaptureDateProperty );
   106 	iCaptureDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCaptureDateProperty );
   105 	iDurationPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDurationProperty );
   107 	iDurationPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDurationProperty );
   162 	{
   164 	{
   163 	delete iPropDefs;
   165 	delete iPropDefs;
   164 	iMimeTypeMappings.Close();
   166 	iMimeTypeMappings.Close();
   165     RMediaIdUtil::ReleaseInstance();
   167     RMediaIdUtil::ReleaseInstance();
   166 
   168 
       
   169     delete iPhoneVideosPath;
       
   170     delete iMmcVideosPath;
       
   171     
   167 	WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()");
   172 	WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()");
   168 	}
   173 	}
   169 
   174 
   170 /**
   175 /**
   171 * 2nd phase constructor
   176 * 2nd phase constructor
   267     User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   272     User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   268             KExtensionWmv(), KMimeTypeWmv(), 
   273             KExtensionWmv(), KMimeTypeWmv(), 
   269             TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
   274             TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
   270                     KMimeTypeWmv(), KMimeTypeWmv() ) ), 
   275                     KMimeTypeWmv(), KMimeTypeWmv() ) ), 
   271             cmp ) );
   276             cmp ) );
       
   277 
       
   278     TFileName videos = PathInfo::VideosPath();
       
   279     
       
   280     TFileName phonePath = PathInfo::PhoneMemoryRootPath();
       
   281     phonePath.Append( videos );
       
   282     iPhoneVideosPath = phonePath.AllocL();
       
   283 
       
   284     TFileName mmcPath = PathInfo::MemoryCardRootPath();
       
   285     mmcPath.Append( videos );
       
   286     iMmcVideosPath = mmcPath.Right( mmcPath.Length() - 1 ).AllocL();
   272     
   287     
   273     iMediaIdUtil = &RMediaIdUtil::GetInstanceL();
   288     iMediaIdUtil = &RMediaIdUtil::GetInstanceL();
   274     }
   289     }
   275 
   290 
   276 
   291 
   397             TRAP_IGNORE( HandleObjectPropertiesL( *aHD, *fileData, EFalse ) );
   412             TRAP_IGNORE( HandleObjectPropertiesL( *aHD, *fileData, EFalse ) );
   398             }
   413             }
   399     	}
   414     	}
   400     else
   415     else
   401         {
   416         {
   402         WRITELOG1( "CHarvesterVideoPlugin::HarvestSingleFileL() - TRAP error: %d", error );
   417         WRITELOG1( "CHarvesterVideoPlugin::HarvestL() - TRAP error: %d", error );
   403         TInt convertedError = KErrNone;
   418         TInt convertedError = KErrNone;
   404         MdsUtils::ConvertTrapError( error, convertedError );
   419         MdsUtils::ConvertTrapError( error, convertedError );
   405         aHD->SetErrorCode( convertedError );
   420         aHD->SetErrorCode( convertedError );
   406         }
   421         }
   407 
   422 
   432 // ---------------------------------------------------------------------------
   447 // ---------------------------------------------------------------------------
   433 //
   448 //
   434 void CHarvesterVideoPlugin::GatherDataL( CMdEObject& aMetadataObject,
   449 void CHarvesterVideoPlugin::GatherDataL( CMdEObject& aMetadataObject,
   435 		CVideoHarvestData& aVHD )
   450 		CVideoHarvestData& aVHD )
   436     {
   451     {
       
   452 #ifdef _DEBUG
       
   453     TTime dStart, dStop;
       
   454     dStart.UniversalTime();
       
   455     dStop.UniversalTime();
       
   456     WRITELOG1( "CHarvesterVideoPlugin::GatherDataL start %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() );
       
   457 #endif
   437     const TDesC& uri = aMetadataObject.Uri();
   458     const TDesC& uri = aMetadataObject.Uri();
   438     
   459     
   439     WRITELOG1( "CHarvesterVideoPlugin - Gather data from file %S", &uri );
   460     WRITELOG1( "CHarvesterVideoPlugin - Gather data from file %S", &uri );
   440     
   461     
   441     RFile64 file;
   462     RFile64 file;
   930 #endif
   951 #endif
   931         }
   952         }
   932     WRITELOG( "CHarvesterVideoPlugin - Closing file" );        
   953     WRITELOG( "CHarvesterVideoPlugin - Closing file" );        
   933     CleanupStack::PopAndDestroy( &file );        
   954     CleanupStack::PopAndDestroy( &file );        
   934 
   955 
       
   956 #ifdef _DEBUG
       
   957     dStop.UniversalTime();
       
   958     WRITELOG1( "CHarvesterVideoPlugin::GatherDataL start %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() );
       
   959 #endif  
       
   960     
   935     WRITELOG( "CHarvesterVideoPlugin - Start adding data to object" );
   961     WRITELOG( "CHarvesterVideoPlugin - Start adding data to object" );
   936     }
   962     }
   937 
   963 
   938 // ---------------------------------------------------------------------------
   964 // ---------------------------------------------------------------------------
   939 // HandleNewObjectL
   965 // HandleNewObjectL
   967     	// Last modified date
   993     	// Last modified date
   968     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iLastModifiedDatePropertyDef, &aVHD.iModified, aIsAdd );
   994     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iLastModifiedDatePropertyDef, &aVHD.iModified, aIsAdd );
   969     
   995     
   970     	// File size
   996     	// File size
   971     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iSizePropertyDef, &aVHD.iFileSize, aIsAdd );
   997     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iSizePropertyDef, &aVHD.iFileSize, aIsAdd );
       
   998     	
       
   999     	// Default folder
       
  1000         const TDesC& uri = mdeObject.Uri();
       
  1001         if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound ||
       
  1002             uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound ||
       
  1003             uri.FindF( KDCIMFolder ) != KErrNotFound ) 
       
  1004             {
       
  1005             TBool inDefaultFolder( ETrue );
       
  1006             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
       
  1007             }
       
  1008         else
       
  1009             {
       
  1010             TBool inDefaultFolder( EFalse );
       
  1011             CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );    
       
  1012             }
   972     	}
  1013     	}
   973 
  1014 
   974     // Item Type
  1015     // Item Type
   975     if( aVHD.iMimeBuf )
  1016     if( aVHD.iMimeBuf )
   976         {
  1017         {