mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp
--- a/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp Fri May 14 18:19:45 2010 -0500
+++ b/mmfenh/advancedaudiocontroller/audiotonecontrollerplugin/src/mmfaudiotonecontroller.cpp Fri May 28 19:26:28 2010 -0500
@@ -114,6 +114,7 @@
void CMMFAudioToneController::ConstructL()
{
iSourceAndSinkAdded = EFalse;
+ iDataSink = NULL;
// Construct custom command parsers
CMMFAudioPlayDeviceCustomCommandParser* audPlayDevParser = CMMFAudioPlayDeviceCustomCommandParser::NewL(*this);
@@ -138,7 +139,15 @@
{
User::LeaveIfError(iFactory->CreateAudioOutputControlUtility(iAudioOutputControlUtility));
}
-//end drm cr
+ //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));
}
@@ -235,6 +244,9 @@
//Only support playing to audio output
if (aSink.DataSinkType() != KUidMmfAudioOutput)
User::Leave( KErrNotSupported );
+
+
+ iDataSink = &aSink;
iMMFDevSound = CMMFDevSound::NewL();
@@ -280,6 +292,22 @@
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)
{
@@ -381,6 +409,18 @@
}
}
+ //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());
@@ -414,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();
@@ -450,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 ]
@@ -1061,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;
+ }
+ }
+