Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <mmf/common/mmferrors.h>
18 using namespace ContentAccess;
19 #include "tsu3gplibraryapinegative.h"
21 // --------------------------
22 // C3GPLibParser_Negative
23 // --------------------------
25 void C3GPLibParser_Negative::CallAudioApiL(C3GPParse* aParse, TInt aExpectedError)
28 // Retrieve audio stream attributes
29 T3GPAudioType audioType;
35 err = aParse->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
36 User::LeaveIfError(CheckError(err, aExpectedError, _L("aParse->GetAudioProperties")));
39 T3GPFrameType type = E3GPAudio;
40 err = aParse->GetFrameAvailability(type, available);
41 if (aExpectedError == KErrNotSupported)
43 // GetFrameAvailability will return KErrNotFound when there is no audio in the 3gp files
44 User::LeaveIfError(CheckError(err, KErrNotFound, _L("GetFrameAvailability")));
48 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetFrameAvailability")));
52 err = aParse->GetAudioFramesSize(size);
53 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioFramesSize")));
56 CleanupClosePushL(buffer);
58 if (aExpectedError == KErrNone)
60 buffer.CreateL(size); // Use size retrieved from GetVideoFrameSize
64 buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
68 TUint timeStampInTimescale;
70 err = aParse->ReadAudioFrames(buffer, returnedFrames, timeStampInMs, timeStampInTimescale);
71 User::LeaveIfError(CheckError(err, aExpectedError, _L("ReadAudioFrames")));
72 CleanupStack::PopAndDestroy(&buffer);
75 err = aParse->GetAudioSampleEntryIndex(index);
76 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioSampleEntryIndex")));
78 T3GPQcelpStorageMode mode;
79 err = aParse->GetQcelpStorageMode(mode);
80 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetQcelpStorageMode")));
83 void C3GPLibParser_Negative::CallVideoApiL(C3GPParse* aParse, TInt aExpectedError)
86 // Retrieve video & audio stream attributes
87 T3GPVideoType videoType;
94 err = aParse->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
95 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoProperties")));
98 T3GPFrameType type = E3GPVideo;
99 err = aParse->GetFrameAvailability(type, available);
100 if (aExpectedError == KErrNotSupported)
102 // GetFrameAvailability will return KErrNotFound when there is no video in the 3gp files
103 User::LeaveIfError(CheckError(err, KErrNotFound, _L("GetFrameAvailability")));
107 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetFrameAvailability")));
111 err = aParse->GetVideoFrameSize(size);
112 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameSize")));
115 CleanupClosePushL(buffer);
116 if (aExpectedError == KErrNone)
118 buffer.CreateL(size); // Use size retrieved from GetVideoFrameSize
122 buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
126 TUint timeStampInTimescale;
127 err = aParse->ReadVideoFrame(buffer, keyFrame, timeStampInMs, timeStampInTimescale);
128 User::LeaveIfError(CheckError(err, aExpectedError, _L("ReadVideoFrame")));
129 CleanupStack::PopAndDestroy(&buffer);
131 err = aParse->GetVideoTimestamp(timeStampInMs, timeStampInTimescale);
132 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoTimestamp")));
135 err = aParse->GetNumberOfVideoFrames(num);
136 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetNumberOfVideoFrames")));
139 err = aParse->GetVideoSampleEntryIndex(index);
140 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoSampleEntryIndex")));
142 err = aParse->GetVideoFrameSize(index, size);
143 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameSize")));
145 err = aParse->GetVideoFrameStartTime(index, timeStampInMs, timeStampInTimescale);
146 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameStartTime")));
148 err = aParse->GetVideoFrameKeyType(index, keyFrame);
149 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameKeyType")));
152 err = aParse->GetH263VideoLevel(level);
153 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetH263VideoLevel")));
155 T3GPFrameDependencies dependencies;
156 err = aParse->GetVideoFrameDependencies(dependencies);
157 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameDependencies")));
159 TUint numberOfFrames = 2;
160 RArray<T3GPFrameInfoParameters> array;
161 err = aParse->GetVideoFrameProperties(index, numberOfFrames, array);
163 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameProperties")));
166 void C3GPLibParser_Negative::CallVideoDecoderInfoApiL(C3GPParse* aParse, TInt aExpectedError)
169 CleanupClosePushL(buffer);
172 TInt err = aParse->GetVideoDecoderSpecificInfoSize(dsiSize);
173 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoDecoderSpecificInfoSize")));
175 if (aExpectedError == KErrNone)
177 buffer.CreateL(dsiSize);
181 buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
183 err = aParse->GetVideoDecoderSpecificInfo(buffer);
184 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoDecoderSpecificInfo")));
186 CleanupStack::PopAndDestroy(&buffer);
189 void C3GPLibParser_Negative::CallAudioDecoderInfoApiL(C3GPParse* aParse, TInt aExpectedError)
192 CleanupClosePushL(buffer);
194 TInt err = aParse->GetAudioDecoderSpecificInfoSize(dsiSize);
195 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioDecoderSpecificInfoSize")));
197 if (aExpectedError == KErrNone)
199 buffer.CreateL(dsiSize);
203 buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
205 err = aParse->GetAudioDecoderSpecificInfo(buffer);
206 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioDecoderSpecificInfo")));
208 CleanupStack::PopAndDestroy(&buffer);
211 // Retrieve user data atom.
212 void C3GPLibParser_Negative::CallUDTApiL(C3GPParse* aParse, TUint32 aUdtType, TUint& aIndex, TInt aExpectedError, T3GPUdtaLocation aLocation)
216 TUint tempIndex = aIndex; // use the copy of the aIndex so it does not get overwritten by GetUserDataAtomSize
218 err = aParse->GetUserDataAtomSize(aUdtType, aLocation, tempIndex, udtSize);
219 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetUserDataAtomSize")));
222 CleanupClosePushL(buffer);
224 if (aExpectedError == KErrNone && err == KErrNone)
226 buffer.CreateL(udtSize); // Use size retrieved from GetUserDataAtomSize
230 buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
232 err = aParse->GetUserDataAtom(aUdtType, aLocation, buffer, aIndex);
233 CleanupStack::PopAndDestroy(&buffer);
235 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetUserDataAtom")));
238 void C3GPLibParser_Negative::CallCommonApiL(C3GPParse* aParse, TInt aExpectedError)
244 err = aParse->GetContainerProperties(size, avgBitRate);
245 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetContainerProperties")));
248 err = aParse->C3GPParse::GetFrameType(type);
249 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetFrameType")));
252 err = aParse->GetStreamable(streamable);
253 User::LeaveIfError(CheckError(err, aExpectedError, _L("GetStreamable")));
256 TBool keyFrame = EFalse;
259 err = aParse->Seek(position, keyFrame, audioPosition, videoPosition);
260 User::LeaveIfError(CheckError(err, aExpectedError, _L("Seek")));
263 // -----------------------------------------------------------------------------
264 // Create 3GP Parser to read zero size file content and call all APIs except
265 // asynchrounous read
266 // -----------------------------------------------------------------------------
268 C3GPLibParser_0101::C3GPLibParser_0101()
272 TVerdict C3GPLibParser_0101::doTestStepL()
274 if(TestStepResult() == EPass)
276 C3GPParse* parser = C3GPParse::NewL();
277 CleanupStack::PushL(parser);
279 TRAPD(err, EmptyFileFailedCorruptL(parser));
282 SetTestStepResult(EFail);
285 CleanupStack::PopAndDestroy(parser);
287 return TestStepResult();
290 void C3GPLibParser_0101::EmptyFileFailedCorruptL(C3GPParse* aParse)
292 // all api test with empty file using file path
293 // When the parser is in use, calling parser open again should fail with KErrInUse
294 ParserOpenFileL(aParse, KErrInUse);
296 CallCommonApiL(aParse, KErrCorrupt);
297 CallVideoApiL(aParse, KErrCorrupt);
298 CallAudioApiL(aParse, KErrCorrupt);
299 CallVideoDecoderInfoApiL(aParse, KErrCorrupt);
300 CallAudioDecoderInfoApiL(aParse, KErrCorrupt);
301 TUint32 udtType = 0x7469746c;
303 CallUDTApiL(aParse, udtType, index, KErrCorrupt);
304 T3GPUdtaLocation location = E3GPUdtaAudioTrak;
305 CallUDTApiL(aParse, udtType, index, KErrCorrupt, location);
306 ParserCompleteL(aParse);
308 // all api test with empty file using file handle
309 // When the parser is in use, calling parser open again should fail with KErrInUse
310 ParserOpenFileHandleL(aParse, EFileRead | EFileShareReadersOnly, KErrInUse);
312 CallCommonApiL(aParse, KErrCorrupt);
313 CallVideoApiL(aParse, KErrCorrupt);
314 CallAudioApiL(aParse, KErrCorrupt);
315 CallVideoDecoderInfoApiL(aParse, KErrCorrupt);
316 CallAudioDecoderInfoApiL(aParse, KErrCorrupt);
317 CallUDTApiL(aParse, udtType, index, KErrCorrupt);
318 CallUDTApiL(aParse, udtType, index, KErrCorrupt, location);
319 ParserCompleteHandleL(aParse);
321 // all api test with empty file using CAF
322 // When the parser is in use, calling parser open again should fail with KErrInUse
323 ParserOpenCafLC(aParse, KErrInUse);
325 CallCommonApiL(aParse, KErrCorrupt);
326 CallVideoApiL(aParse, KErrCorrupt);
327 CallAudioApiL(aParse, KErrCorrupt);
328 CallVideoDecoderInfoApiL(aParse, KErrCorrupt);
329 CallAudioDecoderInfoApiL(aParse, KErrCorrupt);
330 CallUDTApiL(aParse, udtType, index, KErrCorrupt);
331 CallUDTApiL(aParse, udtType, index, KErrCorrupt, location);
332 ParserCompleteCafL(aParse);
334 // test open using buffer mode
335 // When the parser is in use, calling parser open again should fail with KErrInUse
336 ParserOpenL(aParse, KErrInUse);
337 ParserCompleteL(aParse);
338 // Call complete again, should pass with no error
339 ParserCompleteL(aParse);
342 // -----------------------------------------------------------------------------
343 // Initialise a 3GP file parse with an empty filename and file path pointing
344 // at non-existent files
345 // -----------------------------------------------------------------------------
347 C3GPLibParser_0102::C3GPLibParser_0102()
351 TVerdict C3GPLibParser_0102::doTestStepL()
353 if(TestStepResult() == EPass)
355 C3GPParse* parser = C3GPParse::NewL();
356 CleanupStack::PushL(parser);
358 // Initialise a 3GP file parse with an empty filename and it should fail with KErrUnderflow
359 TInt err = parser->Open(KEmptyFileString);
360 if (err != KErrUnderflow)
362 ERR_PRINTF2(_L("parser->Open(KEmptyFileString) expects KErrUnderflow. Returns with %d"), err);
363 SetTestStepResult(EFail);
366 // Setup 3GP Parser with a file path of a non-existing file. This should fail with KErrAccessDenied.
367 err = parser->Open(KInvalidFileString);
368 if (err != KErrAccessDenied)
370 ERR_PRINTF2(_L("parser->Open(KEmptyFileString) expects KErrAccessDenied. Returns with %d"), err);
371 SetTestStepResult(EFail);
374 CleanupStack::PopAndDestroy(parser);
376 return TestStepResult();
379 // -----------------------------------------------------------------------------
380 // Create parser by passing in a file path of a file already opened in
381 // EFileShareExclusive mode.
382 // -----------------------------------------------------------------------------
384 C3GPLibParser_0104::C3GPLibParser_0104()
388 TVerdict C3GPLibParser_0104::doTestStepL()
390 if(TestStepResult() == EPass)
392 C3GPParse* parser = C3GPParse::NewL();
393 CleanupStack::PushL(parser);
395 // Open a valid mp4/3gp/3g2 file with EFileShareExclusive mode
396 // Instantiate a 3GP parser object with the same file path already opened above
397 FileOpenL(EFileShareExclusive);
398 TInt err = parser->Open(iInputFile);
399 if (err != KErrAccessDenied)
401 ERR_PRINTF2(_L("parser->Open(iInputFile) expects KErrAccessDenied. Returns with %d"), err);
402 SetTestStepResult(EFail);
404 ParserCompleteL(parser);
407 CleanupStack::PopAndDestroy(parser);
409 return TestStepResult();
412 // -----------------------------------------------------------------------------
413 // Use 3GP Parser to parse file before it has been setup
414 // -----------------------------------------------------------------------------
416 C3GPLibParser_0106::C3GPLibParser_0106()
420 TVerdict C3GPLibParser_0106::doTestStepL()
422 if(TestStepResult() == EPass)
424 C3GPParse* parser = C3GPParse::NewL();
425 CleanupStack::PushL(parser);
427 TRAPD(err, AllApiFailedNotReadyL(parser));
430 SetTestStepResult(EFail);
433 CleanupStack::PopAndDestroy(parser);
435 return TestStepResult();
438 void C3GPLibParser_0106::AllApiFailedNotReadyL(C3GPParse* aParse)
440 CallCommonApiL(aParse, KErrNotReady);
441 CallVideoApiL(aParse, KErrNotReady);
442 CallAudioApiL(aParse, KErrNotReady);
443 CallVideoDecoderInfoApiL(aParse, KErrNotReady);
444 CallAudioDecoderInfoApiL(aParse, KErrNotReady);
445 TUint32 udtType = 0x7469746c;
447 CallUDTApiL(aParse, udtType, index, KErrNotReady);
450 CleanupClosePushL(buffer);
451 // create 0 size buffer for negative test when API is called before parse is opened
453 TInt err = aParse->InsertData(buffer);
454 User::LeaveIfError(CheckError(err, KErrNotReady, _L("aParse->InsertData")));
455 CleanupStack::PopAndDestroy(&buffer);
458 err = aParse->GetNumBufferedBytes(num);
459 User::LeaveIfError(CheckError(err, KErrNotReady, _L("aParse->InsertData")));
462 // -----------------------------------------------------------------------------
463 // Use invalid frame type for all frame type API.
464 // -----------------------------------------------------------------------------
466 C3GPLibParser_0107::C3GPLibParser_0107()
470 TVerdict C3GPLibParser_0107::doTestStepL()
472 if(TestStepResult() == EPass)
474 C3GPParse* parser = C3GPParse::NewL();
475 CleanupStack::PushL(parser);
477 TRAPD(err, InvalidFrameTypeL(parser));
480 SetTestStepResult(EFail);
483 CleanupStack::PopAndDestroy(parser);
485 return TestStepResult();
488 void C3GPLibParser_0107::InvalidFrameTypeL(C3GPParse* aParse)
491 ParserOpenFileL(aParse);
493 // Invalid type tests
494 TInt invalidType = 10;
495 T3GPVideoType invalidVideoType = static_cast<T3GPVideoType>(invalidType);
502 TInt err = aParse->GetVideoProperties(invalidVideoType, length, frameRate, avgBitRate, videoSize, timeScale);
503 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoProperties")));
505 T3GPAudioType invalidAudioType = static_cast<T3GPAudioType>(invalidType);
506 TInt framesPerSample;
508 err = aParse->GetAudioProperties(invalidAudioType, length, framesPerSample, avgBitRate, timeScale);
509 User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetAudioProperties")));
511 T3GPFrameType invalidFrameType = static_cast<T3GPFrameType>(invalidType);
513 err = aParse->GetFrameType(invalidFrameType);
514 User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetAudioProperties")));
516 T3GPQcelpStorageMode invalidMode = static_cast<T3GPQcelpStorageMode>(invalidType);
518 err = aParse->GetQcelpStorageMode(invalidMode);
519 User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetVideoProperties() invalid type")));
521 ParserCompleteL(aParse);
524 // -----------------------------------------------------------------------------
525 // Use invalid frame index for video frame APIs and Get video frame properties for more
526 // than the total number of video frames in the video clip
527 // -----------------------------------------------------------------------------
529 C3GPLibParser_0108::C3GPLibParser_0108()
533 TVerdict C3GPLibParser_0108::doTestStepL()
535 if(TestStepResult() == EPass)
537 C3GPParse* parser = C3GPParse::NewL();
538 CleanupStack::PushL(parser);
540 TRAPD(err, AllInvalidFrameIndexL(parser));
543 SetTestStepResult(EFail);
546 CleanupStack::PopAndDestroy(parser);
548 return TestStepResult();
551 void C3GPLibParser_0108::AllInvalidFrameIndexL(C3GPParse* aParse)
554 ParserOpenFileL(aParse);
556 TUint numOfVideoFrames;
557 TInt err = aParse->GetNumberOfVideoFrames(numOfVideoFrames);
558 User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetNumberOfVideoFrames()")));
562 err = aParse->GetVideoFrameSize(numOfVideoFrames + 100, size);
563 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameSize() invalid index")));
565 err = aParse->GetVideoFrameSize((KMaxTUint-15), size);
566 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameSize() negative index")));
569 TUint timeStampInTimescale;
570 err = aParse->GetVideoFrameStartTime(numOfVideoFrames + 10, timeStampInMs, timeStampInTimescale);
571 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameStartTime() invalid index")));
573 err = aParse->GetVideoFrameStartTime((KMaxTUint-15), timeStampInMs, timeStampInTimescale);
574 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameStartTime() negative index")));
577 err = aParse->GetVideoFrameKeyType(numOfVideoFrames + 10, keyFrame);
578 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameKeyType() invalid index")));
580 err = aParse->GetVideoFrameKeyType((KMaxTUint-15), keyFrame);
581 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameKeyType() negative index")));
583 TUint numberOfFrames = 2;
584 RArray<T3GPFrameInfoParameters> array;
585 CleanupClosePushL(array);
587 err = aParse->GetVideoFrameProperties(numOfVideoFrames + 10, numberOfFrames, array);
588 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() invalid index")));
590 // Get video frame properties for more than the total number of video frames in the video clip
591 err = aParse->GetVideoFrameProperties(0, numOfVideoFrames + 10, array);
592 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() invalid number of frame")));
594 err = aParse->GetVideoFrameProperties((KMaxTUint-1), numOfVideoFrames, array);
595 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() with negative index")));
597 err = aParse->GetVideoFrameProperties(15, (KMaxTUint-10), array);
598 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() with negative numOfVideoFrames")));
600 err = aParse->GetVideoFrameProperties((KMaxTUint-15), numOfVideoFrames + 10, array);
601 User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() with negative index and invalid numOfVideoFrames")));
603 CleanupStack::PopAndDestroy(&array);
605 ParserCompleteL(aParse);
608 // -----------------------------------------------------------------------------
609 // Instantiate a 3GP Parser and Call all Parser API that uses frame type as
610 // input parameter with invalid frame types
611 // -----------------------------------------------------------------------------
613 C3GPLibParser_0109::C3GPLibParser_0109()
617 TVerdict C3GPLibParser_0109::doTestStepL()
619 if(TestStepResult() == EPass)
621 C3GPParse* parser = C3GPParse::NewL();
622 CleanupStack::PushL(parser);
624 TRAPD(err, InvalidFrameTypePanicL(parser));
627 SetTestStepResult(EFail);
630 CleanupStack::PopAndDestroy(parser);
632 return TestStepResult();
635 void C3GPLibParser_0109::InvalidFrameTypePanicL(C3GPParse* aParse)
638 ParserOpenFileL(aParse);
640 TInt invalidType = 10;
642 T3GPFrameType invalidFrameType = static_cast<T3GPFrameType>(invalidType);
644 aParse->GetFrameAvailability(invalidFrameType, available);
646 ParserCompleteL(aParse);
649 // -----------------------------------------------------------------------------
650 // Get user data atom by passing in an invalid user atom location.
651 // -----------------------------------------------------------------------------
653 C3GPLibParser_0110::C3GPLibParser_0110()
657 TVerdict C3GPLibParser_0110::doTestStepL()
659 if(TestStepResult() == EPass)
661 C3GPParse* parser = C3GPParse::NewL();
662 CleanupStack::PushL(parser);
664 TRAPD(err, InvalidUdtLocationL(parser));
667 SetTestStepResult(EFail);
670 CleanupStack::PopAndDestroy(parser);
672 return TestStepResult();
675 void C3GPLibParser_0110::InvalidUdtLocationL(C3GPParse* aParse)
678 ParserOpenFileL(aParse);
680 // Invalid type tests
681 TInt invalidType = 10;
683 TUint32 udtType = 0x7469746c;
684 T3GPUdtaLocation invalidLocation = static_cast<T3GPUdtaLocation>(invalidType);
686 CleanupClosePushL(buffer);
687 buffer.CreateL(KBufferSize);
689 aParse->GetUserDataAtom(udtType, invalidLocation, buffer, index);
690 CleanupStack::PopAndDestroy(&buffer);
692 ParserCompleteL(aParse);
695 // -----------------------------------------------------------------------------
696 // Retrieve information when that info is not in the file or the info is not
697 // supported by the library
698 // -----------------------------------------------------------------------------
700 C3GPLibParser_0111::C3GPLibParser_0111()
704 TVerdict C3GPLibParser_0111::doTestStepL()
706 if(TestStepResult() == EPass)
708 C3GPParse* parser = C3GPParse::NewL();
709 CleanupStack::PushL(parser);
711 TRAPD(err, AllVideoAudioApiFailedL(parser));
714 SetTestStepResult(EFail);
717 CleanupStack::PopAndDestroy(parser);
719 return TestStepResult();
722 void C3GPLibParser_0111::AllVideoAudioApiFailedL(C3GPParse* aParse)
725 ParserOpenFileL(aParse);
727 TInt expectedErr = KErrNone;
728 TUint32 udtType = 0x7469746c;
730 T3GPUdtaLocation location = E3GPUdtaVideoTrak;
731 if (iTestSection.Compare(KAudioOnly) == 0 || iTestSection.Compare(KUnsupportedVideo) == 0)
733 CallVideoApiL(aParse, KErrNotSupported);
734 CallVideoDecoderInfoApiL(aParse, KErrNotSupported);
736 else if (iTestSection.Compare(KVideoOnly) == 0 || iTestSection.Compare(KUnsupportedAudioCodec) == 0 ||
737 iTestSection.Compare(KUnsupportedAudioStream) == 0)
739 CallAudioApiL(aParse, KErrNotSupported);
740 CallAudioDecoderInfoApiL(aParse, KErrNotSupported);
742 location = E3GPUdtaAudioTrak;
744 else if (iTestSection.Compare(KWmaFile) == 0)
746 expectedErr = KErrCorrupt;
747 CallVideoDecoderInfoApiL(aParse, expectedErr);
748 CallUDTApiL(aParse, udtType, index, expectedErr, location);
750 else if (iTestSection.Compare(KMisMatch) == 0)
752 // The test file doesn't contain MPEG-4 / AVC video stream. The decoder info should fail.
753 CallVideoDecoderInfoApiL(aParse, KErrNotSupported);
754 CallUDTApiL(aParse, udtType, index, KErrNotFound, location);
756 else if (iTestSection.Compare(KNoAudioNoVideo) == 0)
758 expectedErr = KErrNotSupported;
759 CallVideoApiL(aParse, expectedErr);
760 CallVideoDecoderInfoApiL(aParse, expectedErr);
761 CallAudioApiL(aParse, expectedErr);
762 CallAudioDecoderInfoApiL(aParse, expectedErr);
763 CallCommonApiL(aParse, KErrGeneral);
765 if (iTestSection.Compare(KWmaFile) == 0 || iTestSection.Compare(KMisMatch) == 0)
767 CallVideoApiL(aParse, expectedErr);
768 CallAudioApiL(aParse, expectedErr);
769 CallAudioDecoderInfoApiL(aParse, expectedErr);
770 CallCommonApiL(aParse, expectedErr);
774 CallUDTApiL(aParse, udtType, index, KErrNotFound, location);
776 ParserCompleteL(aParse);
779 // -----------------------------------------------------------------------------
780 // Seek to an invalid position of the file.
781 // -----------------------------------------------------------------------------
783 C3GPLibParser_0119::C3GPLibParser_0119()
787 TVerdict C3GPLibParser_0119::doTestStepL()
789 if(TestStepResult() == EPass)
791 C3GPParse* parser = C3GPParse::NewL();
792 CleanupStack::PushL(parser);
794 TRAPD(err, SeekTestL(parser));
797 SetTestStepResult(EFail);
800 CleanupStack::PopAndDestroy(parser);
802 return TestStepResult();
805 void C3GPLibParser_0119::SeekTestL(C3GPParse* aParse)
808 ParserOpenFileL(aParse);
812 TUint timeStampInMs = 0;
814 // Seek to position 0.
816 err = aParse->Seek(timeStampInMs, ETrue, audioPos, videoPos);
817 if (iTestSection.Compare(KNoAudioNoVideo) == 0)
819 User::LeaveIfError(CheckError(err, KErrGeneral,
820 _L("aParser->Seek(timeStampInMs, ETrue, audioPos, videoPos) with file without audio nor video")));
821 err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
822 User::LeaveIfError(CheckError(err, KErrGeneral,
823 _L("aParser->Seek(timeStampInMs, EFalse, audioPos, videoPos) with file without audio nor video")));
827 User::LeaveIfError(CheckError(err, KErrNone,
828 _L("aParser->Seek(timeStampInMs, ETrue, audioPos, videoPos) with file with audio/video")));
829 err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
830 User::LeaveIfError(CheckError(err, KErrNone,
831 _L("aParser->Seek(timeStampInMs, EFalse, audioPos, videoPos) with file with audio/video")));
834 if (iTestSection.Compare(KNoAudioNoVideo) != 0)
836 // Retrieve video & audio stream length
841 err = GetClipProperties(aParse, videoError, videoLength, audioLength);
842 if (iTestSection.Compare(KAudioOnly) == 0)
844 // audio only, GetVideoProperties should fail with KErrNotSupported. Set video length to 0
845 User::LeaveIfError(CheckError(videoError, KErrNotSupported, _L("GetClipProperties(aParse, videoError, videoLength, audioLength))")));
848 else if (iTestSection.Compare(KVideoOnly) == 0)
850 // video only, GetAudioProperties should fail with KErrNotSupported. Set audio length to 0
851 User::LeaveIfError(CheckError(err, KErrNotSupported, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
856 // All other files contains audio data
857 User::LeaveIfError(CheckError(videoError, KErrNone, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
858 User::LeaveIfError(CheckError(err, KErrNone, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
861 if (audioLength >= videoLength)
863 timeStampInMs = audioLength + 10000;
867 timeStampInMs = videoLength + 10000;
870 // Seek returns KErrNone even thought the position is more than the audio/video length. AudioPos/videoPos should
871 // be the the last audio/video position
872 err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
873 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->Seek() to an invalid position")));
876 err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
877 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->Seek(0, EFalse, audioPos, videoPos)")));
879 ParserCompleteL(aParse);
882 // -----------------------------------------------------------------------------
883 // Read Video Decoder Info, video frame dependencies and user atom when these
884 // info is not in the file
885 // -----------------------------------------------------------------------------
887 C3GPLibParser_0120::C3GPLibParser_0120()
891 TVerdict C3GPLibParser_0120::doTestStepL()
893 if(TestStepResult() == EPass)
895 TInt readBufferSize = 1000;
896 C3GPParse* parser = C3GPParse::NewL(readBufferSize);
897 CleanupStack::PushL(parser);
899 TRAPD(err, VideoAttributesL(parser));
902 SetTestStepResult(EFail);
905 CleanupStack::PopAndDestroy(parser);
907 return TestStepResult();
910 void C3GPLibParser_0120::VideoAttributesL(C3GPParse* aParse)
913 ParserOpenFileL(aParse);
915 // Read Video Decoder Info from a mp4/3gp/3g2 file containing H263 video.
916 CallVideoDecoderInfoApiL(aParse, KErrNotSupported);
918 ParserCompleteL(aParse);
921 // -----------------------------------------------------------------------------
922 // Instantiate parser with read buffer size < 0.
923 // -----------------------------------------------------------------------------
925 C3GPLibParser_0126::C3GPLibParser_0126()
929 TVerdict C3GPLibParser_0126::doTestStepL()
931 if(TestStepResult() == EPass)
933 TInt readBufferSize = -1;
934 C3GPParse* parser = C3GPParse::NewL(readBufferSize);
937 SetTestStepResult(EFail);
942 return TestStepResult();
945 // -----------------------------------------------------------------------------
946 // Retrieve video and audio info using empty buffer and size 1 buffer for all
947 // buffer related API.
948 // -----------------------------------------------------------------------------
950 C3GPLibParser_0127::C3GPLibParser_0127()
954 TVerdict C3GPLibParser_0127::doTestStepL()
956 if(TestStepResult() == EPass)
958 TInt readBufferSize = 1000;
959 C3GPParse* parser = C3GPParse::NewL(readBufferSize);
960 CleanupStack::PushL(parser);
962 TRAPD(err, TestEmptyBufferL(parser));
965 SetTestStepResult(EFail);
968 CleanupStack::PopAndDestroy(parser);
970 return TestStepResult();
973 void C3GPLibParser_0127::TestEmptyBufferL(C3GPParse* aParse)
976 ParserOpenFileL(aParse);
978 // Create an empty buffer
979 TInt expectedErr = KErrOverflow;
981 CleanupClosePushL(buffer);
983 TUint32 udtType = 0x6d657461; // The udt type of test file is 'meta'
985 T3GPUdtaLocation location = E3GPUdtaVideoTrak;
987 if (iTestSection.Compare(KAudioMore) != 0)
996 TInt err = aParse->GetUserDataAtom(udtType, location, buffer, index);
997 User::LeaveIfError(CheckError(err, expectedErr, _L("GetUserDataAtom")));
999 err = aParse->GetVideoDecoderSpecificInfo(buffer);
1000 User::LeaveIfError(CheckError(err, expectedErr, _L("GetVideoDecoderSpecificInfo")));
1002 err = aParse->GetAudioDecoderSpecificInfo(buffer);
1003 User::LeaveIfError(CheckError(err, expectedErr, _L("GetAudioDecoderSpecificInfo")));
1005 err = aParse->InsertData(buffer);
1006 User::LeaveIfError(CheckError(err, KErrGeneral, _L("InsertData")));
1008 TUint timeStampInMs;
1009 TUint timeStampInTimescale;
1010 TInt returnedFrames;
1011 err = aParse->ReadAudioFrames(buffer, returnedFrames, timeStampInMs, timeStampInTimescale);
1012 User::LeaveIfError(CheckError(err, expectedErr, _L("ReadAudioFrames")));
1015 err = aParse->ReadVideoFrame(buffer, keyframe, timeStampInMs, timeStampInTimescale);
1016 User::LeaveIfError(CheckError(err, expectedErr, _L("ReadVideoFrame")));
1018 iSchedulerWait = new (ELeave) CActiveSchedulerWait;
1021 User::Leave(KErrNoMemory);
1024 iWaitForNotification = ETrue;
1025 aParse->ReadVideoFrame(*this, buffer);
1027 if (iWaitForNotification)
1029 iSchedulerWait->Start();
1032 User::LeaveIfError(CheckError(err, expectedErr, _L("ReadVideoFrame async")));
1034 iWaitForNotification = ETrue;
1035 aParse->ReadAudioFrames(*this, buffer);
1036 CleanupStack::PopAndDestroy(&buffer);
1038 if (iWaitForNotification)
1040 iSchedulerWait->Start();
1043 User::LeaveIfError(CheckError(err, expectedErr, _L("ReadAudioFrames async")));
1045 if ( iSchedulerWait->IsStarted() )
1047 iSchedulerWait->AsyncStop();
1049 ParserCompleteL(aParse);
1052 // -----------------------------------------------------------------------------
1053 // Async read before the parser has been setup.
1054 // -----------------------------------------------------------------------------
1056 C3GPLibParser_0130::C3GPLibParser_0130()
1060 TVerdict C3GPLibParser_0130::doTestStepPreambleL()
1062 C3GPLib_AsyncObserver::doTestStepPreambleL();
1063 if (TestStepResult() == EPass)
1065 iScheduler = new (ELeave) CActiveScheduler;
1066 CActiveScheduler::Install(iScheduler);
1068 return TestStepResult();
1071 TVerdict C3GPLibParser_0130::doTestStepPostambleL()
1073 C3GPLibParser_base::doTestStepPostambleL();
1076 INFO_PRINTF1(_L("delete iScheduler"));
1077 CActiveScheduler::Install(NULL);
1082 return TestStepResult();
1085 TVerdict C3GPLibParser_0130::doTestStepL()
1087 if(TestStepResult() == EPass)
1089 C3GPParse* parser = C3GPParse::NewL();
1090 CleanupStack::PushL(parser);
1092 TRAPD(err, ReadFrameAsyncWoOpenL(parser));
1093 if (err != KErrNone)
1095 SetTestStepResult(EFail);
1098 CleanupStack::PopAndDestroy(parser);
1100 return TestStepResult();
1103 void C3GPLibParser_0130::ReadFrameAsyncWoOpenL(C3GPParse* aParser)
1105 TInt err = ReadAudioVideoFrameAsync(aParser, ETrue);
1106 User::LeaveIfError(CheckError(err, KErrNotReady, _L("ReadAudioVideoFrameAsync audio")));
1108 err = ReadAudioVideoFrameAsync(aParser, EFalse);
1109 User::LeaveIfError(CheckError(err, KErrNotReady, _L("ReadAudioVideoFrameAsync video")));
1111 aParser->CancelReadFrame();
1114 // -----------------------------------------------------------------------------
1115 // Async read negative test after the parser has been setup.
1116 // -----------------------------------------------------------------------------
1118 C3GPLibParser_0131::C3GPLibParser_0131()
1122 TVerdict C3GPLibParser_0131::doTestStepPreambleL()
1124 C3GPLib_AsyncObserver::doTestStepPreambleL();
1125 if (TestStepResult() == EPass)
1127 iScheduler = new (ELeave) CActiveScheduler;
1128 CActiveScheduler::Install(iScheduler);
1130 return TestStepResult();
1133 TVerdict C3GPLibParser_0131::doTestStepPostambleL()
1135 C3GPLib_AsyncObserver::doTestStepPostambleL();
1138 INFO_PRINTF1(_L("delete iScheduler"));
1139 CActiveScheduler::Install(NULL);
1144 return TestStepResult();
1147 TVerdict C3GPLibParser_0131::doTestStepL()
1149 if(TestStepResult() == EPass)
1151 C3GPParse* parser = C3GPParse::NewL();
1152 CleanupStack::PushL(parser);
1154 TRAPD(err, ReadFrameAsyncAfterOpenL(parser));
1155 if (err != KErrNone)
1157 SetTestStepResult(EFail);
1160 CleanupStack::PopAndDestroy(parser);
1162 return TestStepResult();
1165 void C3GPLibParser_0131::ReadFrameAsyncAfterOpenL(C3GPParse* aParser)
1168 ParserOpenFileL(aParser);
1173 TInt AudioErr = GetClipProperties(aParser, videoError, videoLength, audioLength);
1175 if (AudioErr != KErrNone && AudioErr != KErrNotSupported && AudioErr == KErrCorrupt)
1177 SetTestStepError(AudioErr);
1178 if (!ShouldRunOOMTest())
1180 ERR_PRINTF2(_L("audioErr %d; "), AudioErr);
1182 ParserCompleteL(aParser);
1185 if (videoError != KErrNone && videoError != KErrNotSupported && videoError != KErrCorrupt)
1187 SetTestStepError(videoError);
1188 ERR_PRINTF2(_L("videoError %d; "), videoError);
1189 ParserCompleteL(aParser);
1193 TInt err = KErrNone;
1195 // Call read audio frame async when there is no audio. Expects error
1196 if (AudioErr == KErrNotSupported || AudioErr == KErrCorrupt)
1198 err = ReadAudioVideoFrameAsync(aParser, ETrue);
1201 if (err != KErrNone)
1203 if (!ShouldRunOOMTest())
1205 ERR_PRINTF2(_L("ReadAudioVideoFrameAsync audio err %d "), err);
1207 SetTestStepError(err);
1210 // Call read video frame async when there is no video. Expects error
1211 if (videoError == KErrNotSupported && AudioErr != KErrNotSupported)
1213 err = ReadAudioVideoFrameAsync(aParser, EFalse);
1214 if (err != KErrNone)
1216 if (!ShouldRunOOMTest())
1218 ERR_PRINTF2(_L("ReadAudioVideoFrameAsync video err %d "), err);
1220 SetTestStepError(err);
1224 // call Cancel Async read when there is no outstanding async read request
1225 aParser->CancelReadFrame();
1227 ParserCompleteL(aParser);
1230 // -----------------------------------------------------------------------------
1231 // Retrieve video & audio frames async in buffer mode.
1232 // -----------------------------------------------------------------------------
1234 C3GPLibParser_0136::C3GPLibParser_0136()
1238 TVerdict C3GPLibParser_0136::doTestStepPreambleL()
1240 C3GPLib_AsyncObserver::doTestStepPreambleL();
1241 if (TestStepResult() == EPass)
1243 iScheduler = new (ELeave) CActiveScheduler;
1244 CActiveScheduler::Install(iScheduler);
1246 return TestStepResult();
1249 TVerdict C3GPLibParser_0136::doTestStepPostambleL()
1251 C3GPLib_AsyncObserver::doTestStepPostambleL();
1254 INFO_PRINTF1(_L("delete iScheduler"));
1255 CActiveScheduler::Install(NULL);
1260 return TestStepResult();
1263 TVerdict C3GPLibParser_0136::doTestStepL()
1265 if(TestStepResult() == EPass)
1267 C3GPParse* parser = C3GPParse::NewL();
1268 CleanupStack::PushL(parser);
1270 TRAPD(err, ReadFrameAsyncInBufferModeL(parser));
1271 if (err != KErrNone)
1273 SetTestStepResult(EFail);
1276 CleanupStack::PopAndDestroy(parser);
1278 return TestStepResult();
1281 void C3GPLibParser_0136::OpenFileInBufferModeL(C3GPParse& aParser)
1283 // open parser in buffer mode
1284 User::LeaveIfError(aParser.Open());
1287 User::LeaveIfError(fs.Connect());
1288 CleanupClosePushL(fs);
1291 User::LeaveIfError(file.Open(fs, iInputFile, EFileRead | EFileStream));
1292 CleanupClosePushL(file);
1295 buffer.CreateL(1000);
1296 CleanupClosePushL(buffer);
1298 TInt bufferRead = 0;
1301 User::LeaveIfError(file.Read(buffer));
1302 bufferRead = buffer.Length();
1305 User::LeaveIfError(aParser.InsertData(buffer));
1307 } while (bufferRead > 0);
1309 CleanupStack::PopAndDestroy(&buffer);
1310 CleanupStack::PopAndDestroy(&file);
1311 CleanupStack::PopAndDestroy(&fs);
1314 void C3GPLibParser_0136::ReadFrameAsyncInBufferModeL(C3GPParse* aParser)
1319 OpenFileInBufferModeL(*aParser);
1321 // Get Video & Audio properties to ensure both source exist
1322 T3GPVideoType videoType;
1323 T3GPAudioType audioType;
1328 TInt framesPerSample;
1331 User::LeaveIfError(aParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale));
1332 User::LeaveIfError(aParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale));
1334 TInt audioFrameErr = ReadAudioVideoFrameAsync(aParser, ETrue);
1335 TInt videoFrameErr = ReadAudioVideoFrameAsync(aParser, EFalse);
1336 if (audioFrameErr != videoFrameErr)
1338 ERR_PRINTF1(_L("Unexpected error returned"));
1339 SetTestStepResult(EInconclusive);
1343 SetTestStepError(audioFrameErr);
1346 // call Cancel Async read when there is no outstanding async read request
1347 aParser->CancelReadFrame();
1349 ParserCompleteL(aParser);
1353 // -----------------------------------------------------------------------------
1354 // Get frame type using file path
1355 // -----------------------------------------------------------------------------
1357 C3GPLibParser_0135::C3GPLibParser_0135()
1362 TVerdict C3GPLibParser_0135::doTestStepL()
1364 if(TestStepResult() == EPass)
1366 C3GPParse* parser = C3GPParse::NewL();
1367 CleanupStack::PushL(parser);
1369 TRAPD(err, GetFrameTypeNegativeL(parser));
1370 if (err != KErrNone)
1372 SetTestStepResult(EFail);
1375 CleanupStack::PopAndDestroy(parser);
1377 return TestStepResult();
1380 void C3GPLibParser_0135::GetFrameTypeNegativeL(C3GPParse* aParser)
1382 ParserOpenFileL(aParser);
1385 TInt err = KErrNone;
1389 TInt AudioErr = GetClipProperties(aParser, videoError, videoLength, audioLength);
1391 if ((AudioErr != KErrNone && AudioErr != KErrNotSupported))
1393 SetTestStepError(AudioErr);
1394 ERR_PRINTF2(_L("audioErr %d; "), AudioErr);
1395 ParserCompleteL(aParser);
1398 if ((videoError != KErrNone && videoError != KErrNotSupported))
1400 SetTestStepError(videoError);
1401 ERR_PRINTF2(_L("videoError %d; "), videoError);
1402 ParserCompleteL(aParser);
1406 if (AudioErr == KErrNone)
1408 // read all audio frames and then check the next frame type
1409 err = ReadAudioVideoFrame(aParser, ETrue, ETrue);
1410 User::LeaveIfError(CheckError(err, KErrNotFound, _L("ReadAudioVideoFrame")));
1413 if (videoError == KErrNone )
1415 // read all video frames
1416 err = ReadAudioVideoFrame(aParser, ETrue);
1417 User::LeaveIfError(CheckError(err, KErrNotFound, _L("ReadAudioVideoFrame")));
1420 if (err == KErrNotFound && (AudioErr == KErrNone || videoError == KErrNone))
1422 err = aParser->GetFrameType(type);
1425 if (err != KErrNone)
1427 SetTestStepError(err);
1430 ParserCompleteL(aParser);
1433 // -----------------------------------------------------------------------------
1434 // Get audio/video attributes of a large file (>2GB) using 32bit APIs
1435 // -----------------------------------------------------------------------------
1437 C3GPLibParser_0137::C3GPLibParser_0137()
1441 TVerdict C3GPLibParser_0137::doTestStepL()
1443 if(TestStepResult() == EPass)
1445 C3GPParse* parser = C3GPParse::NewL();
1446 CleanupStack::PushL(parser);
1448 TRAPD(err, GetVideoAudioAttributesL(parser));
1449 if (err != KErrNone)
1451 SetTestStepError(err);
1454 CleanupStack::PopAndDestroy(parser);
1456 return TestStepResult();
1459 void C3GPLibParser_0137::GetVideoAudioAttributesL(C3GPParse* aParser)
1461 // open parser in 32bit file handle
1462 ParserOpenFileHandleL(aParser);
1463 DoGetVideoAudioAttributesL(aParser);
1464 ParserCompleteHandleL(aParser);
1467 // -----------------------------------------------------------------------------
1468 // Get audio/video frames of a large file (>2GB) using 32bit APIs
1469 // -----------------------------------------------------------------------------
1471 C3GPLibParser_0138::C3GPLibParser_0138()
1475 TVerdict C3GPLibParser_0138::doTestStepL()
1477 if(TestStepResult() == EPass)
1479 C3GPParse* parser = C3GPParse::NewL();
1480 CleanupStack::PushL(parser);
1482 TRAPD(err, ReadFrameL(parser));
1483 if (err != KErrNone)
1485 SetTestStepError(err);
1488 CleanupStack::PopAndDestroy(parser);
1490 return TestStepResult();
1493 void C3GPLibParser_0138::ReadFrameL(C3GPParse* aParser)
1495 // open parser in 32bit file handle
1496 ParserOpenFileHandleL(aParser);
1497 User::LeaveIfError(DoReadFrame(aParser));
1498 ParserCompleteHandleL(aParser);
1501 // -----------------------------------------------------------------------------
1502 // Get audio/video frames of a large file (>2GB) using 32bit APIs
1503 // -----------------------------------------------------------------------------
1505 C3GPLibParser_0139::C3GPLibParser_0139()
1509 TVerdict C3GPLibParser_0139::doTestStepPreambleL()
1511 C3GPLib_AsyncObserver::doTestStepPreambleL();
1512 if (TestStepResult() == EPass)
1514 iScheduler = new (ELeave) CActiveScheduler;
1515 CActiveScheduler::Install(iScheduler);
1517 return TestStepResult();
1520 TVerdict C3GPLibParser_0139::doTestStepPostambleL()
1522 C3GPLib_AsyncObserver::doTestStepPostambleL();
1525 INFO_PRINTF1(_L("delete iScheduler"));
1526 CActiveScheduler::Install(NULL);
1531 return TestStepResult();
1534 TVerdict C3GPLibParser_0139::doTestStepL()
1536 if(TestStepResult() == EPass)
1538 C3GPParse* parser = C3GPParse::NewL();
1539 CleanupStack::PushL(parser);
1541 TRAPD(err, ReadFrameAsyncL(parser));
1542 if (err != KErrNone)
1544 SetTestStepError(err);
1547 CleanupStack::PopAndDestroy(parser);
1549 return TestStepResult();
1552 void C3GPLibParser_0139::ReadFrameAsyncL(C3GPParse* aParser)
1554 ParserOpenFileHandleL(aParser);
1555 User::LeaveIfError(DoReadFrameAsync(aParser));
1556 if (!ShouldRunOOMTest())
1558 INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL() using file handler"));
1560 ParserCompleteHandleL(aParser);
1563 TInt C3GPLibParser_0139::DoReadFrameAsync(C3GPParse* aParser, TBool aCancel)
1565 TInt err = KErrNone;
1569 err = ReadAudioVideoFrameAsync(aParser, ETrue);
1570 if (err == KErrNone)
1572 err = ReadAudioVideoFrameAsync(aParser, EFalse);
1577 err = ReadAudioVideoFrameAsync(aParser, EFalse, ETrue);
1583 // -----------------------------------------------------------------------------
1584 // Test the retrieval of Get video / audio properties when the properties are filled
1585 // in but the file does not contain any actual data
1586 // -----------------------------------------------------------------------------
1588 TVerdict C3GPSingleDataSourceTest::doTestStepPreambleL()
1591 if(!GetStringFromConfig(ConfigSection(),_L("inputFile"), inputFile))
1593 SetTestStepResult(EFail);
1597 iParser = C3GPParse::NewL();
1598 User::LeaveIfError(iParser->Open(inputFile));
1599 SetTestStepResult(EPass);
1600 SetTestStepError(KErrNone);
1603 return TestStepResult();
1606 TVerdict C3GPSingleDataSourceTest::doTestStepPostambleL()
1610 iParser->Complete();
1615 return TestStepResult();
1619 TVerdict C3GPSingleDataSourceTest::doTestStepL()
1621 if (TestStepResult() != EPass)
1623 return TestStepResult();
1626 if (ConfigSection() == _L("MM-3GP-PARSE-U-0112-CP-2"))
1628 // for a video only file containing audio properties but no real audio data
1629 T3GPVideoType videoType;
1635 TInt err = iParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
1636 if (err == KErrNone)
1638 T3GPAudioType audioType;
1639 TInt framesPerSample;
1644 err = iParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
1645 if (err == KErrNone)
1647 if (audioType == E3GPMpeg4Audio)
1650 err = iParser->GetAudioDecoderSpecificInfoSize(size);
1651 if (err != KErrNone)
1653 if (!ShouldRunOOMTest())
1655 ERR_PRINTF2(_L("C3GPParse::GetAudioDecoderSpecificInfoSize returns %d."), err);
1661 TBool available = EFalse;
1662 err = iParser->GetFrameAvailability(E3GPAudio, available);
1663 if (err != KErrNone && err != KErrNotFound)
1665 if (!ShouldRunOOMTest())
1667 ERR_PRINTF2(_L("C3GPParse::GetFrameAvailability returns %d."), err);
1672 TUint frameSize = 0;
1673 err = iParser->GetAudioFramesSize(frameSize);
1674 if (err == KErrNone)
1676 // Expect retrieval of audio properties to fail, doesn't matter what error code
1678 if (!ShouldRunOOMTest())
1680 ERR_PRINTF1(_L("C3GPParse::GetAudioFramesSize expects to fail but does not"));
1682 SetTestStepResult(EFail);
1685 if (TestStepResult() == EPass)
1687 TUint frameIndex = 0;
1688 err = iParser->GetAudioSampleEntryIndex(frameIndex);
1689 if (err == KErrNone)
1691 // Expect retrieval of audio properties to fail, doesn't matter what error code
1693 if (!ShouldRunOOMTest())
1695 ERR_PRINTF1(_L("C3GPParse::GetAudioSampleEntryIndex expects to fail but does not"));
1697 SetTestStepResult(EFail);
1703 if (!ShouldRunOOMTest())
1705 ERR_PRINTF2(_L("C3GPParse::GetAudioProperties returns %d"), err);
1711 else if (ConfigSection() == _L("MM-3GP-PARSE-U-0111-CP-2"))
1713 // for a file containing audio data & video properties and a video track, but the video track
1714 // contains NO video data
1715 T3GPAudioType audioType;
1716 TInt framesPerSample;
1721 TInt err = iParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
1722 if (err == KErrNone)
1724 T3GPVideoType videoType;
1730 err = iParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
1731 if (err == KErrNone)
1733 if (videoType == E3GPMpeg4Video || videoType == E3GPAvcProfileBaseline)
1736 err = iParser->GetVideoDecoderSpecificInfoSize(size);
1737 if (err != KErrNone)
1739 if (!ShouldRunOOMTest())
1741 ERR_PRINTF2(_L("C3GPParse::GetVideoDecoderSpecificInfoSize returns %d."), err);
1749 if (!ShouldRunOOMTest())
1751 ERR_PRINTF2(_L("C3GPParse::GetVideoProperties returns %d"), err);
1756 TBool available = EFalse;
1757 err = iParser->GetFrameAvailability(E3GPVideo, available);
1758 if (err != KErrNone && err != KErrNotFound)
1760 if (!ShouldRunOOMTest())
1762 ERR_PRINTF2(_L("C3GPParse::GetFrameAvailability returns %d."), err);
1767 TUint numberOfFrames = 0;
1768 if (TestStepResult() == EPass)
1770 err = iParser->GetNumberOfVideoFrames(numberOfFrames);
1771 if (err != KErrNone)
1773 if (!ShouldRunOOMTest())
1775 ERR_PRINTF2(_L("C3GPParse::GetNumberOfVideoFrames returns %d"), err);
1779 if (numberOfFrames != 0)
1781 if (!ShouldRunOOMTest())
1783 ERR_PRINTF2(_L("C3GPParse::GetNumberOfVideoFrames retrieves %d frames when expecting 0"), numberOfFrames);
1785 SetTestStepResult(EFail);
1789 if (TestStepResult() == EPass)
1792 TInt err = iParser->GetVideoFrameSize(frameSize);
1793 if (err == KErrNone)
1795 if (!ShouldRunOOMTest())
1797 ERR_PRINTF1(_L("C3GPParse::GetVideoFrameSize expects to fail but does not"));
1799 SetTestStepResult(EFail);
1803 if (TestStepResult() == EPass)
1807 TInt err = iParser->GetVideoTimestamp(tsInMs, tsInTs);
1808 if (err == KErrNone)
1810 if (!ShouldRunOOMTest())
1812 ERR_PRINTF1(_L("C3GPParse::GetVideoTimestamp expects to fail but does not"));
1814 SetTestStepResult(EFail);
1818 if (TestStepResult() == EPass)
1821 TInt err = iParser->GetVideoSampleEntryIndex(index);
1822 if (err == KErrNone)
1824 if (!ShouldRunOOMTest())
1826 ERR_PRINTF1(_L("C3GPParse::GetVideoSampleEntryIndex expects to fail but does not"));
1828 SetTestStepResult(EFail);
1835 SetTestStepResult(ETestSuiteError);
1838 return TestStepResult();