Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __MMFBTSWCODECPLAYDATAPATH_H__
17 #define __MMFBTSWCODECPLAYDATAPATH_H__
20 #include "mmfBtSwCodecDataPath.h"
21 #include "mmfbtswcodecwrapper.h"
24 class CMMFSwCodecPlayDataPath; //fwd ref
25 class CMMFSwCodecUtility; // fwd ref
27 class CRoutingSoundPlayDevice; // fwd ref
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
37 class CDataPathPlayer : public CActive
40 CDataPathPlayer(CMMFSwCodecPlayDataPath& aParent, TInt aPriority);
44 void PlayData(const CMMFDataBuffer& aData);
47 virtual TInt RunError(TInt aError);
48 virtual void DoCancel();
49 virtual void Error(TInt aError);
51 CMMFSwCodecPlayDataPath& iParent;
52 const CMMFDataBuffer* iDataFromSource;
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.
64 class CSoundDevPlayErrorReceiver : public CActive
67 CSoundDevPlayErrorReceiver(CMMFSwCodecPlayDataPath& aParent, TInt aPriority);
68 ~CSoundDevPlayErrorReceiver();
72 virtual void DoCancel();
74 CMMFSwCodecPlayDataPath& iParent;
79 * Derived class for play datapath internal to the Sw codec wrapper
82 class CMMFSwCodecPlayDataPath : public CMMFSwCodecDataPath
85 static CMMFSwCodecPlayDataPath* NewL(CRoutingSoundPlayDevice* aSoundDevice,
87 virtual ~CMMFSwCodecPlayDataPath();
88 virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver);
89 virtual TInt AddCodec(CMMFSwCodec& aCodec);
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
100 CMMFSwCodecPlayDataPath(CRoutingSoundPlayDevice* aSoundDevice, TUid aDeviceUid) :
101 iSoundDevice(aSoundDevice), iDeviceUid(aDeviceUid) {};
103 void FillSourceBufferL();
104 void FillSoundDeviceBufferL();
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;
124 TUid iDeviceUid; // required to close the RoutingSoundPlayDevice