sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #ifndef __MMFBTSWCODECDATAPATH_H__
sl@0: #define __MMFBTSWCODECDATAPATH_H__
sl@0: 
sl@0: #include <e32base.h>
sl@0: #include <mmf/server/mmfdatabuffer.h>
sl@0: 
sl@0: class MMMFHwDeviceObserver;
sl@0: class CMMFSwCodec;
sl@0: 
sl@0: /**
sl@0:  *  Base class for the datapath internal to the Sw codec wrapper
sl@0:  *  @internalComponent
sl@0:  */
sl@0: class CMMFSwCodecDataPath : public CBase
sl@0: 	{ 
sl@0: public: 
sl@0: 	enum TSwCodecDataPathState
sl@0: 	{
sl@0: 	EStopped,
sl@0: 	EPlaying,
sl@0: 	EPaused
sl@0: 	};
sl@0: public:	
sl@0: 	virtual	~CMMFSwCodecDataPath(); 
sl@0: 	virtual TInt SetObserver(MMMFHwDeviceObserver& aHwObserver) = 0;
sl@0: 	virtual TInt AddCodec(CMMFSwCodec& aCodec) = 0;
sl@0: 	virtual TInt Start() = 0;
sl@0: 	virtual void Stop() = 0;
sl@0: 	virtual void Pause() = 0;
sl@0: 	virtual void BufferFilledL(CMMFDataBuffer& aBuffer) = 0;
sl@0: 	virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer) = 0;
sl@0: 	virtual void SoundDeviceException(TInt aError) = 0;
sl@0: 	virtual TSwCodecDataPathState State() {return iState;};
sl@0: protected:	
sl@0: 	CMMFSwCodecDataPath() {};
sl@0: 	inline void Panic(TInt aPanicCode);
sl@0: 	void ConstructL();
sl@0: 
sl@0: #ifdef __CYCLE_MMF_DATABUFFERS__
sl@0: 	CMMFDataBuffer* CycleAudioBuffer(CMMFDataBuffer* aBuffer);
sl@0: #endif
sl@0: 
sl@0: #ifdef __USE_MMF_TRANSFERBUFFERS__
sl@0: 	CMMFTransferBuffer* CreateTransferBufferL(TUint aBufferSize, CMMFTransferBuffer* aOldBuffer);
sl@0: #endif
sl@0: 
sl@0: #ifdef __USE_MMF_PTRBUFFERS__
sl@0: 	CMMFPtrBuffer* CreatePtrBufferL(TUint aBufferSize);
sl@0: #endif
sl@0: 
sl@0: protected: 
sl@0: 	TSwCodecDataPathState iState;
sl@0: 	MMMFHwDeviceObserver* iHwDeviceObserver;
sl@0: 	CMMFSwCodec* iCodec;
sl@0: #ifdef __USE_MMF_TRANSFERBUFFERS__
sl@0: 	RTransferBuffer* iTransferBuffer;
sl@0: 	RTransferWindow* iTransferWindow;
sl@0: #endif
sl@0: 
sl@0: #ifdef __USE_MMF_PTRBUFFERS__
sl@0: 	HBufC8* iPtrBufferMemoryBlock;
sl@0: #endif
sl@0: 
sl@0: 	};
sl@0: 
sl@0: /**
sl@0:  * Internal panic
sl@0:  * @internalComponent
sl@0:  */
sl@0: inline void CMMFSwCodecDataPath::Panic(TInt aPanicCode)
sl@0: 	{
sl@0: 	_LIT(KMMFSwCodecWrapperPanicCategory, "MMFSwCodecWrapper");
sl@0: 	User::Panic(KMMFSwCodecWrapperPanicCategory, aPanicCode);
sl@0: 	}
sl@0: 
sl@0: #endif
sl@0: