os/mm/mmlibs/mmfw/src/Plugin/Codec/audio/GSM610/GSM610.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/src/Plugin/Codec/audio/GSM610/GSM610.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,154 @@
     1.4 +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __GSM610_H__
    1.20 +#define __GSM610_H__
    1.21 +
    1.22 +
    1.23 +//*******************************************************************
    1.24 +//* INCLUDE FILES:
    1.25 +//*******************************************************************
    1.26 +
    1.27 +// Standard EPOC32 includes required by this header file
    1.28 +#include <e32base.h>
    1.29 +#include <mmf/server/mmfcodec.h>
    1.30 +#include <mmf/server/mmfdatabuffer.h>
    1.31 +#include <e32std.h>
    1.32 +
    1.33 +#include "gsm610fr.h"
    1.34 +
    1.35 +const TUint	KGsmEncodedFrameSize = 65;
    1.36 +
    1.37 +const TUint	KPcmEncodedFrameSize = 160*2;
    1.38 +const TUint	KPcmInputFrameSize   = KPcmEncodedFrameSize*2;	// cache 2 frames
    1.39 +
    1.40 +
    1.41 +// Internal to Symbian
    1.42 +// Used to be TMMFPtr8 - useful aid to porting
    1.43 +class TMMFPtr8 : public TPtr8
    1.44 +	{
    1.45 +public:
    1.46 +	TMMFPtr8()
    1.47 +		: TPtr8(0,0,0) {};
    1.48 +	inline void Set(const TDes8& aDes)
    1.49 +		{ TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.MaxLength()); };
    1.50 +	inline void SetLengthOnly(const TDes8& aDes)
    1.51 +		{ TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.Length()); };
    1.52 +	inline void Set(const TPtrC8& aDes)
    1.53 +		{ TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.Length()); };
    1.54 +	inline void Shift(TInt aOffset)
    1.55 +		{ SetLength(Length()-aOffset); iMaxLength-=aOffset; iPtr+=aOffset; };
    1.56 +	};
    1.57 +
    1.58 +//*******************************************************************
    1.59 +//* GSM to 16 bit PCM Codec Class:
    1.60 +//*******************************************************************
    1.61 +
    1.62 +class CGsmTo16PcmWavCodec : public CBase
    1.63 +	{
    1.64 +public:
    1.65 +	CGsmTo16PcmWavCodec();
    1.66 +	~CGsmTo16PcmWavCodec();
    1.67 +
    1.68 +	void ConstructL();
    1.69 +
    1.70 +	void Reset();
    1.71 +	void ResetAllL();
    1.72 +	void ProcessL(TMMFPtr8* aSrc, TMMFPtr8* aDst);
    1.73 +
    1.74 +private:
    1.75 +	TUint    iOutBufferCount;
    1.76 +	TUint8* iOutBufferPtr;
    1.77 +	TUint8  iOutBuffer [KPcmInputFrameSize];
    1.78 +	TUint    iInBufferCount;
    1.79 +	TUint8* iInBufferPtr;
    1.80 +	TUint8  iInBuffer [KGsmEncodedFrameSize];
    1.81 +
    1.82 +
    1.83 +	CGSM610FR_Decoder* iGsmDecoder;
    1.84 +	};
    1.85 +
    1.86 +
    1.87 +//*******************************************************************
    1.88 +//* 16 bit PCM to GSM Codec Class:
    1.89 +//*******************************************************************
    1.90 +
    1.91 +class C16PcmToGsmWavCodec : public CBase
    1.92 +	{
    1.93 +public:
    1.94 +	C16PcmToGsmWavCodec();
    1.95 +	~C16PcmToGsmWavCodec();
    1.96 +	void ConstructL();
    1.97 +
    1.98 +	void Reset();
    1.99 +	void ResetAllL();
   1.100 +	void ProcessL(TMMFPtr8* aSrc, TMMFPtr8* aDst);
   1.101 +	
   1.102 +private:
   1.103 +	TUint    iOutBufferCount;
   1.104 +	TUint8* iOutBufferPtr;
   1.105 +	TUint8  iOutBuffer [KGsmEncodedFrameSize];
   1.106 +	TUint    iInBufferCount;
   1.107 +	TUint8* iInBufferPtr;
   1.108 +	TUint8  iInBuffer [KPcmInputFrameSize];
   1.109 +
   1.110 +	CGSM610FR_Encoder* iGsmEncoder;
   1.111 +
   1.112 +	};
   1.113 +
   1.114 +class CMMFGsmTo16PcmCodec : public CMMFCodec
   1.115 +	{
   1.116 +public:
   1.117 +	static CMMFCodec* NewL(TAny* aInitParams);
   1.118 +	virtual ~CMMFGsmTo16PcmCodec();
   1.119 +	TCodecProcessResult ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst);
   1.120 +
   1.121 +private:
   1.122 +	CMMFGsmTo16PcmCodec();
   1.123 +	void ConstructL(TAny* aInitParams);
   1.124 +private:
   1.125 +	//buffers owned by the datapath
   1.126 +	const CMMFDataBuffer* iSrc;
   1.127 +	CMMFDataBuffer* iDst;
   1.128 +	TUint iLastFrameNumber;
   1.129 +
   1.130 +	//the real codec, CMMFGsmTo16PcmCodec is just a wrapper
   1.131 +	CGsmTo16PcmWavCodec* iCodecPtr;
   1.132 +	};
   1.133 +
   1.134 +
   1.135 +class CMMF16PcmToGsmCodec : public CMMFCodec
   1.136 +	{
   1.137 +public:
   1.138 +	static CMMFCodec* NewL(TAny* aInitParams);
   1.139 +	virtual ~CMMF16PcmToGsmCodec();
   1.140 +	TCodecProcessResult ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst);
   1.141 +
   1.142 +private:
   1.143 +	CMMF16PcmToGsmCodec();
   1.144 +	void ConstructL(TAny* aInitParams);
   1.145 +private:
   1.146 +	//buffers owned by the datapath
   1.147 +	const CMMFDataBuffer* iSrc;
   1.148 +	CMMFDataBuffer* iDst;
   1.149 +	TUint iLastFrameNumber;
   1.150 +
   1.151 +	//the real codec, is CMMF16PcmToGsmCodec just a wrapper
   1.152 +	C16PcmToGsmWavCodec* iCodecPtr;
   1.153 +	};
   1.154 +
   1.155 +
   1.156 +
   1.157 +#endif