sl@0: // Copyright (c) 2005-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 __MMFBTSWCODECRECORDDATAPATH_H__ sl@0: #define __MMFBTSWCODECRECORDDATAPATH_H__ sl@0: sl@0: #include "mmfBtSwCodecDataPath.h" sl@0: sl@0: class CMMFSwCodecRecordDataPath; //fwd ref sl@0: class CRoutingSoundRecordDevice; // fwd ref sl@0: sl@0: /** sl@0: * Active object used by the CMMFSwCodecPlayDataPath to get data from the sound sl@0: * driver. This particular active object encapsulates the asynchronous record sl@0: * function, where a buffer of data is received from the WINS audio device, sl@0: * and the active object's RunL is called when the buffer has been created by sl@0: * the WINS audio device. sl@0: * @internalComponent sl@0: */ sl@0: class CDataPathRecorder : public CActive sl@0: { sl@0: public: sl@0: CDataPathRecorder(CMMFSwCodecRecordDataPath& aParent, TInt aPriority); sl@0: ~CDataPathRecorder(); sl@0: void Start(); sl@0: void RecordData(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: CMMFSwCodecRecordDataPath& iParent; sl@0: CMMFDataBuffer* iDataFromSource; sl@0: TBool iStopping; 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, recording has sl@0: * been terminated for some reason. The active object then notifies its parent, sl@0: * so that proper cleanup and client notification can occur. sl@0: * @internalComponent sl@0: */ sl@0: class CSoundDevRecordErrorReceiver : public CActive sl@0: { sl@0: public: sl@0: CSoundDevRecordErrorReceiver(CMMFSwCodecRecordDataPath& aParent, TInt aPriority); sl@0: ~CSoundDevRecordErrorReceiver(); sl@0: void Start(); sl@0: void Stop(); sl@0: virtual void RunL(); sl@0: virtual void DoCancel(); sl@0: private: sl@0: CMMFSwCodecRecordDataPath& 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 CMMFSwCodecRecordDataPath : public CMMFSwCodecDataPath sl@0: { sl@0: public: sl@0: static CMMFSwCodecRecordDataPath* NewL(CRoutingSoundRecordDevice* aSoundDevice); sl@0: virtual ~CMMFSwCodecRecordDataPath(); sl@0: virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver); sl@0: virtual TInt AddCodec(CMMFSwCodec& aCodec); sl@0: virtual TInt Start(); //record 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 CRoutingSoundRecordDevice* Device(); sl@0: virtual TUint RecordedBytesCount(); sl@0: protected: sl@0: CMMFSwCodecRecordDataPath(CRoutingSoundRecordDevice* aSoundDevice) : iSoundDevice(aSoundDevice) {}; sl@0: void ConstructL(); sl@0: void FillSoundDeviceBufferL(); sl@0: void FillSinkBufferL(); sl@0: protected: sl@0: CDataPathRecorder* iAudioRecorder; sl@0: CSoundDevRecordErrorReceiver* iSoundDeviceErrorReceiver; sl@0: CRoutingSoundRecordDevice* iSoundDevice; // Not owned. sl@0: CMMFDataBuffer* iSinkBuffer; sl@0: CMMFDataBuffer* iSoundDeviceBuffer; sl@0: TUint iSinkBufferSize; sl@0: TUint iSoundDevBufferSize; sl@0: TUint iRecordedBytesCount; sl@0: TUid iDeviceUid; sl@0: }; sl@0: sl@0: #endif sl@0: