|
1 // Copyright (c) 2002-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 // include\mmf\src\plugin\Hwdevice\audio\pcm16ToPcm16HwDevice.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __MMF_PCM16_TO_PCM16_HW_DEVICE_H__ |
|
19 #define __MMF_PCM16_TO_PCM16_HW_DEVICE_H__ |
|
20 #include <mmf/server/mmfswcodecwrapper.h> |
|
21 |
|
22 #ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER |
|
23 #include "mdasoundadapter.h" |
|
24 #else |
|
25 #include <mdasound.h> |
|
26 #endif |
|
27 |
|
28 #include "../../swcodecwrapper/mmfswaudioinput.h" |
|
29 |
|
30 #include "../../swcodecwrapper/mmfSwCodecDataPath.h" |
|
31 |
|
32 // for the bitrate custom interface |
|
33 #include <mmf/server/devsoundstandardcustominterfaces.h> |
|
34 |
|
35 //note we need to keep this buffer at 8K as the tone utility expects 8K |
|
36 const TInt KPCM16ToPCM16BufferSize = 0x2000; |
|
37 const TInt KDevSoundMinFrameSize = 0x800; //2K |
|
38 const TInt KDevSoundMaxFrameSize = 0x4000; //16K |
|
39 const TInt KDevSoundDeltaFrameSize = 0x800; //2K |
|
40 const TInt KDevSoundFramesPerSecond = 4; |
|
41 |
|
42 /* |
|
43 * |
|
44 * class CMMFPcm16ToPcm16HwDevice |
|
45 * |
|
46 */ |
|
47 class CMMFPcm16ToPcm16HwDevice : public CMMFSwCodecWrapper, |
|
48 public MMMFDevSoundCustomInterfaceBitRate |
|
49 { |
|
50 public: |
|
51 static CMMFPcm16ToPcm16HwDevice* NewL(); |
|
52 virtual CMMFSwCodec& Codec(); |
|
53 virtual TAny* CustomInterface(TUid aInterfaceId); |
|
54 ~CMMFPcm16ToPcm16HwDevice(); |
|
55 |
|
56 TUint CalculateBufferSize(); |
|
57 private: |
|
58 // from MMMFDevSoundCustomInterfaceBitRate |
|
59 virtual void GetSupportedBitRatesL(RArray<TInt>& aSupportedBitRates); |
|
60 virtual TInt BitRateL(); |
|
61 virtual void SetBitRateL(TInt aBitRate); |
|
62 |
|
63 void BitRatesFromSampleRatesL(RArray<TInt>& aSupportedBitRates, const RArray<TInt>& aSupportedSampleRates); |
|
64 |
|
65 void ConstructL(); |
|
66 }; |
|
67 |
|
68 /* |
|
69 * |
|
70 * class CMMFPcm16ToPcm16Codec converts Pcm16 to pcm16 |
|
71 * |
|
72 */ |
|
73 class CMMFPcm16ToPcm16Codec : public CMMFSwCodec |
|
74 { |
|
75 public: |
|
76 virtual TCodecProcessResult ProcessL(const CMMFBuffer& /*aSource*/, CMMFBuffer& /*aDest*/); |
|
77 // virtual TUint SourceBufferSize() {return KPCM16ToPCM16BufferSize;}; |
|
78 // virtual TUint SinkBufferSize() {return KPCM16ToPCM16BufferSize;}; |
|
79 virtual TUint SourceBufferSize(); |
|
80 virtual TUint SinkBufferSize(); |
|
81 virtual TBool IsNullCodec() {return ETrue;}; |
|
82 |
|
83 void SetHwDevice(CMMFPcm16ToPcm16HwDevice* aHwDevice); |
|
84 private: |
|
85 TUint iBufferSize; |
|
86 CMMFPcm16ToPcm16HwDevice* iHwDevice; |
|
87 }; |
|
88 |
|
89 #endif //__MMF_PCM16_TO_PCM16_HW_DEVICE_H__ |
|
90 |