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