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 __MMFCLIENTAUDIOCONVERTER_H
|
sl@0
|
17 |
#define __MMFCLIENTAUDIOCONVERTER_H
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <e32std.h>
|
sl@0
|
20 |
#include <e32base.h>
|
sl@0
|
21 |
#include <mdaaudiosampleeditor.h>
|
sl@0
|
22 |
#include <mmf/server/mmffile.h>
|
sl@0
|
23 |
#include <mmf/server/mmfdes.h>
|
sl@0
|
24 |
#include <mmf/server/mmfurl.h>
|
sl@0
|
25 |
#include <mmf/common/mmfcontroller.h>
|
sl@0
|
26 |
#include "mmfclientutility.h"
|
sl@0
|
27 |
|
sl@0
|
28 |
/**
|
sl@0
|
29 |
Concrete implementation of the CMdaAudioConvertUtility API.
|
sl@0
|
30 |
@see CMdaAudioConvertUtility
|
sl@0
|
31 |
*/
|
sl@0
|
32 |
class CMMFMdaAudioConvertUtility;
|
sl@0
|
33 |
NONSHARABLE_CLASS( CMMFMdaAudioConvertUtility ): public CBase,
|
sl@0
|
34 |
public MMMFControllerEventMonitorObserver,
|
sl@0
|
35 |
public MMMFFindAndOpenControllerObserver
|
sl@0
|
36 |
{
|
sl@0
|
37 |
friend class CMdaAudioConvertUtility;
|
sl@0
|
38 |
// for testing only
|
sl@0
|
39 |
friend class CTestStepUnitMMFAudClient;
|
sl@0
|
40 |
|
sl@0
|
41 |
public:
|
sl@0
|
42 |
~CMMFMdaAudioConvertUtility();
|
sl@0
|
43 |
|
sl@0
|
44 |
void OpenL(const TDesC& aPrimaryFile, const TDesC& aSecondaryFile);
|
sl@0
|
45 |
// Open existing file and new/existing secondary
|
sl@0
|
46 |
void OpenL(const TDesC& aPrimaryFile,
|
sl@0
|
47 |
TMdaClipLocation* aLocation, // Normally file or descriptor
|
sl@0
|
48 |
TMdaClipFormat* aFormat, // Data format
|
sl@0
|
49 |
TMdaPackage* aArg1 = NULL, // Normally codec to use
|
sl@0
|
50 |
TMdaPackage* aArg2 = NULL); // Normally audio settings
|
sl@0
|
51 |
|
sl@0
|
52 |
void OpenL(TMdaClipLocation* aPriLocation,
|
sl@0
|
53 |
TMdaClipLocation* aSecLocation,
|
sl@0
|
54 |
TMdaClipFormat* aPriFormat,
|
sl@0
|
55 |
TMdaClipFormat* aSecFormat,
|
sl@0
|
56 |
TMdaPackage* aPriArg1 = NULL, // Normally source codec to use
|
sl@0
|
57 |
TMdaPackage* aPriArg2 = NULL, // Normally source audio settings
|
sl@0
|
58 |
TMdaPackage* aSecArg1 = NULL, // Normally sink codec to use
|
sl@0
|
59 |
TMdaPackage* aSecArg2 = NULL);// Normally sink audio settings
|
sl@0
|
60 |
|
sl@0
|
61 |
// new controller based open
|
sl@0
|
62 |
void OpenL(TMdaClipLocation* aPriLocation,
|
sl@0
|
63 |
TMdaClipLocation* aSecLocation,
|
sl@0
|
64 |
TUid aControllerUid, // the controller to use
|
sl@0
|
65 |
TUid aDestFormatUid,
|
sl@0
|
66 |
TFourCC aDestDataType);
|
sl@0
|
67 |
//from MMMFControllerEventMonitorObserver
|
sl@0
|
68 |
void HandleEvent(const TMMFEvent& aEvent);
|
sl@0
|
69 |
|
sl@0
|
70 |
// from MMMFFindAndOpenControllerObserver
|
sl@0
|
71 |
virtual void MfaocComplete(
|
sl@0
|
72 |
TInt& aError,
|
sl@0
|
73 |
RMMFController* aController,
|
sl@0
|
74 |
TUid aControllerUid,
|
sl@0
|
75 |
TMMFMessageDestination* aSourceHandle,
|
sl@0
|
76 |
TMMFMessageDestination* aSinkHandle);
|
sl@0
|
77 |
|
sl@0
|
78 |
void UseSharedHeap();
|
sl@0
|
79 |
|
sl@0
|
80 |
protected:
|
sl@0
|
81 |
CMMFMdaAudioConvertUtility(CMdaAudioConvertUtility* aParent, MMdaObjectStateChangeObserver& aCallback);
|
sl@0
|
82 |
void ConstructL(TInt aPriority, TInt aPref);
|
sl@0
|
83 |
private:
|
sl@0
|
84 |
|
sl@0
|
85 |
CMdaAudioClipUtility::TState State();
|
sl@0
|
86 |
void Close();
|
sl@0
|
87 |
void PlayL(); // N.B. ConvertL should be used in preference to PlayL
|
sl@0
|
88 |
void RecordL(); // N.B. ConvertL should be used in preference to RecordL
|
sl@0
|
89 |
void ConvertL();
|
sl@0
|
90 |
void Stop();
|
sl@0
|
91 |
void CropL(TBool aCropToEnd = ETrue);
|
sl@0
|
92 |
void SetPosition(const TTimeIntervalMicroSeconds& aPosition);
|
sl@0
|
93 |
const TTimeIntervalMicroSeconds& Position();
|
sl@0
|
94 |
const TTimeIntervalMicroSeconds& RecordTimeAvailable();
|
sl@0
|
95 |
const TTimeIntervalMicroSeconds& Duration();
|
sl@0
|
96 |
void SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd);
|
sl@0
|
97 |
void ClearPlayWindow();
|
sl@0
|
98 |
void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
|
sl@0
|
99 |
void SetMaxWriteLength(TInt aMaxWriteLength /*= KMdaClipLocationMaxWriteLengthNone*/);
|
sl@0
|
100 |
void SetPriority(TInt aPriority, TInt aPref);
|
sl@0
|
101 |
void CropL(const TTimeIntervalMicroSeconds & aCropBegin,
|
sl@0
|
102 |
const TTimeIntervalMicroSeconds & aCropEnd);
|
sl@0
|
103 |
|
sl@0
|
104 |
// Codec support
|
sl@0
|
105 |
void GetSupportedDestinationDataTypesL(RArray<TFourCC>& aSupportedDestinationDataTypes);
|
sl@0
|
106 |
void SetSourceDataTypeL(TFourCC aDataType) ;
|
sl@0
|
107 |
void SetDestinationDataTypeL(TFourCC aCodec);
|
sl@0
|
108 |
TFourCC DestinationDataTypeL();
|
sl@0
|
109 |
TFourCC SourceDataTypeL();
|
sl@0
|
110 |
|
sl@0
|
111 |
// Bit rate support
|
sl@0
|
112 |
void SetDestinationBitRateL(TUint aBitRate);
|
sl@0
|
113 |
TUint DestinationBitRateL();
|
sl@0
|
114 |
void GetSupportedConversionBitRatesL(RArray<TUint>& aSupportedBitRates);
|
sl@0
|
115 |
TUint SourceBitRateL();
|
sl@0
|
116 |
|
sl@0
|
117 |
// Sample rate support
|
sl@0
|
118 |
void SetSourceSampleRateL(TUint aSampleRate);
|
sl@0
|
119 |
void SetDestinationSampleRateL(TUint aSampleRate);
|
sl@0
|
120 |
TUint DestinationSampleRateL();
|
sl@0
|
121 |
void GetSupportedConversionSampleRatesL(RArray<TUint>& aSupportedSampleRates);
|
sl@0
|
122 |
TUint SourceSampleRateL();
|
sl@0
|
123 |
|
sl@0
|
124 |
// Format support
|
sl@0
|
125 |
void SetSourceFormatL(TUid aRecordFormat);
|
sl@0
|
126 |
void SetDestinationFormatL(TUid aFormatUid);
|
sl@0
|
127 |
TUid DestinationFormatL();
|
sl@0
|
128 |
TUid SourceFormatL();
|
sl@0
|
129 |
|
sl@0
|
130 |
// Number of channels
|
sl@0
|
131 |
void SetSourceNumberOfChannelsL(TUint aNumberOfChannels);
|
sl@0
|
132 |
void SetDestinationNumberOfChannelsL(TUint aNumberOfChannels);
|
sl@0
|
133 |
TUint DestinationNumberOfChannelsL();
|
sl@0
|
134 |
void GetSupportedConversionNumberOfChannelsL(RArray<TUint>& aSupportedNumChannels);
|
sl@0
|
135 |
TUint SourceNumberOfChannelsL();
|
sl@0
|
136 |
|
sl@0
|
137 |
const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
|
sl@0
|
138 |
TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
|
sl@0
|
139 |
TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
|
sl@0
|
140 |
void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
|
sl@0
|
141 |
void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
|
sl@0
|
142 |
|
sl@0
|
143 |
CMdaAudioConvertUtility* Parent() const;
|
sl@0
|
144 |
|
sl@0
|
145 |
void Reset();
|
sl@0
|
146 |
TInt ControllerOpen();
|
sl@0
|
147 |
void ConfigureSourceSinkL(TMdaClipLocation* aPriLocation, TMdaClipLocation* aSecLocation);
|
sl@0
|
148 |
|
sl@0
|
149 |
TInt SetThreadPriority(const TThreadPriority& aThreadPriority) const;
|
sl@0
|
150 |
private:
|
sl@0
|
151 |
MMdaObjectStateChangeObserver& iCallback;
|
sl@0
|
152 |
CMMFMdaObjectStateChangeObserverCallback* iAsyncCallback;
|
sl@0
|
153 |
|
sl@0
|
154 |
RMMFController iController;
|
sl@0
|
155 |
CMMFControllerEventMonitor* iControllerEventMonitor;
|
sl@0
|
156 |
|
sl@0
|
157 |
// Source and sink handle info
|
sl@0
|
158 |
TMMFMessageDestination iSourceHandle;
|
sl@0
|
159 |
TMMFMessageDestination iSinkHandle;
|
sl@0
|
160 |
// Custom commands
|
sl@0
|
161 |
RMMFAudioControllerCustomCommands iAudioControllerCustomCommands;
|
sl@0
|
162 |
RMMFAudioPlayControllerCustomCommands iAudioPlayControllerCustomCommands;
|
sl@0
|
163 |
RMMFAudioRecordControllerCustomCommands iAudioRecordControllerCustomCommands;
|
sl@0
|
164 |
|
sl@0
|
165 |
TMMFPrioritySettings iPrioritySettings;
|
sl@0
|
166 |
|
sl@0
|
167 |
TTimeIntervalMicroSeconds iPosition;
|
sl@0
|
168 |
TTimeIntervalMicroSeconds iPositionTemp;
|
sl@0
|
169 |
TTimeIntervalMicroSeconds iDuration;
|
sl@0
|
170 |
TTimeIntervalMicroSeconds iRecordTimeAvailable;
|
sl@0
|
171 |
|
sl@0
|
172 |
CMdaAudioClipUtility::TState iState;
|
sl@0
|
173 |
|
sl@0
|
174 |
// Convert window start and end times and whether it has been set
|
sl@0
|
175 |
TTimeIntervalMicroSeconds iConvertStart;
|
sl@0
|
176 |
TTimeIntervalMicroSeconds iConvertEnd;
|
sl@0
|
177 |
TBool iConvertWindowSet;
|
sl@0
|
178 |
|
sl@0
|
179 |
// parent class for callback
|
sl@0
|
180 |
CMdaAudioConvertUtility* iParent;
|
sl@0
|
181 |
RArray<TUid> iMediaIds;
|
sl@0
|
182 |
|
sl@0
|
183 |
// keeping track of cropped clip duration
|
sl@0
|
184 |
TBool iHasCropped;
|
sl@0
|
185 |
TTimeIntervalMicroSeconds iCroppedDuration;
|
sl@0
|
186 |
CMMFControllerImplementationInformation* iControllerImplementationInformation;
|
sl@0
|
187 |
TUid iControllerUid;
|
sl@0
|
188 |
|
sl@0
|
189 |
// utility class to find and open a suitable controller asynchronously
|
sl@0
|
190 |
CMMFFindAndOpenController* iFindAndOpenController;
|
sl@0
|
191 |
|
sl@0
|
192 |
TUid iSourceFormatUid; // for SetSourceFormat()
|
sl@0
|
193 |
TUid iSinkFormatUid; // for SetSinkFormat()
|
sl@0
|
194 |
|
sl@0
|
195 |
TFourCC iSourceDataType; // for SetSourceDataType()
|
sl@0
|
196 |
TFourCC iSinkDataType; // for SetSinkDataType()
|
sl@0
|
197 |
|
sl@0
|
198 |
TInt iSourceSampleRate; // for SetSourceSampleRateL()
|
sl@0
|
199 |
TInt iSinkSampleRate; // for SetDestinationSampleRateL()
|
sl@0
|
200 |
|
sl@0
|
201 |
TInt iSourceChannels; // for SetSourceNumberOfChannelsL()
|
sl@0
|
202 |
TInt iSinkChannels; // for SetDestinationNumberOfChannelsL()
|
sl@0
|
203 |
};
|
sl@0
|
204 |
|
sl@0
|
205 |
#endif
|