mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp
branchRCL_3
changeset 9 bee149131e4b
parent 0 a2952bb97e68
child 14 05b0d2323768
equal deleted inserted replaced
4:d45095c2f4f3 9:bee149131e4b
    34 #include <hxmetadatautil.h>
    34 #include <hxmetadatautil.h>
    35 #endif
    35 #endif
    36 
    36 
    37 #include "mmmtpdputility.h"
    37 #include "mmmtpdputility.h"
    38 #include "mmmtpdpfiledefs.h"
    38 #include "mmmtpdpfiledefs.h"
       
    39 #include "tobjectdescription.h"
    39 #include "mmmtpdplogger.h"
    40 #include "mmmtpdplogger.h"
    40 
    41 
    41 using namespace ContentAccess;
    42 using namespace ContentAccess;
    42 
    43 
    43 // local to this file, non standard mimetype used for ASF parsing with helix
    44 // local to this file, non standard mimetype used for ASF parsing with helix
    66 
    67 
    67 #ifdef __WINDOWS_MEDIA
    68 #ifdef __WINDOWS_MEDIA
    68     if ( file.Ext().CompareF( KTxtExtensionWMA ) == 0 )
    69     if ( file.Ext().CompareF( KTxtExtensionWMA ) == 0 )
    69             return EMTPFormatCodeWMA;
    70             return EMTPFormatCodeWMA;
    70 #endif // __WINDOWS_MEDIA
    71 #endif // __WINDOWS_MEDIA
    71     
    72 
    72     if ( ( file.Ext().CompareF( KTxtExtensionMP4 ) == 0 ) || ( file.Ext().CompareF( KTxtExtensionM4A ) == 0 ) )
    73     if ( ( file.Ext().CompareF( KTxtExtensionMP4 ) == 0 )
       
    74         || ( file.Ext().CompareF( KTxtExtensionM4A ) == 0 ) )
    73         return EMTPFormatCodeMP4Container;
    75         return EMTPFormatCodeMP4Container;
    74 
    76 
    75     if ( ( file.Ext().CompareF( KTxtExtension3GP ) == 0 ) || ( file.Ext().CompareF( KTxtExtensionO4A ) == 0 ) || ( file.Ext().CompareF( KTxtExtensionO4V ) == 0 ) )
    77     if ( ( file.Ext().CompareF( KTxtExtension3GP ) == 0 )
       
    78         || ( file.Ext().CompareF( KTxtExtensionO4A ) == 0 )
       
    79         || ( file.Ext().CompareF( KTxtExtensionO4V ) == 0 ) )
    76         return EMTPFormatCode3GPContainer;
    80         return EMTPFormatCode3GPContainer;
    77 
    81 
    78     if ( file.Ext().CompareF( KTxtExtensionAAC ) == 0 )
    82     if ( file.Ext().CompareF( KTxtExtensionAAC ) == 0 )
    79         return EMTPFormatCodeAAC;
    83         return EMTPFormatCodeAAC;
    80     
    84 
    81     if ( file.Ext().CompareF( KTxtExtensionWAV ) == 0 )
    85     if ( file.Ext().CompareF( KTxtExtensionWAV ) == 0 )
    82         return EMTPFormatCodeWAV;
    86         return EMTPFormatCodeWAV;
    83     
    87 
    84 #ifdef __WINDOWS_MEDIA
    88 #ifdef __WINDOWS_MEDIA
    85     if ( file.Ext().CompareF( KTxtExtensionWMV ) == 0 )
    89     if ( file.Ext().CompareF( KTxtExtensionWMV ) == 0 )
    86         return EMTPFormatCodeWMV;
    90         return EMTPFormatCodeWMV;
    87     
    91 
    88     if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 )
    92     if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 )
    89         return EMTPFormatCodeASF;
    93         return EMTPFormatCodeASF;
    90 
    94 
    91 #endif // __WINDOWS_MEDIA
    95 #endif // __WINDOWS_MEDIA
    92 
    96 
   142 
   146 
   143     return EFalse;
   147     return EFalse;
   144     }
   148     }
   145 
   149 
   146 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
       
   151 // MmMtpDpUtility::HasReference
       
   152 // Utility function to decide if there is any reference
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 TBool MmMtpDpUtility::HasReference( TUint16 aObjFormatCode )
       
   156     {
       
   157     if ( aObjFormatCode == EMTPFormatCodeAbstractAudioAlbum
       
   158         || aObjFormatCode == EMTPFormatCodeAbstractAudioVideoPlaylist
       
   159         || aObjFormatCode == EMTPFormatCodeM3UPlaylist )
       
   160         return ETrue;
       
   161     else
       
   162         return EFalse;
       
   163     }
       
   164 
       
   165 // -----------------------------------------------------------------------------
   147 // MmMtpDpUtility::IsVideoL (Slow Version)
   166 // MmMtpDpUtility::IsVideoL (Slow Version)
   148 // Utility function to determine whether a format is Video or not
   167 // Utility function to determine whether a format is Video or not
   149 // -----------------------------------------------------------------------------
   168 // -----------------------------------------------------------------------------
   150 //
   169 //
   151 EXPORT_C TBool MmMtpDpUtility::IsVideoL( const TDesC& aFullFileName )
   170 EXPORT_C TBool MmMtpDpUtility::IsVideoL( const TDesC& aFullFileName )
   168         {
   187         {
   169         return ETrue;
   188         return ETrue;
   170         }
   189         }
   171     else if ( ext.CompareF( KTxtExtensionMP4 ) == 0
   190     else if ( ext.CompareF( KTxtExtensionMP4 ) == 0
   172         || ext.CompareF( KTxtExtension3GP ) == 0
   191         || ext.CompareF( KTxtExtension3GP ) == 0
   173         || ext.CompareF( KTxtExtensionODF ) == 0 
   192         || ext.CompareF( KTxtExtensionODF ) == 0
   174         || ext.CompareF( KTxtExtensionASF ) == 0 )
   193         || ext.CompareF( KTxtExtensionASF ) == 0 )
   175             {
   194         {
   176             HBufC8* mimetype = ContainerMimeType( aFullFileName );
   195         HBufC8* mimetype = ContainerMimeType( aFullFileName );
   177             User::LeaveIfNull( mimetype );
   196         User::LeaveIfNull( mimetype );
   178 
   197 
   179             CleanupStack::PushL( mimetype ); // + mimetype
   198         CleanupStack::PushL( mimetype ); // + mimetype
   180 
   199 
   181             TMmMtpSubFormatCode subFormatCode;
   200         TMmMtpSubFormatCode subFormatCode;
   182 
   201 
   183             User::LeaveIfError( SubFormatCodeFromMime( *mimetype, subFormatCode ) );
   202         User::LeaveIfError( SubFormatCodeFromMime( *mimetype, subFormatCode ) );
   184             CleanupStack::PopAndDestroy( mimetype ); // - mimetype
   203         CleanupStack::PopAndDestroy( mimetype ); // - mimetype
   185 
   204 
   186             if ( subFormatCode == EMTPSubFormatCodeVideo )
   205         if ( subFormatCode == EMTPSubFormatCodeVideo )
   187                 {
   206             {
   188                 return ETrue;
   207             return ETrue;
   189                 }
   208             }
   190             else
   209         else
   191                 {
   210             {
   192                 return EFalse;
   211             return EFalse;
   193                 }
   212             }
   194             }
   213         }
   195     else if ( ext.CompareF( KTxtExtensionO4V ) == 0 )
   214     else if ( ext.CompareF( KTxtExtensionO4V ) == 0 )
   196         return ETrue;
   215         return ETrue;
   197 
   216 
   198     // other format, as audio
   217     // other format, as audio
   199     return EFalse;
   218     return EFalse;
   202 // -----------------------------------------------------------------------------
   221 // -----------------------------------------------------------------------------
   203 // MmMtpDpUtility::IsVideoL (Fast Version)
   222 // MmMtpDpUtility::IsVideoL (Fast Version)
   204 // Utility function to determine whether a format is Video or not
   223 // Utility function to determine whether a format is Video or not
   205 // -----------------------------------------------------------------------------
   224 // -----------------------------------------------------------------------------
   206 //
   225 //
   207 TBool MmMtpDpUtility::IsVideoL( const TDesC& aFullFileName, 
   226 TBool MmMtpDpUtility::IsVideoL( const TDesC& aFullFileName,
   208     const MMTPDataProviderFramework& aFramework )
   227     const MMTPDataProviderFramework& aFramework )
   209     {
   228     {
   210     PRINT1( _L( "MM MTP => MmMtpDpUtility::IsVideoL (Fast Version) aFullFileName = %S" ), &aFullFileName );
   229     PRINT1( _L( "MM MTP => MmMtpDpUtility::IsVideoL (Fast Version) aFullFileName = %S" ), &aFullFileName );
   211     
   230 
   212     CMTPObjectMetaData* info = CMTPObjectMetaData::NewLC(); // + info
   231     CMTPObjectMetaData* info = CMTPObjectMetaData::NewLC(); // + info
   213     aFramework.ObjectMgr().ObjectL( aFullFileName, *info );
   232     aFramework.ObjectMgr().ObjectL( aFullFileName, *info );
   214 
   233 
   215     TUint formatCode = info->Uint( CMTPObjectMetaData::EFormatCode );
   234     TUint formatCode = info->Uint( CMTPObjectMetaData::EFormatCode );
   216     TUint subFormatCode = info->Uint( CMTPObjectMetaData::EFormatSubCode );
   235     TUint subFormatCode = info->Uint( CMTPObjectMetaData::EFormatSubCode );
   217 
   236 
   218     CleanupStack::PopAndDestroy( info ); // - info
   237     CleanupStack::PopAndDestroy( info ); // - info
   219     
   238 
   220     if ( formatCode == EMTPFormatCodeWMV )
   239     return MmMtpDpUtility::IsVideoL( formatCode, subFormatCode );
       
   240     }
       
   241 
       
   242 // -----------------------------------------------------------------------------
       
   243 // MmMtpDpUtility::IsVideoL (Fast Version)
       
   244 // Utility function to determine whether a format is Video or not
       
   245 // -----------------------------------------------------------------------------
       
   246 //
       
   247 TBool MmMtpDpUtility::IsVideoL( TUint aFormatCode, TUint aSubFormatCode )
       
   248     {
       
   249     if ( aFormatCode == KMTPFormatsAll )
       
   250         User::Leave( KErrArgument );
       
   251 
       
   252     if ( aFormatCode == EMTPFormatCodeWMV )
   221         {
   253         {
   222         return ETrue;
   254         return ETrue;
   223         }
   255         }
   224     else if ( ( formatCode == EMTPFormatCodeMP4Container )
   256     else if ( ( aFormatCode == EMTPFormatCodeMP4Container )
   225         || ( formatCode == EMTPFormatCode3GPContainer )
   257         || ( aFormatCode == EMTPFormatCode3GPContainer )
   226         || ( formatCode == EMTPFormatCodeASF ) )
   258         || ( aFormatCode == EMTPFormatCodeASF ) )
   227         {
   259         {
   228         if ( subFormatCode == EMTPSubFormatCodeAudio )
   260         if ( aSubFormatCode == EMTPSubFormatCodeAudio )
   229             {
   261             {
   230             return EFalse;
   262             return EFalse;
   231             }
   263             }
   232         else if ( subFormatCode == EMTPSubFormatCodeVideo )
   264         else if ( aSubFormatCode == EMTPSubFormatCodeVideo )
   233             {
   265             {
   234             return ETrue;
   266             return ETrue;
   235             }
   267             }
   236         }
   268         }
   237 
   269 
   267 TUint64 MmMtpDpUtility::GetObjectSizeL( RFs& aFs, const TDesC& aFileName )
   299 TUint64 MmMtpDpUtility::GetObjectSizeL( RFs& aFs, const TDesC& aFileName )
   268     {
   300     {
   269     TEntry fileInfo;
   301     TEntry fileInfo;
   270     // Shouldn't leave
   302     // Shouldn't leave
   271     User::LeaveIfError( aFs.Entry( aFileName, fileInfo ) );
   303     User::LeaveIfError( aFs.Entry( aFileName, fileInfo ) );
   272     return fileInfo.iSize;
   304     return fileInfo.FileSize();
   273     }
   305     }
   274 
   306 
   275 // -----------------------------------------------------------------------------
   307 // -----------------------------------------------------------------------------
   276 // MmMtpDpUtility::GetDateModifiedL
   308 // MmMtpDpUtility::GetDateModifiedL
   277 // Get the file date modified.
   309 // Get the file date modified.
   304     if ( fileInfo.IsReadOnly() )
   336     if ( fileInfo.IsReadOnly() )
   305         {
   337         {
   306         protectionStatus = EMTPProtectionReadOnly;
   338         protectionStatus = EMTPProtectionReadOnly;
   307         }
   339         }
   308 
   340 
       
   341     PRINT2( _L( "MM MTP <> MmMtpDpUtility::GetProtectionStatusL aFullFileName = %S, protectionStatus = 0x%x" ),
       
   342         &aFullFileName,
       
   343         protectionStatus );
       
   344 
   309     return protectionStatus;
   345     return protectionStatus;
   310     }
   346     }
   311 
   347 
   312 // -----------------------------------------------------------------------------
   348 // -----------------------------------------------------------------------------
   313 // MmMtpDpUtility::CheckPropType
   349 // MmMtpDpUtility::CheckPropType
   314 // Check if property type match datatype.
   350 // Check if property type match datatype.
   315 // -----------------------------------------------------------------------------
   351 // -----------------------------------------------------------------------------
   316 //
   352 //
   317 TMTPResponseCode MmMtpDpUtility::CheckPropType(TUint16 aPropertyCode, TUint16 aDataType)
   353 TMTPResponseCode MmMtpDpUtility::CheckPropType(TUint16 aPropertyCode, TUint16 aDataType)
   318     {
   354     {
   319     PRINT2( _L( "MM MTP => MmMtpDpUtility::CheckPropCode aPropertyCode = 0x%x, aDataType = 0x%x" ), 
   355     PRINT2( _L( "MM MTP => MmMtpDpUtility::CheckPropCode aPropertyCode = 0x%x, aDataType = 0x%x" ),
   320         aPropertyCode, 
   356         aPropertyCode,
   321         aDataType );
   357         aDataType );
   322 
   358 
   323     TMTPResponseCode responseCode = EMTPRespCodeOK;
   359     TMTPResponseCode responseCode = EMTPRespCodeOK;
   324     switch ( aPropertyCode )
   360     switch ( aPropertyCode )
   325         {
   361         {
   331         case EMTPObjectPropCodeParentObject:
   367         case EMTPObjectPropCodeParentObject:
   332         case EMTPObjectPropCodePersistentUniqueObjectIdentifier:
   368         case EMTPObjectPropCodePersistentUniqueObjectIdentifier:
   333         case EMTPObjectPropCodeDateCreated:
   369         case EMTPObjectPropCodeDateCreated:
   334         case EMTPObjectPropCodeDateModified:
   370         case EMTPObjectPropCodeDateModified:
   335         case EMTPObjectPropCodeDateAdded:
   371         case EMTPObjectPropCodeDateAdded:
   336         case EMTPObjectPropCodeNonConsumable:
       
   337         case EMTPObjectPropCodeVideoBitRate:
   372         case EMTPObjectPropCodeVideoBitRate:
   338             {
   373             {
   339             responseCode = EMTPRespCodeAccessDenied;
   374             responseCode = EMTPRespCodeAccessDenied;
   340             }
   375             }
   341             break;
   376             break;
   397                 responseCode = EMTPRespCodeInvalidObjectPropFormat;
   432                 responseCode = EMTPRespCodeInvalidObjectPropFormat;
   398                 }
   433                 }
   399             }
   434             }
   400             break;
   435             break;
   401 
   436 
       
   437         // Uint8 properties
       
   438         case EMTPObjectPropCodeNonConsumable:
       
   439         case EMTPExtObjectPropCodeOmaDrmStatus: // 0xDB01
       
   440             {
       
   441             if ( aDataType != EMTPTypeUINT8 )
       
   442                 {
       
   443                 responseCode = EMTPRespCodeInvalidObjectPropFormat;
       
   444                 }
       
   445             }
       
   446             break;
       
   447 
   402         default:
   448         default:
   403             {
   449             {
   404             responseCode = EMTPRespCodeInvalidObjectPropCode;
   450             responseCode = EMTPRespCodeInvalidObjectPropCode;
   405             }
   451             }
   406             break;
   452             break;
   407         }
   453         }
   408     PRINT1( _L( "MM MTP <= MmMtpDpUtility::CheckPropCode responseCode = 0x%x" ), 
   454     PRINT1( _L( "MM MTP <= MmMtpDpUtility::CheckPropCode responseCode = 0x%x" ),
   409         responseCode );
   455         responseCode );
   410     return responseCode;
   456     return responseCode;
   411     }
   457     }
   412 
   458 
   413 // -----------------------------------------------------------------------------
   459 // -----------------------------------------------------------------------------
   433         aNewName.Insert( 0, ptr );
   479         aNewName.Insert( 0, ptr );
   434         }
   480         }
   435 
   481 
   436     return aFs.Rename( aFullFileName, aNewName );
   482     return aFs.Rename( aFullFileName, aNewName );
   437     }
   483     }
   438     
   484 
   439 // -----------------------------------------------------------------------------
   485 // -----------------------------------------------------------------------------
   440 // MetadataAccessWrapper::ContainerMimeType
   486 // MetadataAccessWrapper::ContainerMimeType
   441 // Get mime type from file
   487 // Get mime type from file
   442 // -----------------------------------------------------------------------------
   488 // -----------------------------------------------------------------------------
   443 //
   489 //
   482         {
   528         {
   483         TRAP( err, mimebuf = AsfMimeTypeL( aFullPath ) );
   529         TRAP( err, mimebuf = AsfMimeTypeL( aFullPath ) );
   484         PRINT1( _L("MM MTP <> MmMtpDpUtility::ContainerMimeType, AsfMimeTypeL err = %d"), err );
   530         PRINT1( _L("MM MTP <> MmMtpDpUtility::ContainerMimeType, AsfMimeTypeL err = %d"), err );
   485         }
   531         }
   486 #endif
   532 #endif
   487     
   533 
   488     PRINT( _L( "MM MTP <= MmMtpDpUtility::ContainerMimeType" ) );
   534     PRINT( _L( "MM MTP <= MmMtpDpUtility::ContainerMimeType" ) );
   489     return mimebuf;
   535     return mimebuf;
   490     }
   536     }
   491 
   537 
   492 // -----------------------------------------------------------------------------
   538 // -----------------------------------------------------------------------------
   497 HBufC8* MmMtpDpUtility::Mp4MimeTypeL( const TDesC& aFullPath )
   543 HBufC8* MmMtpDpUtility::Mp4MimeTypeL( const TDesC& aFullPath )
   498     {
   544     {
   499     PRINT( _L( "MM MTP => MmMtpDpUtility::Mp4MimeTypeL" ) );
   545     PRINT( _L( "MM MTP => MmMtpDpUtility::Mp4MimeTypeL" ) );
   500     HBufC8* mimebuf = NULL;
   546     HBufC8* mimebuf = NULL;
   501     TParsePtrC file( aFullPath );
   547     TParsePtrC file( aFullPath );
   502     
   548 
   503     if ( file.Ext().CompareF( KTxtExtensionMP4 ) == 0
   549     if ( file.Ext().CompareF( KTxtExtensionMP4 ) == 0
   504         || file.Ext().CompareF( KTxtExtension3GP ) == 0 )
   550         || file.Ext().CompareF( KTxtExtension3GP ) == 0 )
   505         {
   551         {
   506         // get mime from file
   552         // get mime from file
   507         MP4Handle mp4Handle = NULL;
   553         MP4Handle mp4Handle = NULL;
   571         }
   617         }
   572     else
   618     else
   573         {
   619         {
   574         User::Leave( KErrNotSupported );
   620         User::Leave( KErrNotSupported );
   575         }
   621         }
   576     
   622 
   577     if ( mimebuf == NULL )
   623     if ( mimebuf == NULL )
   578         {
   624         {
   579         User::Leave( KErrNotFound );
   625         User::Leave( KErrNotFound );
   580         }
   626         }
   581     PRINT( _L( "MM MTP <= MmMtpDpUtility::Mp4MimeTypeL" ) );
   627     PRINT( _L( "MM MTP <= MmMtpDpUtility::Mp4MimeTypeL" ) );
   589 //
   635 //
   590 HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath )
   636 HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath )
   591     {
   637     {
   592     PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) );
   638     PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) );
   593     HBufC8* mimebuf = NULL;
   639     HBufC8* mimebuf = NULL;
   594     
   640 
   595     TParsePtrC file( aFullPath );
   641     TParsePtrC file( aFullPath );
   596         
   642 
   597     if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 )
   643     if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 )
   598         {    
   644         {
   599         CContent* content = CContent::NewL( aFullPath );
   645         CContent* content = CContent::NewL( aFullPath );
   600         CleanupStack::PushL( content ); // + content
   646         CleanupStack::PushL( content ); // + content
   601         
   647 
   602         HBufC* buffer = HBufC::NewL( KMimeTypeMaxLength );
   648         HBufC* buffer = HBufC::NewL( KMimeTypeMaxLength );
   603         CleanupStack::PushL( buffer ); // + buffer
   649         CleanupStack::PushL( buffer ); // + buffer
   604         
   650 
   605         TPtr data = buffer->Des();
   651         TPtr data = buffer->Des();
   606         TInt err = content->GetStringAttribute( EMimeType, data );
   652         TInt err = content->GetStringAttribute( EMimeType, data );
   607                 
   653 
   608         if ( err == KErrNone )
   654         if ( err == KErrNone )
   609             {
   655             {
   610             mimebuf = HBufC8::New( buffer->Length() );
   656             mimebuf = HBufC8::New( buffer->Length() );
   611     
   657 
   612             if (mimebuf == NULL)
   658             if (mimebuf == NULL)
   613                 {
   659                 {
   614                 User::LeaveIfError( KErrNotFound );
   660                 User::LeaveIfError( KErrNotFound );
   615                 }
   661                 }
   616             
   662 
   617             mimebuf->Des().Copy( *buffer );
   663             mimebuf->Des().Copy( *buffer );
   618             }
   664             }
   619         
   665 
   620         // leave if NULL
   666         // leave if NULL
   621         if ( mimebuf == NULL )
   667         if ( mimebuf == NULL )
   622             {
   668             {
   623             User::Leave( KErrNotFound );
   669             User::Leave( KErrNotFound );
   624             }
   670             }
   625         
   671 
   626         CleanupStack::PopAndDestroy( buffer ); // - buffer
   672         CleanupStack::PopAndDestroy( buffer ); // - buffer
   627         CleanupStack::PopAndDestroy( content ); // - content
   673         CleanupStack::PopAndDestroy( content ); // - content
   628         }
   674         }
   629     else
   675     else
   630         {
   676         {
   631         User::Leave( KErrNotSupported );
   677         User::Leave( KErrNotSupported );
   632         }
   678         }
   633     
   679 
   634     PRINT( _L( "MM MTP <= MmMtpDpUtility::OdfMimeTypeL" ) );
   680     PRINT( _L( "MM MTP <= MmMtpDpUtility::OdfMimeTypeL" ) );
   635     return mimebuf;
   681     return mimebuf;
   636     }
   682     }
   637 
   683 
   638 // -----------------------------------------------------------------------------
   684 // -----------------------------------------------------------------------------
   641 // -----------------------------------------------------------------------------
   687 // -----------------------------------------------------------------------------
   642 //
   688 //
   643 HBufC8* MmMtpDpUtility::AsfMimeTypeL( const TDesC& aFullPath )
   689 HBufC8* MmMtpDpUtility::AsfMimeTypeL( const TDesC& aFullPath )
   644     {
   690     {
   645     PRINT( _L( "MM MTP => MmMtpDpUtility::AsfMimeTypeL" ) );
   691     PRINT( _L( "MM MTP => MmMtpDpUtility::AsfMimeTypeL" ) );
   646     
   692 
   647     HBufC8* mimebuf = NULL;
   693     HBufC8* mimebuf = NULL;
   648     
   694 
   649 #ifdef __WINDOWS_MEDIA
   695 #ifdef __WINDOWS_MEDIA
   650     TParsePtrC file( aFullPath );
   696     TParsePtrC file( aFullPath );
   651     
   697 
   652     if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 )
   698     if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 )
   653         {
   699         {
   654         CHXMetaDataUtility *hxUtility = CHXMetaDataUtility::NewL();
   700         CHXMetaDataUtility *hxUtility = CHXMetaDataUtility::NewL();
   655         CleanupStack::PushL( hxUtility );
   701         CleanupStack::PushL( hxUtility );
   656     
   702 
   657         hxUtility->OpenFileL( aFullPath );
   703         hxUtility->OpenFileL( aFullPath );
   658         
   704 
   659         HXMetaDataKeys::EHXMetaDataId id;
   705         HXMetaDataKeys::EHXMetaDataId id;
   660         TUint count = 0;
   706         TUint count = 0;
   661         TBool isAudio = EFalse;
   707         TBool isAudio = EFalse;
   662         hxUtility->GetMetaDataCount( count );
   708         hxUtility->GetMetaDataCount( count );
   663         for ( TUint i = 0; i < count; i++ )
   709         for ( TUint i = 0; i < count; i++ )
   664             {    
   710             {
   665             HBufC* buf = NULL;
   711             HBufC* buf = NULL;
   666             hxUtility->GetMetaDataAt( i, id, buf ); 
   712             hxUtility->GetMetaDataAt( i, id, buf );
   667 
   713 
   668             if ( id == HXMetaDataKeys::EHXMimeType )
   714             if ( id == HXMetaDataKeys::EHXMimeType )
   669                 {
   715                 {
   670                 TPtr des = buf->Des();
   716                 TPtr des = buf->Des();
   671                 
   717 
   672                 if ( des.Find( KHxMimeTypeWma() ) != KErrNotFound )
   718                 if ( des.Find( KHxMimeTypeWma() ) != KErrNotFound )
   673                     {
   719                     {
   674                     isAudio = ETrue;
   720                     isAudio = ETrue;
   675                     }
   721                     }
   676                 else if ( des.Find( KHxMimeTypeWmv() ) != KErrNotFound )
   722                 else if ( des.Find( KHxMimeTypeWmv() ) != KErrNotFound )
   693                     }
   739                     }
   694                 }
   740                 }
   695             }
   741             }
   696 
   742 
   697         hxUtility->ResetL();
   743         hxUtility->ResetL();
   698         CleanupStack::PopAndDestroy( hxUtility );        
   744         CleanupStack::PopAndDestroy( hxUtility );
   699         }
   745         }
   700     else
   746     else
   701         {
   747         {
   702         User::Leave( KErrNotSupported );
   748         User::Leave( KErrNotSupported );
   703         }
   749         }
   704 
   750 
   705 #else
   751 #else
   706     User::Leave( KErrNotSupported );
   752     User::Leave( KErrNotSupported );
   707 #endif
   753 #endif
   708     
   754 
   709     PRINT( _L( "MM MTP <= MmMtpDpUtility::AsfMimeTypeL" ) );
   755     PRINT( _L( "MM MTP <= MmMtpDpUtility::AsfMimeTypeL" ) );
   710     return mimebuf;
   756     return mimebuf;
   711     }
   757     }
   712 
   758 
   713 // -----------------------------------------------------------------------------
   759 // -----------------------------------------------------------------------------
   714 // MetadataAccessWrapper::SubFormatCodeFromMime
   760 // MetadataAccessWrapper::SubFormatCodeFromMime
   715 // Get subformat code from mime string
   761 // Get subformat code from mime string
   716 // -----------------------------------------------------------------------------
   762 // -----------------------------------------------------------------------------
   717 //
   763 //
   718 TInt MmMtpDpUtility::SubFormatCodeFromMime( const TDesC8& aMimeType, 
   764 TInt MmMtpDpUtility::SubFormatCodeFromMime( const TDesC8& aMimeType,
   719     TMmMtpSubFormatCode& aSubFormatCode )
   765     TMmMtpSubFormatCode& aSubFormatCode )
   720     {
   766     {
   721     PRINT( _L( "MM MTP => MmMtpDpUtility::SubFormatCodeFromMime" ) );
   767     PRINT( _L( "MM MTP => MmMtpDpUtility::SubFormatCodeFromMime" ) );
   722 
   768 
   723     if ( aMimeType.CompareF( KMimeTypeVideoMp4 ) == 0
   769     if ( aMimeType.CompareF( KMimeTypeVideoMp4 ) == 0
   789             content = NULL;
   835             content = NULL;
   790             }
   836             }
   791         }
   837         }
   792 
   838 
   793     PRINT1( _L( "MM MTP <= MmMtpDpUtility::GetDrmStatus, drmStatus: %d" ), drmStatus );
   839     PRINT1( _L( "MM MTP <= MmMtpDpUtility::GetDrmStatus, drmStatus: %d" ), drmStatus );
   794     
   840 
   795     return drmStatus;
   841     return drmStatus;
   796     }
   842     }
   797 
   843 
   798 //end of file
   844 // end of file