devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecDataPath.h
changeset 0 79dd3e2336a0
equal deleted inserted replaced
-1:000000000000 0:79dd3e2336a0
       
     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 __MMFSWCODECDATAPATH_H__
       
    17 #define __MMFSWCODECDATAPATH_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <mmf/server/mmfdatabuffer.h>
       
    21 
       
    22 
       
    23 #ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER
       
    24 	#include "mdasoundadapter.h"
       
    25 #else
       
    26 	#include <mdasound.h>
       
    27 	_LIT(KPddFileName,"ESDRV.PDD");
       
    28 	_LIT(KLddFileName,"ESOUND.LDD");
       
    29 #endif
       
    30 	
       
    31 class MMMFHwDeviceObserver;
       
    32 class CMMFSwCodec;
       
    33 
       
    34 /*
       
    35 Interface for setting desired sample rate, channels and for setting Gain/Volume
       
    36 */
       
    37 const TUid KUidSwSetParamInterface = {0x1028707E}; 
       
    38 class MSwSetParamInterface
       
    39 	{
       
    40 public:
       
    41 	virtual TInt SetSampleRate(TInt aSampleRate)=0;
       
    42 	virtual TInt SetNumChannels(TInt aNumChannels)=0;
       
    43 	virtual TInt SetGain(TInt aGain)=0;
       
    44 	virtual TInt GetBufferSizes(TInt& aMinSize, TInt& aMaxSize)=0;
       
    45 	};
       
    46 
       
    47 /*
       
    48  * Interface for discovering various parameters
       
    49  */
       
    50 const TUid KUidSwInfoInterface = {0x1028707F}; 
       
    51 class MSwInfoInterface
       
    52     {
       
    53 public:
       
    54     virtual TInt GetSupportedSampleRates(RArray<TInt>& aSupportedSampleRates)=0; 
       
    55     };
       
    56 	
       
    57 /**
       
    58  *  Base class for the datapath internal to the Sw codec wrapper
       
    59  *  @internalComponent
       
    60  */
       
    61 class CMMFSwCodecDataPath : public CBase
       
    62 	{ 
       
    63 public: 
       
    64 	enum TSwCodecDataPathState
       
    65 	{
       
    66 	EStopped,
       
    67 	EPlaying,
       
    68 	EPaused
       
    69 	};
       
    70 public:	
       
    71 	virtual	~CMMFSwCodecDataPath(); 
       
    72 	virtual TInt SetObserver(MMMFHwDeviceObserver& aHwObserver) = 0;
       
    73 	virtual TInt AddCodec(CMMFSwCodec& aCodec) = 0;
       
    74 	virtual TInt Start() = 0;
       
    75 	virtual void Stop() = 0;
       
    76 	virtual void Pause() = 0;
       
    77 	virtual RMdaDevSound& Device() = 0;
       
    78 	virtual void BufferFilledL(CMMFDataBuffer& aBuffer) = 0;
       
    79 	virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer) = 0;
       
    80 	virtual void SoundDeviceException(TInt aError) = 0;
       
    81 	virtual TSwCodecDataPathState State() const = 0;
       
    82 	virtual TAny* CustomInterface(TUid aInterfaceId);
       
    83 protected:	
       
    84 	CMMFSwCodecDataPath() {};
       
    85 	inline void Panic(TInt aPanicCode);
       
    86 	void ConstructL();
       
    87 
       
    88 #ifdef __CYCLE_MMF_DATABUFFERS__
       
    89 	CMMFDataBuffer* CycleAudioBuffer(CMMFDataBuffer* aBuffer);
       
    90 #endif
       
    91 
       
    92 #ifdef __USE_MMF_TRANSFERBUFFERS__
       
    93 	CMMFTransferBuffer* CreateTransferBufferL(TUint aBufferSize, CMMFTransferBuffer* aOldBuffer);
       
    94 #endif
       
    95 
       
    96 #ifdef __USE_MMF_PTRBUFFERS__
       
    97 	CMMFPtrBuffer* CreatePtrBufferL(TUint aBufferSize);
       
    98 #endif
       
    99 
       
   100 protected: 
       
   101 	MMMFHwDeviceObserver* iHwDeviceObserver;
       
   102 	CMMFSwCodec* iCodec;
       
   103 #ifdef __USE_MMF_TRANSFERBUFFERS__
       
   104 	RTransferBuffer* iTransferBuffer;
       
   105 	RTransferWindow* iTransferWindow;
       
   106 #endif
       
   107 
       
   108 #ifdef __USE_MMF_PTRBUFFERS__
       
   109 	HBufC8* iPtrBufferMemoryBlock;
       
   110 #endif
       
   111 	};
       
   112 
       
   113 /**
       
   114  * Internal panic
       
   115  * @internalComponent
       
   116  */
       
   117 inline void CMMFSwCodecDataPath::Panic(TInt aPanicCode)
       
   118 	{
       
   119 	_LIT(KMMFSwCodecWrapperPanicCategory, "MMFSwCodecWrapper");
       
   120 	User::Panic(KMMFSwCodecWrapperPanicCategory, aPanicCode);
       
   121 	}
       
   122 
       
   123 /**
       
   124  * Extended datapath class with state info  
       
   125  * @internalComponent 
       
   126  */
       
   127 class CMMFSwCodecDataPathX : public CMMFSwCodecDataPath
       
   128     {
       
   129 protected: 
       
   130     CMMFSwCodecDataPathX(): CMMFSwCodecDataPath() {}
       
   131     
       
   132     // from CMMFSwCodecDataPath
       
   133     TSwCodecDataPathState State() const {return iState;}
       
   134 
       
   135     TSwCodecDataPathState iState;
       
   136     };
       
   137 
       
   138 #endif
       
   139