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