harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
branchRCL_3
changeset 63 e538444823de
parent 57 2872ae438bf7
equal deleted inserted replaced
57:2872ae438bf7 63:e538444823de
    83 _LIT(KInUse, "InUse");
    83 _LIT(KInUse, "InUse");
    84 
    84 
    85 const TInt KKiloBytes = 1024;
    85 const TInt KKiloBytes = 1024;
    86 const TReal32 KThousandReal = 1000.0;
    86 const TReal32 KThousandReal = 1000.0;
    87 
    87 
    88 CHarvesterVideoPluginPropertyDefs::CHarvesterVideoPluginPropertyDefs() : CBase(),
    88 CHarvesterVideoPluginPropertyDefs::CHarvesterVideoPluginPropertyDefs() : CBase()
    89     iCreationDatePropertyDef( NULL )
       
    90 	{
    89 	{
    91 	}
    90 	}
    92 
    91 
    93 void CHarvesterVideoPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
    92 void CHarvesterVideoPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
    94 	{
    93 	{
    95     SetByObjectDefL( aObjectDef );
    94 	CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
       
    95 	
       
    96 	// Common property definitions
       
    97 	CMdEObjectDef& objectDef = nsDef.GetObjectDefL( Object::KBaseObject );
       
    98 	iCreationDatePropertyDef = &objectDef.GetPropertyDefL( Object::KCreationDateProperty );
       
    99 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty );
       
   100 	iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty );
       
   101 	iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty );
       
   102 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty );
       
   103 	iTitlePropertyDef = &objectDef.GetPropertyDefL( Object::KTitleProperty );
       
   104 	iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( Object::KInDefaultFolder );
       
   105 
       
   106 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject );
       
   107 	iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty );
       
   108 	iCaptureDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCaptureDateProperty );
       
   109 	iDurationPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDurationProperty );
       
   110 	iWidthPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KWidthProperty );
       
   111 	iHeightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KHeightProperty );
       
   112 	iBitratePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KBitrateProperty );
       
   113 	iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCopyrightProperty );
       
   114 	iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KAuthorProperty );
       
   115 	iGenrePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KGenreProperty );
       
   116 	iArtistPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KArtistProperty );
       
   117 	iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDescriptionProperty );
       
   118     iDrmPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDRMProperty );
       
   119 	
       
   120 	iAudioFourCCDef = &mediaDef.GetPropertyDefL( MediaObject::KAudioFourCCProperty );
       
   121 
       
   122 	// Video property definitions
       
   123 	CMdEObjectDef& videoDef = nsDef.GetObjectDefL( Video::KVideoObject );
       
   124 	iFrameratePropertyDef = &videoDef.GetPropertyDefL( Video::KFramerateProperty );
       
   125 
       
   126 	// Audio property definitions
       
   127 	CMdEObjectDef& audioDef = nsDef.GetObjectDefL( Audio::KAudioObject );
       
   128 	iSamplingFrequencyPropertyDef = &audioDef.GetPropertyDefL( Audio::KSamplingFrequencyProperty );
    96 	}
   129 	}
    97 
   130 
    98 CHarvesterVideoPluginPropertyDefs* CHarvesterVideoPluginPropertyDefs::NewL()
   131 CHarvesterVideoPluginPropertyDefs* CHarvesterVideoPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
    99     {
   132 	{
   100     CHarvesterVideoPluginPropertyDefs* self = 
   133 	CHarvesterVideoPluginPropertyDefs* self = 
   101         new (ELeave) CHarvesterVideoPluginPropertyDefs();
   134 		new (ELeave) CHarvesterVideoPluginPropertyDefs();
   102     return self;
   135 	CleanupStack::PushL( self );
   103     }
   136 	self->ConstructL( aObjectDef );
   104 
   137 	CleanupStack::Pop( self );
   105 void CHarvesterVideoPluginPropertyDefs::SetByObjectDefL( CMdEObjectDef& aObjectDef )
   138 	return self;
   106     {
   139 	}
   107     CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
       
   108     
       
   109     // Common property definitions
       
   110     CMdEObjectDef& objectDef = nsDef.GetObjectDefL( Object::KBaseObject );
       
   111     iCreationDatePropertyDef = &objectDef.GetPropertyDefL( Object::KCreationDateProperty );
       
   112     iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty );
       
   113     iSizePropertyDef = &objectDef.GetPropertyDefL( Object::KSizeProperty );
       
   114     iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( Object::KTimeOffsetProperty );
       
   115     iItemTypePropertyDef = &objectDef.GetPropertyDefL( Object::KItemTypeProperty );
       
   116     iTitlePropertyDef = &objectDef.GetPropertyDefL( Object::KTitleProperty );
       
   117     iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( Object::KInDefaultFolder );
       
   118 
       
   119     CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MediaObject::KMediaObject );
       
   120     iReleaseDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KReleaseDateProperty );
       
   121     iCaptureDatePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCaptureDateProperty );
       
   122     iDurationPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDurationProperty );
       
   123     iWidthPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KWidthProperty );
       
   124     iHeightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KHeightProperty );
       
   125     iBitratePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KBitrateProperty );
       
   126     iCopyrightPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KCopyrightProperty );
       
   127     iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KAuthorProperty );
       
   128     iGenrePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KGenreProperty );
       
   129     iArtistPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KArtistProperty );
       
   130     iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDescriptionProperty );
       
   131     iDrmPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDRMProperty );
       
   132     
       
   133     iAudioFourCCDef = &mediaDef.GetPropertyDefL( MediaObject::KAudioFourCCProperty );
       
   134 
       
   135     // Video property definitions
       
   136     CMdEObjectDef& videoDef = nsDef.GetObjectDefL( Video::KVideoObject );
       
   137     iFrameratePropertyDef = &videoDef.GetPropertyDefL( Video::KFramerateProperty );
       
   138 
       
   139     // Audio property definitions
       
   140     CMdEObjectDef& audioDef = nsDef.GetObjectDefL( Audio::KAudioObject );
       
   141     iSamplingFrequencyPropertyDef = &audioDef.GetPropertyDefL( Audio::KSamplingFrequencyProperty );
       
   142     }
       
   143 
   140 
   144 /**
   141 /**
   145 * Default constructor
   142 * Default constructor
   146 */
   143 */
   147 CHarvesterVideoPlugin::CHarvesterVideoPlugin() : CHarvesterPlugin(), iPropDefs( NULL )
   144 CHarvesterVideoPlugin::CHarvesterVideoPlugin() : CHarvesterPlugin(), iPropDefs( NULL )
   166 * Destruction
   163 * Destruction
   167 */
   164 */
   168 CHarvesterVideoPlugin::~CHarvesterVideoPlugin()
   165 CHarvesterVideoPlugin::~CHarvesterVideoPlugin()
   169 	{
   166 	{
   170 	delete iPropDefs;
   167 	delete iPropDefs;
   171 	iPropDefs = NULL;
       
   172 	iMimeTypeMappings.Close();
   168 	iMimeTypeMappings.Close();
   173     RMediaIdUtil::ReleaseInstance();
   169     RMediaIdUtil::ReleaseInstance();
   174 
   170 
   175     delete iPhoneVideosPath;
   171     delete iPhoneVideosPath;
   176     iPhoneVideosPath = NULL;
       
   177     delete iMmcVideosPath;
   172     delete iMmcVideosPath;
   178     iMmcVideosPath = NULL;
       
   179     
   173     
   180 	WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()");
   174 	WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()");
   181 	}
   175 	}
   182 
   176 
   183 /**
   177 /**
   184 * 2nd phase constructor
   178 * 2nd phase constructor
   185 */
   179 */
   186 void CHarvesterVideoPlugin::ConstructL()
   180 void CHarvesterVideoPlugin::ConstructL()
   187 	{
   181 	{
   188 	WRITELOG( "CHarvesterVideoPlugin::ConstructL() - begin" );
   182 	WRITELOG( "CHarvesterVideoPlugin::ConstructL() - begin" );
   189 	
       
   190 	iPropDefs = CHarvesterVideoPluginPropertyDefs::NewL();
       
   191 	
   183 	
   192 	TLinearOrder< THarvestingHandling > cmp( THarvestingHandling::CompareFunction );
   184 	TLinearOrder< THarvestingHandling > cmp( THarvestingHandling::CompareFunction );
   193 
   185 
   194 	// MPEG4
   186 	// MPEG4
   195 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   187 	User::LeaveIfError( iMimeTypeMappings.InsertInOrder( THarvestingHandling(
   337     // and will not be processed again until the file is modified
   329     // and will not be processed again until the file is modified
   338     const TInt error = file.Open( iFs, aUri, EFileRead | EFileShareReadersOnly  );
   330     const TInt error = file.Open( iFs, aUri, EFileRead | EFileShareReadersOnly  );
   339     if ( error != KErrNone )
   331     if ( error != KErrNone )
   340         {
   332         {
   341         WRITELOG1( "CHarvesterVideoPlugin::GetObjectType - File open error: %d", error );
   333         WRITELOG1( "CHarvesterVideoPlugin::GetObjectType - File open error: %d", error );
   342         if( error == KErrInUse || KErrLocked )
   334         if( error == KErrInUse )
   343             {
   335             {
   344 #ifdef _DEBUG
   336 #ifdef _DEBUG
   345             TPtrC fileName( aUri.Mid(2) );
   337             TPtrC fileName( aUri.Mid(2) );
   346             WRITELOG1( "CHarvesterVideoPlugin :: Checking open file handles to %S", &fileName );
   338             WRITELOG1( "CHarvesterVideoPlugin :: Checking open file handles to %S", &fileName );
   347 
   339 
   554             }
   546             }
   555         }
   547         }
   556     
   548     
   557     if( !dataExtracted )
   549     if( !dataExtracted )
   558         {
   550         {
   559         // If file could be opened, use file handle to fetch base data, otherwise
   551         TEntry entry;
   560         // attempt to fetch the data from TEntry 
   552         const TInt errorcode = iFs.Entry( uri, entry );
   561         if( error == KErrNone )
   553         
       
   554         if ( errorcode != KErrNone )
   562             {
   555             {
   563             User::LeaveIfError( file.Modified( aVHD.iModified ) );
   556             WRITELOG1( "CHarvesterVideoPlugin - Error getting entry: %d", errorcode );
   564             User::LeaveIfError( file.Size( aVHD.iFileSize ) );            
   557             CleanupStack::PopAndDestroy( &file );
       
   558             User::Leave( errorcode );
   565             }
   559             }
   566         else
   560         
   567             {
   561         aVHD.iModified = entry.iModified;
   568             TEntry entry;
   562         aVHD.iFileSize = (TUint)entry.iSize;
   569             const TInt errorcode = iFs.Entry( uri, entry );
       
   570         
       
   571             if ( errorcode != KErrNone )
       
   572                 {
       
   573                 WRITELOG1( "CHarvesterVideoPlugin - Error getting entry: %d", errorcode );
       
   574                 CleanupStack::PopAndDestroy( &file );
       
   575                 User::Leave( errorcode );
       
   576                 }
       
   577         
       
   578             aVHD.iModified = entry.iModified;
       
   579             aVHD.iFileSize = (TUint)entry.iSize;        
       
   580             }
       
   581         
   563         
   582         WRITELOG1( "CHarvesterVideoPlugin - File size: %d", aVHD.iFileSize );
   564         WRITELOG1( "CHarvesterVideoPlugin - File size: %d", aVHD.iFileSize );
   583         }
   565         }
       
   566 
       
   567     // now the minimum information has been harvested
       
   568     // from now on the harvested data should always be stored
       
   569 
       
   570     const THarvestingHandling* mapping = FindHandler( uri );
       
   571     
       
   572     if( !mapping )
       
   573     	{
       
   574     	CleanupStack::PopAndDestroy( &file );
       
   575     	User::Leave( KErrNotFound );
       
   576     	}
   584 
   577 
   585     aVHD.iVideoObject = aMetadataObject.Def().Name().Compare( KVideo ) == 0;
   578     aVHD.iVideoObject = aMetadataObject.Def().Name().Compare( KVideo ) == 0;
   586 
   579 
   587     if( error != KErrNone )
   580     if( error != KErrNone )
   588         {
   581         {
   589         WRITELOG1( "CHarvesterVideoPlugin - File open error: %d", error );
   582         WRITELOG1( "CHarvesterVideoPlugin - File open error: %d", error );
   590         CleanupStack::PopAndDestroy( &file );
   583         CleanupStack::PopAndDestroy( &file );
   591         User::Leave( KErrCompletion );
   584         User::Leave( KErrCompletion );
   592         }
   585         }
   593     
   586     
   594     // now the minimum information has been harvested
       
   595     // from now on the harvested data should always be stored
       
   596 
       
   597     const THarvestingHandling* mapping = FindHandler( uri );
       
   598     
       
   599     if( !mapping )
       
   600     	{
       
   601     	CleanupStack::PopAndDestroy( &file );
       
   602     	User::Leave( KErrNotFound );
       
   603     	}
       
   604     
       
   605     if ( mapping->iHandler.iLibrary == TVideoMetadataHandling::EHexilMetadataHandling )
   587     if ( mapping->iHandler.iLibrary == TVideoMetadataHandling::EHexilMetadataHandling )
   606     	{
   588     	{
   607     	// doesn't own pointers to MIME types
   589     	// doesn't own pointers to MIME types
   608     	RPointerArray<HBufC> mimes;
   590     	RPointerArray<HBufC> mimes;
   609     	CleanupClosePushL( mimes );
   591     	CleanupClosePushL( mimes );
   610 
   592 
   611         TPtrC ext;
   593         TPtrC ext;
   612         const TBool exists = MdsUtils::GetExt( uri, ext );
   594         MdsUtils::GetExt( uri, ext );
   613         
   595         
   614         // Check for possibly protected content
   596         // Check for possibly protected content
   615         if( exists && ext.CompareF( KExtensionWmv ) == 0 )
   597         if( ext.CompareF( KExtensionWmv ) == 0 )
   616             {
   598             {
   617             ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
   599             ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
   618             ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
   600             ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
   619             
   601             
   620             data->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
   602             data->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
   623     	
   605     	
   624     	CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
   606     	CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
   625         CleanupStack::PushL( helixMetadata );
   607         CleanupStack::PushL( helixMetadata );
   626         
   608         
   627         TRAP( error, helixMetadata->OpenFileL( file ) );        
   609         TRAP( error, helixMetadata->OpenFileL( file ) );        
   628 
       
   629         // No need for the file handle anymore so closing it
       
   630         WRITELOG( "CHarvesterVideoPlugin - Parsing done, file handle can be closed" );   
       
   631         file.Close();
       
   632         
   610         
   633         if ( error == KErrNone )
   611         if ( error == KErrNone )
   634         	{
   612         	{
   635         	HBufC *buf = NULL;
   613         	HBufC *buf = NULL;
   636         	HXMetaDataKeys::EHXMetaDataId metaid;        	
   614         	HXMetaDataKeys::EHXMetaDataId metaid;        	
   809         if( mime.Ptr() && ( mime.Length() > 0 ) )
   787         if( mime.Ptr() && ( mime.Length() > 0 ) )
   810         	{
   788         	{
   811         	aVHD.iMimeBuf = mime.Alloc();
   789         	aVHD.iMimeBuf = mime.Alloc();
   812         	}
   790         	}
   813         
   791         
   814         helixMetadata->ResetL();
       
   815         CleanupStack::PopAndDestroy( helixMetadata );
   792         CleanupStack::PopAndDestroy( helixMetadata );
   816         
   793         
   817         // don't destory mime type pointers just clean array
   794         // don't destory mime type pointers just clean array
   818         CleanupStack::PopAndDestroy( &mimes );
   795         CleanupStack::PopAndDestroy( &mimes );
   819         
   796         
   980             {
   957             {
   981             WRITELOG( "CHarvesterVideoPlugin - Error closing file handle" );
   958             WRITELOG( "CHarvesterVideoPlugin - Error closing file handle" );
   982             }
   959             }
   983 #endif
   960 #endif
   984         }
   961         }
   985     WRITELOG( "CHarvesterVideoPlugin - Closing file, if still open" );        
   962     WRITELOG( "CHarvesterVideoPlugin - Closing file" );        
   986     CleanupStack::PopAndDestroy( &file );        
   963     CleanupStack::PopAndDestroy( &file );        
   987 
   964 
   988 #ifdef _DEBUG
   965 #ifdef _DEBUG
   989     dStop.UniversalTime();
   966     dStop.UniversalTime();
   990     WRITELOG1( "CHarvesterVideoPlugin::GatherDataL end %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() );
   967     WRITELOG1( "CHarvesterVideoPlugin::GatherDataL start %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() );
   991 #endif  
   968 #endif  
   992     
   969     
   993     WRITELOG( "CHarvesterVideoPlugin - Start adding data to object" );
   970     WRITELOG( "CHarvesterVideoPlugin - Start adding data to object" );
   994     }
   971     }
   995 
   972 
  1003 		TBool aIsAdd )
   980 		TBool aIsAdd )
  1004     {
   981     {
  1005     WRITELOG("CHarvesterVideoPlugin::HandleObjectPropertiesL ");
   982     WRITELOG("CHarvesterVideoPlugin::HandleObjectPropertiesL ");
  1006 
   983 
  1007     CMdEObject& mdeObject = aHD.MdeObject();
   984     CMdEObject& mdeObject = aHD.MdeObject();
  1008     
   985 
  1009     InitPropDefsL( mdeObject.Def() );
   986     if( !iPropDefs )
       
   987     	{
       
   988     	CMdEObjectDef& objectDef = mdeObject.Def();
       
   989     	iPropDefs = CHarvesterVideoPluginPropertyDefs::NewL( objectDef );
       
   990     	// Prefetch max text lengt for validity checking
       
   991     	iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
       
   992     	}
  1010 
   993 
  1011     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
   994     TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
  1012     TTime localModifiedDate = aVHD.iModified + timeOffsetSeconds;
   995     TTime localModifiedDate = aVHD.iModified + timeOffsetSeconds;
  1013 
   996 
  1014     if( !mdeObject.Placeholder() )
   997     if( !mdeObject.Placeholder() )
  1232 
  1215 
  1233 void CHarvesterVideoPlugin::GetRmTypeL( RFile64& aFile, TDes& aType )
  1216 void CHarvesterVideoPlugin::GetRmTypeL( RFile64& aFile, TDes& aType )
  1234 	{
  1217 	{
  1235 	TBool possibleVideo = EFalse;
  1218 	TBool possibleVideo = EFalse;
  1236 
  1219 
       
  1220 	CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
       
  1221 	CleanupStack::PushL( helixMetadata );
       
  1222 
  1237     TFileName tempName;
  1223     TFileName tempName;
  1238     TUint32 mediaId( 0 );
  1224     TUint32 mediaId( 0 );
  1239     TInt blackListError( KErrNone );
  1225     TInt blackListError( KErrNone );
  1240     
  1226     
  1241     blackListError = GetFileFullNameAndMediaId( aFile, tempName, mediaId );
  1227     blackListError = GetFileFullNameAndMediaId( aFile, tempName, mediaId );
  1242     if( blackListError == KErrNone )
  1228     if( blackListError == KErrNone )
  1243         {
  1229         {
  1244         blackListError = AddFileToBlackList( tempName, mediaId );
  1230         AddFileToBlackList( tempName, mediaId );
  1245         }
  1231         }
  1246 	
  1232 	
  1247     CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
       
  1248     CleanupStack::PushL( helixMetadata );
       
  1249     
       
  1250 	TRAPD( err, helixMetadata->OpenFileL( aFile ) );
  1233 	TRAPD( err, helixMetadata->OpenFileL( aFile ) );
  1251 	aFile.Close();
       
  1252 
  1234 
  1253 	if( err == KErrNone )
  1235 	if( err == KErrNone )
  1254 		{
  1236 		{
  1255 		// doesn't own pointers to MIME types
  1237 		// doesn't own pointers to MIME types
  1256 		RPointerArray<HBufC> mimes;
  1238 		RPointerArray<HBufC> mimes;
  1273 				}
  1255 				}
  1274 			}
  1256 			}
  1275 	
  1257 	
  1276 		const TInt mimeCount = mimes.Count();
  1258 		const TInt mimeCount = mimes.Count();
  1277 		
  1259 		
  1278 		// Set to Video, regardless how badly file is corrupted
  1260 		// at least one MIME type must be found
  1279 		if( mimeCount == 0 )
  1261 		if( mimeCount == 0 )
  1280 			{
  1262 			{
  1281 		    aType.Copy( KVideo );
  1263 			User::Leave( KErrNotFound );
  1282 			}
  1264 			}
  1283 	
  1265 	
  1284 		for( TInt i = 0; i < mimeCount; i++ )
  1266 		for( TInt i = 0; i < mimeCount; i++ )
  1285 			{
  1267 			{
  1286 			HBufC* mime = mimes[i];
  1268 			HBufC* mime = mimes[i];
  1329 	// Set to Video, regardless how badly file is corrupted
  1311 	// Set to Video, regardless how badly file is corrupted
  1330 	else
  1312 	else
  1331 		{
  1313 		{
  1332 		aType.Copy( KVideo );
  1314 		aType.Copy( KVideo );
  1333 		}
  1315 		}
  1334 
       
  1335 	helixMetadata->ResetL();
       
  1336     CleanupStack::PopAndDestroy( helixMetadata );
       
  1337 	
  1316 	
  1338     if( blackListError == KErrNone )
  1317     if( blackListError == KErrNone )
  1339         {
  1318         {
  1340         RemoveFileFromBlackList( tempName, mediaId );
  1319         RemoveFileFromBlackList( tempName, mediaId );
  1341         }  
  1320         }
       
  1321     
       
  1322     CleanupStack::PopAndDestroy( helixMetadata );
  1342 	}
  1323 	}
  1343 
  1324 
  1344 TInt CHarvesterVideoPlugin::AddFileToBlackList( const TFileName& aFullName, const TUint32& aMediaId )
  1325 TInt CHarvesterVideoPlugin::AddFileToBlackList( const TFileName& aFullName, const TUint32& aMediaId )
  1345     {
  1326     {
  1346     TInt blackListError( KErrNone );
  1327     TInt blackListError( KErrNone );
  1348     TTime modified ( 0 );
  1329     TTime modified ( 0 );
  1349     blackListError = iFs.Modified( aFullName, modified );
  1330     blackListError = iFs.Modified( aFullName, modified );
  1350     if( blackListError == KErrNone )
  1331     if( blackListError == KErrNone )
  1351         {
  1332         {
  1352         WRITELOG( "CHarvesterVideoPlugin::AddFileToBlackList - Adding URI to blacklist" );
  1333         WRITELOG( "CHarvesterVideoPlugin::AddFileToBlackList - Adding URI to blacklist" );
  1353         blackListError = iBlacklist->AddFile( aFullName, aMediaId, modified );
  1334         iBlacklist->AddFile( aFullName, aMediaId, modified );
  1354         }
  1335         }
  1355 
  1336 
  1356     return blackListError;
  1337     return blackListError;
  1357     }
  1338     }
  1358 
  1339 
  1446         return;
  1427         return;
  1447         }
  1428         }
  1448     return;
  1429     return;
  1449     }
  1430     }
  1450 
  1431 
  1451 void CHarvesterVideoPlugin::InitPropDefsL(CMdEObjectDef& aObjectDef)
       
  1452     {
       
  1453     if( !iPropDefs->iCreationDatePropertyDef )
       
  1454         {
       
  1455         iPropDefs->SetByObjectDefL( aObjectDef );
       
  1456         // Prefetch max text lengt for validity checking
       
  1457         iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
       
  1458         }
       
  1459     }
       
  1460 
       
  1461 // End of file
  1432 // End of file
  1462 
  1433