os/mm/devsound/sounddevbt/src/swcodecwrapper/mmfBtSwCodecRecordDataPath.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __MMFBTSWCODECRECORDDATAPATH_H__
    17 #define __MMFBTSWCODECRECORDDATAPATH_H__
    18 
    19 #include "mmfBtSwCodecDataPath.h"
    20 
    21 class CMMFSwCodecRecordDataPath; //fwd ref
    22 class CRoutingSoundRecordDevice;	// fwd ref
    23 
    24 /**
    25  * Active object used by the CMMFSwCodecPlayDataPath to get data from the sound
    26  * driver.  This particular active object encapsulates the asynchronous record
    27  * function, where a buffer of data is received from the WINS audio device, 
    28  * and the active object's RunL is called when the buffer has been created by 
    29  * the WINS audio device.
    30  * @internalComponent
    31  */
    32 class CDataPathRecorder : public CActive
    33 	{
    34 public:
    35 	CDataPathRecorder(CMMFSwCodecRecordDataPath& aParent, TInt aPriority);
    36 	~CDataPathRecorder();
    37 	void Start();
    38 	void RecordData(CMMFDataBuffer& aData);
    39 	void Stop();
    40 	virtual void RunL();
    41 	virtual TInt RunError(TInt aError);
    42 	virtual void DoCancel();
    43 	virtual void Error(TInt aError);
    44 private:
    45 	CMMFSwCodecRecordDataPath& iParent;
    46 	CMMFDataBuffer* iDataFromSource;
    47 	TBool iStopping;
    48 	};
    49 
    50 /**
    51  * Active object used by CMMFSwCodecPlayDataPath to listening for error messages
    52  * from the WINS audio device.  If this object's RunL is called, recording has 
    53  * been terminated for some reason.  The active object then notifies its parent, 
    54  * so that proper cleanup and client notification can occur.
    55  * @internalComponent
    56  */
    57 class CSoundDevRecordErrorReceiver : public CActive
    58 	{
    59 public:
    60 	CSoundDevRecordErrorReceiver(CMMFSwCodecRecordDataPath& aParent, TInt aPriority);
    61 	~CSoundDevRecordErrorReceiver();
    62 	void Start();
    63 	void Stop();
    64 	virtual void RunL();
    65 	virtual void DoCancel();
    66 private:
    67 	CMMFSwCodecRecordDataPath& iParent;
    68 	};
    69 
    70 
    71 /**
    72  *  Derived class for play datapath internal to the Sw codec wrapper
    73  *  @internalComponent
    74  */
    75 class CMMFSwCodecRecordDataPath : public CMMFSwCodecDataPath
    76 	{ 
    77 public:	
    78 	static CMMFSwCodecRecordDataPath* NewL(CRoutingSoundRecordDevice* aSoundDevice);
    79 	virtual ~CMMFSwCodecRecordDataPath();
    80 	virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver);
    81 	virtual TInt AddCodec(CMMFSwCodec& aCodec);
    82 	virtual TInt Start(); //record
    83 	virtual void Stop();
    84 	virtual void Pause();
    85 	virtual void BufferFilledL(CMMFDataBuffer& aBuffer);
    86 	virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer);	
    87 	virtual void SoundDeviceException(TInt aError);
    88 	virtual CRoutingSoundRecordDevice* Device();
    89 	virtual TUint RecordedBytesCount(); 
    90 protected:	
    91 	CMMFSwCodecRecordDataPath(CRoutingSoundRecordDevice* aSoundDevice) : iSoundDevice(aSoundDevice) {};
    92 	void ConstructL();
    93 	void FillSoundDeviceBufferL();
    94 	void FillSinkBufferL();
    95 protected: 
    96 	CDataPathRecorder* iAudioRecorder;
    97 	CSoundDevRecordErrorReceiver* iSoundDeviceErrorReceiver;
    98 	CRoutingSoundRecordDevice* iSoundDevice;	// Not owned.
    99 	CMMFDataBuffer* iSinkBuffer;
   100 	CMMFDataBuffer* iSoundDeviceBuffer;
   101 	TUint iSinkBufferSize;
   102 	TUint iSoundDevBufferSize;
   103 	TUint iRecordedBytesCount;
   104 	TUid iDeviceUid;
   105 	};
   106 
   107 #endif
   108