devsound/sounddevbt/src/swcodecwrapper/mmfBtSwCodecConvertDataPath.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2005-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 #ifndef __MMFBTSWCODECCONVERTDATAPATH_H__
       
    17 #define __MMFBTSWCODECCONVERTDATAPATH_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <mdasound.h>
       
    21 
       
    22 #include "mmfBtSwCodecDataPath.h"
       
    23 
       
    24 /**
       
    25  *  Derived class for convert datapath internal to the Sw codec wrapper
       
    26  *  @internalComponent
       
    27  */
       
    28 class CMMFSwCodecConvertDataPath : public CMMFSwCodecDataPath
       
    29 	{ 
       
    30 public:	
       
    31 	static CMMFSwCodecConvertDataPath* NewL();
       
    32 	virtual ~CMMFSwCodecConvertDataPath(); 
       
    33 	virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver);
       
    34 	virtual TInt AddCodec(CMMFSwCodec& aCodec);
       
    35 	virtual TInt Start();
       
    36 	virtual void Stop();
       
    37 	virtual void Pause();
       
    38 	virtual void BufferFilledL(CMMFDataBuffer& aBuffer);
       
    39 	virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer);	
       
    40 	virtual void SoundDeviceException(TInt aError);
       
    41 	virtual RMdaDevSound& Device();
       
    42 	void FillSourceBufferL();
       
    43 	void FillSinkBufferL();
       
    44 	void EmptySinkBufferL();
       
    45 private:	
       
    46 	CMMFSwCodecConvertDataPath() {};
       
    47 	void ConstructL();	
       
    48 private: 
       
    49 	/**
       
    50      * Private class for the convert datapath that is an active object
       
    51 	 * used to drive the conversion.  This class performs the main data transfer
       
    52 	 * between the source and the sink.
       
    53      * This is done in a separate class as opposed to CMMFSwCodecConvertDataPath
       
    54      * because the class needs to be an active object to avoid recursive call stacks
       
    55      * in cases where the source and sink are not active objects - which is
       
    56      * the case with descriptors.  Making CMMFSwCodecConvertDataPath derive
       
    57      * from CActive is less desirable as it would involve multiple inheretence
       
    58      * @internalComponent
       
    59      */
       
    60 	class CDataPathConverter : public CActive
       
    61 	{
       
    62 	public:
       
    63 		enum TConvertState
       
    64 		{
       
    65 		EIdle,
       
    66 		EFillingSourceBuffer,
       
    67 		EFillingSinkBuffer,
       
    68 		EEmptyingSinkBuffer
       
    69 		};
       
    70 	public:
       
    71 		CDataPathConverter(CMMFSwCodecConvertDataPath& aParent, TInt aPriority);
       
    72 		~CDataPathConverter();
       
    73 		void Start();
       
    74 		void BufferFilledL(CMMFDataBuffer& aBuffer);
       
    75 		void BufferEmptiedL(CMMFDataBuffer& aBuffer);
       
    76 		void ChangeConvertState(TConvertState aNewConvertState);
       
    77 		//CActive
       
    78 		virtual void RunL();
       
    79 		virtual TInt RunError(TInt aError);
       
    80 		virtual void DoCancel();
       
    81 	private:	
       
    82 		void FillSourceBufferL();
       
    83 		void FillSinkBufferL();
       
    84 		void EmptySinkBufferL();
       
    85 	private:
       
    86 		TConvertState iConvertState;
       
    87 		CMMFSwCodecConvertDataPath& iParent;
       
    88 		CMMFDataBuffer* iSourceBuffer;
       
    89 	};
       
    90 private: 
       
    91 	CDataPathConverter* iDataPathConverter;
       
    92 	CMMFDataBuffer* iSourceBuffer;
       
    93 	CMMFDataBuffer* iSinkBuffer;
       
    94 	TBool iNoMoreSourceData;
       
    95 	TUint iSinkBufferSize;
       
    96 	TUint iSourceBufferSize;
       
    97 	RMdaDevSound iDummyDevSound;//don't need a devsound for convert
       
    98 	};
       
    99 
       
   100 #endif
       
   101