os/mm/devsound/sounddevbt/src/swcodecwrapper/mmfBtSwCodecConvertDataPath.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/sounddevbt/src/swcodecwrapper/mmfBtSwCodecConvertDataPath.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,101 @@
     1.4 +// Copyright (c) 2005-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 __MMFBTSWCODECCONVERTDATAPATH_H__
    1.20 +#define __MMFBTSWCODECCONVERTDATAPATH_H__
    1.21 +
    1.22 +#include <e32base.h>
    1.23 +#include <mdasound.h>
    1.24 +
    1.25 +#include "mmfBtSwCodecDataPath.h"
    1.26 +
    1.27 +/**
    1.28 + *  Derived class for convert datapath internal to the Sw codec wrapper
    1.29 + *  @internalComponent
    1.30 + */
    1.31 +class CMMFSwCodecConvertDataPath : public CMMFSwCodecDataPath
    1.32 +	{ 
    1.33 +public:	
    1.34 +	static CMMFSwCodecConvertDataPath* NewL();
    1.35 +	virtual ~CMMFSwCodecConvertDataPath(); 
    1.36 +	virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver);
    1.37 +	virtual TInt AddCodec(CMMFSwCodec& aCodec);
    1.38 +	virtual TInt Start();
    1.39 +	virtual void Stop();
    1.40 +	virtual void Pause();
    1.41 +	virtual void BufferFilledL(CMMFDataBuffer& aBuffer);
    1.42 +	virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer);	
    1.43 +	virtual void SoundDeviceException(TInt aError);
    1.44 +	virtual RMdaDevSound& Device();
    1.45 +	void FillSourceBufferL();
    1.46 +	void FillSinkBufferL();
    1.47 +	void EmptySinkBufferL();
    1.48 +private:	
    1.49 +	CMMFSwCodecConvertDataPath() {};
    1.50 +	void ConstructL();	
    1.51 +private: 
    1.52 +	/**
    1.53 +     * Private class for the convert datapath that is an active object
    1.54 +	 * used to drive the conversion.  This class performs the main data transfer
    1.55 +	 * between the source and the sink.
    1.56 +     * This is done in a separate class as opposed to CMMFSwCodecConvertDataPath
    1.57 +     * because the class needs to be an active object to avoid recursive call stacks
    1.58 +     * in cases where the source and sink are not active objects - which is
    1.59 +     * the case with descriptors.  Making CMMFSwCodecConvertDataPath derive
    1.60 +     * from CActive is less desirable as it would involve multiple inheretence
    1.61 +     * @internalComponent
    1.62 +     */
    1.63 +	class CDataPathConverter : public CActive
    1.64 +	{
    1.65 +	public:
    1.66 +		enum TConvertState
    1.67 +		{
    1.68 +		EIdle,
    1.69 +		EFillingSourceBuffer,
    1.70 +		EFillingSinkBuffer,
    1.71 +		EEmptyingSinkBuffer
    1.72 +		};
    1.73 +	public:
    1.74 +		CDataPathConverter(CMMFSwCodecConvertDataPath& aParent, TInt aPriority);
    1.75 +		~CDataPathConverter();
    1.76 +		void Start();
    1.77 +		void BufferFilledL(CMMFDataBuffer& aBuffer);
    1.78 +		void BufferEmptiedL(CMMFDataBuffer& aBuffer);
    1.79 +		void ChangeConvertState(TConvertState aNewConvertState);
    1.80 +		//CActive
    1.81 +		virtual void RunL();
    1.82 +		virtual TInt RunError(TInt aError);
    1.83 +		virtual void DoCancel();
    1.84 +	private:	
    1.85 +		void FillSourceBufferL();
    1.86 +		void FillSinkBufferL();
    1.87 +		void EmptySinkBufferL();
    1.88 +	private:
    1.89 +		TConvertState iConvertState;
    1.90 +		CMMFSwCodecConvertDataPath& iParent;
    1.91 +		CMMFDataBuffer* iSourceBuffer;
    1.92 +	};
    1.93 +private: 
    1.94 +	CDataPathConverter* iDataPathConverter;
    1.95 +	CMMFDataBuffer* iSourceBuffer;
    1.96 +	CMMFDataBuffer* iSinkBuffer;
    1.97 +	TBool iNoMoreSourceData;
    1.98 +	TUint iSinkBufferSize;
    1.99 +	TUint iSourceBufferSize;
   1.100 +	RMdaDevSound iDummyDevSound;//don't need a devsound for convert
   1.101 +	};
   1.102 +
   1.103 +#endif
   1.104 +