1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/sounddevbt/src/swcodecwrapper/mmfBtSwCodecRecordDataPath.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,108 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __MMFBTSWCODECRECORDDATAPATH_H__
1.20 +#define __MMFBTSWCODECRECORDDATAPATH_H__
1.21 +
1.22 +#include "mmfBtSwCodecDataPath.h"
1.23 +
1.24 +class CMMFSwCodecRecordDataPath; //fwd ref
1.25 +class CRoutingSoundRecordDevice; // fwd ref
1.26 +
1.27 +/**
1.28 + * Active object used by the CMMFSwCodecPlayDataPath to get data from the sound
1.29 + * driver. This particular active object encapsulates the asynchronous record
1.30 + * function, where a buffer of data is received from the WINS audio device,
1.31 + * and the active object's RunL is called when the buffer has been created by
1.32 + * the WINS audio device.
1.33 + * @internalComponent
1.34 + */
1.35 +class CDataPathRecorder : public CActive
1.36 + {
1.37 +public:
1.38 + CDataPathRecorder(CMMFSwCodecRecordDataPath& aParent, TInt aPriority);
1.39 + ~CDataPathRecorder();
1.40 + void Start();
1.41 + void RecordData(CMMFDataBuffer& aData);
1.42 + void Stop();
1.43 + virtual void RunL();
1.44 + virtual TInt RunError(TInt aError);
1.45 + virtual void DoCancel();
1.46 + virtual void Error(TInt aError);
1.47 +private:
1.48 + CMMFSwCodecRecordDataPath& iParent;
1.49 + CMMFDataBuffer* iDataFromSource;
1.50 + TBool iStopping;
1.51 + };
1.52 +
1.53 +/**
1.54 + * Active object used by CMMFSwCodecPlayDataPath to listening for error messages
1.55 + * from the WINS audio device. If this object's RunL is called, recording has
1.56 + * been terminated for some reason. The active object then notifies its parent,
1.57 + * so that proper cleanup and client notification can occur.
1.58 + * @internalComponent
1.59 + */
1.60 +class CSoundDevRecordErrorReceiver : public CActive
1.61 + {
1.62 +public:
1.63 + CSoundDevRecordErrorReceiver(CMMFSwCodecRecordDataPath& aParent, TInt aPriority);
1.64 + ~CSoundDevRecordErrorReceiver();
1.65 + void Start();
1.66 + void Stop();
1.67 + virtual void RunL();
1.68 + virtual void DoCancel();
1.69 +private:
1.70 + CMMFSwCodecRecordDataPath& iParent;
1.71 + };
1.72 +
1.73 +
1.74 +/**
1.75 + * Derived class for play datapath internal to the Sw codec wrapper
1.76 + * @internalComponent
1.77 + */
1.78 +class CMMFSwCodecRecordDataPath : public CMMFSwCodecDataPath
1.79 + {
1.80 +public:
1.81 + static CMMFSwCodecRecordDataPath* NewL(CRoutingSoundRecordDevice* aSoundDevice);
1.82 + virtual ~CMMFSwCodecRecordDataPath();
1.83 + virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver);
1.84 + virtual TInt AddCodec(CMMFSwCodec& aCodec);
1.85 + virtual TInt Start(); //record
1.86 + virtual void Stop();
1.87 + virtual void Pause();
1.88 + virtual void BufferFilledL(CMMFDataBuffer& aBuffer);
1.89 + virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer);
1.90 + virtual void SoundDeviceException(TInt aError);
1.91 + virtual CRoutingSoundRecordDevice* Device();
1.92 + virtual TUint RecordedBytesCount();
1.93 +protected:
1.94 + CMMFSwCodecRecordDataPath(CRoutingSoundRecordDevice* aSoundDevice) : iSoundDevice(aSoundDevice) {};
1.95 + void ConstructL();
1.96 + void FillSoundDeviceBufferL();
1.97 + void FillSinkBufferL();
1.98 +protected:
1.99 + CDataPathRecorder* iAudioRecorder;
1.100 + CSoundDevRecordErrorReceiver* iSoundDeviceErrorReceiver;
1.101 + CRoutingSoundRecordDevice* iSoundDevice; // Not owned.
1.102 + CMMFDataBuffer* iSinkBuffer;
1.103 + CMMFDataBuffer* iSoundDeviceBuffer;
1.104 + TUint iSinkBufferSize;
1.105 + TUint iSoundDevBufferSize;
1.106 + TUint iRecordedBytesCount;
1.107 + TUid iDeviceUid;
1.108 + };
1.109 +
1.110 +#endif
1.111 +