|
1 // Copyright (c) 1997-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 |
|
17 #ifndef __MMF_CODEC_BASE_DEFINITIONS_H__ |
|
18 #define __MMF_CODEC_BASE_DEFINITIONS_H__ |
|
19 |
|
20 #include <mmf/server/mmfcodec.h> |
|
21 #include <mmf/server/mmfdatabuffer.h> |
|
22 #include <e32std.h> |
|
23 // IMA ADPCM Codecs |
|
24 |
|
25 // Internal to Symbian |
|
26 class TMMFImaAdpcmCodecStateOld |
|
27 { |
|
28 public: |
|
29 inline TMMFImaAdpcmCodecStateOld(); |
|
30 inline TMMFImaAdpcmCodecStateOld(TInt16 aPredicted, TUint8 aIndex); |
|
31 public: |
|
32 TInt16 iPredicted; // Previous output value |
|
33 TUint8 iIndex; // Index into stepsize table |
|
34 }; |
|
35 |
|
36 // Internal to Symbian |
|
37 class TMMFAudioCodecBaseOld |
|
38 { |
|
39 public: |
|
40 inline TMMFAudioCodecBaseOld(); |
|
41 // |
|
42 virtual void Convert(TUint8* aSrc, TUint8* aDst, TInt aSamples)=0; |
|
43 }; |
|
44 |
|
45 |
|
46 // Internal to Symbian |
|
47 class TMMFImaAdpcmBaseCodecOld : public TMMFAudioCodecBaseOld |
|
48 { |
|
49 public: |
|
50 inline TMMFImaAdpcmBaseCodecOld(const TInt aChannels); |
|
51 inline void SetState(const TMMFImaAdpcmCodecStateOld& aState); |
|
52 inline void SetState(const TMMFImaAdpcmCodecStateOld& aState,const TInt aChannel); |
|
53 inline const TMMFImaAdpcmCodecStateOld& GetState(); |
|
54 inline const TMMFImaAdpcmCodecStateOld& GetState(const TInt aChannel); |
|
55 void ResetBuffer(); |
|
56 TBool OutputStep(); |
|
57 protected: |
|
58 TMMFImaAdpcmCodecStateOld iState[2]; //for mono & stereo |
|
59 static const TInt iIndexTable[16]; |
|
60 static const TInt iStepSizeTable[89]; |
|
61 TBool iBufferStep; |
|
62 TInt iBuffer; |
|
63 TInt iChannels; |
|
64 }; |
|
65 |
|
66 // Internal to Symbian |
|
67 class TMMFImaAdpcmTo16PcmCodecOld : public TMMFImaAdpcmBaseCodecOld |
|
68 { |
|
69 public: |
|
70 inline TMMFImaAdpcmTo16PcmCodecOld(const TInt aChannels); |
|
71 virtual void Convert(TUint8* aSrc, TUint8* aDst, TInt aSamples); |
|
72 }; |
|
73 |
|
74 |
|
75 // Internal to Symbian |
|
76 class TMMF16PcmToImaAdpcmCodecOld : public TMMFImaAdpcmBaseCodecOld |
|
77 { |
|
78 public: |
|
79 inline TMMF16PcmToImaAdpcmCodecOld(const TInt aChannels); |
|
80 virtual void Convert(TUint8* aSrc, TUint8* aDst, TInt aSamples); |
|
81 }; |
|
82 |
|
83 |
|
84 inline TMMFAudioCodecBaseOld::TMMFAudioCodecBaseOld() |
|
85 {} |
|
86 |
|
87 inline TMMFImaAdpcmBaseCodecOld::TMMFImaAdpcmBaseCodecOld(const TInt aChannels) |
|
88 : iBufferStep(ETrue), iBuffer(0), iChannels(aChannels) {} |
|
89 |
|
90 inline TMMFImaAdpcmCodecStateOld::TMMFImaAdpcmCodecStateOld() |
|
91 : iPredicted(0), iIndex(0) {} |
|
92 |
|
93 inline TMMFImaAdpcmCodecStateOld::TMMFImaAdpcmCodecStateOld(TInt16 aPredicted, TUint8 aIndex) |
|
94 : iPredicted(aPredicted), iIndex(aIndex) {} |
|
95 |
|
96 inline void TMMFImaAdpcmBaseCodecOld::SetState(const TMMFImaAdpcmCodecStateOld& aState) |
|
97 { iState[0] = aState; } |
|
98 |
|
99 inline const TMMFImaAdpcmCodecStateOld& TMMFImaAdpcmBaseCodecOld::GetState() |
|
100 { return iState[0]; } |
|
101 |
|
102 inline void TMMFImaAdpcmBaseCodecOld::SetState(const TMMFImaAdpcmCodecStateOld& aState, const TInt aChannel) |
|
103 { iState[aChannel] = aState; } |
|
104 |
|
105 inline const TMMFImaAdpcmCodecStateOld& TMMFImaAdpcmBaseCodecOld::GetState(const TInt aChannel) |
|
106 { return iState[aChannel]; } |
|
107 |
|
108 inline TMMFImaAdpcmTo16PcmCodecOld::TMMFImaAdpcmTo16PcmCodecOld(const TInt aChannels) |
|
109 :TMMFImaAdpcmBaseCodecOld(aChannels) |
|
110 {} |
|
111 inline TMMF16PcmToImaAdpcmCodecOld::TMMF16PcmToImaAdpcmCodecOld(const TInt aChannels) |
|
112 :TMMFImaAdpcmBaseCodecOld(aChannels) |
|
113 {} |
|
114 |
|
115 #endif |