os/mm/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecDataPath.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef __MMFSWCODECDATAPATH_H__
sl@0
    17
#define __MMFSWCODECDATAPATH_H__
sl@0
    18
sl@0
    19
#include <e32base.h>
sl@0
    20
#include <mmf/server/mmfdatabuffer.h>
sl@0
    21
sl@0
    22
sl@0
    23
#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER
sl@0
    24
	#include "mdasoundadapter.h"
sl@0
    25
#else
sl@0
    26
	#include <mdasound.h>
sl@0
    27
	_LIT(KPddFileName,"ESDRV.PDD");
sl@0
    28
	_LIT(KLddFileName,"ESOUND.LDD");
sl@0
    29
#endif
sl@0
    30
	
sl@0
    31
class MMMFHwDeviceObserver;
sl@0
    32
class CMMFSwCodec;
sl@0
    33
sl@0
    34
/*
sl@0
    35
Interface for setting desired sample rate, channels and for setting Gain/Volume
sl@0
    36
*/
sl@0
    37
const TUid KUidSwSetParamInterface = {0x1028707E}; 
sl@0
    38
class MSwSetParamInterface
sl@0
    39
	{
sl@0
    40
public:
sl@0
    41
	virtual TInt SetSampleRate(TInt aSampleRate)=0;
sl@0
    42
	virtual TInt SetNumChannels(TInt aNumChannels)=0;
sl@0
    43
	virtual TInt SetGain(TInt aGain)=0;
sl@0
    44
	virtual TInt GetBufferSizes(TInt& aMinSize, TInt& aMaxSize)=0;
sl@0
    45
	};
sl@0
    46
sl@0
    47
/*
sl@0
    48
 * Interface for discovering various parameters
sl@0
    49
 */
sl@0
    50
const TUid KUidSwInfoInterface = {0x1028707F}; 
sl@0
    51
class MSwInfoInterface
sl@0
    52
    {
sl@0
    53
public:
sl@0
    54
    virtual TInt GetSupportedSampleRates(RArray<TInt>& aSupportedSampleRates)=0; 
sl@0
    55
    };
sl@0
    56
	
sl@0
    57
/**
sl@0
    58
 *  Base class for the datapath internal to the Sw codec wrapper
sl@0
    59
 *  @internalComponent
sl@0
    60
 */
sl@0
    61
class CMMFSwCodecDataPath : public CBase
sl@0
    62
	{ 
sl@0
    63
public: 
sl@0
    64
	enum TSwCodecDataPathState
sl@0
    65
	{
sl@0
    66
	EStopped,
sl@0
    67
	EPlaying,
sl@0
    68
	EPaused
sl@0
    69
	};
sl@0
    70
public:	
sl@0
    71
	virtual	~CMMFSwCodecDataPath(); 
sl@0
    72
	virtual TInt SetObserver(MMMFHwDeviceObserver& aHwObserver) = 0;
sl@0
    73
	virtual TInt AddCodec(CMMFSwCodec& aCodec) = 0;
sl@0
    74
	virtual TInt Start() = 0;
sl@0
    75
	virtual void Stop() = 0;
sl@0
    76
	virtual void Pause() = 0;
sl@0
    77
	virtual RMdaDevSound& Device() = 0;
sl@0
    78
	virtual void BufferFilledL(CMMFDataBuffer& aBuffer) = 0;
sl@0
    79
	virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer) = 0;
sl@0
    80
	virtual void SoundDeviceException(TInt aError) = 0;
sl@0
    81
	virtual TSwCodecDataPathState State() const = 0;
sl@0
    82
	virtual TAny* CustomInterface(TUid aInterfaceId);
sl@0
    83
protected:	
sl@0
    84
	CMMFSwCodecDataPath() {};
sl@0
    85
	inline void Panic(TInt aPanicCode);
sl@0
    86
	void ConstructL();
sl@0
    87
sl@0
    88
#ifdef __CYCLE_MMF_DATABUFFERS__
sl@0
    89
	CMMFDataBuffer* CycleAudioBuffer(CMMFDataBuffer* aBuffer);
sl@0
    90
#endif
sl@0
    91
sl@0
    92
#ifdef __USE_MMF_TRANSFERBUFFERS__
sl@0
    93
	CMMFTransferBuffer* CreateTransferBufferL(TUint aBufferSize, CMMFTransferBuffer* aOldBuffer);
sl@0
    94
#endif
sl@0
    95
sl@0
    96
#ifdef __USE_MMF_PTRBUFFERS__
sl@0
    97
	CMMFPtrBuffer* CreatePtrBufferL(TUint aBufferSize);
sl@0
    98
#endif
sl@0
    99
sl@0
   100
protected: 
sl@0
   101
	MMMFHwDeviceObserver* iHwDeviceObserver;
sl@0
   102
	CMMFSwCodec* iCodec;
sl@0
   103
#ifdef __USE_MMF_TRANSFERBUFFERS__
sl@0
   104
	RTransferBuffer* iTransferBuffer;
sl@0
   105
	RTransferWindow* iTransferWindow;
sl@0
   106
#endif
sl@0
   107
sl@0
   108
#ifdef __USE_MMF_PTRBUFFERS__
sl@0
   109
	HBufC8* iPtrBufferMemoryBlock;
sl@0
   110
#endif
sl@0
   111
	};
sl@0
   112
sl@0
   113
/**
sl@0
   114
 * Internal panic
sl@0
   115
 * @internalComponent
sl@0
   116
 */
sl@0
   117
inline void CMMFSwCodecDataPath::Panic(TInt aPanicCode)
sl@0
   118
	{
sl@0
   119
	_LIT(KMMFSwCodecWrapperPanicCategory, "MMFSwCodecWrapper");
sl@0
   120
	User::Panic(KMMFSwCodecWrapperPanicCategory, aPanicCode);
sl@0
   121
	}
sl@0
   122
sl@0
   123
/**
sl@0
   124
 * Extended datapath class with state info  
sl@0
   125
 * @internalComponent 
sl@0
   126
 */
sl@0
   127
class CMMFSwCodecDataPathX : public CMMFSwCodecDataPath
sl@0
   128
    {
sl@0
   129
protected: 
sl@0
   130
    CMMFSwCodecDataPathX(): CMMFSwCodecDataPath() {}
sl@0
   131
    
sl@0
   132
    // from CMMFSwCodecDataPath
sl@0
   133
    TSwCodecDataPathState State() const {return iState;}
sl@0
   134
sl@0
   135
    TSwCodecDataPathState iState;
sl@0
   136
    };
sl@0
   137
sl@0
   138
#endif
sl@0
   139