sl@0: // Copyright (c) 2003-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: #ifndef __MMFBTSWCODECPLAYDATAPATH_H__ sl@0: #define __MMFBTSWCODECPLAYDATAPATH_H__ sl@0: sl@0: sl@0: #include "mmfBtSwCodecDataPath.h" sl@0: #include "mmfbtswcodecwrapper.h" sl@0: sl@0: sl@0: class CMMFSwCodecPlayDataPath; //fwd ref sl@0: class CMMFSwCodecUtility; // fwd ref sl@0: sl@0: class CRoutingSoundPlayDevice; // fwd ref sl@0: sl@0: /** sl@0: * Active object used by the CMMFSwCodecPlayDataPath to send data to the sound sl@0: * driver This particular active object encapsulates the asynchronous play sl@0: * function, where a buffer of data is sent to the WINS audio device, and the sl@0: * active object's RunL is called when the buffer has been consumed by the sl@0: * WINS audio device. sl@0: * @internalComponent sl@0: */ sl@0: class CDataPathPlayer : public CActive sl@0: { sl@0: public: sl@0: CDataPathPlayer(CMMFSwCodecPlayDataPath& aParent, TInt aPriority); sl@0: ~CDataPathPlayer(); sl@0: void Start(); sl@0: void ResumePlaying(); sl@0: void PlayData(const CMMFDataBuffer& aData); sl@0: void Stop(); sl@0: virtual void RunL(); sl@0: virtual TInt RunError(TInt aError); sl@0: virtual void DoCancel(); sl@0: virtual void Error(TInt aError); sl@0: private: sl@0: CMMFSwCodecPlayDataPath& iParent; sl@0: const CMMFDataBuffer* iDataFromSource; sl@0: TBool iResumePlaying; sl@0: }; sl@0: sl@0: /* sl@0: * Active object used by CMMFSwCodecPlayDataPath to listening for error messages sl@0: * from the WINS audio device. If this object's RunL is called, playback has sl@0: * been terminated for some reason. The active object then sl@0: * notifies its parent the datapath, so that proper cleanup and client sl@0: * notification can occur. sl@0: * @internalComponent sl@0: */ sl@0: class CSoundDevPlayErrorReceiver : public CActive sl@0: { sl@0: public: sl@0: CSoundDevPlayErrorReceiver(CMMFSwCodecPlayDataPath& aParent, TInt aPriority); sl@0: ~CSoundDevPlayErrorReceiver(); sl@0: void Start(); sl@0: void Stop(); sl@0: virtual void RunL(); sl@0: virtual void DoCancel(); sl@0: private: sl@0: CMMFSwCodecPlayDataPath& iParent; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: * Derived class for play datapath internal to the Sw codec wrapper sl@0: * @internalComponent sl@0: */ sl@0: class CMMFSwCodecPlayDataPath : public CMMFSwCodecDataPath sl@0: { sl@0: public: sl@0: static CMMFSwCodecPlayDataPath* NewL(CRoutingSoundPlayDevice* aSoundDevice, sl@0: TUid aDeviceUid); sl@0: virtual ~CMMFSwCodecPlayDataPath(); sl@0: virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver); sl@0: virtual TInt AddCodec(CMMFSwCodec& aCodec); sl@0: virtual TInt Start(); sl@0: virtual void Stop(); sl@0: virtual void Pause(); sl@0: virtual void BufferFilledL(CMMFDataBuffer& aBuffer); sl@0: virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer); sl@0: virtual void SoundDeviceException(TInt aError); sl@0: virtual CRoutingSoundPlayDevice* Device(); sl@0: virtual void SetPlayCustomInterface(MPlayCustomInterface& aCustomInterface); sl@0: virtual void SetConfigForAudioRamp(TUint aSampleRate, TUint aChannels); //need for audio ramper sl@0: protected: sl@0: CMMFSwCodecPlayDataPath(CRoutingSoundPlayDevice* aSoundDevice, TUid aDeviceUid) : sl@0: iSoundDevice(aSoundDevice), iDeviceUid(aDeviceUid) {}; sl@0: void ConstructL(); sl@0: void FillSourceBufferL(); sl@0: void FillSoundDeviceBufferL(); sl@0: protected: sl@0: CDataPathPlayer* iAudioPlayer; sl@0: CSoundDevPlayErrorReceiver* iSoundDeviceErrorReceiver; sl@0: CRoutingSoundPlayDevice* iSoundDevice; // Not owned sl@0: CMMFDataBuffer* iSourceBuffer; sl@0: CMMFDataBuffer* iSoundDeviceBuffer; sl@0: TBool iNoMoreSourceData; sl@0: TBool iSinkCanReceive; sl@0: TUint iSourceBufferSize; sl@0: TUint iSoundDevBufferSize; sl@0: CMMFSwCodecUtility* iUtility; sl@0: TBool iRampAudioSample; sl@0: MPlayCustomInterface* iCustomInterface; // not owned sl@0: TTimeIntervalMicroSeconds iVolumeRamp; sl@0: sl@0: // DEF048512 sl@0: TInt iSampleRate; sl@0: TInt iChannels; sl@0: sl@0: TUid iDeviceUid; // required to close the RoutingSoundPlayDevice sl@0: }; sl@0: sl@0: #endif sl@0: