sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "audiobufferprefilltestdevice.h" sl@0: #include "devsoundciutestdevices.hrh" sl@0: sl@0: const TInt32 KTenSeconds = 10000000; // Ten seconds sl@0: sl@0: /* sl@0: CMMFSampleBuffering Implementation sl@0: */ sl@0: CMMFSampleBuffering* CMMFSampleBuffering::NewL() sl@0: { sl@0: CMMFSampleBuffering* self = new(ELeave) CMMFSampleBuffering(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CMMFSampleBuffering::CMMFSampleBuffering() : CActive(0) sl@0: { sl@0: CActiveScheduler::Add(this); sl@0: } sl@0: sl@0: void CMMFSampleBuffering::ConstructL() sl@0: { sl@0: User::LeaveIfError( iTimer.CreateLocal() ); sl@0: } sl@0: sl@0: CMMFSampleBuffering::~CMMFSampleBuffering() sl@0: { sl@0: iTimer.Close(); sl@0: Cancel(); sl@0: } sl@0: sl@0: //Actual implementation of method MmsbEnableSampleBufferingBeforePlayback sl@0: TInt CMMFSampleBuffering::MmsbEnableSampleBufferingBeforePlayback() sl@0: { sl@0: return KErrNone; sl@0: } sl@0: sl@0: //Actual implementation of method MmsbDisableSampleBufferingBeforePlayback sl@0: TInt CMMFSampleBuffering::MmsbDisableSampleBufferingBeforePlayback() sl@0: { sl@0: return KErrNone; sl@0: } sl@0: sl@0: //Actual implementation of method MmsbNotifyPlayStarted sl@0: void CMMFSampleBuffering::MmsbNotifyPlayStarted(TRequestStatus& aStatus) sl@0: { sl@0: // check not already active sl@0: ASSERT(!IsActive()); sl@0: sl@0: iClientStatus = &aStatus; sl@0: *iClientStatus = KRequestPending; sl@0: sl@0: iTimer.After(iStatus, KTenSeconds); sl@0: sl@0: SetActive(); sl@0: } sl@0: sl@0: //Actual implementation of method MmsbCancelNotifyPlayStarted sl@0: void CMMFSampleBuffering::MmsbCancelNotifyPlayStarted() sl@0: { sl@0: CActive::Cancel(); sl@0: } sl@0: sl@0: //Actual implementation of method RunL sl@0: void CMMFSampleBuffering::RunL() sl@0: { sl@0: TRequestStatus* status = iClientStatus; sl@0: User::RequestComplete(status, KErrNotSupported); sl@0: } sl@0: sl@0: //Actual implementation of method DoCancel sl@0: void CMMFSampleBuffering::DoCancel() sl@0: { sl@0: iTimer.Cancel(); sl@0: TRequestStatus* status = iClientStatus; sl@0: User::RequestComplete(status, KErrCancel); sl@0: } sl@0: sl@0: sl@0: /* sl@0: CSampleBufferingTestDevice Implementation sl@0: */ sl@0: CMMFHwDevice* CSampleBufferingTestDevice::NewL() sl@0: { sl@0: CSampleBufferingTestDevice* self=new(ELeave) CSampleBufferingTestDevice(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CSampleBufferingTestDevice::~CSampleBufferingTestDevice() sl@0: { sl@0: delete iSampleBuffering; sl@0: } sl@0: sl@0: CSampleBufferingTestDevice::CSampleBufferingTestDevice() sl@0: { sl@0: } sl@0: sl@0: void CSampleBufferingTestDevice::ConstructL() sl@0: { sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::Stop() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::Pause() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TAny* CSampleBufferingTestDevice::CustomInterface(TUid aInterfaceId) sl@0: { sl@0: // Just return something non-NULL to keep the sl@0: // DevSound initialisation process happy sl@0: TAny* ret = static_cast(this); sl@0: sl@0: // Now for the CIs we want to test... sl@0: if (aInterfaceId == KUidSampleBuffering) sl@0: { sl@0: if (!iSampleBuffering) sl@0: { sl@0: TRAPD(err, iSampleBuffering = CMMFSampleBuffering::NewL()); sl@0: if (err == KErrNone && iSampleBuffering) sl@0: { sl@0: MMMFSampleBuffering* ptr = this; sl@0: ret = static_cast(ptr); sl@0: } sl@0: else sl@0: { sl@0: ret = NULL; sl@0: } sl@0: } sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::SetConfig(TTaskConfig& /*aConfig*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::StopAndDeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::DeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: CMMFSwCodec& CSampleBufferingTestDevice::Codec() sl@0: { sl@0: return *iCodec; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::MmsbEnableSampleBufferingBeforePlayback() sl@0: { sl@0: TInt result = KErrBadHandle; sl@0: sl@0: if (iSampleBuffering) sl@0: { sl@0: result = iSampleBuffering->MmsbEnableSampleBufferingBeforePlayback(); sl@0: } sl@0: sl@0: return result; sl@0: } sl@0: sl@0: TInt CSampleBufferingTestDevice::MmsbDisableSampleBufferingBeforePlayback() sl@0: { sl@0: TInt result = KErrBadHandle; sl@0: sl@0: if (iSampleBuffering) sl@0: { sl@0: result = iSampleBuffering->MmsbDisableSampleBufferingBeforePlayback(); sl@0: } sl@0: sl@0: return result; sl@0: } sl@0: sl@0: void CSampleBufferingTestDevice::MmsbNotifyPlayStarted(TRequestStatus& aStatus) sl@0: { sl@0: if (iSampleBuffering) sl@0: { sl@0: iSampleBuffering->MmsbNotifyPlayStarted(aStatus); sl@0: } sl@0: } sl@0: sl@0: void CSampleBufferingTestDevice::MmsbCancelNotifyPlayStarted() sl@0: { sl@0: if (iSampleBuffering) sl@0: { sl@0: iSampleBuffering->MmsbCancelNotifyPlayStarted(); sl@0: } sl@0: }