Update contrib.
1 // Copyright (c) 2000-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 //*******************************************************************
22 //*******************************************************************
24 // Standard EPOC32 includes required by this header file
26 #include <mmf/server/mmfcodec.h>
27 #include <mmf/server/mmfdatabuffer.h>
32 const TUint KGsmEncodedFrameSize = 65;
34 const TUint KPcmEncodedFrameSize = 160*2;
35 const TUint KPcmInputFrameSize = KPcmEncodedFrameSize*2; // cache 2 frames
38 // Internal to Symbian
39 // Used to be TMMFPtr8 - useful aid to porting
40 class TMMFPtr8 : public TPtr8
45 inline void Set(const TDes8& aDes)
46 { TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.MaxLength()); };
47 inline void SetLengthOnly(const TDes8& aDes)
48 { TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.Length()); };
49 inline void Set(const TPtrC8& aDes)
50 { TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.Length()); };
51 inline void Shift(TInt aOffset)
52 { SetLength(Length()-aOffset); iMaxLength-=aOffset; iPtr+=aOffset; };
55 //*******************************************************************
56 //* GSM to 16 bit PCM Codec Class:
57 //*******************************************************************
59 class CGsmTo16PcmWavCodec : public CBase
62 CGsmTo16PcmWavCodec();
63 ~CGsmTo16PcmWavCodec();
69 void ProcessL(TMMFPtr8* aSrc, TMMFPtr8* aDst);
72 TUint iOutBufferCount;
73 TUint8* iOutBufferPtr;
74 TUint8 iOutBuffer [KPcmInputFrameSize];
77 TUint8 iInBuffer [KGsmEncodedFrameSize];
80 CGSM610FR_Decoder* iGsmDecoder;
84 //*******************************************************************
85 //* 16 bit PCM to GSM Codec Class:
86 //*******************************************************************
88 class C16PcmToGsmWavCodec : public CBase
91 C16PcmToGsmWavCodec();
92 ~C16PcmToGsmWavCodec();
97 void ProcessL(TMMFPtr8* aSrc, TMMFPtr8* aDst);
100 TUint iOutBufferCount;
101 TUint8* iOutBufferPtr;
102 TUint8 iOutBuffer [KGsmEncodedFrameSize];
103 TUint iInBufferCount;
104 TUint8* iInBufferPtr;
105 TUint8 iInBuffer [KPcmInputFrameSize];
107 CGSM610FR_Encoder* iGsmEncoder;
111 class CMMFGsmTo16PcmCodec : public CMMFCodec
114 static CMMFCodec* NewL(TAny* aInitParams);
115 virtual ~CMMFGsmTo16PcmCodec();
116 TCodecProcessResult ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst);
119 CMMFGsmTo16PcmCodec();
120 void ConstructL(TAny* aInitParams);
122 //buffers owned by the datapath
123 const CMMFDataBuffer* iSrc;
124 CMMFDataBuffer* iDst;
125 TUint iLastFrameNumber;
127 //the real codec, CMMFGsmTo16PcmCodec is just a wrapper
128 CGsmTo16PcmWavCodec* iCodecPtr;
132 class CMMF16PcmToGsmCodec : public CMMFCodec
135 static CMMFCodec* NewL(TAny* aInitParams);
136 virtual ~CMMF16PcmToGsmCodec();
137 TCodecProcessResult ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst);
140 CMMF16PcmToGsmCodec();
141 void ConstructL(TAny* aInitParams);
143 //buffers owned by the datapath
144 const CMMFDataBuffer* iSrc;
145 CMMFDataBuffer* iDst;
146 TUint iLastFrameNumber;
148 //the real codec, is CMMF16PcmToGsmCodec just a wrapper
149 C16PcmToGsmWavCodec* iCodecPtr;