devsound/sounddevbt/src/swcodecwrapper/mmfBtSwCodecPlayDataPath.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 __MMFBTSWCODECPLAYDATAPATH_H__
       
    17 #define __MMFBTSWCODECPLAYDATAPATH_H__
       
    18 
       
    19 
       
    20 #include "mmfBtSwCodecDataPath.h"
       
    21 #include "mmfbtswcodecwrapper.h"
       
    22 
       
    23 
       
    24 class CMMFSwCodecPlayDataPath; //fwd ref
       
    25 class CMMFSwCodecUtility;	// fwd ref
       
    26 
       
    27 class CRoutingSoundPlayDevice;	// fwd ref
       
    28 
       
    29 /**
       
    30  * Active object used by the CMMFSwCodecPlayDataPath to send data to the sound
       
    31  * driver  This particular active object encapsulates the asynchronous play 
       
    32  * function, where a buffer of data is sent to the WINS audio device, and the
       
    33  * active object's RunL is called when the buffer has been consumed by the 
       
    34  * WINS audio device.
       
    35  * @internalComponent
       
    36  */
       
    37 class CDataPathPlayer : public CActive
       
    38 	{
       
    39 public:
       
    40 	CDataPathPlayer(CMMFSwCodecPlayDataPath& aParent, TInt aPriority);
       
    41 	~CDataPathPlayer();
       
    42 	void Start();
       
    43 	void ResumePlaying();
       
    44 	void PlayData(const CMMFDataBuffer& aData);
       
    45 	void Stop();
       
    46 	virtual void RunL();
       
    47 	virtual TInt RunError(TInt aError);
       
    48 	virtual void DoCancel();
       
    49 	virtual void Error(TInt aError);
       
    50 private:
       
    51 	CMMFSwCodecPlayDataPath& iParent;
       
    52 	const CMMFDataBuffer* iDataFromSource;
       
    53 	TBool iResumePlaying;
       
    54 	};
       
    55 
       
    56 /*
       
    57 * Active object used by CMMFSwCodecPlayDataPath to listening for error messages
       
    58 * from the WINS audio device.  If this object's RunL is called, playback has 
       
    59 * been terminated for some reason.  The active object then 
       
    60 * notifies its parent the datapath, so that proper cleanup and client 
       
    61 * notification can occur.
       
    62 * @internalComponent
       
    63 */
       
    64 class CSoundDevPlayErrorReceiver : public CActive
       
    65 	{
       
    66 public:
       
    67 	CSoundDevPlayErrorReceiver(CMMFSwCodecPlayDataPath& aParent, TInt aPriority);
       
    68 	~CSoundDevPlayErrorReceiver();
       
    69 	void Start();
       
    70 	void Stop();
       
    71 	virtual void RunL();
       
    72 	virtual void DoCancel();
       
    73 private:
       
    74 	CMMFSwCodecPlayDataPath& iParent;
       
    75 	};
       
    76 
       
    77 
       
    78 /**
       
    79  *  Derived class for play datapath internal to the Sw codec wrapper
       
    80  *  @internalComponent
       
    81  */
       
    82 class CMMFSwCodecPlayDataPath : public CMMFSwCodecDataPath
       
    83 	{ 
       
    84 public:	
       
    85 	static CMMFSwCodecPlayDataPath* NewL(CRoutingSoundPlayDevice* aSoundDevice,
       
    86 										 TUid aDeviceUid);
       
    87 	virtual ~CMMFSwCodecPlayDataPath(); 
       
    88 	virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver);
       
    89 	virtual TInt AddCodec(CMMFSwCodec& aCodec);
       
    90 	virtual TInt Start();
       
    91 	virtual void Stop();
       
    92 	virtual void Pause();
       
    93 	virtual void BufferFilledL(CMMFDataBuffer& aBuffer);
       
    94 	virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer);
       
    95 	virtual void SoundDeviceException(TInt aError);
       
    96 	virtual CRoutingSoundPlayDevice* Device();
       
    97 	virtual void SetPlayCustomInterface(MPlayCustomInterface& aCustomInterface);
       
    98 	virtual void SetConfigForAudioRamp(TUint aSampleRate, TUint aChannels); //need for audio ramper
       
    99 protected:	
       
   100 	CMMFSwCodecPlayDataPath(CRoutingSoundPlayDevice* aSoundDevice, TUid aDeviceUid) :
       
   101 							iSoundDevice(aSoundDevice), iDeviceUid(aDeviceUid) {};
       
   102 	void ConstructL();
       
   103 	void FillSourceBufferL();
       
   104 	void FillSoundDeviceBufferL();
       
   105 protected: 
       
   106 	CDataPathPlayer* iAudioPlayer;
       
   107 	CSoundDevPlayErrorReceiver* iSoundDeviceErrorReceiver;
       
   108 	CRoutingSoundPlayDevice* iSoundDevice;	// Not owned
       
   109 	CMMFDataBuffer* iSourceBuffer;
       
   110 	CMMFDataBuffer* iSoundDeviceBuffer;
       
   111 	TBool iNoMoreSourceData;
       
   112 	TBool iSinkCanReceive;
       
   113 	TUint iSourceBufferSize;
       
   114 	TUint iSoundDevBufferSize;
       
   115 	CMMFSwCodecUtility* iUtility;
       
   116 	TBool iRampAudioSample;
       
   117 	MPlayCustomInterface* iCustomInterface;	// not owned
       
   118 	TTimeIntervalMicroSeconds iVolumeRamp;
       
   119 	
       
   120 	// DEF048512
       
   121 	TInt iSampleRate;
       
   122 	TInt iChannels;
       
   123 	
       
   124 	TUid iDeviceUid;	// required to close the RoutingSoundPlayDevice
       
   125 	};
       
   126 
       
   127 #endif
       
   128