1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/sounddevbt/src/swcodecwrapper/mmfBtSwCodecPlayDataPath.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,128 @@
1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __MMFBTSWCODECPLAYDATAPATH_H__
1.20 +#define __MMFBTSWCODECPLAYDATAPATH_H__
1.21 +
1.22 +
1.23 +#include "mmfBtSwCodecDataPath.h"
1.24 +#include "mmfbtswcodecwrapper.h"
1.25 +
1.26 +
1.27 +class CMMFSwCodecPlayDataPath; //fwd ref
1.28 +class CMMFSwCodecUtility; // fwd ref
1.29 +
1.30 +class CRoutingSoundPlayDevice; // fwd ref
1.31 +
1.32 +/**
1.33 + * Active object used by the CMMFSwCodecPlayDataPath to send data to the sound
1.34 + * driver This particular active object encapsulates the asynchronous play
1.35 + * function, where a buffer of data is sent to the WINS audio device, and the
1.36 + * active object's RunL is called when the buffer has been consumed by the
1.37 + * WINS audio device.
1.38 + * @internalComponent
1.39 + */
1.40 +class CDataPathPlayer : public CActive
1.41 + {
1.42 +public:
1.43 + CDataPathPlayer(CMMFSwCodecPlayDataPath& aParent, TInt aPriority);
1.44 + ~CDataPathPlayer();
1.45 + void Start();
1.46 + void ResumePlaying();
1.47 + void PlayData(const CMMFDataBuffer& aData);
1.48 + void Stop();
1.49 + virtual void RunL();
1.50 + virtual TInt RunError(TInt aError);
1.51 + virtual void DoCancel();
1.52 + virtual void Error(TInt aError);
1.53 +private:
1.54 + CMMFSwCodecPlayDataPath& iParent;
1.55 + const CMMFDataBuffer* iDataFromSource;
1.56 + TBool iResumePlaying;
1.57 + };
1.58 +
1.59 +/*
1.60 +* Active object used by CMMFSwCodecPlayDataPath to listening for error messages
1.61 +* from the WINS audio device. If this object's RunL is called, playback has
1.62 +* been terminated for some reason. The active object then
1.63 +* notifies its parent the datapath, so that proper cleanup and client
1.64 +* notification can occur.
1.65 +* @internalComponent
1.66 +*/
1.67 +class CSoundDevPlayErrorReceiver : public CActive
1.68 + {
1.69 +public:
1.70 + CSoundDevPlayErrorReceiver(CMMFSwCodecPlayDataPath& aParent, TInt aPriority);
1.71 + ~CSoundDevPlayErrorReceiver();
1.72 + void Start();
1.73 + void Stop();
1.74 + virtual void RunL();
1.75 + virtual void DoCancel();
1.76 +private:
1.77 + CMMFSwCodecPlayDataPath& iParent;
1.78 + };
1.79 +
1.80 +
1.81 +/**
1.82 + * Derived class for play datapath internal to the Sw codec wrapper
1.83 + * @internalComponent
1.84 + */
1.85 +class CMMFSwCodecPlayDataPath : public CMMFSwCodecDataPath
1.86 + {
1.87 +public:
1.88 + static CMMFSwCodecPlayDataPath* NewL(CRoutingSoundPlayDevice* aSoundDevice,
1.89 + TUid aDeviceUid);
1.90 + virtual ~CMMFSwCodecPlayDataPath();
1.91 + virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver);
1.92 + virtual TInt AddCodec(CMMFSwCodec& aCodec);
1.93 + virtual TInt Start();
1.94 + virtual void Stop();
1.95 + virtual void Pause();
1.96 + virtual void BufferFilledL(CMMFDataBuffer& aBuffer);
1.97 + virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer);
1.98 + virtual void SoundDeviceException(TInt aError);
1.99 + virtual CRoutingSoundPlayDevice* Device();
1.100 + virtual void SetPlayCustomInterface(MPlayCustomInterface& aCustomInterface);
1.101 + virtual void SetConfigForAudioRamp(TUint aSampleRate, TUint aChannels); //need for audio ramper
1.102 +protected:
1.103 + CMMFSwCodecPlayDataPath(CRoutingSoundPlayDevice* aSoundDevice, TUid aDeviceUid) :
1.104 + iSoundDevice(aSoundDevice), iDeviceUid(aDeviceUid) {};
1.105 + void ConstructL();
1.106 + void FillSourceBufferL();
1.107 + void FillSoundDeviceBufferL();
1.108 +protected:
1.109 + CDataPathPlayer* iAudioPlayer;
1.110 + CSoundDevPlayErrorReceiver* iSoundDeviceErrorReceiver;
1.111 + CRoutingSoundPlayDevice* iSoundDevice; // Not owned
1.112 + CMMFDataBuffer* iSourceBuffer;
1.113 + CMMFDataBuffer* iSoundDeviceBuffer;
1.114 + TBool iNoMoreSourceData;
1.115 + TBool iSinkCanReceive;
1.116 + TUint iSourceBufferSize;
1.117 + TUint iSoundDevBufferSize;
1.118 + CMMFSwCodecUtility* iUtility;
1.119 + TBool iRampAudioSample;
1.120 + MPlayCustomInterface* iCustomInterface; // not owned
1.121 + TTimeIntervalMicroSeconds iVolumeRamp;
1.122 +
1.123 + // DEF048512
1.124 + TInt iSampleRate;
1.125 + TInt iChannels;
1.126 +
1.127 + TUid iDeviceUid; // required to close the RoutingSoundPlayDevice
1.128 + };
1.129 +
1.130 +#endif
1.131 +