harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
branchRCL_3
changeset 21 85f623e1ef41
parent 20 f23c07ec56e2
child 22 29d87345eaeb
equal deleted inserted replaced
20:f23c07ec56e2 21:85f623e1ef41
   337     // and will not be processed again until the file is modified
   337     // and will not be processed again until the file is modified
   338     const TInt error = file.Open( iFs, aUri, EFileRead | EFileShareReadersOnly  );
   338     const TInt error = file.Open( iFs, aUri, EFileRead | EFileShareReadersOnly  );
   339     if ( error != KErrNone )
   339     if ( error != KErrNone )
   340         {
   340         {
   341         WRITELOG1( "CHarvesterVideoPlugin::GetObjectType - File open error: %d", error );
   341         WRITELOG1( "CHarvesterVideoPlugin::GetObjectType - File open error: %d", error );
   342         if( error == KErrInUse || KErrLocked )
   342         if( error == KErrInUse )
   343             {
   343             {
   344 #ifdef _DEBUG
   344 #ifdef _DEBUG
   345             TPtrC fileName( aUri.Mid(2) );
   345             TPtrC fileName( aUri.Mid(2) );
   346             WRITELOG1( "CHarvesterVideoPlugin :: Checking open file handles to %S", &fileName );
   346             WRITELOG1( "CHarvesterVideoPlugin :: Checking open file handles to %S", &fileName );
   347 
   347 
   625         CleanupStack::PushL( helixMetadata );
   625         CleanupStack::PushL( helixMetadata );
   626         
   626         
   627         TRAP( error, helixMetadata->OpenFileL( file ) );        
   627         TRAP( error, helixMetadata->OpenFileL( file ) );        
   628 
   628 
   629         // No need for the file handle anymore so closing it
   629         // No need for the file handle anymore so closing it
   630         WRITELOG( "CHarvesterVideoPlugin - Parsing done, file handle can be closed" );   
       
   631         file.Close();
   630         file.Close();
   632         
   631         
   633         if ( error == KErrNone )
   632         if ( error == KErrNone )
   634         	{
   633         	{
   635         	HBufC *buf = NULL;
   634         	HBufC *buf = NULL;
   980             {
   979             {
   981             WRITELOG( "CHarvesterVideoPlugin - Error closing file handle" );
   980             WRITELOG( "CHarvesterVideoPlugin - Error closing file handle" );
   982             }
   981             }
   983 #endif
   982 #endif
   984         }
   983         }
   985     WRITELOG( "CHarvesterVideoPlugin - Closing file, if still open" );        
   984     WRITELOG( "CHarvesterVideoPlugin - Closing file" );        
   986     CleanupStack::PopAndDestroy( &file );        
   985     CleanupStack::PopAndDestroy( &file );        
   987 
   986 
   988 #ifdef _DEBUG
   987 #ifdef _DEBUG
   989     dStop.UniversalTime();
   988     dStop.UniversalTime();
   990     WRITELOG1( "CHarvesterVideoPlugin::GatherDataL start %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() );
   989     WRITELOG1( "CHarvesterVideoPlugin::GatherDataL start %d us", (TInt)dStop.MicroSecondsFrom(dStart).Int64() );
  1246 	
  1245 	
  1247     CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
  1246     CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
  1248     CleanupStack::PushL( helixMetadata );
  1247     CleanupStack::PushL( helixMetadata );
  1249     
  1248     
  1250 	TRAPD( err, helixMetadata->OpenFileL( aFile ) );
  1249 	TRAPD( err, helixMetadata->OpenFileL( aFile ) );
  1251 	aFile.Close();
       
  1252 
  1250 
  1253 	if( err == KErrNone )
  1251 	if( err == KErrNone )
  1254 		{
  1252 		{
  1255 		// doesn't own pointers to MIME types
  1253 		// doesn't own pointers to MIME types
  1256 		RPointerArray<HBufC> mimes;
  1254 		RPointerArray<HBufC> mimes;
  1273 				}
  1271 				}
  1274 			}
  1272 			}
  1275 	
  1273 	
  1276 		const TInt mimeCount = mimes.Count();
  1274 		const TInt mimeCount = mimes.Count();
  1277 		
  1275 		
  1278 		// Set to Video, regardless how badly file is corrupted
  1276 		// at least one MIME type must be found
  1279 		if( mimeCount == 0 )
  1277 		if( mimeCount == 0 )
  1280 			{
  1278 			{
  1281 		    aType.Copy( KVideo );
  1279 			User::Leave( KErrNotFound );
  1282 			}
  1280 			}
  1283 	
  1281 	
  1284 		for( TInt i = 0; i < mimeCount; i++ )
  1282 		for( TInt i = 0; i < mimeCount; i++ )
  1285 			{
  1283 			{
  1286 			HBufC* mime = mimes[i];
  1284 			HBufC* mime = mimes[i];
  1336     CleanupStack::PopAndDestroy( helixMetadata );
  1334     CleanupStack::PopAndDestroy( helixMetadata );
  1337 	
  1335 	
  1338     if( blackListError == KErrNone )
  1336     if( blackListError == KErrNone )
  1339         {
  1337         {
  1340         RemoveFileFromBlackList( tempName, mediaId );
  1338         RemoveFileFromBlackList( tempName, mediaId );
  1341         }  
  1339         }
       
  1340     
  1342 	}
  1341 	}
  1343 
  1342 
  1344 TInt CHarvesterVideoPlugin::AddFileToBlackList( const TFileName& aFullName, const TUint32& aMediaId )
  1343 TInt CHarvesterVideoPlugin::AddFileToBlackList( const TFileName& aFullName, const TUint32& aMediaId )
  1345     {
  1344     {
  1346     TInt blackListError( KErrNone );
  1345     TInt blackListError( KErrNone );