mmappcomponents/harvester/metadataextractor/src/mpxmetadataextractor.cpp
branchRCL_3
changeset 30 6f9f6e99a23e
parent 28 f56ec6ce2732
child 42 4aca42fa4eb1
equal deleted inserted replaced
28:f56ec6ce2732 30:6f9f6e99a23e
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Extracts metadata from a file
    14 * Description:  Extracts metadata from a file
    15 *  Version     : %version: da1mmcf#38.1.4.2.6.1.12 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: da1mmcf#38.1.4.2.6.1.13 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 #include <e32base.h>
    19 #include <e32base.h>
    20 #include <badesca.h>
    20 #include <badesca.h>
   145     delete iMetadataUtility;
   145     delete iMetadataUtility;
   146     delete iFileInfoUtil;
   146     delete iFileInfoUtil;
   147     delete iDrmMediaUtility;
   147     delete iDrmMediaUtility;
   148     delete iTaskTimer;
   148     delete iTaskTimer;
   149     iFile.Close();
   149     iFile.Close();
       
   150     if ( iMedia != NULL )
       
   151         {
       
   152         delete iMedia;
       
   153         }
   150 #ifdef RD_MPX_TNM_INTEGRATION
   154 #ifdef RD_MPX_TNM_INTEGRATION
   151     delete iTNManager;
   155     delete iTNManager;
   152     if (iTNSyncWait && iTNSyncWait->IsStarted() )
   156     if (iTNSyncWait && iTNSyncWait->IsStarted() )
   153         {
   157         {
   154         iTNSyncWait->AsyncStop();
   158         iTNSyncWait->AsyncStop();
   210         
   214         
   211         iArrayTasks.Remove( 0 );
   215         iArrayTasks.Remove( 0 );
   212         }
   216         }
   213     
   217     
   214     aNewProperty = iMedia;
   218     aNewProperty = iMedia;
       
   219     iMedia = NULL;  // ownership transferred.
   215     CleanUp();
   220     CleanUp();
   216     }
   221     }
   217 
   222 
   218 // ---------------------------------------------------------------------------
   223 // ---------------------------------------------------------------------------
   219 // Sets all of the default media properties
   224 // Sets all of the default media properties
   809 // Create media and set default data and mimetype.
   814 // Create media and set default data and mimetype.
   810 // ----------------------------------------------------------------------------
   815 // ----------------------------------------------------------------------------
   811 void CMPXMetadataExtractor::DoCreateMediaL()
   816 void CMPXMetadataExtractor::DoCreateMediaL()
   812     {
   817     {
   813     MPX_FUNC("CMPXMetadataExtractor::DoCreateMediaL()");
   818     MPX_FUNC("CMPXMetadataExtractor::DoCreateMediaL()");
       
   819     MPX_ASSERT( iMedia == NULL );
   814     RArray<TInt> contentIDs;
   820     RArray<TInt> contentIDs;
       
   821     CleanupClosePushL( contentIDs );
   815     contentIDs.AppendL( KMPXMediaIdGeneral );
   822     contentIDs.AppendL( KMPXMediaIdGeneral );
   816     contentIDs.AppendL( KMPXMediaIdAudio );
   823     contentIDs.AppendL( KMPXMediaIdAudio );
   817     contentIDs.AppendL( KMPXMediaIdMusic );
   824     contentIDs.AppendL( KMPXMediaIdMusic );
   818     contentIDs.AppendL( KMPXMediaIdDrm );
   825     contentIDs.AppendL( KMPXMediaIdDrm );
   819     contentIDs.AppendL( KMPXMediaIdMTP );
   826     contentIDs.AppendL( KMPXMediaIdMTP );
   820     iMedia = CMPXMedia::NewL( contentIDs.Array() );
   827     iMedia = CMPXMedia::NewL( contentIDs.Array() );
   821     contentIDs.Close();
   828     CleanupStack::PopAndDestroy( &contentIDs );
   822 
   829 
   823     // CMPXMedia default types
   830     // CMPXMedia default types
   824     iMedia->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType,
   831     iMedia->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType,
   825                                               EMPXItem );
   832                                               EMPXItem );
   826     iMedia->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory,
   833     iMedia->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory,
  1012 // ----------------------------------------------------------------------------
  1019 // ----------------------------------------------------------------------------
  1013 void CMPXMetadataExtractor::HandleTaskTimerExpired()
  1020 void CMPXMetadataExtractor::HandleTaskTimerExpired()
  1014     {
  1021     {
  1015     MPX_FUNC("CMPXMetadataExtractor::HandleTaskTimerExpired()");
  1022     MPX_FUNC("CMPXMetadataExtractor::HandleTaskTimerExpired()");
  1016     
  1023     
  1017     iTaskTimer->Cancel();
  1024     if ( iTaskTimer && iTaskTimer->IsActive() )
       
  1025         {
       
  1026         iTaskTimer->Cancel();
       
  1027         }
  1018     // execute task at index 0
  1028     // execute task at index 0
  1019     MPX_TRAPD( error, ExecuteTaskL() );
  1029     MPX_TRAPD( error, ExecuteTaskL() );
  1020     if ( error || iCancelled )
  1030     if ( error || iCancelled )
  1021         {
  1031         {
  1022         // cleanup
  1032         // cleanup
  1044         {
  1054         {
  1045         // done
  1055         // done
  1046         if ( iObs && !iCancelled )
  1056         if ( iObs && !iCancelled )
  1047             {
  1057             {
  1048             iObs->HandleCreateMediaComplete( iMedia, error );
  1058             iObs->HandleCreateMediaComplete( iMedia, error );
       
  1059             iMedia = NULL;  // ownership transferred.
  1049             }
  1060             }
  1050         
  1061         
  1051         CleanUp();
  1062         CleanUp();
  1052         }
  1063         }
  1053     }
  1064     }