--- a/devsound/a3fdevsound/src/devsoundadaptor/cdevaudiocontrol.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/devsound/a3fdevsound/src/devsoundadaptor/cdevaudiocontrol.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -937,15 +937,15 @@
if (aEvent == KUidA3FContextUpdateComplete)
{
- if(iIgnoreAsyncOpComplete)
+ if(iIgnoreAsyncOpComplete)
{
- iAdaptationObserver->PreemptionFinishedCallbackReceived(ETrue);
- iIgnoreAsyncOpComplete = EFalse;
- }
- else
- {
- iAdaptationObserver->AsynchronousOperationComplete(aError, ETrue);
- }
+ iAdaptationObserver->PreemptionFinishedCallbackReceived(ETrue);
+ iIgnoreAsyncOpComplete = EFalse;
+ }
+ else
+ {
+ iAdaptationObserver->AsynchronousOperationComplete(aError, ETrue);
+ }
}
else if(aEvent == KUidA3FContextPreEmption || aEvent == KUidA3FContextPreEmptedCommit)
{
--- a/devsound/a3fdevsound/src/devsoundadaptor/cdevcommoncontrol.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/devsound/a3fdevsound/src/devsoundadaptor/cdevcommoncontrol.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -177,28 +177,42 @@
void CDevCommonControl::ContextEvent(TUid aEvent, TInt aError)
{
DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
- DP_IN();
+ DP3_IN("ContextEvent aEvent=%x iActiveState=%d aError=%d",aEvent, iDevAudio->iActiveState, aError);
// Can't "switch {...}" on UIDs unfortunately:
-
if (aEvent == KUidA3FContextUpdateComplete)
{
- //use a sub state pattern to make premtion cycles like other cycles.
- if(iBeingPreempted)
+ if(iBeingPreempted && iStateEventReceived)
{
+ //use a sub state pattern to make premtion cycles like other cycles.
DP1(DLERR,"Preemption error=%d", aError);
- CDevAudioControl::ContextEvent(aEvent, aError);
iDevAudio->iActiveState = EDevSoundAdaptorBeingPreempted;
iBeingPreempted=EFalse;
}
- ContextEventUpdateComplete(aError);
+ ContextEventUpdateComplete(aError);
+ }
+
+ else if ((aEvent == KUidA3FContextCommitUpdate))
+ {
+ iBeingPreempted=EFalse; // clear being preempted
+ TBool adaptorControlsContext = iAdaptationObserver->AdaptorControlsContext();
+ iIgnoreAsyncOpComplete = !adaptorControlsContext;
+ // if we don't control context, always send a PreemptionFinishedCallbackReceived()
+ iStateEventReceived=EFalse;
}
else if ((aEvent == KUidA3FContextPreEmption) or (aEvent == KUidA3FContextPreEmptedCommit))
{
- //we are not being preemptied
+ // clear iBeingPreepted - will be set in ContextEventPreEmption if req
iBeingPreempted=EFalse;
+ TBool adaptorControlsContext = iAdaptationObserver->AdaptorControlsContext();
+ iStateEventReceived=EFalse;
+ iIgnoreAsyncOpComplete=EFalse; // clear being iIgnoreAsyncOpComplete
ContextEventPreEmption(aEvent, aError);
+ if (!adaptorControlsContext)
+ {
+ iIgnoreAsyncOpComplete = ETrue; // if we don't control context never do AsyncOpComplete
+ }
}
else if (aEvent == KUidA3FContextAbort)
@@ -212,7 +226,7 @@
void CDevCommonControl::ContextEventAsynchronousPlayCompletion(TInt aError) // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventAsynchronousPlayCompletion, CtxDevSound, DPLOCAL);
DP_IN();
iAdaptationObserver->AsynchronousOperationComplete(aError, ETrue);
@@ -228,7 +242,7 @@
void CDevCommonControl::ContextEventAsynchronousInitializeComplete(TInt aError) // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventAsynchronousInitializeComplete, CtxDevSound, DPLOCAL);
DP_IN();
iAdaptationObserver->AsynchronousOperationComplete(aError, ETrue);
@@ -240,7 +254,7 @@
void CDevCommonControl::ContextEventUpdateComplete(TInt aError) // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventUpdateComplete, CtxDevSound, DPLOCAL);
DP_IN();
if (iStateEventReceived)
@@ -277,7 +291,7 @@
void CDevCommonControl::ContextEventPreEmption(TUid aEvent, TInt aError) // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventPreEmption, CtxDevSound, DPLOCAL);
DP_IN();
DP1(DLERR,"Preemption error=%d", aError);
@@ -290,7 +304,7 @@
void CDevCommonControl::ContextEventAbort(TInt aError) // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventAbort, CtxDevSound, DPLOCAL);
DP_IN();
DP1(DLERR,"Abort error=%d", aError);
@@ -302,7 +316,7 @@
void CDevCommonControl::ContextEventStopDevSoundNotifications() // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventStopDevSoundNotifications, CtxDevSound, DPLOCAL);
DP_IN();
iDevAudio->iAudioStream->UnregisterAudioStreamObserver(*this);
@@ -316,7 +330,7 @@
void CDevCommonControl::ContextEventPauseResumeSequenceDueToEmptyBuffers(TBool aFlush) // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventPauseResumeSequenceDueToEmptyBuffers, CtxDevSound, DPLOCAL);
DP_IN();
TInt err(KErrNone);
@@ -345,7 +359,7 @@
void CDevCommonControl::ContextEventStateDevSoundAdaptorUnloading() // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventStateDevSoundAdaptorUnloading, CtxDevSound, DPLOCAL);
DP_IN();
// Due destruction sequence or reinitialization
@@ -400,7 +414,7 @@
void CDevCommonControl::ContextEventStateDevSoundAdaptorLoading() // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventStateDevSoundAdaptorLoading, CtxDevSound, DPLOCAL);
DP_IN();
iDevAudio->RequestGainAndBalance(this); // TODO handle error
@@ -429,7 +443,7 @@
void CDevCommonControl::ContextEventStateDevSoundAdaptorStopping() // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventStateDevSoundAdaptorStopping, CtxDevSound, DPLOCAL);
DP_IN();
TInt err = Unload();
@@ -447,7 +461,7 @@
void CDevCommonControl::ContextEventStateDevSoundAdaptorBeingPreempted() // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventStateDevSoundAdaptorBeingPreempted, CtxDevSound, DPLOCAL);
DP_IN();
__ASSERT_DEBUG(iDevAudio->iActiveStreamState == EInitialized, Panic(EStreamBeingDemotedToEIdle));
@@ -468,7 +482,7 @@
void CDevCommonControl::ContextEventStateDevSoundAdaptorUninitializing() // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventStateDevSoundAdaptorUninitializing, CtxDevSound, DPLOCAL);
DP_IN();
TInt err = RemoveProcessingUnits();
@@ -487,7 +501,7 @@
void CDevCommonControl::ContextEventErrorStateDevSoundAdaptorActivating(TInt aError) // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventErrorStateDevSoundAdaptorActivating, CtxDevSound, DPLOCAL);
DP_IN();
// If the resume operation fails as result of EmptyBuffers
@@ -515,7 +529,7 @@
void CDevCommonControl::ContextEventErrorStateDevSoundAdaptorBeingPreempted() // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventErrorStateDevSoundAdaptorBeingPreempted, CtxDevSound, DPLOCAL);
DP_IN();
__ASSERT_DEBUG(iDevAudio->iActiveStreamState == EInitialized, Panic(EStreamBeingDemotedToEIdle));
@@ -532,12 +546,20 @@
void CDevCommonControl::ContextEventUpdateWithoutStateEventNoError() // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
- DP_IN();
+ DP_CONTEXT(CDevCommonControl::ContextEventUpdateWithoutStateEventNoError, CtxDevSound, DPLOCAL);
+ DP2_IN("iActiveState=%d iIgnoreAsyncOpComplete=%d",iDevAudio->iActiveState, iIgnoreAsyncOpComplete);
if (iDevAudio->iActiveState != EDevSoundAdaptorRemovingProcessingUnits)
{
- iAdaptationObserver->AsynchronousOperationComplete(KErrNone, ETrue);
+ if (iIgnoreAsyncOpComplete)
+ {
+ iAdaptationObserver->PreemptionFinishedCallbackReceived(ETrue);
+ iIgnoreAsyncOpComplete = EFalse;
+ }
+ else
+ {
+ iAdaptationObserver->AsynchronousOperationComplete(KErrNone, ETrue);
+ }
DP_OUT();
return;
}
@@ -568,11 +590,9 @@
void CDevCommonControl::ContextEventUpdateWithoutStateEventButWithError(TInt aError) // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventUpdateWithoutStateEventButWithError, CtxDevSound, DPLOCAL);
DP_IN();
- // NOTE: If no state change then do NOT complete the event.
-
// NOTE: We shouldn't actually be in any of the states below when calling this function.
// But just in case we are we will rewind the state before dealing with the error.
switch (iDevAudio->iActiveState)
@@ -602,7 +622,7 @@
void CDevCommonControl::ContextEventUpdateWithStateEventNoError() // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventUpdateWithStateEventNoError, CtxDevSound, DPLOCAL);
DP_IN();
switch (iDevAudio->iActiveState)
@@ -657,10 +677,10 @@
void CDevCommonControl::ContextEventUpdateWithStateEventAndError(TInt aError) // from CDevCommonControl
{
- DP_CONTEXT(CDevCommonControl::ContextEvent, CtxDevSound, DPLOCAL);
+ DP_CONTEXT(CDevCommonControl::ContextEventUpdateWithStateEventAndError, CtxDevSound, DPLOCAL);
DP_IN();
- DP1(DLERR,"ContextEvent error=%d", aError);
+ DP1(DLERR,"ContextEventUpdateWithStateEventAndError error=%d", aError);
switch(iDevAudio->iActiveState)
{
--- a/devsound/a3fdevsound/src/devsoundadaptor/mmfdevsoundadaptation.h Fri Mar 12 15:50:33 2010 +0200
+++ b/devsound/a3fdevsound/src/devsoundadaptor/mmfdevsoundadaptation.h Mon Mar 15 12:46:07 2010 +0200
@@ -223,7 +223,11 @@
*/
virtual void PreemptionFinishedCallbackReceived(TBool aCanStartNewOperation) = 0;
-
+ /*
+ * The adaptor has control of the context.
+ * @return returns True if the adaptor is the entity responsible for calling Commit()
+ */
+ virtual TBool AdaptorControlsContext() const = 0;
};
--- a/devsound/a3fdevsound/src/mmfdevsoundproxy/mmfdevsoundproxy.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/devsound/a3fdevsound/src/mmfdevsoundproxy/mmfdevsoundproxy.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -1347,6 +1347,10 @@
// don't actually resume until then!
iState = ERecordingResumingInLastBufferCycle;
}
+ else if (iState == ERecordingResumingInLastBufferCycle)
+ {
+ //Do Nothing as you can't resume twice on last buffer
+ }
else
{
err = SendReceive(EMMFDevSoundProxyResume,
--- a/devsound/a3fdevsound/src/mmfdevsoundserver/mmfdevsoundsession.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/devsound/a3fdevsound/src/mmfdevsoundserver/mmfdevsoundsession.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -227,7 +227,8 @@
//
void CMMFDevSoundSession::ServiceL(const RMmfIpcMessage& aMessage)
{
- SYMBIAN_DEBPRN2(_L("\nCMMFDevSoundSession[0x%x] NEW REQUEST %02x while pending=%d"), aMessage.Function(), iOperationCompletePending);
+ SYMBIAN_DEBPRN2(_L("\nCMMFDevSoundSession[0x%x] NEW REQUEST %02x while pending=%d"),
+ aMessage.Function(), iOperationCompletePending || iAsyncQueueStart->IsActive());
if( iOperationCompletePending || iAsyncQueueStart->IsActive())
{
// if not possible to service now, then queue request
@@ -236,7 +237,16 @@
else
{
// If there is no oustanding operation service inmediately
- DoServiceRequestL(aMessage);
+ TRAPD(err, DoServiceRequestL(aMessage));
+ if (err)
+ {
+ aMessage.Complete(err); // repeat normal ServiceL() behaviour since we may keep going
+ }
+ if (!iOperationCompletePending && iQueuedRequests.Count() != 0)
+ {
+ //dequeue next
+ DequeueRequest();
+ }
}
}
@@ -444,12 +454,14 @@
if (iCIExtension)
{
iOperationCompletePending = ETrue;
+ iHandlingExtdCI = ETrue;
TRAPD(err2, err = iCIExtension->HandleMessageL(aMessage));
if (err2)
{
err = err2;
}
iOperationCompletePending = EFalse;
+ iHandlingExtdCI = EFalse;
}
if (err != KErrNone)
@@ -1699,6 +1711,11 @@
//
void CMMFDevSoundSession::PreemptionFinishedCallbackReceived(TBool aCanStartNewOperation)
{
+ if (iHandlingExtdCI)
+ {
+ // we are in the middle of handling a CI, so ignore - will handle later when unwinding
+ return;
+ }
iOperationCompletePending = EFalse;
if ( aCanStartNewOperation && iQueuedRequests.Count() != 0 )
{
@@ -1706,6 +1723,14 @@
}
}
+//
+// CMMFDevSoundSession::AdaptorControlsContext()
+//
+
+TBool CMMFDevSoundSession::AdaptorControlsContext() const
+ {
+ return !iHandlingExtdCI;
+ }
MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFDevSoundSession::InterfaceFromUid(TUid aUid)
{
@@ -1740,6 +1765,9 @@
void CMMFDevSoundSession::AsynchronousOperationComplete(TInt aError, TBool aCanStartNewOperation)
{
+ __ASSERT_DEBUG(!iHandlingExtdCI, Panic(EUnexpectedAsyncOpCompleteHandlingCI));
+ // when handling CIs we should not reach here
+
switch (iRequestBeingServiced.Type())
{
case TMMFDevSoundRequest::ESessionEvents:
@@ -1820,6 +1848,8 @@
void CMMFDevSoundSession::DequeueRequest()
{
+ iAsyncQueueStart->Cancel(); // if we're in here cancel any background request
+
TMMFDevSoundRequest msg = iQueuedRequests[0];
if (msg.IsCallBack() > 0)
@@ -1839,7 +1869,8 @@
}
}
- else
+
+ if (iQueuedRequests.Count()>0)
{
// Some rules about what request can be followed
SYMBIAN_DEBPRN0(_L("\n CMMFDevSoundSession[0x%x]======== Flag can service new request\n"));
--- a/devsound/a3fdevsound/src/mmfdevsoundserver/mmfdevsoundsession.h Fri Mar 12 15:50:33 2010 +0200
+++ b/devsound/a3fdevsound/src/mmfdevsoundserver/mmfdevsoundsession.h Mon Mar 15 12:46:07 2010 +0200
@@ -47,7 +47,8 @@
enum TMMFDevSoundSessionPanicCodes
{
EMsgQueueFailedToSendMsg =1,
- EQueueRequestsFailedToAppend
+ EQueueRequestsFailedToAppend,
+ EUnexpectedAsyncOpCompleteHandlingCI
};
// CLASS DECLARATION
@@ -1310,6 +1311,9 @@
*/
void PreemptionFinishedCallbackReceived(TBool aCanStartNewOperation);
+ // from MDevSoundAdaptationObserver
+ TBool AdaptorControlsContext() const;
+
/**
MDevSoundAdaptationObserver callback.
Indicates that a low layer operation completion
@@ -1486,6 +1490,7 @@
RArray<TMMFDevSoundRequest> iQueuedRequests;
TMMFDevSoundRequest iRequestBeingServiced;
TBool iOperationCompletePending;
+ TBool iHandlingExtdCI;
TBool iPlayErrorOccured;
//Check if the call of SetClientConfigL was alredy made
--- a/devsoundextensions/audiorouting/Output/AudioOutputProxy/src/AudioOutputProxy.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/devsoundextensions/audiorouting/Output/AudioOutputProxy/src/AudioOutputProxy.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -43,6 +43,7 @@
iOutput = ENoPreference;
iDefaultOutput = ENoPreference;
iSecureOutput = EFalse;
+ iRegistered = EFalse;
}
// Two-phased constructor.
@@ -140,14 +141,22 @@
//
void CAudioOutputProxy::RegisterObserverL(MAudioOutputObserver& aObserver)
{
- iRegistered = ETrue;
- iObserver = &aObserver;
- delete iAsyncSender;
- iAsyncSender = NULL;
+ if(iRegistered)
+ {
+ iObserver = &aObserver;
+ iAsyncSender->SetObserver(aObserver);
+ }
+ else
+ {
+ iRegistered = ETrue;
+ iObserver = &aObserver;
+ delete iAsyncSender;
+ iAsyncSender = NULL;
- iAsyncSender = CAudioOutputProxyAO::NewL(this,aObserver,iCustomCommand);
- iAsyncSender->SetRegisterFlag(ETrue);
- iAsyncSender->SendAsyncMessage(iMessageHandler,EAofRegisterObserver);
+ iAsyncSender = CAudioOutputProxyAO::NewL(this,aObserver,iCustomCommand);
+ iAsyncSender->SetRegisterFlag(ETrue);
+ iAsyncSender->SendAsyncMessage(iMessageHandler,EAofRegisterObserver);
+ }
}
// ---------------------------------------------------------
--- a/devsoundextensions/audiorouting/Output/AudioOutputProxy/src/AudioOutputProxyAO.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/devsoundextensions/audiorouting/Output/AudioOutputProxy/src/AudioOutputProxyAO.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -17,6 +17,7 @@
#include "AudioOutput.h"
+#include "AudioOutputMessageTypes.h"
#include <e32svr.h>
#include "AudioOutputProxyAO.h"
#include <CustomCommandUtility.h>
@@ -46,7 +47,7 @@
CActive(CActive::EPriorityStandard),
iAudioOutputProxy(aOutputProxy),
iCustomCommandUtility(aUtility),
- iObserver(aObserver)
+ iObserver(&aObserver)
{
}
@@ -70,7 +71,7 @@
{
iCustomCommandUtility->CustomCommandAsync( *iDestination,iFunction,KNullDesC8,KNullDesC8,iCallbackData,iStatus );
SetActive();
- iObserver.DefaultAudioOutputChanged(*iAudioOutputProxy,iCallbackData());
+ iObserver->DefaultAudioOutputChanged(*iAudioOutputProxy,iCallbackData());
}
}
@@ -82,6 +83,10 @@
//
void CAudioOutputProxyAO::DoCancel()
{
+ if ( iRegistered != EFalse )
+ {
+ iCustomCommandUtility->CustomCommandSync( *iDestination, EAofUnregisterObserver, KNullDesC8, KNullDesC8);
+ }
}
// ---------------------------------------------------------
@@ -110,3 +115,13 @@
{
iRegistered = aFlag;
}
+// ---------------------------------------------------------
+// CAudioOutputProxyAO::SetObserver
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CAudioOutputProxyAO::SetObserver(MAudioOutputObserver& aObserver)
+ {
+ iObserver = &aObserver;
+ }
--- a/devsoundextensions/ciextnfactoryplugins/ciextnclientplugin/src/ciextnclientplugin.h Fri Mar 12 15:50:33 2010 +0200
+++ b/devsoundextensions/ciextnfactoryplugins/ciextnclientplugin/src/ciextnclientplugin.h Mon Mar 15 12:46:07 2010 +0200
@@ -23,7 +23,7 @@
// Include files
#include <e32base.h>
-#include <a3f/MmfDevSoundCustomInterfaceExtensions.h>
+#include <a3f/mmfdevsoundcustominterfaceextensions.h>
// Forward declarations
class MCIFactoryIntfc;
--- a/devsoundextensions/ciextnfactoryplugins/ciextnserverplugin/src/ciextnserverplugin.h Fri Mar 12 15:50:33 2010 +0200
+++ b/devsoundextensions/ciextnfactoryplugins/ciextnserverplugin/src/ciextnserverplugin.h Mon Mar 15 12:46:07 2010 +0200
@@ -23,7 +23,7 @@
// Include files
#include <e32base.h>
-#include <a3f/MmfDevSoundCustomInterfaceExtensions.h>
+#include <a3f/mmfdevsoundcustominterfaceextensions.h>
#include "ciextnserverpluginwrapper.h"
// Forward declarations
--- a/inc/AudioOutputProxyAO.h Fri Mar 12 15:50:33 2010 +0200
+++ b/inc/AudioOutputProxyAO.h Mon Mar 15 12:46:07 2010 +0200
@@ -60,6 +60,15 @@
* @return void
*/
void SetRegisterFlag(TBool aFlag);
+
+ /**
+ * ?member_description.
+ * @since Series 60 3.0
+ * @param aObserver Observer Instance
+ * @return void
+ */
+ void SetObserver(MAudioOutputObserver& aObserver);
+
private:
@@ -89,7 +98,7 @@
CAudioOutput* iAudioOutputProxy;
MCustomCommand* iCustomCommandUtility;
TPckgBuf<CAudioOutput::TAudioOutputPreference> iCallbackData;
- MAudioOutputObserver& iObserver;
+ MAudioOutputObserver* iObserver;
const TMMFMessageDestinationPckg* iDestination;
TInt iFunction;
TBool iRegistered;
--- a/mdfdevvideoextensions/nga_mdf_postprocessor/src/NGAPostProcHwDevice.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/mdfdevvideoextensions/nga_mdf_postprocessor/src/NGAPostProcHwDevice.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -1197,7 +1197,7 @@
if(err)
{
PP_DEBUG(_L("CNGAPostProcHwDevice[%x]:MmvbmGetBufferL() Surface Setup Failed %d"), this, err);
- return NULL;
+ User::Leave(err);
}
}
--- a/mm_plat/audio_routing_api/tsrc/AudioRoutingTestClass/group/AudioRoutingTestClass.mmp Fri Mar 12 15:50:33 2010 +0200
+++ b/mm_plat/audio_routing_api/tsrc/AudioRoutingTestClass/group/AudioRoutingTestClass.mmp Mon Mar 15 12:46:07 2010 +0200
@@ -48,6 +48,7 @@
OS_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
SYSTEMINCLUDE /epoc32/include/mmf/common
SYSTEMINCLUDE /epoc32/include/mmf/server
--- a/mm_pub/audio_effects_api/tsrc/AudioEffectTestModule/group/AudioEffectTestModule.mmp Fri Mar 12 15:50:33 2010 +0200
+++ b/mm_pub/audio_effects_api/tsrc/AudioEffectTestModule/group/AudioEffectTestModule.mmp Mon Mar 15 12:46:07 2010 +0200
@@ -45,6 +45,7 @@
OS_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
SYSTEMINCLUDE /epoc32/include/mmf/common
SYSTEMINCLUDE /epoc32/include/mmf/server
--- a/mm_pub/audio_effects_presets_api/tsrc/EffectPresetsTest/group/EffectPresetsTest.mmp Fri Mar 12 15:50:33 2010 +0200
+++ b/mm_pub/audio_effects_presets_api/tsrc/EffectPresetsTest/group/EffectPresetsTest.mmp Mon Mar 15 12:46:07 2010 +0200
@@ -45,6 +45,7 @@
OS_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
SYSTEMINCLUDE /epoc32/include/mmf/common
SYSTEMINCLUDE /epoc32/include/mmf/server
--- a/mm_pub/drm_audio_player_api/tsrc/DRMAudioPlay/group/DRMAudioPlay.mmp Fri Mar 12 15:50:33 2010 +0200
+++ b/mm_pub/drm_audio_player_api/tsrc/DRMAudioPlay/group/DRMAudioPlay.mmp Mon Mar 15 12:46:07 2010 +0200
@@ -49,7 +49,7 @@
MW_LAYER_SYSTEMINCLUDE
SYSTEMINCLUDE /epoc32/include/ecom
SYSTEMINCLUDE /epoc32/include/mmf/common
-SYSTEMINCLUDE /epoc32/include/caf
+//SYSTEMINCLUDE /epoc32/include/caf
LIBRARY euser.lib
LIBRARY stiftestinterface.lib
--- a/mm_pub/drm_audio_player_api/tsrc/DRMAudioPlay/inc/DRMAudioPlay.h Fri Mar 12 15:50:33 2010 +0200
+++ b/mm_pub/drm_audio_player_api/tsrc/DRMAudioPlay/inc/DRMAudioPlay.h Mon Mar 15 12:46:07 2010 +0200
@@ -38,7 +38,7 @@
#include "UrlParameters.h"
#include <f32file.h>
#include <s32file.h>
-#include <mmcaf.h>
+#include <mmf/common/mmcaf.h>
const TInt KErrConfigInvalid = KErrNone; //-1100;
--- a/mm_pub/drm_audio_player_api/tsrc/DRMAudioPlay/src/DRMAudioPlay_core.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/mm_pub/drm_audio_player_api/tsrc/DRMAudioPlay/src/DRMAudioPlay_core.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -18,9 +18,9 @@
// INCLUDE FILES
#include <StifTestInterface.h>
#include "DRMAudioPlay.h"
-#include <caf.h>
-#include <supplier.h>
-#include <importfile.h>
+#include <caf/caf.h>
+#include <caf/supplier.h>
+#include <caf/importfile.h>
#include <oma2agent.h>
#include <BAUTILS.H>
--- a/mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterbody.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterbody.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -220,8 +220,10 @@
{
timePlayed = endTime-iStartTime;
}
- TUint32 bytesPlayed = (timePlayed*iPlayData.iSampleRate*KBytesPerSample)/iFCFrequency;
- currentBytesPlayed = iBytesPlayed+bytesPlayed;
+ TUint64 bytesPlayed = iPlayData.iSampleRate*KBytesPerSample; //A TUint64 is used because during the multiplying segment of the calculation we regularly overflow what a TUint32 can handle
+ bytesPlayed = (bytesPlayed * timePlayed)/iFCFrequency; //The division brings it back into TUint32 territory, however. We cannot do this before the multiplication without risking significant loss of accuracy
+
+ currentBytesPlayed = iBytesPlayed+I64LOW(bytesPlayed);
#ifdef SYMBIAN_SOUNDADAPTER_DEBUG
RDebug::Printf("EstimatedBytesPlayed[%d] Driver's bytesPlayed[%d]", currentBytesPlayed, iBytesPlayed);
#endif
--- a/mmlibs/mmfw/MMPFiles/client/MediaClientVideo.mmp Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/MMPFiles/client/MediaClientVideo.mmp Mon Mar 15 12:46:07 2010 +0200
@@ -42,6 +42,10 @@
source mediaclientvideodisplaybody.cpp
source mediaclientextdisplayinterface.cpp
source mediaclientextdisplayhandler.cpp
+source mediaclientwseventobserver.cpp
+source mediaclientpolicyserverclient.cpp
+source mediaclientpolicyserversession.cpp
+
#endif
source mmfclientvideoplayerbody.cpp
--- a/mmlibs/mmfw/MMPFiles/client/mediaclientvideodisplay.mmp Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/MMPFiles/client/mediaclientvideodisplay.mmp Mon Mar 15 12:46:07 2010 +0200
@@ -37,6 +37,9 @@
source mediaclientvideodisplaybody.cpp
source mediaclientextdisplayinterface.cpp
source mediaclientextdisplayhandler.cpp
+source mediaclientwseventobserver.cpp
+source mediaclientpolicyserverclient.cpp
+source mediaclientpolicyserversession.cpp
library ws32.lib
library euser.lib
--- a/mmlibs/mmfw/inc/mmf/common/MmfPanicCodes.h Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/inc/mmf/common/MmfPanicCodes.h Mon Mar 15 12:46:07 2010 +0200
@@ -117,7 +117,10 @@
EMMFFilePanicBufferFilledLNotSupported,
/** Panic code raised if the file is already open.
*/
- EMMFFileAlreadyOpen
+ EMMFFileAlreadyOpen,
+ /** Panic code raised if the file Handle is NULL.
+ */
+ EMMFFileHandleNULL
};
/**
--- a/mmlibs/mmfw/inc/mmf/server/mmfdatasink.h Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/inc/mmf/server/mmfdatasink.h Mon Mar 15 12:46:07 2010 +0200
@@ -222,7 +222,7 @@
@param aType
The source type UID.
*/
- MDataSink(TUid aType): iDataSinkType(aType) {}
+ MDataSink(TUid aType): iDataSinkType(aType),iDtor_ID_Key(TUid::Null()) {}
private:
TUid iDataSinkType;
--- a/mmlibs/mmfw/src/Client/Video/mediaclientextdisplayhandler.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/src/Client/Video/mediaclientextdisplayhandler.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -54,6 +54,8 @@
iRootWindow = RWindowGroup(iWs);
User::LeaveIfError(iRootWindow.Construct((TUint32)this, ETrue));
+ DEBUG_PRINTF2("CMediaClientExtDisplayHandler::ConstructL RWindowGroupId %d", iRootWindow.WindowGroupId());
+
DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL RWindow Create");
iExternalDisplayWindow = RWindow(iWs);
User::LeaveIfError(iExternalDisplayWindow.Construct(iRootWindow,((TUint32)(this)) + 1));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mmlibs/mmfw/src/Client/Video/mediaclientpolicyserverclient.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -0,0 +1,124 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "mediaclientpolicyserverclient.h"
+#include <e32std.h>
+#include "mediaclientvideotrace.h"
+
+CMediaClientPolicyServerClient* CMediaClientPolicyServerClient::NewL()
+ {
+ DEBUG_PRINTF("CMediaClientPolicyServerClient::NewL +++");
+
+ CMediaClientPolicyServerClient* self = new( ELeave ) CMediaClientPolicyServerClient();
+
+ DEBUG_PRINTF("CMediaClientPolicyServerClient::NewL ---");
+ return self;
+ }
+
+CMediaClientPolicyServerClient::~CMediaClientPolicyServerClient()
+ {
+ DEBUG_PRINTF("CMediaClientPolicyServerClient::~CMediaClientPolicyServerClient +++");
+ iSession.Close();
+ DEBUG_PRINTF("CMediaClientPolicyServerClient::~CMediaClientPolicyServerClient ---");
+ }
+
+void CMediaClientPolicyServerClient::SetSurface(const TSurfaceId& aSurfaceId)
+ {
+ DEBUG_PRINTF("CMediaClientPolicyServerClient::SetSurface +++");
+
+ if( aSurfaceId.IsNull() )
+ {
+ DEBUG_PRINTF("CMediaClientPolicyServerClient::SetSurface NULL SurfaceId received");
+ }
+ else
+ {
+ iSurfaceId = aSurfaceId;
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::SetSurface - SurfaceId 0 0x%x", iSurfaceId.iInternal[0]);
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::SetSurface - SurfaceId 1 0x%x", iSurfaceId.iInternal[1]);
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::SetSurface - SurfaceId 2 0x%x", iSurfaceId.iInternal[2]);
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::SetSurface - SurfaceId 3 0x%x", iSurfaceId.iInternal[3]);
+ }
+
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::SetSurface ---");
+ }
+
+void CMediaClientPolicyServerClient::FocusChanged(TBool aForeground)
+ {
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::FocusChanged +++");
+
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - SurfaceId 0 0x%x", iSurfaceId.iInternal[0]);
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - SurfaceId 1 0x%x", iSurfaceId.iInternal[1]);
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - SurfaceId 2 0x%x", iSurfaceId.iInternal[2]);
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - SurfaceId 3 0x%x", iSurfaceId.iInternal[3]);
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - Focus %d", aForeground);
+
+ if( iSurfaceId.IsNull() )
+ {
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::FocusChanged SurfaceId is NULL ... ignore focus change event");
+ }
+ else
+ {
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::FocusChanged Send focus change event to PS");
+ TFocusSurfaceChangedEvent focusChangedMessage;
+ focusChangedMessage.iSurfaceId = iSurfaceId;
+ focusChangedMessage.iForeground = aForeground;
+ TPckgBuf<TFocusSurfaceChangedEvent> buffer(focusChangedMessage);
+ TIpcArgs messageArguments(&buffer);
+
+ TInt error = iSession.SendMessage(KFocusSurfaceChanged, messageArguments);
+
+ if(error)
+ {
+ DEBUG_PRINTF2(" CMediaClientPolicyServerClient::FocusChanged SendMessage failed, error = %d", error);
+ }
+ }
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::FocusChanged ---");
+ }
+
+TBool CMediaClientPolicyServerClient::IgnoreProcess(TSecureId aId)
+ {
+ DEBUG_PRINTF("CMediaClientPolicyServerClient::IgnoreProcess +++");
+
+ TBool ignore = (
+ (aId == 0x10281EF2) || // aknnfysrv
+ (aId == 0x10207218) || // akncapserver
+ (aId == 0x10003a4a) // eiksrvs
+ );
+
+ DEBUG_PRINTF2("CMediaClientPolicyServerClient::IgnoreProcess --- return %d", ignore);
+ return ignore;
+ }
+
+TInt CMediaClientPolicyServerClient::Connect()
+ {
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::Connect +++");
+ TInt error = iSession.Connect();
+ DEBUG_PRINTF2(" CMediaClientPolicyServerClient::Connect --- return %d", error);
+ return error;
+ }
+
+void CMediaClientPolicyServerClient::Close()
+ {
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::Close +++");
+ iSession.Close();
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::Close ---");
+ }
+
+CMediaClientPolicyServerClient::CMediaClientPolicyServerClient()
+ {
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::CMediaClientPolicyServerClient +++");
+ iSurfaceId = TSurfaceId::CreateNullId();
+ DEBUG_PRINTF(" CMediaClientPolicyServerClient::CMediaClientPolicyServerClient ---");
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mmlibs/mmfw/src/Client/Video/mediaclientpolicyserverclient.h Mon Mar 15 12:46:07 2010 +0200
@@ -0,0 +1,54 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef MEDIACLIENTPOLICYSERVERCLIENT_H
+#define MEDIACLIENTPOLICYSERVERCLIENT_H
+
+#include "mediaclientpolicyserversession.h"
+#include <e32base.h>
+#include <graphics/surface.h>
+
+const TInt KFocusSurfaceChanged = 9; // taken from Policy Server
+
+NONSHARABLE_CLASS(CMediaClientPolicyServerClient) : public CBase
+ {
+private:
+ class TFocusSurfaceChangedEvent
+ {
+ public:
+ TSurfaceId iSurfaceId;
+ TBool iForeground;
+ };
+
+public:
+ static CMediaClientPolicyServerClient* NewL();
+ virtual ~CMediaClientPolicyServerClient();
+
+public:
+ TInt Connect();
+ void Close();
+ void SetSurface(const TSurfaceId& aSurfaceId);
+ void FocusChanged(TBool aForeground);
+ TBool IgnoreProcess(TSecureId aId);
+
+private:
+ CMediaClientPolicyServerClient();
+
+private:
+ RMediaClientPolicyServerSession iSession;
+ TSurfaceId iSurfaceId;
+ };
+
+#endif // MEDIACLIENTPOLICYSERVERCLIENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mmlibs/mmfw/src/Client/Video/mediaclientpolicyserversession.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -0,0 +1,119 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "mediaclientpolicyserversession.h"
+#include <e32std.h>
+#include "mediaclientvideotrace.h"
+
+// Policy Server EXE name
+_LIT( KIvePolicyServerImg, "ivepolicyserver" );
+
+// Policy Server thread name
+_LIT( KIvePolicyServerName, "!ivepolicyserver0x10204C27" );
+
+// Number of asynchronous message slots
+const TInt KIveAsyncMessageSlots = 1;
+
+static TInt StartServer()
+ {
+ DEBUG_PRINTF("medialclientsession StartServer +++");
+
+ RProcess server;
+ TInt error = server.Create(KIvePolicyServerImg, KNullDesC);
+ if (error != KErrNone)
+ {
+ DEBUG_PRINTF2("medialclientsession StartServer server creation failed %d", error);
+ return error;
+ }
+
+ TRequestStatus status;
+
+ server.Rendezvous(status);
+ if (status != KRequestPending)
+ {
+ server.Kill( 0 );
+ // abort startup
+ }
+ else
+ {
+ server.Resume();
+ // logon OK - start the server
+ }
+
+ User::WaitForRequest(status);
+ // wait for start or death
+ error = (server.ExitType() == EExitPanic) ? KErrGeneral : status.Int();
+ server.Close();
+
+ DEBUG_PRINTF(" medialclientsession StartServer ---");
+ return error;
+ }
+
+RMediaClientPolicyServerSession::RMediaClientPolicyServerSession():
+ RSessionBase()
+ {
+ DEBUG_PRINTF(" RMediaClientPolicyServerSession::RMediaClientPolicyServerSession +++");
+ DEBUG_PRINTF(" RMediaClientPolicyServerSession::RMediaClientPolicyServerSession ---");
+ }
+
+TInt RMediaClientPolicyServerSession::Connect()
+ {
+ DEBUG_PRINTF(" RMediaClientPolicyServerSession::Connect +++");
+
+ TInt error = KErrNone;
+ for (TInt i = 0; i < 2; i++)
+ {
+ // Try to create session.
+ error = CreateSession(KIvePolicyServerName, TVersion( 0, 0, 0 ), KIveAsyncMessageSlots);
+
+ if (error != KErrNotFound && error != KErrServerTerminated)
+ {
+ DEBUG_PRINTF("RMediaClientPolicyServerSession::Connect Server found and session created.");
+ DEBUG_PRINTF2("RMediaClientPolicyServerSession::Connect --- returns %d", error);
+ return error;
+ }
+
+ // If session failed, try to start server once.
+ if (i == 0)
+ {
+ DEBUG_PRINTF("RMediaClientPolicyServerSession::Connect StartServer");
+ // Start server
+ error = StartServer();
+ if (error != KErrNone && error != KErrAlreadyExists)
+ {
+ DEBUG_PRINTF("RMediaClientPolicyServerSession::Connect Server startup failed.");
+ DEBUG_PRINTF2("RMediaClientPolicyServerSession::Connect --- returns %d", error);
+ return error;
+ }
+ }
+ else
+ {
+ DEBUG_PRINTF2("RMediaClientPolicyServerSession::Connect Session creation failed error %d", error);
+ }
+ }
+
+ DEBUG_PRINTF2("RMediaClientPolicyServerSession::Connect --- returns %d", error);
+ return error;
+ }
+
+TInt RMediaClientPolicyServerSession::SendMessage( TInt aFunction, const TIpcArgs &aArgs ) const
+ {
+ DEBUG_PRINTF("RMediaClientPolicyServerSession::SendMessage +++");
+
+ TInt error = SendReceive( aFunction, aArgs );
+
+ DEBUG_PRINTF2("RMediaClientPolicyServerSession::SendMessage --- returns %d", error);
+ return error;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mmlibs/mmfw/src/Client/Video/mediaclientpolicyserversession.h Mon Mar 15 12:46:07 2010 +0200
@@ -0,0 +1,37 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#ifndef MEDIACLIENTPOLICYSERVERSESSION_H
+#define MEDIACLIENTPOLICYSERVERSESSION_H
+
+#include <e32std.h>
+
+/**
+ @file
+ @internalComponent
+
+*/
+class RMediaClientPolicyServerSession : public RSessionBase
+ {
+public:
+
+ RMediaClientPolicyServerSession();
+
+ TInt Connect();
+ TInt SendMessage( TInt aFunction, const TIpcArgs &aArgs ) const;
+ };
+
+#endif // MEDIACLIENTPOLICYSERVERSESSION_H
+
--- a/mmlibs/mmfw/src/Client/Video/mediaclientvideodisplaybody.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/src/Client/Video/mediaclientvideodisplaybody.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -15,6 +15,7 @@
#include "mediaclientvideodisplaybody.h"
#include "mediaclientvideotrace.h"
+#include "mediaclientpolicyserverclient.h"
#include <surfaceeventhandler.h>
#include <mmf/plugin/mmfmediaclientextdisplayinterface.hrh>
#include <e32cmn.h>
@@ -62,15 +63,36 @@
SetWindowArrayPtr2Client();
- CreateExtDisplayPluginL();
-
- // Try and enable display switching by default. If this leaves then do so quietly.
- // Either the client has no scheduler installed or the device does not support external
- // switching (i.e. no plugin was found)
- TRAPD(err, SetExternalDisplaySwitchingL(aExtDisplaySwitchingControl));
- err = err; // remove compile warning
- DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ConstructL SetExternalDisplaySwitchingL returned with %d", err);
-
+ // External display switching and wserv events are only possible if there is
+ // an active scheduler in client thread
+ if(CActiveScheduler::Current())
+ {
+ CreateExtDisplayPluginL();
+ iWsEventObserver = CMediaClientWsEventObserver::NewL(*this);
+
+ iServerClient = CMediaClientPolicyServerClient::NewL();
+ if(iServerClient->Connect() != KErrNone)
+ {
+ delete iServerClient;
+ iServerClient = NULL;
+ }
+
+ if(IsSurfaceCreated() && iServerClient)
+ {
+ iServerClient->SetSurface(iSurfaceId);
+ }
+
+ // Try and enable display switching by default. If this leaves then do so quietly.
+ // Either the client has no scheduler installed or the device does not support external
+ // switching (i.e. no plugin was found)
+ TRAPD(err, SetExternalDisplaySwitchingL(aExtDisplaySwitchingControl));
+ err = err; // remove compile warning
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::ConstructL SetExternalDisplaySwitchingL returned with %d", err);
+ }
+ else
+ {
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL No CActiveScheduler - ext display and focus features disabled ");
+ }
DEBUG_PRINTF("CMediaClientVideoDisplayBody::ConstructL ---");
}
@@ -106,6 +128,10 @@
RemoveExtDisplayPlugin();
REComSession::FinalClose();
+ delete iWsEventObserver;
+
+ delete iServerClient;
+
DEBUG_PRINTF("CMediaClientVideoDisplayBody::~CMediaClientVideoDisplayBody ---");
}
@@ -129,7 +155,7 @@
void CMediaClientVideoDisplayBody::AddDisplayWindowL(const RWindowBase* aWindow, const TRect& aClipRect, const TRect& aCropRegion, const TRect& aVideoExtent,
TReal32 aScaleWidth, TReal32 aScaleHeight, TVideoRotation aRotation,
TAutoScaleType aAutoScaleType, TInt aHorizPos, TInt aVertPos, RWindow* aWindow2)
- {
+ {
DEBUG_PRINTF("CMediaClientVideoDisplayBody::AddDisplayWindowL +++");
DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL - aWindow WsHandle 0x%X", aWindow->WsHandle());
DEBUG_PRINTF5("CMediaClientVideoDisplayBody::AddDisplayWindowL - aClipRect %d,%d - %d,%d", aClipRect.iTl.iX, aClipRect.iTl.iY, aClipRect.iBr.iX, aClipRect.iBr.iY);
@@ -152,24 +178,25 @@
iCropRegion = aCropRegion;
+ TBool prevClientWindowIsInFocus = iClientWindowIsInFocus;
+ UpdateFocus();
+
if (IsSurfaceCreated())
{
- // first client window just added
- if((iClientWindows.Count() == 1) && iClientRequestedExtDisplaySwitching)
+ // if first window was just added OR the new window has moved us from out of focus to in focus
+ if(((iClientWindows.Count() == 1) || !prevClientWindowIsInFocus) && iClientRequestedExtDisplaySwitching &&
+ iClientWindowIsInFocus && iExtDisplayConnected)
{
- if(iExtDisplayConnected)
+ TRAPD(err, CreateExtDisplayHandlerL());
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL CreateExtDisplayHandlerL error %d", err);
+ if(err == KErrNone)
{
- TRAPD(err, CreateExtDisplayHandlerL());
- DEBUG_PRINTF2("CMediaClientVideoDisplayBody::AddDisplayWindowL CreateExtDisplayHandlerL error %d", err);
- if(err == KErrNone)
- {
- SetWindowArrayPtr2Ext();
- User::LeaveIfError(RedrawWindows(aCropRegion));
- }
+ SetWindowArrayPtr2Ext();
+ User::LeaveIfError(RedrawWindows(aCropRegion));
}
}
- if(!iExtDisplayConnected || !iExtDisplayHandler)
+ if(!iSwitchedToExternalDisplay)
{
User::LeaveIfError(SetBackgroundSurface(winData, aCropRegion));
}
@@ -190,25 +217,32 @@
TInt pos = iClientWindows.Find(aWindow.WsHandle(), TWindowData::CompareByWsHandle);
if (pos >= 0)
- {
- if (IsSurfaceCreated() && (!iExtDisplayConnected || !iExtDisplayHandler))
- {
- iClientWindows[pos].iWindow->RemoveBackgroundSurface(ETrue);
+ {
+ if(IsSurfaceCreated() && !iSwitchedToExternalDisplay)
+ {
+ iClientWindows[pos].iWindow->RemoveBackgroundSurface(ETrue);
// Make sure all window rendering has completed before proceeding
RWsSession* ws = iClientWindows[pos].iWindow->Session();
if (ws)
- {
- ws->Finish();
- }
- }
- iClientWindows.Remove(pos);
-
- if(iClientWindows.Count() == 0 && iExtDisplayConnected && iExtDisplayHandler)
- {
- RemoveBackgroundSurface(ETrue);
- SetWindowArrayPtr2Client();
- RemoveExtDisplayHandler();
- }
+ {
+ ws->Finish();
+ }
+ }
+
+ iClientWindows.Remove(pos);
+
+ TBool prevClientWindowIsInFocus = iClientWindowIsInFocus;
+ UpdateFocus();
+
+ // if only window was just removed OR removal has moved us from in focus to out of focus
+ if((iClientWindows.Count() == 0 || prevClientWindowIsInFocus) && iSwitchedToExternalDisplay &&
+ !iClientWindowIsInFocus)
+ {
+ RemoveBackgroundSurface(ETrue);
+ SetWindowArrayPtr2Client();
+ RemoveExtDisplayHandler();
+ RedrawWindows(iCropRegion);
+ }
}
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveDisplayWindow ---");
@@ -235,13 +269,18 @@
iAspectRatio = aAspectRatio;
iCropRegion = aCropRegion;
+ if(iServerClient)
+ {
+ iServerClient->SetSurface(iSurfaceId);
+ }
+
if (emitEvent && iEventHandler)
{
iEventHandler->MmsehSurfaceCreated(iDisplayId, iSurfaceId, iCropRect, iAspectRatio);
}
TInt err = KErrNone;
- if((iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching)
+ if((iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching && iClientWindowIsInFocus)
{
if(iExtDisplayConnected && !iExtDisplayHandler)
{
@@ -296,7 +335,7 @@
iSurfaceId = TSurfaceId::CreateNullId();
- if(iExtDisplayConnected && iExtDisplayHandler)
+ if(iSwitchedToExternalDisplay)
{
SetWindowArrayPtr2Client();
RemoveExtDisplayHandler();
@@ -374,7 +413,7 @@
{
if(prevCropRegion == aCropRegion)
{
- if(!iExtDisplayConnected || !iExtDisplayHandler)
+ if(!iSwitchedToExternalDisplay)
{
User::LeaveIfError(SetBackgroundSurface(iClientWindows[aPos], aCropRegion));
}
@@ -486,13 +525,13 @@
iClientWindows[i].iAutoScaleType = aScaleType;
iClientWindows[i].iHorizPos = aHorizPos;
iClientWindows[i].iVertPos = aVertPos;
- if (IsSurfaceCreated() && (!iExtDisplayConnected || !iExtDisplayHandler))
+ if (IsSurfaceCreated() && !iSwitchedToExternalDisplay)
{
User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion));
}
}
- if (IsSurfaceCreated() && iExtDisplayConnected && iExtDisplayHandler && (aCropRegion != prevCropRegion))
+ if (IsSurfaceCreated() && iSwitchedToExternalDisplay && (aCropRegion != prevCropRegion))
{
User::LeaveIfError(RedrawWindows(aCropRegion));
}
@@ -513,13 +552,13 @@
for (TInt i = 0; i < count; ++i)
{
iClientWindows[i].iRotation = aRotation;
- if (IsSurfaceCreated() && (!iExtDisplayConnected || !iExtDisplayHandler))
+ if (IsSurfaceCreated() && !iSwitchedToExternalDisplay)
{
User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion));
}
}
- if (IsSurfaceCreated() && iExtDisplayConnected && iExtDisplayHandler && (aCropRegion != prevCropRegion))
+ if (IsSurfaceCreated() && iSwitchedToExternalDisplay && (aCropRegion != prevCropRegion))
{
User::LeaveIfError(RedrawWindows(aCropRegion));
}
@@ -547,13 +586,13 @@
iClientWindows[i].iScaleWidth = aWidthPercentage;
iClientWindows[i].iScaleHeight = aHeightPercentage;
iClientWindows[i].iAutoScaleType = EAutoScaleNone;
- if (IsSurfaceCreated() && (!iExtDisplayConnected || !iExtDisplayHandler))
+ if (IsSurfaceCreated() && !iSwitchedToExternalDisplay)
{
User::LeaveIfError(SetBackgroundSurface(iClientWindows[i], aCropRegion));
}
}
- if (IsSurfaceCreated() && iExtDisplayConnected && iExtDisplayHandler && (aCropRegion != prevCropRegion))
+ if (IsSurfaceCreated() && iSwitchedToExternalDisplay && (aCropRegion != prevCropRegion))
{
User::LeaveIfError(RedrawWindows(aCropRegion));
}
@@ -978,34 +1017,8 @@
if(iClientRequestedExtDisplaySwitching != aControl)
{
- iClientRequestedExtDisplaySwitching = aControl;
-
- DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL SurfaceCreated %d", IsSurfaceCreated());
- DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL Client window count %d", iClientWindows.Count());
- DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL External Display Connected %d", iExtDisplayConnected);
- DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL Client Requested Ext Display Switching %d", iClientRequestedExtDisplaySwitching);
-
- if(IsSurfaceCreated() && (iClientWindows.Count() > 0) && iExtDisplayConnected)
- {
- if(iClientRequestedExtDisplaySwitching)
- {
- TRAPD(err, CreateExtDisplayHandlerL());
- DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL CreateExtDisplayHandlerL error %d", err);
- if(err == KErrNone)
- {
- RemoveBackgroundSurface(ETrue);
- SetWindowArrayPtr2Ext();
- RedrawWindows(iCropRegion);
- }
- }
- else if(iExtDisplayHandler)
- {
- RemoveBackgroundSurface(ETrue);
- RemoveExtDisplayHandler();
- SetWindowArrayPtr2Client();
- RedrawWindows(iCropRegion);
- }
- }
+ iClientRequestedExtDisplaySwitching = aControl;
+ SwitchSurface();
}
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetExternalDisplaySwitchingL ---");
@@ -1018,28 +1031,7 @@
if(iExtDisplayConnected != aExtDisplayConnected)
{
iExtDisplayConnected = aExtDisplayConnected;
-
- if(IsSurfaceCreated() && (iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching)
- {
- if(iExtDisplayConnected)
- {
- TRAPD(err, CreateExtDisplayHandlerL());
- DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MedcpcExtDisplayNotifyConnected CreateExtDisplayHandlerL error %d", err);
- if(err == KErrNone)
- {
- RemoveBackgroundSurface(ETrue);
- SetWindowArrayPtr2Ext();
- RedrawWindows(iCropRegion);
- }
- }
- else if(iExtDisplayHandler)
- {
- RemoveBackgroundSurface(ETrue);
- RemoveExtDisplayHandler();
- SetWindowArrayPtr2Client();
- RedrawWindows(iCropRegion);
- }
- }
+ SwitchSurface();
}
else
{
@@ -1054,6 +1046,7 @@
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client +++");
iWindowsArrayPtr = &iClientWindows;
+ iSwitchedToExternalDisplay = EFalse;
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Client ---");
}
@@ -1063,6 +1056,7 @@
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext +++");
iWindowsArrayPtr = &iExtDisplayWindows;
+ iSwitchedToExternalDisplay = ETrue;
DEBUG_PRINTF("CMediaClientVideoDisplayBody::SetWindowArrayPtr2Ext ---");
}
@@ -1136,3 +1130,108 @@
}
DEBUG_PRINTF("CMediaClientVideoDisplayBody::RemoveExtDisplayPlugin ---");
}
+
+void CMediaClientVideoDisplayBody::MmcweoFocusWindowGroupChanged()
+ {
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::MweocFocusWindowGroupChanged +++");
+
+ TBool prevClientWindowIsInFocus = iClientWindowIsInFocus;
+ UpdateFocus();
+
+ if(prevClientWindowIsInFocus != iClientWindowIsInFocus)
+ {
+ SwitchSurface();
+ }
+
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::MweocFocusWindowGroupChanged ---");
+ }
+
+TBool CMediaClientVideoDisplayBody::MmcweoIgnoreProcess(TSecureId aId)
+ {
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::MmcweoIgnoreProcess +++");
+
+ TBool ignore = ETrue;
+ if (iServerClient)
+ {
+ ignore = iServerClient->IgnoreProcess(aId);
+ }
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MmcweoIgnoreProcess --- return %d", ignore);
+ return ignore;
+ }
+
+void CMediaClientVideoDisplayBody::UpdateFocus()
+ {
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus +++");
+
+ if(!iWsEventObserver)
+ {
+ iClientWindowIsInFocus = ETrue;
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus Event Observer is NULL");
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus ---");
+ return;
+ }
+
+ TBool prevClientWindowIsInFocus = iClientWindowIsInFocus;
+
+ TInt focusGroupId;
+ if(iWsEventObserver->FocusWindowGroupId(focusGroupId) == KErrNone)
+ {
+ iClientWindowIsInFocus = EFalse;
+ TInt count = iClientWindows.Count();
+ for(TInt i = 0; i < count; i++)
+ {
+ if(iClientWindows[i].iWindow->WindowGroupId() == focusGroupId)
+ {
+ iClientWindowIsInFocus = ETrue;
+ break;
+ }
+ }
+ }
+ else
+ {
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus Error retrieving focus WgId from observer");
+ iClientWindowIsInFocus = ETrue;
+ }
+
+ if(iServerClient && (prevClientWindowIsInFocus != iClientWindowIsInFocus))
+ {
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::MweocFocusWindowGroupChanged calling server, focus %d", iClientWindowIsInFocus);
+ iServerClient->FocusChanged(iClientWindowIsInFocus);
+ }
+
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::UpdateFocus Client window in focus %d", iClientWindowIsInFocus);
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::UpdateFocus ---");
+ }
+
+void CMediaClientVideoDisplayBody::SwitchSurface()
+ {
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::SwitchSurface +++");
+
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface SurfaceCreated %d", IsSurfaceCreated());
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface Client window count %d", iClientWindows.Count());
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface Client Requested Ext Display Switching %d", iClientRequestedExtDisplaySwitching);
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface Client Window in Focus %d", iClientWindowIsInFocus);
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface External Display Connected %d", iExtDisplayConnected);
+
+ if(IsSurfaceCreated() && (iClientWindows.Count() > 0) && iClientRequestedExtDisplaySwitching &&
+ iClientWindowIsInFocus && iExtDisplayConnected)
+ {
+ TRAPD(err, CreateExtDisplayHandlerL());
+ DEBUG_PRINTF2("CMediaClientVideoDisplayBody::SwitchSurface CreateExtDisplayHandlerL error %d", err);
+ if(err == KErrNone)
+ {
+ RemoveBackgroundSurface(ETrue);
+ SetWindowArrayPtr2Ext();
+ RedrawWindows(iCropRegion);
+ }
+ }
+ else if(iSwitchedToExternalDisplay)
+ {
+ RemoveBackgroundSurface(ETrue);
+ RemoveExtDisplayHandler();
+ SetWindowArrayPtr2Client();
+ RedrawWindows(iCropRegion);
+ }
+
+ DEBUG_PRINTF("CMediaClientVideoDisplayBody::SwitchSurface ---");
+ }
--- a/mmlibs/mmfw/src/Client/Video/mediaclientvideodisplaybody.h Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/src/Client/Video/mediaclientvideodisplaybody.h Mon Mar 15 12:46:07 2010 +0200
@@ -17,6 +17,7 @@
#define MEDIACLIENTVIDEODISPLAYBODY_H
#include "mediaclientextdisplayhandler.h"
+#include "mediaclientwseventobserver.h"
#include <graphics/surface.h>
#include <graphics/surfaceconfiguration.h>
#include <mmf/common/mmfvideosurfacecustomcommands.h>
@@ -24,13 +25,15 @@
#include <mmf/plugin/mmfmediaclientextdisplayinterface.h>
class MMMFSurfaceEventHandler;
+class CMediaClientPolicyServerClient;
/**
@internalTechnology
@released
*/
-NONSHARABLE_CLASS(CMediaClientVideoDisplayBody) : public CBase, public MExtDisplayConnectionProviderCallback
+NONSHARABLE_CLASS(CMediaClientVideoDisplayBody) : public CBase, public MExtDisplayConnectionProviderCallback,
+public MMediaClientWsEventObserverCallback
{
private:
NONSHARABLE_CLASS(TWindowData)
@@ -143,8 +146,6 @@
TInt SetBackgroundSurface(TWindowData& aWindowData, const TRect& aCropRegion);
TBool HasWindows() const;
- void MedcpcExtDisplayNotifyConnected(TBool aExtDisplayConnected);
-
void UpdateCropRegionL(const TRect& aCropRegion, TInt aPos);
void CreateExtDisplayPluginL();
void RemoveExtDisplayPlugin();
@@ -152,6 +153,15 @@
void RemoveExtDisplayHandler();
void SetWindowArrayPtr2Client();
void SetWindowArrayPtr2Ext();
+ void SwitchSurface();
+ void UpdateFocus();
+
+ // MExtDisplayConnectionProviderCallback
+ void MedcpcExtDisplayNotifyConnected(TBool aExtDisplayConnected);
+
+ // MMediaClientWsEventObserverCallback
+ void MmcweoFocusWindowGroupChanged();
+ TBool MmcweoIgnoreProcess(TSecureId aId);
private:
@@ -164,14 +174,19 @@
RArray<TWindowData> iClientWindows;
RArray<TWindowData> iExtDisplayWindows;
RArray<TWindowData>* iWindowsArrayPtr;
+ TBool iSwitchedToExternalDisplay;
TRect iCropRegion;
TBool iClientRequestedExtDisplaySwitching;
CExtDisplayConnectionProviderInterface* iExtDisplayConnectionProvider;
CMediaClientExtDisplayHandler* iExtDisplayHandler;
+ CMediaClientWsEventObserver* iWsEventObserver;
+ TBool iClientWindowIsInFocus;
TBool iExtDisplayConnected;
TBool iExtDisplaySwitchingSupported;
+ CMediaClientPolicyServerClient* iServerClient;
+
friend class CVideoPlayerUtility::CBody;
friend class CTestStepUnitMMFVidClient;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mmlibs/mmfw/src/Client/Video/mediaclientwseventobserver.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -0,0 +1,177 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#include "mediaclientwseventobserver.h"
+#include "mediaclientvideotrace.h"
+
+CMediaClientWsEventObserver* CMediaClientWsEventObserver::NewL(MMediaClientWsEventObserverCallback& aCallback)
+ {
+ DEBUG_PRINTF("CMediaClientWsEventObserver::NewL +++");
+ CMediaClientWsEventObserver* self = new (ELeave) CMediaClientWsEventObserver(aCallback);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ DEBUG_PRINTF("CMediaClientWsEventObserver::NewL ---");
+ return self;
+ }
+
+CMediaClientWsEventObserver::CMediaClientWsEventObserver(MMediaClientWsEventObserverCallback& aCallback) :
+CActive(EPriorityStandard),
+iCallback(aCallback)
+ {
+ DEBUG_PRINTF("CMediaClientWsEventObserver::CMediaClientWsEventObserver +++");
+ DEBUG_PRINTF("CMediaClientWsEventObserver::CMediaClientWsEventObserver ---");
+ }
+
+void CMediaClientWsEventObserver::ConstructL()
+ {
+ DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL +++");
+
+ DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL RWsSession Connect");
+ TInt err = iWs.Connect();
+ if (err != KErrNone)
+ {
+ DEBUG_PRINTF2("CMediaClientWsEventObserver::ConstructL Windows Server unavailable, err %d", err);
+ User::Leave(err);
+ }
+
+ DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL RWindowGroup Create");
+ iWindowGroup = RWindowGroup(iWs);
+ User::LeaveIfError(iWindowGroup.Construct((TUint32)this, EFalse));
+
+ // Send created window to the background and hide it from the
+ // application switcher
+ iWindowGroup.SetOrdinalPosition( -1, -1000 ); // -1000 = ECoeWinPriorityNeverAtFront
+
+ DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL RWindowGroup EnableFocusChangeEvents");
+ User::LeaveIfError(iWindowGroup.EnableFocusChangeEvents());
+
+ UpdateFocusWindowGroupId(ETrue);
+ DEBUG_PRINTF3("CMediaClientWsEventObserver::ConstructL Initial WgId %d Error %d", iWgId, iWgIdError);
+
+ CActiveScheduler::Add(this);
+
+ // register with window server to receive focus change notifications
+ DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL iWs.EventReady()");
+ iWs.EventReady(&iStatus);
+
+ DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL SetActive()");
+ SetActive();
+
+ DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL ---");
+ }
+
+CMediaClientWsEventObserver::~CMediaClientWsEventObserver()
+ {
+ DEBUG_PRINTF("CMediaClientWsEventObserver::~CMediaClientWsEventObserver +++");
+
+ Cancel();
+
+ iWindowGroup.Close();
+
+ iWs.Close();
+
+ DEBUG_PRINTF("CMediaClientWsEventObserver::~CMediaClientWsEventObserver ---");
+ }
+
+TInt CMediaClientWsEventObserver::FocusWindowGroupId(TInt& aFocusGroupId)
+ {
+ DEBUG_PRINTF("CMediaClientWsEventObserver::FocusWindowGroupId +++");
+ aFocusGroupId = iWgId;
+ DEBUG_PRINTF3("CMediaClientWsEventObserver::FocusWindowGroupId --- WgId %d, Error %d", iWgId, iWgIdError);
+ return iWgIdError;
+ }
+
+void CMediaClientWsEventObserver::UpdateFocusWindowGroupId(TBool aConstruction)
+ {
+ DEBUG_PRINTF2("CMediaClientWsEventObserver::UpdateFocusWindowGroupId +++, construction %d", aConstruction);
+
+ TInt wgId = iWs.GetFocusWindowGroup();
+ DEBUG_PRINTF2("CMediaClientWsEventObserver::UpdateFocusWindowGroupId id %d ", wgId);
+
+ // get the thread that owns windowgroup id
+ TThreadId threadId;
+ iWgIdError = iWs.GetWindowGroupClientThreadId(wgId, threadId);
+ if(iWgIdError != KErrNone)
+ {
+ DEBUG_PRINTF2("CMediaClientWsEventObserver::UpdateFocusWindowGroupId --- Get Thread Id error %d", iWgIdError);
+ return;
+ }
+
+ RThread thread;
+ iWgIdError = thread.Open(threadId);
+ if(iWgIdError != KErrNone)
+ {
+ DEBUG_PRINTF2("CMediaClientWsEventObserver::UpdateFocusWindowGroupId --- Open thread error %d", iWgIdError);
+ return;
+ }
+
+ TSecureId fgThreadId = thread.SecureId();
+ thread.Close();
+
+ if(iCallback.MmcweoIgnoreProcess(fgThreadId))
+ {
+ // If ignore returns ETrue during construction the previous value of iWgId does not contain a valid id. It is 0.
+ // This is an error case so set error flag accordingly.
+ if(aConstruction)
+ {
+ iWgIdError = KErrNotSupported;
+ }
+ }
+ else
+ {
+ iWgId = wgId;
+ }
+
+ DEBUG_PRINTF("CMediaClientWsEventObserver::UpdateFocusWindowGroupId --- ");
+ }
+
+void CMediaClientWsEventObserver::RunL()
+ {
+ DEBUG_PRINTF("CMediaClientWsEventObserver::RunL +++");
+
+ iWs.GetEvent(iEvent);
+
+ DEBUG_PRINTF("CMediaClientWsEventObserver::RunL EventReady()");
+ iWs.EventReady(&iStatus);
+ DEBUG_PRINTF("CMediaClientWsEventObserver::RunL SetActive()");
+ SetActive();
+
+ DEBUG_PRINTF2("CMediaClientWsEventObserver::RunL() Ws event.Type %d", iEvent.Type());
+ if(iEvent.Type() == EEventFocusGroupChanged)
+ {
+ DEBUG_PRINTF("CMediaClientWsEventObserver::RunL Received EEventFocusGroupChanged");
+
+ TInt prevWgId = iWgId;
+ UpdateFocusWindowGroupId(EFalse);
+ if((iWgIdError != KErrNone) || (iWgId != prevWgId))
+ {
+ iCallback.MmcweoFocusWindowGroupChanged();
+ }
+ }
+ else
+ {
+ DEBUG_PRINTF("CMediaClientWsEventObserver::RunL Event Ignored");
+ }
+
+ DEBUG_PRINTF("CMediaClientWsEventObserver::RunL ---");
+ }
+
+void CMediaClientWsEventObserver::DoCancel()
+ {
+ DEBUG_PRINTF("CMediaClientWsEventObserver::DoCancel +++");
+ iWs.EventReadyCancel();
+ DEBUG_PRINTF("CMediaClientWsEventObserver::DoCancel ---");
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mmlibs/mmfw/src/Client/Video/mediaclientwseventobserver.h Mon Mar 15 12:46:07 2010 +0200
@@ -0,0 +1,61 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MEDIACLIENTWSEVENTOBSERVER_H
+#define MEDIACLIENTWSEVENTOBSERVER_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+class MMediaClientWsEventObserverCallback
+ {
+public:
+ virtual void MmcweoFocusWindowGroupChanged() = 0;
+ virtual TBool MmcweoIgnoreProcess(TSecureId aId) = 0;
+ };
+
+NONSHARABLE_CLASS(CMediaClientWsEventObserver) : public CActive
+ {
+public:
+ static CMediaClientWsEventObserver* NewL(MMediaClientWsEventObserverCallback& aCallback);
+ ~CMediaClientWsEventObserver();
+
+ TInt FocusWindowGroupId(TInt& aFocusGroupId);
+
+ // from CActive
+ void RunL();
+ void DoCancel();
+
+private:
+ CMediaClientWsEventObserver(MMediaClientWsEventObserverCallback& aCallback);
+ void ConstructL();
+ void UpdateFocusWindowGroupId(TBool aConstruction);
+
+private:
+ RWsSession iWs;
+ RWindowGroup iWindowGroup;
+ MMediaClientWsEventObserverCallback& iCallback;
+ TWsEvent iEvent;
+ TInt iWgId;
+ TInt iWgIdError;
+ };
+
+#endif // MEDIACLIENTWSEVENTOBSERVER_H
+
--- a/mmlibs/mmfw/src/Plugin/StdSourceAndSink/Mmffile.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/src/Plugin/StdSourceAndSink/Mmffile.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -1032,7 +1032,10 @@
fileOpened = ETrue;
}
if (err == KErrNone)
+ {
+ __ASSERT_DEBUG(iFile != NULL,Panic(EMMFFileHandleNULL));
err = iFile->Size(size);
+ }
if (err)
{
size = 0;
@@ -1043,6 +1046,7 @@
if (fileOpened)
{
+ __ASSERT_DEBUG(iFile != NULL,Panic(EMMFFileHandleNULL));
delete iFile;
iFile = NULL;
iFileSize = -1;
--- a/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/inc/TSU_MMF_DEVSOUND_STEP.h Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/inc/TSU_MMF_DEVSOUND_STEP.h Mon Mar 15 12:46:07 2010 +0200
@@ -1529,6 +1529,7 @@
_LIT(KRecordDataFollowingResume, "RecordDataFollowingResume");
_LIT(KRecordDataPriorToResume, "RecordDataPriorToResume");
_LIT(KCheckForNoDataAfterResume, "CheckForNoDataAfterResume");
+_LIT(KCallResumeAfterResume, "CallResumeAfterResume ");
enum TPanicCodes
{
@@ -1806,6 +1807,7 @@
TBool iRecordDataPriorToResume;
TBool iCheckForNoDataAfterResume;
TBool iInitAfterPauseClause;
+ TBool iResumeAfterResume;
};
/*
--- a/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/scripts/tsu_mmf_devsound_suite_truepause.script Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/scripts/tsu_mmf_devsound_suite_truepause.script Mon Mar 15 12:46:07 2010 +0200
@@ -256,6 +256,32 @@
RUN_TEST_STEP 60000, TSU_MMF_DEVSOUND_SUITE, MM-MMF-DEVSOUND-U-0088-HP, c:\tsu_mmf_truepause_devsound.ini MM-MMF-DEVSOUND-U-0288-HP
TEST_COMPLETE
+//! @SYMTestCaseID MM-MMF-DEVSOUND-U-0388-HP
+//! @SYMREQ REQ11453
+//! REQ11455
+//! @SYMPREQ 1540
+//! @SYMTestCaseDec Resume Record audio - Pause and resume for PCM.
+//! @SYMTestPriority Normal
+//! @SYMTestType Negative Usecase
+//! @SYMTestActions 1. Create a Devsound instance.
+//! 2. Create a CPeriodic instance.
+//! 3. Open the audio files to be recorded and initialize the Devsound instance to record audio(PCM).
+//! 3.1 Wait for InitializeComplete(KErrNone) callback response.
+//! 4. Start the CPeriodic instance.
+//! 5. Call RecodInitL() to start the recording process.
+//! 6. Wait for BufferToBeEmptied(..) callback to retrieve the buffered data from DevSound. To continue receiving BTBE callbacks, is mandatory to call RecordData() method.
+//! 7. On the CPeriodic timer event, use Pause() to temporarily stop the record process.
+//! 7.1 Continue RecordData()/BufferToBeEmptied() loop until last buffer flag is set.
+//! 8. After last buffer is received, call IsResumeSupported(), and Resume() an then Resume() again
+//! 9. On timer event (2s) we should not have received any buffers - if we get a buffer in this time, that is an error
+//! 10. Close file session.
+//! @SYMTestExpectedResults IsResumeSupported() will return ETrue.
+//! Resume()(will return KErrNone) is supported for PCM.
+//! Output is recorded at c:\mm\mmf\testfiles\truepause_devsound_test_data\record_1.raw
+PRINT Resume Record audio - Pause and resume for PCM.
+RUN_TEST_STEP 60000, TSU_MMF_DEVSOUND_SUITE, MM-MMF-DEVSOUND-U-0088-HP, c:\tsu_mmf_truepause_devsound.ini MM-MMF-DEVSOUND-U-0388-HP
+TEST_COMPLETE
+
//! @SYMTestCaseID MM-MMF-DEVSOUND-U-0089-HP
//! @SYMREQ REQ11453
//! REQ11455
--- a/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/scripts/tsu_mmf_truepause_devsound.ini Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/scripts/tsu_mmf_truepause_devsound.ini Mon Mar 15 12:46:07 2010 +0200
@@ -41,6 +41,7 @@
RecordDataFollowingResume = true
RecordDataPriorToResume = false
CheckForNoDataAfterResume = false
+CallResumeAfterResume = false
[MM-MMF-DEVSOUND-U-0188-HP]
Duration = 4
@@ -49,6 +50,7 @@
RecordDataFollowingResume = false
RecordDataPriorToResume = true
CheckForNoDataAfterResume = false
+CallResumeAfterResume = false
[MM-MMF-DEVSOUND-U-0288-HP]
Duration = 4
@@ -57,6 +59,16 @@
RecordDataFollowingResume = false
RecordDataPriorToResume = false
CheckForNoDataAfterResume = true
+CallResumeAfterResume = false
+
+[MM-MMF-DEVSOUND-U-0388-HP]
+Duration = 4
+Filename = c:\mm\mmf\testfiles\truepause_devsound_test_data\record_1.raw
+FourccCode = P16
+RecordDataFollowingResume = false
+RecordDataPriorToResume = false
+CheckForNoDataAfterResume = true
+CallResumeAfterResume = true
[MM-MMF-DEVSOUND-U-0089-HP]
Duration = 4
@@ -127,6 +139,7 @@
RecordDataFollowingResume = true
RecordDataPriorToResume = false
CheckForNoDataAfterResume = false
+CallResumeAfterResume = false
[MM-MMF-DEVSOUND-U-0199-HP]
Filename = c:\mm\mmf\testfiles\truepause_devsound_test_data\cerrodelasilla.raw
--- a/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/src/TSU_MMF_DEVSOUND_STEP.cpp Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/src/TSU_MMF_DEVSOUND_STEP.cpp Mon Mar 15 12:46:07 2010 +0200
@@ -8815,6 +8815,7 @@
iRecordDataPriorToResume = EFalse;
iCheckForNoDataAfterResume = EFalse;
iInitAfterPauseClause = EFalse;
+ iResumeAfterResume = EFalse;
}
RA3FDevSoundTestRecord::~RA3FDevSoundTestRecord()
@@ -9111,7 +9112,11 @@
INFO_PRINTF1(_L("Calling CMMFDevSound::Resume()"));
err = iMMFDevSound->Resume();
}
-
+ if(iResumeAfterResume)
+ {
+ INFO_PRINTF1(_L("Calling CMMFDevSound::Resume()"));
+ err = iMMFDevSound->Resume();
+ }
if (iTestStepName != _L("MM-MMF-DEVSOUND-U-0088-HP"))
{
INFO_PRINTF1(_L("Calling CMMFDevSound::RecordData()"));
@@ -10238,6 +10243,12 @@
StopTest(KErrNotFound, ETestSuiteError);
return;
}
+ if ( !GetBoolFromConfig(iDefaultParamSet, KCallResumeAfterResume, iResumeAfterResume) )
+ {
+ ERR_PRINTF2(KMsgErrorGetParameter, &KCallResumeAfterResume);
+ StopTest(KErrNotFound, ETestSuiteError);
+ return;
+ }
if ( !GetBoolFromConfig(iDefaultParamSet, KCheckForNoDataAfterResume, iCheckForNoDataAfterResume) )
{
ERR_PRINTF2(KMsgErrorGetParameter, &KCheckForNoDataAfterResume);
@@ -11387,6 +11398,12 @@
StopTest(KErrNotFound, ETestSuiteError);
return;
}
+ if ( !GetBoolFromConfig(iDefaultParamSet, KCallResumeAfterResume, iResumeAfterResume) )
+ {
+ ERR_PRINTF2(KMsgErrorGetParameter, &KCallResumeAfterResume);
+ StopTest(KErrNotFound, ETestSuiteError);
+ return;
+ }
if ( !GetBoolFromConfig(iDefaultParamSet, KCheckForNoDataAfterResume, iCheckForNoDataAfterResume) )
{
ERR_PRINTF2(KMsgErrorGetParameter, &KCheckForNoDataAfterResume);
@@ -11468,3 +11485,6 @@
iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
}
+
+
+
--- a/mmlibs/mmfw/tsrc/mmfunittest/MmpFiles/TSU_MMF_VCLNT_01.mmp Fri Mar 12 15:50:33 2010 +0200
+++ b/mmlibs/mmfw/tsrc/mmfunittest/MmpFiles/TSU_MMF_VCLNT_01.mmp Mon Mar 15 12:46:07 2010 +0200
@@ -50,6 +50,9 @@
source ../../../../src/Client/Video/mediaclientvideodisplaybody.cpp
source ../../../../src/Client/Video/mediaclientextdisplayinterface.cpp
source ../../../../src/Client/Video/mediaclientextdisplayhandler.cpp
+source ../../../../src/Client/Video/mediaclientwseventobserver.cpp
+source ../../../../src/Client/Video/mediaclientpolicyserverclient.cpp
+source ../../../../src/Client/Video/mediaclientpolicyserversession.cpp
source teststepvidplayereventhandler.cpp
#endif
#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
@@ -118,6 +121,8 @@
#endif //SYMBIAN_BUILD_GCE
#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
+MACRO __ENABLE_MEDIA_CLIENT_VIDEO_TRACE__
+
NOSTRICTDEF
SMPSAFE