sl@0
|
1 |
// Copyright (c) 2001-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 __TSU_MMF_AFMT_H__
|
sl@0
|
17 |
#define __TSU_MMF_AFMT_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <testframework.h>
|
sl@0
|
20 |
#include <mmf/server/mmfbuffer.h>
|
sl@0
|
21 |
#include <mmf/server/mmfdatabuffer.h>
|
sl@0
|
22 |
#include <mmf/common/mmfutilities.h>
|
sl@0
|
23 |
#include <mmf/common/mmffourcc.h>
|
sl@0
|
24 |
#include <mmf/server/mmfdatasink.h>
|
sl@0
|
25 |
|
sl@0
|
26 |
// Forward declaration
|
sl@0
|
27 |
class MMFTestDataSink;
|
sl@0
|
28 |
|
sl@0
|
29 |
class CTestSuite ;
|
sl@0
|
30 |
class CTestSuite_MMF_AFMT;
|
sl@0
|
31 |
|
sl@0
|
32 |
class MDataSource;
|
sl@0
|
33 |
class CMMFFormatDecode;
|
sl@0
|
34 |
class CMMFFormatEncode;
|
sl@0
|
35 |
|
sl@0
|
36 |
// Constants
|
sl@0
|
37 |
const TUint KFormatDefaultFrameSize = 0x1000;
|
sl@0
|
38 |
const TUint KGSMAvgBytesPerSecond = 1625;
|
sl@0
|
39 |
const TInt KOneSecondInMicroSeconds(1000000);
|
sl@0
|
40 |
|
sl@0
|
41 |
|
sl@0
|
42 |
// NOTE: With the test files for audio formats, we have to use PCM only, as
|
sl@0
|
43 |
// any other compression type appears to require a whole 'chain' of codecs etc
|
sl@0
|
44 |
// to initialise correctly. This would be better done in System testing.
|
sl@0
|
45 |
#ifdef __WINS__
|
sl@0
|
46 |
#include "Tsu_mmf_afmt_WINS.h"
|
sl@0
|
47 |
#else
|
sl@0
|
48 |
// ARM build - if flag below set we use C drive for files
|
sl@0
|
49 |
#ifdef __AFMT_USE_C_DRIVE__
|
sl@0
|
50 |
#include "Tsu_mmf_afmt_WINS.h"
|
sl@0
|
51 |
#else
|
sl@0
|
52 |
#include "Tsu_mmf_afmt_ARM4.h"
|
sl@0
|
53 |
#endif // __AFMT_USE_C_DRIVE__
|
sl@0
|
54 |
#endif
|
sl@0
|
55 |
|
sl@0
|
56 |
|
sl@0
|
57 |
// Other constants
|
sl@0
|
58 |
const TInt KStartFrame = 1; // The first frame in a file.
|
sl@0
|
59 |
|
sl@0
|
60 |
|
sl@0
|
61 |
|
sl@0
|
62 |
enum ENewLType {KNewLUndefined, // Default value (leave if we get this).
|
sl@0
|
63 |
KNewLUid, // Call NewL with a UID
|
sl@0
|
64 |
KNewLFilename, // Call NewL with a filename
|
sl@0
|
65 |
KNewLDescriptor,// Call NewL with a Descriptor of data
|
sl@0
|
66 |
KNewLClip // Call NewL passing in a CMMFClip
|
sl@0
|
67 |
};
|
sl@0
|
68 |
|
sl@0
|
69 |
/** @xxxx
|
sl@0
|
70 |
* @class CTestStep_MMF_AFMT TSU_MMF_AFMT.h "TSU_MMF_AFMT.h"
|
sl@0
|
71 |
* @brief Test class that enables MMF Audio Format tests.
|
sl@0
|
72 |
* It's a base class for all test steps.
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
class CTestStep_MMF_AFMT : public CTestStep, public MAsyncEventHandler
|
sl@0
|
75 |
{
|
sl@0
|
76 |
public: // Constructor/Destructor
|
sl@0
|
77 |
CTestStep_MMF_AFMT() : iData(0,0,0) {};
|
sl@0
|
78 |
virtual ~CTestStep_MMF_AFMT();
|
sl@0
|
79 |
virtual void Close();
|
sl@0
|
80 |
|
sl@0
|
81 |
public: // From CTestStep
|
sl@0
|
82 |
void SetTestSuite(const CTestSuite_MMF_AFMT* aTestSuite )
|
sl@0
|
83 |
{ iAFMTTestSuite = aTestSuite;}
|
sl@0
|
84 |
|
sl@0
|
85 |
public: // New functions
|
sl@0
|
86 |
virtual void BufferEmptiedCallback(CMMFBuffer* /*aBuffer*/){}
|
sl@0
|
87 |
virtual void BufferFilledCallback(CMMFBuffer* /*aBuffer*/){}
|
sl@0
|
88 |
|
sl@0
|
89 |
|
sl@0
|
90 |
protected: // New functions
|
sl@0
|
91 |
|
sl@0
|
92 |
/**
|
sl@0
|
93 |
* This function creates a datasource object based on either a descriptor
|
sl@0
|
94 |
* or a file.
|
sl@0
|
95 |
* @param aFile - If 'ETrue', datasource if file based, else it's descriptor based.
|
sl@0
|
96 |
* @param aFilename - If filebased, this is the file name passed to the DataSource
|
sl@0
|
97 |
* If descriptor based, the data is read from the file.
|
sl@0
|
98 |
* @param aOffset - The offset from the start of the file to read (for Descriptor
|
sl@0
|
99 |
* based DataSources only)
|
sl@0
|
100 |
*/
|
sl@0
|
101 |
void CreateDataSource(const TBool& aFile, const TDesC& aFilename, const TUint& aOffset=0);
|
sl@0
|
102 |
|
sl@0
|
103 |
|
sl@0
|
104 |
/**
|
sl@0
|
105 |
* This function creates a data sink object from a CMmfFile object.
|
sl@0
|
106 |
* @param aFile - If 'ETrue', datasource if file based, else it's descriptor based [NOTE
|
sl@0
|
107 |
* use of CMmfDescriptor based sinks is currently not supported]
|
sl@0
|
108 |
* @param aFilename - If filebased, this is the file name passed to the DataSource
|
sl@0
|
109 |
* If descriptor based, the data is read from the file.
|
sl@0
|
110 |
* @param aOffset - The offset from the start of the file to read (for Descriptor
|
sl@0
|
111 |
* based DataSources only)
|
sl@0
|
112 |
*/
|
sl@0
|
113 |
void CreateDataSink(const TBool& aFile, const TDesC& aFilename, const TUint& aOffset=0);
|
sl@0
|
114 |
|
sl@0
|
115 |
|
sl@0
|
116 |
/**
|
sl@0
|
117 |
* This function creates a Format object (type of which is specified by 'aUid') and
|
sl@0
|
118 |
* a data source or data sink to go with the object. This function should be used
|
sl@0
|
119 |
* as a quick way for setting up objects for testing.
|
sl@0
|
120 |
* @param aIsFile - ETrue if we are using CMmfFile or EFalse if using
|
sl@0
|
121 |
* CMmfDescriptor as the DataSource. NOTE: CMmfDescriptor support has not
|
sl@0
|
122 |
* yet been added to this test harness for SINKs. Generally it's best to just use
|
sl@0
|
123 |
* CMmfFile based data sources rather than descriptors.
|
sl@0
|
124 |
* @param aFilename - The file which acts as the data sink. For a CMmfFile
|
sl@0
|
125 |
* based object, this is the file that data gets written to.
|
sl@0
|
126 |
* @param aUid - The UID of the format object to be created.
|
sl@0
|
127 |
*/
|
sl@0
|
128 |
void CreateObjectL(TBool aIsFile, const TDesC& aFilename, TInt aUid);
|
sl@0
|
129 |
|
sl@0
|
130 |
|
sl@0
|
131 |
/**
|
sl@0
|
132 |
* This function is used as a quick way to setup objects for testing.
|
sl@0
|
133 |
* @param aFilename - The file which acts as the data sink. For a CMmfFile
|
sl@0
|
134 |
* based object, this is the file that data gets read/written.
|
sl@0
|
135 |
* @param aUid - The UID of the format object to be created.
|
sl@0
|
136 |
* @return TVerdict - Will always return EPass unless it leaves.
|
sl@0
|
137 |
*/
|
sl@0
|
138 |
TVerdict SetupL(const TDesC& aFilename, TInt aUid);
|
sl@0
|
139 |
|
sl@0
|
140 |
|
sl@0
|
141 |
/**
|
sl@0
|
142 |
* This function deletes all of the pointer member variables which may have been
|
sl@0
|
143 |
* initialised.
|
sl@0
|
144 |
*/
|
sl@0
|
145 |
void Cleanup();
|
sl@0
|
146 |
|
sl@0
|
147 |
|
sl@0
|
148 |
/**
|
sl@0
|
149 |
* This function reads from a source file into the member variable heap buffer, 'iDescHBuf'.
|
sl@0
|
150 |
* This can be used to compare the contents of a file with a buffer for example.
|
sl@0
|
151 |
* @param aFilename - The file to read from.
|
sl@0
|
152 |
* @param aPosition - Where to start reading from in the file.
|
sl@0
|
153 |
* @param aSize - How much of the file to read (in bytes) though if you pass '-1', it will
|
sl@0
|
154 |
* try and read the whole file from 'aPosition' onwards.
|
sl@0
|
155 |
*/
|
sl@0
|
156 |
void ReadFileToDescriptorL(const TDesC& aFilename, TInt aPosition, TInt aSize);
|
sl@0
|
157 |
|
sl@0
|
158 |
|
sl@0
|
159 |
/**
|
sl@0
|
160 |
* This function can be used to make sure that a specified file is not present
|
sl@0
|
161 |
* before a set of tests are run.
|
sl@0
|
162 |
* @param aFilename - The name of the file to delete/check is not present.
|
sl@0
|
163 |
*/
|
sl@0
|
164 |
void DeleteFileL(const TDesC& aFilename);
|
sl@0
|
165 |
|
sl@0
|
166 |
|
sl@0
|
167 |
private: // New functions
|
sl@0
|
168 |
/**
|
sl@0
|
169 |
* This function creates a datasource object based on either a descriptor
|
sl@0
|
170 |
* or a file.
|
sl@0
|
171 |
* @param aIsFile - ETrue if we are using CMmfFile or EFalse if using
|
sl@0
|
172 |
* CMmfDescriptor as the DataSource
|
sl@0
|
173 |
* @param aFilename - The file which acts as the data source. For a CMmfFile
|
sl@0
|
174 |
* based object, this IS the file. For a CMmfDescriptor based object, this
|
sl@0
|
175 |
* file contains the data that is read into the descriptor for test purposes.
|
sl@0
|
176 |
* @param aUid - The UID of the format object to be created.
|
sl@0
|
177 |
*/
|
sl@0
|
178 |
void CreateDecodeObjectL(TBool aBool, const TDesC& aFilename, TInt aUid);
|
sl@0
|
179 |
|
sl@0
|
180 |
|
sl@0
|
181 |
/**
|
sl@0
|
182 |
* This function creates a datasink object based on either a descriptor
|
sl@0
|
183 |
* or a file.
|
sl@0
|
184 |
* @param aIsFile - ETrue if we are using CMmfFile or EFalse if using
|
sl@0
|
185 |
* CMmfDescriptor as the DataSource. NOTE: CMmfDescriptor support has not
|
sl@0
|
186 |
* yet been added to this test harness for SINKs.
|
sl@0
|
187 |
* @param aFilename - The file which acts as the data sink. For a CMmfFile
|
sl@0
|
188 |
* based object, this IS the file.
|
sl@0
|
189 |
* @param aUid - The UID of the format object to be created.
|
sl@0
|
190 |
*/
|
sl@0
|
191 |
void CreateEncodeObjectL(TBool aIsFile, const TDesC& aFilename, TInt aUid);
|
sl@0
|
192 |
|
sl@0
|
193 |
//from MAsyncEventHandler
|
sl@0
|
194 |
virtual TInt SendEventToClient(const TMMFEvent& /*aEvent*/) {return KErrNone;}//XXX - can we do better here?
|
sl@0
|
195 |
|
sl@0
|
196 |
|
sl@0
|
197 |
protected:
|
sl@0
|
198 |
TBool iDecode; // ETrue if using CMmfXXXFormatRead/MDataSource
|
sl@0
|
199 |
// EFalse if using CMmfXXXFormatWrite/MDataSink
|
sl@0
|
200 |
|
sl@0
|
201 |
const CTestSuite_MMF_AFMT* iAFMTTestSuite; // pointer to suite which owns this test
|
sl@0
|
202 |
|
sl@0
|
203 |
MDataSource* iDataSource; // Ptr to a DataSource
|
sl@0
|
204 |
MDataSink* iDataSink; // Ptr to a DataSource
|
sl@0
|
205 |
|
sl@0
|
206 |
CMMFFormatDecode* iFormatDec; // Ptr to a Format Decode object
|
sl@0
|
207 |
CMMFFormatEncode* iFormatEnc; // Ptr to a Format Encode object
|
sl@0
|
208 |
|
sl@0
|
209 |
TUid iUID; // UID object
|
sl@0
|
210 |
TPtrC iFilename; // Filename
|
sl@0
|
211 |
TPtrC iPreferredSupplier; // Preferred supplier string
|
sl@0
|
212 |
//PAC TPtrC8 iData; // Used to hold binary data.
|
sl@0
|
213 |
TPtr8 iData; // Used to hold binary data.
|
sl@0
|
214 |
ENewLType iNewL; // Which NewL call to use when create Format object
|
sl@0
|
215 |
|
sl@0
|
216 |
HBufC8* iDescHBuf; // HBuf for holding descriptor data
|
sl@0
|
217 |
|
sl@0
|
218 |
private:
|
sl@0
|
219 |
};
|
sl@0
|
220 |
|
sl@0
|
221 |
|
sl@0
|
222 |
|
sl@0
|
223 |
|
sl@0
|
224 |
|
sl@0
|
225 |
|
sl@0
|
226 |
|
sl@0
|
227 |
|
sl@0
|
228 |
#endif// TSU_MMF_AFMT_H__
|
sl@0
|
229 |
|