mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp
changeset 20 b67dd1fc57c5
parent 0 71ca22bcf22a
child 21 2ed61feeead6
equal deleted inserted replaced
19:4a629bc82c5e 20:b67dd1fc57c5
    20 #include <mmfcontrollerimplementationuids.hrh>
    20 #include <mmfcontrollerimplementationuids.hrh>
    21 #include <mmf/common/mmffourcc.h>
    21 #include <mmf/common/mmffourcc.h>
    22 #include <mmf/common/mmfpaniccodes.h>
    22 #include <mmf/common/mmfpaniccodes.h>
    23 #include "mmfaudiotonecontroller.h"
    23 #include "mmfaudiotonecontroller.h"
    24 #include <mmf/server/mmfaudiooutput.h>
    24 #include <mmf/server/mmfaudiooutput.h>
       
    25 #include <ConfigurationComponentsFactory.h>
       
    26 #include <AudioOutputControlUtility.h>
       
    27 #include <mmf/server/mmffile.h>
    25 
    28 
    26 /*
    29 /*
    27  A list of panic codes for the Audio Tone Controller
    30  A list of panic codes for the Audio Tone Controller
    28 @internalTechnology
    31 @internalTechnology
    29 
    32 
   125 	
   128 	
   126 	CMMFAudioPlayControllerSetRepeatsCustomCommandParser* audPlayConSetRepeatsParser = CMMFAudioPlayControllerSetRepeatsCustomCommandParser::NewL(*this);
   129 	CMMFAudioPlayControllerSetRepeatsCustomCommandParser* audPlayConSetRepeatsParser = CMMFAudioPlayControllerSetRepeatsCustomCommandParser::NewL(*this);
   127 	CleanupStack::PushL(audPlayConSetRepeatsParser);
   130 	CleanupStack::PushL(audPlayConSetRepeatsParser);
   128 	AddCustomCommandParserL(*audPlayConSetRepeatsParser);
   131 	AddCustomCommandParserL(*audPlayConSetRepeatsParser);
   129 	CleanupStack::Pop(audPlayConSetRepeatsParser);
   132 	CleanupStack::Pop(audPlayConSetRepeatsParser);
   130 	
   133 	// for drm CR/Error 417-45879/ESLM-82JAHL
       
   134     TInt err = CConfigurationComponentsFactory::CreateFactoryL(iFactory);
       
   135     User::LeaveIfError(err);    
       
   136     
       
   137     if (iFactory)
       
   138         {
       
   139         User::LeaveIfError(iFactory->CreateAudioOutputControlUtility(iAudioOutputControlUtility));                
       
   140         }    
       
   141 //end drm cr
   131 	// [ assert the invariant now that we are constructed ]
   142 	// [ assert the invariant now that we are constructed ]
   132 	__ASSERT_ALWAYS( Invariant(), Panic( EStateNotConstructed));
   143 	__ASSERT_ALWAYS( Invariant(), Panic( EStateNotConstructed));
   133 	}
   144 	}
   134 
   145 
   135 
   146 
   148 
   159 
   149 @internalTechnology
   160 @internalTechnology
   150 */
   161 */
   151 CMMFAudioToneController::~CMMFAudioToneController()
   162 CMMFAudioToneController::~CMMFAudioToneController()
   152 	{
   163 	{
       
   164     delete iAudioOutputControlUtility;
       
   165     delete iFactory;
   153 	delete iMMFDevSound;
   166 	delete iMMFDevSound;
   154 	delete iToneSequenceData;
   167 	delete iToneSequenceData;
   155 	delete iMessage;
   168 	delete iMessage;
   156 	}
   169 	}
   157 
   170 
   265 			delete iMessage;
   278 			delete iMessage;
   266 			iMessage = NULL;
   279 			iMessage = NULL;
   267 			User::Leave(err);
   280 			User::Leave(err);
   268 			}
   281 			}
   269 		}
   282 		}
   270 	
   283 	// for drm CR/Error 417-45879/ESLM-82JAHL
       
   284     if (iDataSource->DataSourceType()==KUidMmfFileSource)
       
   285         {
       
   286         CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
       
   287         
       
   288         if (file->IsProtectedL())
       
   289             {
       
   290             User::LeaveIfError(iAudioOutputControlUtility->SetDataSource(iDataSource));
       
   291             }         
       
   292         }
       
   293 	   // end drm cr
   271 	__ASSERT_ALWAYS( Invariant(), Panic( EStateNotPrimed ) );
   294 	__ASSERT_ALWAYS( Invariant(), Panic( EStateNotPrimed ) );
   272 
   295 
   273 	}
   296 	}
   274 
   297 
   275 /**
   298 /**
   344 	if ( State() != EPrimed && State() != EPausePlaying)
   367 	if ( State() != EPrimed && State() != EPausePlaying)
   345 		User::Leave(KErrNotReady);
   368 		User::Leave(KErrNotReady);
   346 
   369 
   347 	// [ assert the Invariant ]
   370 	// [ assert the Invariant ]
   348 	__ASSERT_ALWAYS( Invariant(), Panic(EStateNotReadyToPlay));
   371 	__ASSERT_ALWAYS( Invariant(), Panic(EStateNotReadyToPlay));
   349 
   372         // for drm CR/Error 417-45879/ESLM-82JAHL
       
   373 	   //configure Devsound with output restriction for a DRM protected file
       
   374 	    if (iDataSource->DataSourceType()==KUidMmfFileSource)
       
   375 	        {
       
   376 	        CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
       
   377 	        
       
   378 	        if (file->IsProtectedL())
       
   379 	            {
       
   380 	            iAudioOutputControlUtility->Configure(*iMMFDevSound);    //ignoring errors since rouitng changes are only suggestions to adaptation
       
   381 	            }
       
   382 	        }
       
   383 	
   350 	if(State() == EPausePlaying && iIsResumeSupported)
   384 	if(State() == EPausePlaying && iIsResumeSupported)
   351 		{
   385 		{
   352 		User::LeaveIfError(iMMFDevSound->Resume());
   386 		User::LeaveIfError(iMMFDevSound->Resume());
   353 		}
   387 		}
   354 	else
   388 	else