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 __MMFSWCODECPLAYDATAPATH_H__
|
sl@0
|
17 |
#define __MMFSWCODECPLAYDATAPATH_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#include "mmfSwCodecDataPath.h"
|
sl@0
|
21 |
#include <mmf/server/mmfswcodecwrapper.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
|
sl@0
|
24 |
class CMMFSwCodecPlayDataPath; //fwd ref
|
sl@0
|
25 |
class CMMFSwCodecUtility; // fwd ref
|
sl@0
|
26 |
class MEmptyBuffersCustomInterface; // fwd ref
|
sl@0
|
27 |
class MSetVbrFlagCustomInterface; // 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 CMMFSwCodecDataPathX,
|
sl@0
|
83 |
public MEmptyBuffersCustomInterface,
|
sl@0
|
84 |
public MSetVbrFlagCustomInterface,
|
sl@0
|
85 |
public MTimePlayedCustomInterface,
|
sl@0
|
86 |
public MIgnoreUnderflowEventsCustomInterface
|
sl@0
|
87 |
{
|
sl@0
|
88 |
public:
|
sl@0
|
89 |
static CMMFSwCodecPlayDataPath* NewL();
|
sl@0
|
90 |
virtual ~CMMFSwCodecPlayDataPath();
|
sl@0
|
91 |
virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver);
|
sl@0
|
92 |
virtual TInt AddCodec(CMMFSwCodec& aCodec);
|
sl@0
|
93 |
virtual TInt Start();
|
sl@0
|
94 |
virtual void Stop();
|
sl@0
|
95 |
virtual void Pause();
|
sl@0
|
96 |
virtual void BufferFilledL(CMMFDataBuffer& aBuffer);
|
sl@0
|
97 |
virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer);
|
sl@0
|
98 |
virtual void SoundDeviceException(TInt aError);
|
sl@0
|
99 |
virtual RMdaDevSound& Device();
|
sl@0
|
100 |
virtual void SetPlayCustomInterface(MPlayCustomInterface& aCustomInterface);
|
sl@0
|
101 |
virtual TInt EmptyBuffers();
|
sl@0
|
102 |
virtual TAny* CustomInterface(TUid aInterfaceId);
|
sl@0
|
103 |
//From MSetVbrFlagCustomInterface
|
sl@0
|
104 |
virtual void SetVbrFlag();
|
sl@0
|
105 |
virtual TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime);
|
sl@0
|
106 |
virtual void IgnoreUnderflowEvents();
|
sl@0
|
107 |
protected:
|
sl@0
|
108 |
CMMFSwCodecPlayDataPath() {};
|
sl@0
|
109 |
void ConstructL();
|
sl@0
|
110 |
void FillSourceBufferL();
|
sl@0
|
111 |
void FillSoundDeviceBufferL();
|
sl@0
|
112 |
protected:
|
sl@0
|
113 |
CDataPathPlayer* iAudioPlayer;
|
sl@0
|
114 |
CSoundDevPlayErrorReceiver* iSoundDeviceErrorReceiver;
|
sl@0
|
115 |
RMdaDevSound iSoundDevice;
|
sl@0
|
116 |
CMMFDataBuffer* iSourceBuffer;
|
sl@0
|
117 |
CMMFDataBuffer* iSoundDeviceBuffer;
|
sl@0
|
118 |
TBool iNoMoreSourceData;
|
sl@0
|
119 |
TBool iSinkCanReceive;
|
sl@0
|
120 |
TUint iSourceBufferSize;
|
sl@0
|
121 |
TUint iSoundDevBufferSize;
|
sl@0
|
122 |
CMMFSwCodecUtility* iUtility;
|
sl@0
|
123 |
TBool iRampAudioSample;
|
sl@0
|
124 |
MPlayCustomInterface* iCustomInterface; // not owned
|
sl@0
|
125 |
TTimeIntervalMicroSeconds iVolumeRamp;
|
sl@0
|
126 |
// DEF048512
|
sl@0
|
127 |
TInt iSampleRate;
|
sl@0
|
128 |
TInt iChannels;
|
sl@0
|
129 |
TBool iVbrFlag;
|
sl@0
|
130 |
TInt64 iBytesPlayed;
|
sl@0
|
131 |
TBool iNoMoreSoundDeviceData;
|
sl@0
|
132 |
TBool iIgnoreUnderflow;
|
sl@0
|
133 |
};
|
sl@0
|
134 |
|
sl@0
|
135 |
#endif
|
sl@0
|
136 |
|