sl@0
|
1 |
// Copyright (c) 2002-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 __MMF_AUDIOCONTROLLER_H__
|
sl@0
|
17 |
#define __MMF_AUDIOCONTROLLER_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
// Standard EPOC32 includes required by this header file
|
sl@0
|
20 |
#include <e32base.h>
|
sl@0
|
21 |
#include <e32std.h>
|
sl@0
|
22 |
#include <ecom/implementationproxy.h>
|
sl@0
|
23 |
|
sl@0
|
24 |
// Public Media Server includes
|
sl@0
|
25 |
#include <mmf/common/mmfcontroller.h>
|
sl@0
|
26 |
#include <mmf/server/mmfdatasink.h>
|
sl@0
|
27 |
#include <mmf/server/mmfdatasource.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <mmf/server/mmfdatapathproxy.h>
|
sl@0
|
30 |
#include <mmf/common/mmfaudio.h>
|
sl@0
|
31 |
#include <mmf/server/mmfaudiooutput.h>
|
sl@0
|
32 |
#include <mmf/server/mmfaudioinput.h>
|
sl@0
|
33 |
#include <mmf/common/mmfstandardcustomcommands.h>
|
sl@0
|
34 |
#include <mmf/common/mmfdrmcustomcommands.h>
|
sl@0
|
35 |
|
sl@0
|
36 |
const TInt KOneSecondInMicroSeconds(1000000);
|
sl@0
|
37 |
|
sl@0
|
38 |
//forward declaration
|
sl@0
|
39 |
class CMMFDataPath2;
|
sl@0
|
40 |
|
sl@0
|
41 |
class CMMFMessageHolder : public CBase
|
sl@0
|
42 |
{
|
sl@0
|
43 |
public:
|
sl@0
|
44 |
static CMMFMessageHolder* NewL(TMMFMessage& aMessage)
|
sl@0
|
45 |
{return new(ELeave) CMMFMessageHolder(aMessage);}
|
sl@0
|
46 |
void Complete(TInt a) {iMessage.Complete(a);}
|
sl@0
|
47 |
private:
|
sl@0
|
48 |
CMMFMessageHolder(TMMFMessage& aMessage): CBase(), iMessage(aMessage) {}
|
sl@0
|
49 |
TMMFMessage iMessage;
|
sl@0
|
50 |
};
|
sl@0
|
51 |
|
sl@0
|
52 |
|
sl@0
|
53 |
/**
|
sl@0
|
54 |
*
|
sl@0
|
55 |
* The public API for clients of the MMFAudioController
|
sl@0
|
56 |
*
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
|
sl@0
|
59 |
class CMMFAudioController : public CMMFController,
|
sl@0
|
60 |
public MAsyncEventHandler,
|
sl@0
|
61 |
public MMMFAudioPlayDeviceCustomCommandImplementor,
|
sl@0
|
62 |
public MMMFAudioRecordDeviceCustomCommandImplementor,
|
sl@0
|
63 |
public MMMFAudioPlayControllerCustomCommandImplementor,
|
sl@0
|
64 |
public MMMFAudioRecordControllerCustomCommandImplementor,
|
sl@0
|
65 |
public MMMFAudioControllerCustomCommandImplementor,
|
sl@0
|
66 |
public MMMFDRMCustomCommandImplementor,
|
sl@0
|
67 |
public MMMFResourceNotificationCustomCommandImplementor,
|
sl@0
|
68 |
public MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor
|
sl@0
|
69 |
{
|
sl@0
|
70 |
public:
|
sl@0
|
71 |
static CMMFController* NewL();
|
sl@0
|
72 |
virtual ~CMMFAudioController();
|
sl@0
|
73 |
|
sl@0
|
74 |
//implement CMMFController ecom plugin interface
|
sl@0
|
75 |
virtual void AddDataSourceL(MDataSource& aDataSource);
|
sl@0
|
76 |
virtual void AddDataSinkL(MDataSink& aDataSink);
|
sl@0
|
77 |
virtual void RemoveDataSourceL(MDataSource& aDataSource);
|
sl@0
|
78 |
virtual void RemoveDataSinkL(MDataSink& aDataSink);
|
sl@0
|
79 |
|
sl@0
|
80 |
virtual void ResetL();
|
sl@0
|
81 |
virtual void PrimeL();
|
sl@0
|
82 |
virtual void PlayL();
|
sl@0
|
83 |
virtual void PauseL();
|
sl@0
|
84 |
virtual void StopL() {} //not required
|
sl@0
|
85 |
virtual void StopL(TMMFMessage& aMessage);
|
sl@0
|
86 |
|
sl@0
|
87 |
virtual TTimeIntervalMicroSeconds PositionL() const;
|
sl@0
|
88 |
virtual void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
|
sl@0
|
89 |
virtual TTimeIntervalMicroSeconds DurationL() const;
|
sl@0
|
90 |
virtual void CustomCommand(TMMFMessage& aMessage);
|
sl@0
|
91 |
virtual void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
|
sl@0
|
92 |
virtual void GetNumberOfMetaDataEntriesL(TInt& aNumberOfEntries);
|
sl@0
|
93 |
virtual CMMFMetaDataEntry* GetMetaDataEntryL(TInt aIndex);
|
sl@0
|
94 |
|
sl@0
|
95 |
//from MAsyncEventHandler
|
sl@0
|
96 |
virtual TInt SendEventToClient(const TMMFEvent& aEvent);
|
sl@0
|
97 |
|
sl@0
|
98 |
//from MMMFAudioPlayDeviceCustomCommandImplementor
|
sl@0
|
99 |
virtual void MapdSetVolumeL(TInt aVolume);
|
sl@0
|
100 |
virtual void MapdGetMaxVolumeL(TInt& aMaxVolume);
|
sl@0
|
101 |
virtual void MapdGetVolumeL(TInt& aVolume);
|
sl@0
|
102 |
virtual void MapdSetVolumeRampL(const TTimeIntervalMicroSeconds& aRampDuration);
|
sl@0
|
103 |
virtual void MapdSetBalanceL(TInt aBalance);
|
sl@0
|
104 |
virtual void MapdGetBalanceL(TInt& aBalance);
|
sl@0
|
105 |
|
sl@0
|
106 |
//from MMMFAudioRecordDeviceCustomCommandImplementor
|
sl@0
|
107 |
virtual void MardSetGainL(TInt aGain);
|
sl@0
|
108 |
virtual void MardGetMaxGainL(TInt& aMaxGain);
|
sl@0
|
109 |
virtual void MardGetGainL(TInt& aGain);
|
sl@0
|
110 |
virtual void MardSetBalanceL(TInt aBalance);
|
sl@0
|
111 |
virtual void MardGetBalanceL(TInt& aBalance);
|
sl@0
|
112 |
|
sl@0
|
113 |
//from MMMFAudioPlayControllerCustomCommandImplementor
|
sl@0
|
114 |
virtual void MapcSetPlaybackWindowL(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd);
|
sl@0
|
115 |
virtual void MapcDeletePlaybackWindowL();
|
sl@0
|
116 |
virtual void MapcGetLoadingProgressL(TInt& aPercentageComplete);
|
sl@0
|
117 |
|
sl@0
|
118 |
//from MMMFAudioRecordControllerCustomCommandImplementor
|
sl@0
|
119 |
virtual void MarcGetRecordTimeAvailableL(TTimeIntervalMicroSeconds& aTime);
|
sl@0
|
120 |
virtual void MarcSetMaxDurationL(const TTimeIntervalMicroSeconds& aMaxDuration);
|
sl@0
|
121 |
virtual void MarcSetMaxFileSizeL(TInt aFileSize);
|
sl@0
|
122 |
virtual void MarcCropL(TBool aToEnd);
|
sl@0
|
123 |
virtual void MarcAddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry);
|
sl@0
|
124 |
virtual void MarcRemoveMetaDataEntryL(TInt aIndex);
|
sl@0
|
125 |
virtual void MarcReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry);
|
sl@0
|
126 |
|
sl@0
|
127 |
//from MMMFAudioControllerCustomCommandImplementor
|
sl@0
|
128 |
virtual void MacSetSourceSampleRateL(TUint aSampleRate);
|
sl@0
|
129 |
virtual void MacSetSourceNumChannelsL(TUint aNumChannels);
|
sl@0
|
130 |
virtual void MacSetSourceFormatL(TUid aFormatUid);
|
sl@0
|
131 |
virtual void MacSetSinkSampleRateL(TUint aSampleRate);
|
sl@0
|
132 |
virtual void MacSetSinkNumChannelsL(TUint aNumChannels);
|
sl@0
|
133 |
virtual void MacSetSinkFormatL(TUid aFormatUid);
|
sl@0
|
134 |
virtual void MacSetCodecL(TFourCC aSourceDataType, TFourCC aSinkDataType);
|
sl@0
|
135 |
virtual void MacSetSourceBitRateL(TUint aBitRate);
|
sl@0
|
136 |
virtual void MacSetSourceDataTypeL(TFourCC aDataType);
|
sl@0
|
137 |
virtual void MacSetSinkBitRateL(TUint aRate);
|
sl@0
|
138 |
virtual void MacSetSinkDataTypeL(TFourCC aDataType);
|
sl@0
|
139 |
virtual void MacGetSourceSampleRateL(TUint& aRate);
|
sl@0
|
140 |
virtual void MacGetSourceBitRateL(TUint& aRate);
|
sl@0
|
141 |
virtual void MacGetSourceNumChannelsL(TUint& aNumChannels);
|
sl@0
|
142 |
virtual void MacGetSourceFormatL(TUid& aFormat);
|
sl@0
|
143 |
virtual void MacGetSourceDataTypeL(TFourCC& aDataType);
|
sl@0
|
144 |
virtual void MacGetSinkSampleRateL(TUint& aRate);
|
sl@0
|
145 |
virtual void MacGetSinkBitRateL(TUint& aRate);
|
sl@0
|
146 |
virtual void MacGetSinkNumChannelsL(TUint& aNumChannels);
|
sl@0
|
147 |
virtual void MacGetSinkFormatL(TUid& aFormat);
|
sl@0
|
148 |
virtual void MacGetSinkDataTypeL(TFourCC& aDataType);
|
sl@0
|
149 |
virtual void MacGetSupportedSourceSampleRatesL(RArray<TUint>& aSupportedRates);
|
sl@0
|
150 |
virtual void MacGetSupportedSourceBitRatesL(RArray<TUint>& aSupportedRates);
|
sl@0
|
151 |
virtual void MacGetSupportedSourceNumChannelsL(RArray<TUint>& aSupportedChannels);
|
sl@0
|
152 |
virtual void MacGetSupportedSourceDataTypesL(RArray<TFourCC>& aSupportedDataTypes);
|
sl@0
|
153 |
virtual void MacGetSupportedSinkSampleRatesL(RArray<TUint>& aSupportedRates);
|
sl@0
|
154 |
virtual void MacGetSupportedSinkBitRatesL(RArray<TUint>& aSupportedRates);
|
sl@0
|
155 |
virtual void MacGetSupportedSinkNumChannelsL(RArray<TUint>& aSupportedChannels);
|
sl@0
|
156 |
virtual void MacGetSupportedSinkDataTypesL(RArray<TFourCC>& aSupportedDataTypes);
|
sl@0
|
157 |
|
sl@0
|
158 |
// resource notification
|
sl@0
|
159 |
virtual void MarnRegisterAsClientL(TUid aEventType,const TDesC8& aNotificationRegistrationData);
|
sl@0
|
160 |
virtual void MarnCancelRegisterAsClientL(TUid aEventType);
|
sl@0
|
161 |
virtual void MarnGetResourceNotificationDataL(TUid aEventType,TDes8& aNotificationData);
|
sl@0
|
162 |
virtual void MarnWillResumePlayL();
|
sl@0
|
163 |
|
sl@0
|
164 |
// from MMMFDRMCustomCommandImplementor
|
sl@0
|
165 |
virtual TInt MdcExecuteIntent(ContentAccess::TIntent aIntent);
|
sl@0
|
166 |
virtual TInt MdcEvaluateIntent(ContentAccess::TIntent aIntent);
|
sl@0
|
167 |
virtual TInt MdcDisableAutomaticIntent(TBool aDisableAutoIntent);
|
sl@0
|
168 |
virtual TInt MdcSetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue);
|
sl@0
|
169 |
|
sl@0
|
170 |
//from MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor
|
sl@0
|
171 |
virtual TInt MapcSetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
|
sl@0
|
172 |
public:
|
sl@0
|
173 |
|
sl@0
|
174 |
/**
|
sl@0
|
175 |
TControllerState is an enumeration within the namespace CMMFAudioController
|
sl@0
|
176 |
The enumeration provides a set of control states:
|
sl@0
|
177 |
EStopped is the initial state the controller resides in after it has been loaded
|
sl@0
|
178 |
EPrimed is the state the controller is in when it has been associated with datapaths but is not streaming data
|
sl@0
|
179 |
EPlaying is the state the controller is in when it is streaming data
|
sl@0
|
180 |
*/
|
sl@0
|
181 |
enum TControllerState
|
sl@0
|
182 |
{
|
sl@0
|
183 |
EStopped,
|
sl@0
|
184 |
EPrimed,
|
sl@0
|
185 |
EPlaying
|
sl@0
|
186 |
};
|
sl@0
|
187 |
|
sl@0
|
188 |
protected:
|
sl@0
|
189 |
CMMFAudioController();
|
sl@0
|
190 |
|
sl@0
|
191 |
protected:
|
sl@0
|
192 |
void ConstructL();
|
sl@0
|
193 |
void NegotiateL();
|
sl@0
|
194 |
|
sl@0
|
195 |
void ConvertFromDevSoundCapsToSampleRatesL(const TMMFCapabilities& aDevSoundCaps,
|
sl@0
|
196 |
RArray<TUint>& aSampleRates);
|
sl@0
|
197 |
void ConvertFromDevSoundCapsToNumChannelsL(const TMMFCapabilities& aDevSoundCaps,
|
sl@0
|
198 |
RArray<TUint>& aNumChannels);
|
sl@0
|
199 |
void ConvertFromDevSoundCapsToDataTypesL(const TMMFCapabilities& aDevSoundCaps,
|
sl@0
|
200 |
RArray<TFourCC>& aDataTypes);
|
sl@0
|
201 |
void ConvertFromSampleRateToDevSoundCapsL(TUint aSampleRate, TMMFCapabilities& aDevSoundCaps);
|
sl@0
|
202 |
void ConvertFromNumChannelsToDevSoundCapsL(TUint aNumChannels, TMMFCapabilities& aDevSoundCaps);
|
sl@0
|
203 |
void ConvertFromDataTypeToDevSoundCapsL(TFourCC aDataType, TMMFCapabilities& aDevSoundCaps);
|
sl@0
|
204 |
|
sl@0
|
205 |
// state accessor functions
|
sl@0
|
206 |
TBool SetState( TControllerState aState );
|
sl@0
|
207 |
TControllerState State() const ;
|
sl@0
|
208 |
TBool IsValidStateTransition( TControllerState aState ) const;
|
sl@0
|
209 |
TBool Invariant() const;
|
sl@0
|
210 |
TBool IsValidState( TControllerState aState ) const ;
|
sl@0
|
211 |
TBool ResetPostCondition() const;
|
sl@0
|
212 |
TBool SinkFormatRequired( MDataSink& aDataSink) const;
|
sl@0
|
213 |
TBool SourceFormatRequired(MDataSource& aDataSource) const;
|
sl@0
|
214 |
void CalculateLeftRightBalance( TInt& aLeft, TInt& aRight, TInt aBalance ) const;
|
sl@0
|
215 |
void CalculateBalance( TInt& aBalance, TInt aLeft, TInt aRight ) const;
|
sl@0
|
216 |
|
sl@0
|
217 |
//This method is used to assist testing of the audio controller
|
sl@0
|
218 |
virtual TBool IsUnderTest(){return EFalse;}
|
sl@0
|
219 |
|
sl@0
|
220 |
private:
|
sl@0
|
221 |
MDataSource* iDataSource;
|
sl@0
|
222 |
MDataSink* iDataSink;
|
sl@0
|
223 |
CMMFDataPath2* iDataPath;
|
sl@0
|
224 |
CMMFFormatDecode* iSourceFormat;
|
sl@0
|
225 |
CMMFFormatEncode* iSinkFormat;
|
sl@0
|
226 |
TMediaId iMediaId;
|
sl@0
|
227 |
TBool iDisableAutoIntent;
|
sl@0
|
228 |
TControllerState iState;
|
sl@0
|
229 |
TMMFPrioritySettings iPrioritySettings;
|
sl@0
|
230 |
TBool iSourceAndSinkAdded;
|
sl@0
|
231 |
TBool iStoppingRecording;
|
sl@0
|
232 |
CMMFMessageHolder* iStoppingMessage;
|
sl@0
|
233 |
TBool iIsPaused; // used to determine DRM command to send on PlayL()
|
sl@0
|
234 |
TBool iSourceFormatSupportsCustomInterfaces;
|
sl@0
|
235 |
TBool iRegisterARN;//CR
|
sl@0
|
236 |
TBool iIsPreemptionPause;//CR
|
sl@0
|
237 |
};
|
sl@0
|
238 |
|
sl@0
|
239 |
|
sl@0
|
240 |
#endif
|