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