mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp
branchGCC_SURGE
changeset 47 f3d2589f22d6
parent 44 d141fc1ad77b
child 50 762d760dcfdf
equal deleted inserted replaced
36:3b7506f63335 47:f3d2589f22d6
    25 #include <caf/content.h>
    25 #include <caf/content.h>
    26 #include <mtp/cmtpobjectmetadata.h>
    26 #include <mtp/cmtpobjectmetadata.h>
    27 #include <mtp/mmtpdataproviderframework.h>
    27 #include <mtp/mmtpdataproviderframework.h>
    28 #include <mtp/mmtpobjectmgr.h>
    28 #include <mtp/mmtpobjectmgr.h>
    29 #include <mtp/tmtptypeuint32.h>
    29 #include <mtp/tmtptypeuint32.h>
       
    30 #include <e32property.h>    // for RProperty
    30 
    31 
    31 // for asf mimetype parsing
    32 // for asf mimetype parsing
    32 #ifdef __WINDOWS_MEDIA
    33 #ifdef __WINDOWS_MEDIA
    33 #include <hxmetadatakeys.h>
    34 #include <hxmetadatakeys.h>
    34 #include <hxmetadatautil.h>
    35 #include <hxmetadatautil.h>
    37 #include "mmmtpdputility.h"
    38 #include "mmmtpdputility.h"
    38 #include "mmmtpdpfiledefs.h"
    39 #include "mmmtpdpfiledefs.h"
    39 #include "tobjectdescription.h"
    40 #include "tobjectdescription.h"
    40 #include "mmmtpdplogger.h"
    41 #include "mmmtpdplogger.h"
    41 #include "mmmtpdp_variant.hrh"
    42 #include "mmmtpdp_variant.hrh"
       
    43 #include "cmmmtpdpaccesssingleton.h"
    42 
    44 
    43 using namespace ContentAccess;
    45 using namespace ContentAccess;
    44 
    46 
    45 // local to this file, non standard mimetype used for ASF parsing with helix
    47 // local to this file, non standard mimetype used for ASF parsing with helix
    46 _LIT( KHxMimeTypeWma, "audio/x-hx-wma" );
    48 _LIT( KHxMimeTypeWma, "audio/x-hx-wma" );
    98             else if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 )
   100             else if ( file.Ext().CompareF( KTxtExtensionASF ) == 0 )
    99                 format = EMTPFormatCodeASF;
   101                 format = EMTPFormatCodeASF;
   100 #endif // __WINDOWS_MEDIA
   102 #endif // __WINDOWS_MEDIA
   101             else if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 )
   103             else if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 )
   102                 {
   104                 {
   103                 HBufC8* mime = MmMtpDpUtility::OdfMimeTypeL( file.FullName() );
   105                 HBufC8* mime(NULL);
       
   106                 TRAP_IGNORE( mime = MmMtpDpUtility::OdfMimeTypeL( file.FullName() ) );
   104                 if ( mime != NULL )
   107                 if ( mime != NULL )
   105                     {
   108                     {
   106                     // 3GP
   109                     // 3GP
   107                     if ( mime->CompareF( KMimeTypeAudio3gpp ) == 0
   110                     if ( mime->CompareF( KMimeTypeAudio3gpp ) == 0
   108                         || mime->CompareF( KMimeTypeVideo3gpp ) == 0 )
   111                         || mime->CompareF( KMimeTypeVideo3gpp ) == 0 )
   496         User::Leave( KErrNotSupported );
   499         User::Leave( KErrNotSupported );
   497         }
   500         }
   498 
   501 
   499     if ( mimebuf == NULL )
   502     if ( mimebuf == NULL )
   500         {
   503         {
   501         User::Leave( KErrNotFound );
   504         PRINT( _L( "MM MTP <> MmMtpDpUtility::Mp4MimeTypeL, mimebuf == NULL, default as video" ) );
       
   505 
       
   506         if ( file.Ext().CompareF( KTxtExtension3GP ) == 0
       
   507             || file.Ext().CompareF( KTxtExtension3G2 ) == 0 )
       
   508             {
       
   509             mimebuf = KMimeTypeVideo3gpp().Alloc();
       
   510             }
       
   511         else
       
   512             {
       
   513             mimebuf = KMimeTypeVideoMp4().Alloc();
       
   514             }
   502         }
   515         }
   503     PRINT( _L( "MM MTP <= MmMtpDpUtility::Mp4MimeTypeL" ) );
   516     PRINT( _L( "MM MTP <= MmMtpDpUtility::Mp4MimeTypeL" ) );
   504     return mimebuf;
   517     return mimebuf;
   505     }
   518     }
   506 
   519 
   699     PRINT1( _L( "MM MTP <= MmMtpDpUtility::GetDrmStatus, drmStatus: %d" ), drmStatus );
   712     PRINT1( _L( "MM MTP <= MmMtpDpUtility::GetDrmStatus, drmStatus: %d" ), drmStatus );
   700 
   713 
   701     return drmStatus;
   714     return drmStatus;
   702     }
   715     }
   703 
   716 
       
   717 EXPORT_C void MmMtpDpUtility::SetPSStatus( TMtpPSStatus aStatus )
       
   718     {
       
   719     TBool changeScheduled = EFalse;
       
   720     CMmMtpDpAccessSingleton::CancelActiveToIdleStatusChange();  // cancel any outstanding delay status change
       
   721     
       
   722     if ( aStatus == EMtpPSStatusReadyToSync )
       
   723         {
       
   724         TInt mtpStatus;
       
   725         RProperty::Get( KMtpPSUid, KMtpPSStatus, mtpStatus );
       
   726         
       
   727         if ( mtpStatus == EMtpPSStatusActive )
       
   728             {
       
   729             CMmMtpDpAccessSingleton::ActiveToIdleStatusChange();
       
   730             changeScheduled = ETrue;
       
   731             }
       
   732         }
       
   733 
       
   734     if ( !changeScheduled )
       
   735         DoSetPSStatus( aStatus );
       
   736     }
       
   737 
       
   738 void MmMtpDpUtility::DoSetPSStatus( TMtpPSStatus aStatus )
       
   739     {
       
   740     TInt mtpStatus;
       
   741     RProperty::Get( KMtpPSUid, KMtpPSStatus, mtpStatus );
       
   742 
       
   743     if ( mtpStatus != aStatus )
       
   744         {
       
   745         TInt err = RProperty::Set( KMtpPSUid, KMtpPSStatus, aStatus );
       
   746         PRINT3( _L("MM MTP <> CRequestProcessor::DoSetPSStatus err = %d, previous = %d, current = %d" ), err , mtpStatus, aStatus);
       
   747         }
       
   748     }
   704 // end of file
   749 // end of file