mmappcomponents/harvester/metadataextractor/src/mpxmetadataextractor.cpp
changeset 54 fa0adf088850
parent 48 b7b49303d0c0
child 58 c76ea6caa649
equal deleted inserted replaced
50:762d760dcfdf 54:fa0adf088850
    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.5.3.6 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: da1mmcf#38.1.4.2.6.1.5.3.8 % << 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>
   249     aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtFileName,
   249     aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtFileName,
   250                               KNullDesC );
   250                               KNullDesC );
   251     // URL
   251     // URL
   252     aMediaProp.SetTextValueL( KMPXMediaMusicURL,
   252     aMediaProp.SetTextValueL( KMPXMediaMusicURL,
   253                               KNullDesC );
   253                               KNullDesC );
       
   254     // AlbumArtist
       
   255     aMediaProp.SetTextValueL( KMPXMediaMusicAlbumArtist,
       
   256                               KNullDesC );
       
   257     
   254     }
   258     }
   255 
   259 
   256 // ---------------------------------------------------------------------------
   260 // ---------------------------------------------------------------------------
   257 // Sets media object attributes from metadata utilities
   261 // Sets media object attributes from metadata utilities
   258 // ---------------------------------------------------------------------------
   262 // ---------------------------------------------------------------------------
   468 
   472 
   469                     iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate,
   473                     iMedia->SetTObjectValueL<TUint>( KMPXMediaAudioBitrate,
   470                                                      bitRate );
   474                                                      bitRate );
   471 
   475 
   472                     MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", bitRate);
   476                     MPX_DEBUG2("CMPXMetadataExtractor::SetMediaPropertiesL- duration = %i", bitRate);
       
   477                     }
       
   478                 break;
       
   479                 }
       
   480             case EMetaDataAlbumArtist:
       
   481                 {
       
   482                 TPtr valptr = value->Des();
       
   483                 valptr.Trim();
       
   484                 TInt vallen = value->Length();
       
   485                 if (vallen>0)
       
   486                     {
       
   487                     FindAndReplaceForbiddenChars(valptr, vallen);
       
   488                     iMedia->SetTextValueL(KMPXMediaMusicAlbumArtist, *value);
   473                     }
   489                     }
   474                 break;
   490                 break;
   475                 }
   491                 }
   476             case EMetaDataOriginalArtist:  // fall through
   492             case EMetaDataOriginalArtist:  // fall through
   477             case EMetaDataVendor:          // fall through
   493             case EMetaDataVendor:          // fall through
   921         }
   937         }
   922     else // other case use apparc to fetch and set mimetype
   938     else // other case use apparc to fetch and set mimetype
   923         {
   939         {
   924         TDataType dataType;
   940         TDataType dataType;
   925         TUid dummyUid(KNullUid);
   941         TUid dummyUid(KNullUid);
   926         iAppArc.AppForDocument(iFileName, dummyUid, dataType);
   942         // File handle based mime type recogniton required , because AppArc does 
       
   943         // not have All Files capa required for files in private folders 
       
   944         TDataRecognitionResult result;
       
   945         RFs fs;
       
   946 		RFile rFile;
       
   947         User::LeaveIfError(fs.Connect());
       
   948 		CleanupClosePushL(fs);
       
   949         User::LeaveIfError(fs.ShareProtected());
       
   950         User::LeaveIfError(rFile.Open(fs, iFileName, EFileShareReadersOrWriters));
       
   951 		CleanupClosePushL(rFile);
       
   952         User::LeaveIfError(iAppArc.RecognizeData(rFile, result)); 
       
   953         CleanupStack::PopAndDestroy(&rFile);
       
   954         CleanupStack::PopAndDestroy(&fs);
       
   955         dataType = result.iDataType;
   927         iMedia->SetTextValueL( KMPXMediaGeneralMimeType,dataType.Des() );
   956         iMedia->SetTextValueL( KMPXMediaGeneralMimeType,dataType.Des() );
   928         }
   957         }
   929 
   958 
   930     // Initially set default tags.
   959     // Initially set default tags.
   931     SetDefaultL( *iMedia );
   960     SetDefaultL( *iMedia );