|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #ifndef TSU3GPLIBRARYAPI_H |
|
18 #define TSU3GPLIBRARYAPI_H |
|
19 |
|
20 #include <test/testexecutestepbase.h> |
|
21 #include <c3gplibrary.h> |
|
22 #include <stdlib.h> |
|
23 #include <stdio.h> |
|
24 #include <stddef.h> |
|
25 #include <f32file.h> |
|
26 #include <sys/unistd.h> |
|
27 #include <badesca.h> |
|
28 |
|
29 _LIT( K3GPLibTestFilePath, "c:\\3gplibrary\\" ); |
|
30 |
|
31 const TInt KBufferSize = 1024; // buffer size for read audio/video frames |
|
32 const TInt KNotLeave = 11; |
|
33 |
|
34 // define different test files |
|
35 _LIT(KEmptyFileString, ""); |
|
36 _LIT(KInvalidFileString, "c:\3gplibrary\aaa.3gp"); // Non-existing file |
|
37 _LIT(KNoAudioNoVideo, "MP4-NO-A-V"); |
|
38 _LIT(KSameLenAudioVideo, "3GP-SAME-LEN"); |
|
39 _LIT(KAudioOnly, "3GP-AUDIO-ONLY"); |
|
40 _LIT(KVideoOnly, "MP4-VIDEO-ONLY"); |
|
41 _LIT(KAudioMore, "3GP-AUDIO-MORE"); |
|
42 _LIT(KVideoMore, "3GP-VIDEO-MORE"); |
|
43 _LIT(KSqcp, "3G2-H263-QCEL"); |
|
44 _LIT(KEsds, "MP4-QCEL"); |
|
45 _LIT(KWmaFile, "WMA"); |
|
46 _LIT(KUnsupportedAudioCodec, "UNSUPORTED-AUDIO-CODEC"); |
|
47 _LIT(KUnsupportedVideo, "UNSUPPORTED-VIDEO"); |
|
48 _LIT(KUnsupportedAudioStream, "UNSUPORTED-AUDIO-STREAM"); |
|
49 _LIT(KMisMatch, "MISMATCHED"); |
|
50 _LIT(KMultiUdta, "USER-ATOM-ALL"); |
|
51 |
|
52 // Base class used for most test cases to open and close parser, parse data from file |
|
53 class C3GPLibParser_base : public CTestStep |
|
54 { |
|
55 public: |
|
56 TVerdict doTestStepPreambleL(); |
|
57 TVerdict doTestStepPostambleL(); |
|
58 TInt CheckError(TInt aError, TInt aExpectError, const TDesC& aFunction); |
|
59 void FileOpenL(TUint aFileMode = EFileRead | EFileShareReadersOnly); |
|
60 void FileClose(); |
|
61 void FileOpen64L(TUint aFileMode = EFileRead | EFileShareReadersOnly); |
|
62 void FileClose64(); |
|
63 void ParserOpenL(C3GPParse* aParser, TInt aExpectedError = KErrNone); |
|
64 void ParserOpenFileL(C3GPParse* aParser, TInt aExpectedError = KErrNone); |
|
65 void ParserCompleteL(C3GPParse* aParser); |
|
66 void ParserOpenFileHandleL(C3GPParse* aParser, TUint aFileMode = EFileRead | EFileShareReadersOnly, TInt aExpectedError = KErrNone); |
|
67 void ParserCompleteHandleL(C3GPParse* aParser); |
|
68 void ParserOpenFileHandle64L(C3GPParse* aParser, TUint aFileMode = EFileRead | EFileShareReadersOnly, TInt aExpectedError = KErrNone); |
|
69 void ParserCompleteHandle64L(C3GPParse* aParser); |
|
70 void ParserOpenCafLC(C3GPParse* aParser, TInt aExpectedError = KErrNone); |
|
71 void ParserCompleteCafL(C3GPParse* aParser); |
|
72 void InsertDataL(C3GPParse* aParse, RFile aFile, TInt aBufferSize, TInt aPos); |
|
73 TInt ReadAudioVideoFrame(C3GPParse* aParse, TBool aRepeat = ETrue, TBool aReadAudio = EFalse); |
|
74 TInt GetClipProperties(C3GPParse* aParse, TInt& videoError, TUint& videoLength, TUint& audioLength); |
|
75 TInt ParserGetDecoderInfo(C3GPParse* aParser); |
|
76 TInt CallUDTApi(C3GPParse* aParse, TUint32 aUdtType, TUint& aIndex, T3GPUdtaLocation aLocation = E3GPUdtaVideoTrak); |
|
77 protected: |
|
78 void DoGetVideoAudioAttributesL(C3GPParse* aParser); |
|
79 TInt DoReadFrame(C3GPParse* aParse); |
|
80 void DoSeekTestL(C3GPParse* aParser); |
|
81 void ReadFrameBufferModeL(C3GPParse* aParser); |
|
82 protected: |
|
83 RBuf iInputFile; |
|
84 RBuf iTestSection; |
|
85 RFs iFsSession; |
|
86 RFile iSourceFile; |
|
87 RFile64 iSourceFile64; |
|
88 }; |
|
89 |
|
90 // Base class for asynchronous read |
|
91 class C3GPLib_AsyncObserver : public C3GPLibParser_base, public M3GPParseCallback |
|
92 { |
|
93 public: |
|
94 C3GPLib_AsyncObserver::C3GPLib_AsyncObserver(); |
|
95 TVerdict doTestStepPreambleL(); |
|
96 TVerdict doTestStepPostambleL(); |
|
97 TInt ReadAudioVideoFrameAsync(C3GPParse* aParse, TBool aReadAudio = EFalse, TBool aCancel = EFalse); |
|
98 |
|
99 // from M3GPParseCallback |
|
100 virtual void AudioFramesAvailable(TInt aError, TUint aReturnedFrames, |
|
101 TUint aTimeStampInMs, TUint aTimeStampInTimescale); |
|
102 virtual void VideoFrameAvailable(TInt aError, TBool aKeyFrame, TUint |
|
103 aTimeStampInMs, TUint aTimeStampInTimescale); |
|
104 |
|
105 protected: |
|
106 TBool iWaitForNotification; |
|
107 TBool iAsyncLastNotificationFromAudio; |
|
108 CActiveSchedulerWait* iSchedulerWait; |
|
109 TInt iAsyncError; |
|
110 TUint iAsyncAudioTimeStampInMs; |
|
111 TUint iAsyncAudioReturnedFrames; |
|
112 TUint iAsyncAudioTimestampInTimescale; |
|
113 TUint iAsyncVideoTimeStampInMs; |
|
114 TBool iAsyncVideoKeyFrame; |
|
115 TUint iAsyncVideoTimestampInTimescale; |
|
116 }; |
|
117 |
|
118 _LIT(KTestCase_0001, "MM-3GP-PARSE-U-0001-CP"); |
|
119 class C3GPLibParser_0001 : public C3GPLibParser_base |
|
120 { |
|
121 public: |
|
122 C3GPLibParser_0001(); |
|
123 TVerdict doTestStepL(); |
|
124 private: |
|
125 void OpenCompleteL(C3GPParse* aParser); |
|
126 }; |
|
127 |
|
128 _LIT(KTestCase_0002, "MM-3GP-PARSE-U-0002-CP"); |
|
129 class C3GPLibParser_0002 : public C3GPLibParser_base |
|
130 { |
|
131 public: |
|
132 C3GPLibParser_0002(); |
|
133 TVerdict doTestStepL(); |
|
134 private: |
|
135 void OpenCompleteBufferModeL(C3GPParse* aParser); |
|
136 }; |
|
137 |
|
138 _LIT(KTestCase_0003, "MM-3GP-PARSE-U-0003-CP"); |
|
139 class C3GPLibParser_0003 : public C3GPLibParser_base |
|
140 { |
|
141 public: |
|
142 C3GPLibParser_0003(); |
|
143 TVerdict doTestStepL(); |
|
144 private: |
|
145 void OpenCompleteFileHandleL(C3GPParse* aParser); |
|
146 }; |
|
147 |
|
148 _LIT(KTestCase_0004, "MM-3GP-PARSE-U-0004-CP"); |
|
149 class C3GPLibParser_0004 : public C3GPLibParser_base |
|
150 { |
|
151 public: |
|
152 C3GPLibParser_0004(); |
|
153 TVerdict doTestStepL(); |
|
154 }; |
|
155 |
|
156 _LIT(KTestCase_0005, "MM-3GP-PARSE-U-0005-CP"); |
|
157 class C3GPLibParser_0005 : public C3GPLibParser_base |
|
158 { |
|
159 public: |
|
160 C3GPLibParser_0005(); |
|
161 TVerdict doTestStepL(); |
|
162 private: |
|
163 void GetVideoAudioAttributesL(C3GPParse* aParser); |
|
164 }; |
|
165 |
|
166 _LIT(KTestCase_0006, "MM-3GP-PARSE-U-0006-CP"); |
|
167 class C3GPLibParser_0006 : public C3GPLibParser_base |
|
168 { |
|
169 public: |
|
170 C3GPLibParser_0006(); |
|
171 TVerdict doTestStepL(); |
|
172 private: |
|
173 enum TBufferModeTest |
|
174 { |
|
175 ENumBufferedBytes, |
|
176 EClipProperties, |
|
177 EDecoderInfo, |
|
178 EVideoFrameProp, |
|
179 }; |
|
180 |
|
181 void VideoAudioAttributesBufferModeL(C3GPParse* aParser); |
|
182 TInt CallTest(C3GPParse* aParse, TBufferModeTest aTest, TInt aExpectedNumBuffered = 0); |
|
183 TInt GetVideoAudioAttributes(C3GPParse* aParse, TBufferModeTest aTest); |
|
184 TInt GetVideoFramePropAndNumVideoFrame(C3GPParse* aParse, TBool aExpectPass); |
|
185 }; |
|
186 |
|
187 _LIT(KTestCase_0007, "MM-3GP-PARSE-U-0007-CP"); |
|
188 class C3GPLibParser_0007 : public C3GPLibParser_base |
|
189 { |
|
190 public: |
|
191 C3GPLibParser_0007(); |
|
192 TVerdict doTestStepL(); |
|
193 private: |
|
194 void GetstreamableL(C3GPParse* aParser); |
|
195 }; |
|
196 |
|
197 _LIT(KTestCase_0008, "MM-3GP-PARSE-U-0008-CP"); |
|
198 class C3GPLibParser_0008 : public C3GPLibParser_base |
|
199 { |
|
200 public: |
|
201 C3GPLibParser_0008(); |
|
202 TVerdict doTestStepL(); |
|
203 private: |
|
204 void GetstreamableL(C3GPParse* aParser); |
|
205 }; |
|
206 |
|
207 _LIT(KTestCase_0011, "MM-3GP-PARSE-U-0011-CP"); |
|
208 class C3GPLibParser_0011 : public C3GPLibParser_base |
|
209 { |
|
210 public: |
|
211 C3GPLibParser_0011(); |
|
212 TVerdict doTestStepL(); |
|
213 private: |
|
214 void ReadFrameL(C3GPParse* aParse); |
|
215 }; |
|
216 |
|
217 _LIT(KTestCase_0014, "MM-3GP-PARSE-U-0014-CP"); |
|
218 class C3GPLibParser_0014 : public C3GPLib_AsyncObserver |
|
219 { |
|
220 public: |
|
221 C3GPLibParser_0014(); |
|
222 TVerdict doTestStepL(); |
|
223 TVerdict doTestStepPreambleL(); |
|
224 TVerdict doTestStepPostambleL(); |
|
225 private: |
|
226 void ReadFrameAsyncL(C3GPParse* aParser); |
|
227 TInt DoReadFrameAsync(C3GPParse* aParser, TBool aCancel = EFalse); |
|
228 private: |
|
229 CActiveScheduler* iScheduler; |
|
230 }; |
|
231 |
|
232 _LIT(KTestCase_0015, "MM-3GP-PARSE-U-0015-CP"); |
|
233 class C3GPLibParser_0015 : public C3GPLibParser_base |
|
234 { |
|
235 public: |
|
236 C3GPLibParser_0015(); |
|
237 TVerdict doTestStepL(); |
|
238 private: |
|
239 void ReadFrameL(C3GPParse* aParser); |
|
240 }; |
|
241 |
|
242 _LIT(KTestCase_0016, "MM-3GP-PARSE-U-0016-CP"); |
|
243 class C3GPLibParser_0016 : public C3GPLibParser_base |
|
244 { |
|
245 public: |
|
246 C3GPLibParser_0016(); |
|
247 TVerdict doTestStepL(); |
|
248 private: |
|
249 void GetFrameTypeL(C3GPParse* aParser); |
|
250 }; |
|
251 |
|
252 _LIT(KTestCase_0017, "MM-3GP-PARSE-U-0017-CP"); |
|
253 class C3GPLibParser_0017 : public C3GPLibParser_base |
|
254 { |
|
255 public: |
|
256 C3GPLibParser_0017(); |
|
257 TVerdict doTestStepL(); |
|
258 private: |
|
259 void GetQcelModeL(C3GPParse* aParser); |
|
260 }; |
|
261 |
|
262 _LIT(KTestCase_0021, "MM-3GP-PARSE-U-0021-CP"); |
|
263 class C3GPLibParser_0021 : public C3GPLibParser_base |
|
264 { |
|
265 public: |
|
266 C3GPLibParser_0021(); |
|
267 TVerdict doTestStepL(); |
|
268 private: |
|
269 void GetH263LevelL(C3GPParse* aParser); |
|
270 }; |
|
271 |
|
272 _LIT(KTestCase_0023, "MM-3GP-PARSE-U-0023-CP"); |
|
273 class C3GPLibParser_0023 : public C3GPLibParser_base |
|
274 { |
|
275 public: |
|
276 C3GPLibParser_0023(); |
|
277 TVerdict doTestStepL(); |
|
278 private: |
|
279 void GetDecoderInfoL(C3GPParse* aParser); |
|
280 }; |
|
281 |
|
282 _LIT(KTestCase_0027, "MM-3GP-PARSE-U-0027-CP"); |
|
283 class C3GPLibParser_0027 : public C3GPLibParser_base |
|
284 { |
|
285 public: |
|
286 C3GPLibParser_0027(); |
|
287 TVerdict doTestStepL(); |
|
288 private: |
|
289 void SeekTestL(C3GPParse* aParser); |
|
290 TInt ParserSeek(C3GPParse* aParser, TInt aLen, TUint& aAudioPos, TUint& aVideoPos); |
|
291 }; |
|
292 |
|
293 _LIT(KTestCase_0031, "MM-3GP-PARSE-U-0031-CP"); |
|
294 class C3GPLibParser_0031 : public C3GPLibParser_base |
|
295 { |
|
296 public: |
|
297 C3GPLibParser_0031(); |
|
298 TVerdict doTestStepL(); |
|
299 private: |
|
300 void SeekTestL(C3GPParse* aParser); |
|
301 }; |
|
302 |
|
303 _LIT(KTestCase_0032, "MM-3GP-PARSE-U-0032-CP"); |
|
304 class C3GPLibParser_0032 : public C3GPLibParser_base |
|
305 { |
|
306 public: |
|
307 C3GPLibParser_0032(); |
|
308 TVerdict doTestStepL(); |
|
309 private: |
|
310 void GetFrameAvailabilityL(C3GPParse* aParser); |
|
311 void DoGetFrameAvailabilityL(C3GPParse* aParser); |
|
312 }; |
|
313 |
|
314 _LIT(KTestCase_0033, "MM-3GP-PARSE-U-0033-CP"); |
|
315 class C3GPLibParser_0033 : public C3GPLibParser_base |
|
316 { |
|
317 public: |
|
318 C3GPLibParser_0033(); |
|
319 TVerdict doTestStepL(); |
|
320 private: |
|
321 void VideoInfoL(C3GPParse* aParser); |
|
322 }; |
|
323 |
|
324 _LIT(KTestCase_0034, "MM-3GP-PARSE-U-0034-CP"); |
|
325 class C3GPLibParser_0034 : public C3GPLibParser_base |
|
326 { |
|
327 public: |
|
328 C3GPLibParser_0034(); |
|
329 TVerdict doTestStepL(); |
|
330 private: |
|
331 void VideoInfoBufferModeL(C3GPParse* aParser); |
|
332 }; |
|
333 |
|
334 _LIT(KTestCase_0035, "MM-3GP-PARSE-U-0035-CP"); |
|
335 class C3GPLibParser_0035 : public C3GPLibParser_base |
|
336 { |
|
337 public: |
|
338 C3GPLibParser_0035(); |
|
339 TVerdict doTestStepL(); |
|
340 private: |
|
341 void GetUserDataAtomL(C3GPParse* aParser); |
|
342 }; |
|
343 |
|
344 _LIT(KTestCase_0036, "MM-3GP-PARSE-U-0036-CP"); |
|
345 class C3GPLibParser_0036 : public C3GPLibParser_base |
|
346 { |
|
347 public: |
|
348 C3GPLibParser_0036(); |
|
349 TVerdict doTestStepL(); |
|
350 private: |
|
351 void GetUserDataAtomL(C3GPParse* aParser); |
|
352 }; |
|
353 |
|
354 _LIT(KTestCase_0037, "MM-3GP-PARSE-U-0037-CP"); |
|
355 class C3GPLibParser_0037 : public C3GPLibParser_base |
|
356 { |
|
357 public: |
|
358 C3GPLibParser_0037(); |
|
359 TVerdict doTestStepL(); |
|
360 private: |
|
361 void VideoDependencyL(C3GPParse* aParser); |
|
362 }; |
|
363 |
|
364 _LIT(KTestCase_0038, "MM-3GP-PARSE-U-0038-CP"); |
|
365 class C3GPLibParser_0038 : public C3GPLibParser_base |
|
366 { |
|
367 public: |
|
368 C3GPLibParser_0038(); |
|
369 TVerdict doTestStepL(); |
|
370 private: |
|
371 void VideoInfoL(C3GPParse* aParser); |
|
372 }; |
|
373 |
|
374 _LIT(KTestCase_0039, "MM-3GP-PARSE-U-0039-CP"); |
|
375 class C3GPLibParser_0039 : public C3GPLibParser_base |
|
376 { |
|
377 public: |
|
378 C3GPLibParser_0039(); |
|
379 TVerdict doTestStepL(); |
|
380 private: |
|
381 void AudioAndVideoFrameL(C3GPParse* aParser); |
|
382 }; |
|
383 |
|
384 _LIT(KTestCase_0041, "MM-3GP-PARSE-U-0041-CP"); |
|
385 class C3GPLibParser_0041 : public C3GPLibParser_base |
|
386 { |
|
387 public: |
|
388 C3GPLibParser_0041(); |
|
389 TVerdict doTestStepPreambleL(); |
|
390 TVerdict doTestStepPostambleL(); |
|
391 TVerdict doTestStepL(); |
|
392 private: |
|
393 void MultipleParserL(C3GPParse* aParser1, C3GPParse* aParser2, C3GPParse* aParser3); |
|
394 private: |
|
395 RBuf iInputFile1; |
|
396 RBuf iInputFile2; |
|
397 }; |
|
398 |
|
399 _LIT(KTestCase_0043, "MM-3GP-PARSE-U-0043-CP"); |
|
400 class C3GPLibParser_0043 : public C3GPLibParser_base |
|
401 { |
|
402 public: |
|
403 C3GPLibParser_0043(); |
|
404 TVerdict doTestStepL(); |
|
405 private: |
|
406 void SeekBufferModeL(C3GPParse* aParser); |
|
407 }; |
|
408 |
|
409 _LIT(KTestCase_0045, "MM-3GP-PARSE-U-0045-CP"); |
|
410 class C3GPLibParser_0045 : public C3GPLib_AsyncObserver |
|
411 { |
|
412 public: |
|
413 C3GPLibParser_0045(); |
|
414 TVerdict doTestStepPreambleL(); |
|
415 TVerdict doTestStepL(); |
|
416 TVerdict doTestStepPostambleL(); |
|
417 private: |
|
418 void TestParserWithLargeFileL(C3GPParse* aParser); |
|
419 TInt DoReadFrameAsync(C3GPParse* aParser, TBool aCancel = EFalse); |
|
420 private: |
|
421 CActiveScheduler* iScheduler; |
|
422 }; |
|
423 |
|
424 _LIT(KTestCase_0047, "MM-3GP-PARSE-U-0047-CP"); |
|
425 class C3GPLibParser_0047 : public C3GPLibParser_base |
|
426 { |
|
427 public: |
|
428 C3GPLibParser_0047(); |
|
429 TVerdict doTestStepL(); |
|
430 private: |
|
431 void ReadFrameL(C3GPParse* aParser); |
|
432 }; |
|
433 |
|
434 _LIT(KTestUserDataAtomRetrieval, "UserDataAtomRetrieval"); |
|
435 class C3GPUserDataAtomRetrieval : public CTestStep |
|
436 { |
|
437 public: |
|
438 C3GPUserDataAtomRetrieval(); |
|
439 |
|
440 TVerdict doTestStepL(); |
|
441 TVerdict doTestStepPreambleL(); |
|
442 TVerdict doTestStepPostambleL(); |
|
443 |
|
444 private: |
|
445 TInt iExpectedNumAtom; |
|
446 TUint32 iAtomType; |
|
447 RFs iFs; |
|
448 RFile iInputFile; |
|
449 CDesCArrayFlat* iAtomFileArray; |
|
450 T3GPUdtaLocation iAtomLocation; |
|
451 TBool iLargeFile; |
|
452 RFile64 iInputFile64; |
|
453 }; |
|
454 |
|
455 #endif |
|
456 |