harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp
branchRCL_3
changeset 15 3cebc1a84278
parent 14 646a02f170b9
child 17 50de4d668bb6
equal deleted inserted replaced
14:646a02f170b9 15:3cebc1a84278
    23 
    23 
    24 #include "mdsutils.h"
    24 #include "mdsutils.h"
    25 #include "harvestervideoplugin.h"
    25 #include "harvestervideoplugin.h"
    26 #include "harvesterlog.h"
    26 #include "harvesterlog.h"
    27 #include "harvesterblacklist.h"
    27 #include "harvesterblacklist.h"
    28 #include "harvestercommon.h"
       
    29 #include "mdeobjectwrapper.h"
    28 #include "mdeobjectwrapper.h"
    30 
    29 
    31 #include <mdenamespacedef.h>
    30 #include <mdenamespacedef.h>
    32 #include <mdeobjectdef.h>
    31 #include <mdeobjectdef.h>
    33 #include <mdepropertydef.h>
    32 #include <mdepropertydef.h>
   265             KExtensionWmv(), KMimeTypeWmv(), 
   264             KExtensionWmv(), KMimeTypeWmv(), 
   266             TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
   265             TVideoMetadataHandling( TVideoMetadataHandling::EHexilMetadataHandling, KVideo(),
   267                     KMimeTypeWmv(), KMimeTypeWmv() ) ), 
   266                     KMimeTypeWmv(), KMimeTypeWmv() ) ), 
   268             cmp ) );
   267             cmp ) );
   269     
   268     
   270     SetPriority( KHarvesterPriorityHarvestingPlugin + 1 );
       
   271     }
   269     }
   272 
   270 
   273 
   271 
   274 // ---------------------------------------------------------------------------
   272 // ---------------------------------------------------------------------------
   275 // GetObjectType
   273 // GetObjectType
   304     if ( error != KErrNone )
   302     if ( error != KErrNone )
   305         {
   303         {
   306         WRITELOG1( "CHarvesterVideoPlugin::GetObjectType - File open error: %d", error );
   304         WRITELOG1( "CHarvesterVideoPlugin::GetObjectType - File open error: %d", error );
   307         if( error == KErrInUse )
   305         if( error == KErrInUse )
   308             {
   306             {
       
   307 #ifdef _DEBUG
       
   308             TPtrC fileName( aUri.Mid(2) );
       
   309             WRITELOG1( "CHarvesterVideoPlugin :: Checking open file handles to %S", &fileName );
       
   310 
       
   311             CFileList* fileList = 0;
       
   312             TOpenFileScan fileScan( iFs );
       
   313 
       
   314             TRAP_IGNORE( fileScan.NextL( fileList ) );   
       
   315   
       
   316             while ( fileList )   
       
   317                 {
       
   318                 const TInt count( fileList->Count() ); 
       
   319                 for (TInt i = 0; i < count; i++ )   
       
   320                     {   
       
   321                     if ( (*fileList)[i].iName == aUri.Mid(2) )
       
   322                         {
       
   323                         TFullName processName;
       
   324                         TFindThread find(_L("*"));
       
   325                         while( find.Next( processName ) == KErrNone )
       
   326                             {
       
   327                             RThread thread;
       
   328                             TInt err = thread.Open( processName );
       
   329      
       
   330                             if ( err == KErrNone )
       
   331                                 {
       
   332                                 if ( thread.Id().Id() ==  fileScan.ThreadId() )
       
   333                                     {
       
   334                                     processName = thread.Name();
       
   335                                     thread.Close();
       
   336                                     WRITELOG1( "CHarvesterVideoPlugin:: %S has a file handle open", &processName );
       
   337                                     break;
       
   338                                     }
       
   339                                 thread.Close();
       
   340                                 }
       
   341                             }
       
   342                         }
       
   343                     }
       
   344                 fileList = NULL;
       
   345                 TRAP_IGNORE( fileScan.NextL( fileList ) );   
       
   346                 } 
       
   347 #endif
   309             aObjectType.Copy( KInUse() );
   348             aObjectType.Copy( KInUse() );
   310             }
   349             }
   311         return;
   350         return;
   312         }
   351         }
   313 
   352 
   399     CleanupClosePushL( file );
   438     CleanupClosePushL( file );
   400     if ( error == KErrInUse ||
   439     if ( error == KErrInUse ||
   401          error == KErrLocked )
   440          error == KErrLocked )
   402         {
   441         {
   403         WRITELOG( "CHarvesterVideoPlugin - File is open!" );
   442         WRITELOG( "CHarvesterVideoPlugin - File is open!" );
       
   443 #ifdef _DEBUG
       
   444             TPtrC fileName( uri.Mid(2) );
       
   445             WRITELOG1( "CHarvesterVideoPlugin :: Checking open file handles to %S", &fileName );
       
   446 
       
   447             CFileList* fileList = 0;
       
   448             TOpenFileScan fileScan( iFs );
       
   449 
       
   450             fileScan.NextL( fileList );   
       
   451   
       
   452             while ( fileList )   
       
   453                 {
       
   454                 const TInt count( fileList->Count() ); 
       
   455                 for (TInt i = 0; i < count; i++ )   
       
   456                     {   
       
   457                     if ( (*fileList)[i].iName == uri.Mid(2) )
       
   458                         {
       
   459                         TFullName processName;
       
   460                         TFindThread find(_L("*"));
       
   461                         while( find.Next( processName ) == KErrNone )
       
   462                             {
       
   463                             RThread thread;
       
   464                             TInt err = thread.Open( processName );
       
   465      
       
   466                             if ( err == KErrNone )
       
   467                                 {
       
   468                                 if ( thread.Id().Id() ==  fileScan.ThreadId() )
       
   469                                     {
       
   470                                     processName = thread.Name();
       
   471                                     thread.Close();
       
   472                                     WRITELOG1( "CHarvesterVideoPlugin:: %S has a file handle open", &processName );
       
   473                                     break;
       
   474                                     }
       
   475                                 thread.Close();
       
   476                                 }
       
   477                             }
       
   478                         }
       
   479                     }
       
   480                 fileScan.NextL( fileList );   
       
   481                 } 
       
   482 #endif
   404         CleanupStack::PopAndDestroy( &file );
   483         CleanupStack::PopAndDestroy( &file );
   405         User::Leave( KErrInUse );
   484         User::Leave( KErrInUse );
   406         }
   485         }
   407     else if( error == KErrNotFound ||
   486     else if( error == KErrNotFound ||
   408                 error == KErrPathNotFound ||
   487                 error == KErrPathNotFound ||
   418     
   497     
   419     if( dataExtracted )
   498     if( dataExtracted )
   420         {
   499         {
   421         CMdEProperty* prop = NULL;
   500         CMdEProperty* prop = NULL;
   422         CMdEObjectDef& objectDef = aMetadataObject.Def();
   501         CMdEObjectDef& objectDef = aMetadataObject.Def();
   423         CMdEPropertyDef& sizeDef = objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
       
   424         aMetadataObject.Property( sizeDef, prop );
       
   425         if( prop )
       
   426             {
       
   427             aVHD.iFileSize  = prop->Uint32ValueL();
       
   428             }
       
   429         else
       
   430             {
       
   431             dataExtracted = EFalse;
       
   432             }
       
   433         CMdEPropertyDef& modifiedDef = objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
   502         CMdEPropertyDef& modifiedDef = objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
   434         aMetadataObject.Property( modifiedDef, prop );
   503         aMetadataObject.Property( modifiedDef, prop );
   435         if( prop )
   504         if( prop )
   436             {
   505             {
   437             aVHD.iModified  = prop->TimeValueL();
   506             aVHD.iModified  = prop->TimeValueL();
   454             User::Leave( errorcode );
   523             User::Leave( errorcode );
   455             }
   524             }
   456         
   525         
   457         aVHD.iModified = entry.iModified;
   526         aVHD.iModified = entry.iModified;
   458         aVHD.iFileSize = (TUint)entry.iSize;
   527         aVHD.iFileSize = (TUint)entry.iSize;
   459         }
   528         
   460     
   529         WRITELOG1( "CHarvesterVideoPlugin - File size: %d", aVHD.iFileSize );
   461     WRITELOG1( "CHarvesterVideoPlugin - File size: %d", aVHD.iFileSize );
   530         }
   462 
   531 
   463     // now the minimum information has been harvested
   532     // now the minimum information has been harvested
   464     // from now on the harvested data should always be stored
   533     // from now on the harvested data should always be stored
   465 
   534 
   466     const THarvestingHandling* mapping = FindHandler( uri );
   535     const THarvestingHandling* mapping = FindHandler( uri );