mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp
--- a/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp Thu Aug 19 10:26:11 2010 +0300
+++ b/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp Tue Aug 31 15:43:02 2010 +0300
@@ -22,6 +22,9 @@
#include <mmf/common/mmfpaniccodes.h>
#include "mmfaudiotonecontroller.h"
#include <mmf/server/mmfaudiooutput.h>
+#include <ConfigurationComponentsFactory.h>
+#include <AudioOutputControlUtility.h>
+#include <mmf/server/mmffile.h>
/*
A list of panic codes for the Audio Tone Controller
@@ -111,6 +114,7 @@
void CMMFAudioToneController::ConstructL()
{
iSourceAndSinkAdded = EFalse;
+ iDataSink = NULL;
// Construct custom command parsers
CMMFAudioPlayDeviceCustomCommandParser* audPlayDevParser = CMMFAudioPlayDeviceCustomCommandParser::NewL(*this);
@@ -127,6 +131,22 @@
CleanupStack::PushL(audPlayConSetRepeatsParser);
AddCustomCommandParserL(*audPlayConSetRepeatsParser);
CleanupStack::Pop(audPlayConSetRepeatsParser);
+ // for drm CR/Error 417-45879/ESLM-82JAHL
+ TInt err = CConfigurationComponentsFactory::CreateFactoryL(iFactory);
+ User::LeaveIfError(err);
+
+ if (iFactory)
+ {
+ User::LeaveIfError(iFactory->CreateAudioOutputControlUtility(iAudioOutputControlUtility));
+ }
+ //end drm cr
+
+
+ //For Error : Update s60 tone controller to update the DRM rights
+ CMMFDRMCustomCommandParser* drmParser = CMMFDRMCustomCommandParser::NewL(*this);
+ CleanupStack::PushL(drmParser);
+ AddCustomCommandParserL(*drmParser);
+ CleanupStack::Pop(drmParser);
// [ assert the invariant now that we are constructed ]
__ASSERT_ALWAYS( Invariant(), Panic( EStateNotConstructed));
@@ -150,6 +170,8 @@
*/
CMMFAudioToneController::~CMMFAudioToneController()
{
+ delete iAudioOutputControlUtility;
+ delete iFactory;
delete iMMFDevSound;
delete iToneSequenceData;
delete iMessage;
@@ -222,6 +244,9 @@
//Only support playing to audio output
if (aSink.DataSinkType() != KUidMmfAudioOutput)
User::Leave( KErrNotSupported );
+
+
+ iDataSink = &aSink;
iMMFDevSound = CMMFDevSound::NewL();
@@ -267,7 +292,33 @@
User::Leave(err);
}
}
-
+
+ //For Error : Update s60 tone controller to update the DRM rights
+ if (iDataSource->DataSourceType()==KUidMmfFileSource)
+ {
+ CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+ // we only support protected files for playback
+ if (file->IsProtectedL())
+ {
+ if (iDataSink->DataSinkType()!=KUidMmfAudioOutput)
+ {
+ // Conversion is not allowed for DRM protected files
+ User::Leave(KErrNotSupported);
+ }
+ }
+ }
+
+ // for drm CR/Error 417-45879/ESLM-82JAHL
+ if (iDataSource->DataSourceType()==KUidMmfFileSource)
+ {
+ CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+
+ if (file->IsProtectedL())
+ {
+ User::LeaveIfError(iAudioOutputControlUtility->SetDataSource(iDataSource));
+ }
+ }
+ // end drm cr
__ASSERT_ALWAYS( Invariant(), Panic( EStateNotPrimed ) );
}
@@ -346,7 +397,30 @@
// [ assert the Invariant ]
__ASSERT_ALWAYS( Invariant(), Panic(EStateNotReadyToPlay));
-
+ // for drm CR/Error 417-45879/ESLM-82JAHL
+ //configure Devsound with output restriction for a DRM protected file
+ if (iDataSource->DataSourceType()==KUidMmfFileSource)
+ {
+ CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+
+ if (file->IsProtectedL())
+ {
+ iAudioOutputControlUtility->Configure(*iMMFDevSound); //ignoring errors since rouitng changes are only suggestions to adaptation
+ }
+ }
+
+ //For Error : Update s60 tone controller to update the DRM rights
+ //Getting the Intent for Play if AutomaticIntent is Enabled
+ if (!iDisableAutoIntent && iDataSource->DataSourceType()==KUidMmfFileSource)
+ {
+ CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+ TInt err = file->ExecuteIntent(ContentAccess::EPlay);
+ if (err != KErrNone)
+ {
+ User::LeaveIfError(err);
+ }
+ }
+
if(State() == EPausePlaying && iIsResumeSupported)
{
User::LeaveIfError(iMMFDevSound->Resume());
@@ -380,6 +454,18 @@
__ASSERT_ALWAYS(iMMFDevSound, Panic(EMMFAudioControllerPanicDataSinkDoesNotExist));
+ //For Error : Update s60 tone controller to update the DRM rights
+ //Getting the Intent for Pause if AutomaticIntent is Enabled
+ if (!iDisableAutoIntent && iDataSource->DataSourceType()==KUidMmfFileSource)
+ {
+ CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+ TInt err = file->ExecuteIntent(ContentAccess::EPause);
+
+ if (err != KErrNone)
+ {
+ User::LeaveIfError(err);
+ }
+ }
if(iIsResumeSupported)
{
iMMFDevSound->Pause();
@@ -416,6 +502,19 @@
// Due to the asynchronous nature of the controller
// interaction the response to stopped when stopped
// should not be an error ]
+
+
+ //For Error : Update s60 tone controller to update the DRM rights
+ //Getting the Intent for Stop if AutomaticIntent is Enabled
+ if (!iDisableAutoIntent && iDataSource->DataSourceType()==KUidMmfFileSource)
+ {
+ CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+ TInt err = file->ExecuteIntent(ContentAccess::EStop);
+ if (err != KErrNone)
+ {
+ User::LeaveIfError(err);
+ }
+ }
if (State() != EStopped)
{
//[ update state to stopped propogate to devsound ]
@@ -1027,3 +1126,63 @@
}
return err;
}
+
+//For Error : Update s60 tone controller to update the DRM rights
+//Methods from MMMFDRMCustomCommandImplementor
+//Checking for the Intents if AutomaticIntent is Disabled
+
+TInt CMMFAudioToneController::MdcExecuteIntent(ContentAccess::TIntent aIntent)
+ {
+
+ if (iDataSource->DataSourceType()==KUidMmfFileSource)
+ {
+ CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+ TInt err = file->ExecuteIntent(aIntent);
+ return err;
+ }
+ else
+ {
+ // Evaluating intent will always succeed on sinks that
+ // don't support DRM
+ return KErrNone;
+ }
+
+ }
+
+TInt CMMFAudioToneController::MdcEvaluateIntent(ContentAccess::TIntent aIntent)
+ {
+ if (iDataSource->DataSourceType()==KUidMmfFileSource)
+ {
+ CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+ TInt err = file->EvaluateIntent(aIntent);
+ return err;
+ }
+ else
+ {
+ // Evaluating intent will always succeed on sinks that
+ // don't support DRM
+ return KErrNone;
+ }
+ }
+
+TInt CMMFAudioToneController::MdcDisableAutomaticIntent(TBool aDisableAutoIntent)
+ {
+ iDisableAutoIntent = aDisableAutoIntent;
+ return KErrNone;
+ }
+
+
+TInt CMMFAudioToneController::MdcSetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue)
+ {
+ if (iDataSource->DataSourceType()==KUidMmfFileSource)
+ {
+ CMMFFile* file = static_cast<CMMFFile*>(iDataSource);
+ TInt err = file->SetAgentProperty(aProperty, aValue);
+ return err;
+ }
+ else
+ {
+ return KErrNone;
+ }
+ }
+