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 #include "tsu3gplibraryapi.h"
20 using namespace ContentAccess;
22 // --------------------------
24 // --------------------------
26 TVerdict C3GPLibParser_base::doTestStepPreambleL()
28 SetTestStepResult(EPass);
29 SetTestStepError(KErrNone);
31 TPtrC testSection = ConfigSection();
33 TInt err = iTestSection.Create(testSection.Length());
36 ERR_PRINTF2(_L("Cannot create buffer for inputFilename. err = %d"), err);
37 SetTestStepResult(EInconclusive);
38 return TestStepResult();
40 iTestSection += testSection;
42 TBuf<20> testFolderName;
43 testFolderName.Zero();
44 if (ConfigSection().Compare(_L("3GP-H264-MP4-LARGE")) == 0)
47 testFolderName.Append(_L("inputFileEmu"));
49 testFolderName.Append(_L("inputFileHw"));
54 testFolderName.Append(_L("inputFile"));
58 if(!GetStringFromConfig(ConfigSection(), testFolderName, inputFile))
60 ERR_PRINTF1(_L("Cannot read inputFile from ini file."));
61 SetTestStepResult(ETestSuiteError);
62 return TestStepResult();
64 err = iInputFile.Create(inputFile.Length() + 1);
67 ERR_PRINTF2(_L("Cannot create buffer for inputFilename. err = %d"), err);
68 SetTestStepResult(EInconclusive);
69 return TestStepResult();
71 iInputFile += inputFile;
72 iInputFile.ZeroTerminate();
74 return TestStepResult();
77 TVerdict C3GPLibParser_base::doTestStepPostambleL()
84 iSourceFile64.Close();
86 //Close the file server session
89 return TestStepResult();
92 TInt C3GPLibParser_base::CheckError(TInt aError, TInt aExpectError, const TDesC& aFunction)
94 if (aError != aExpectError)
96 ERR_PRINTF4(_L("%S expected %d, but returns %d; "), &aFunction, aExpectError, aError);
97 if (aError != KErrNone)
101 // expected an error, but return KErrNone
107 void C3GPLibParser_base::ParserOpenL(C3GPParse* aParser, TInt aExpectedError)
111 TInt err = aParser->Open();
112 if (aExpectedError == KErrInUse && err == KErrNone)
114 err = aParser->Open();
117 if (ShouldRunOOMTest() && err != KErrNone && err != aExpectedError)
119 INFO_PRINTF2(_L("Parser open using buffer mode (OOM), returns %d"), err);
123 if (!ShouldRunOOMTest())
125 INFO_PRINTF2(_L("Parser open using buffer mode, returns %d"), err);
128 User::LeaveIfError(CheckError(err, aExpectedError, _L("aParser->Open() buffer mode")));
131 void C3GPLibParser_base::ParserOpenFileL(C3GPParse* aParser, TInt aExpectedError)
135 TInt err = aParser->Open(iInputFile);
136 if (aExpectedError == KErrInUse && err == KErrNone)
138 err = aParser->Open(iInputFile);
141 if (ShouldRunOOMTest() && err != KErrNone && err != aExpectedError)
143 INFO_PRINTF2(_L("Parser open using file path (OOM), returns %d"), err);
147 if (!ShouldRunOOMTest())
149 INFO_PRINTF2(_L("Parser open using file path, returns %d"), err);
152 User::LeaveIfError(CheckError(err, aExpectedError, _L("aParser->Open() file path")));
155 void C3GPLibParser_base::ParserCompleteL(C3GPParse* aParser)
159 TInt err = aParser->Complete();
160 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->Complete()")));
163 void C3GPLibParser_base::FileOpenL(TUint aFileMode)
166 //Create a connection to the file server
167 User::LeaveIfError(iFsSession.Connect());
169 //Open the source file passing in the file server session handle, source
170 //file path and file access mode
171 User::LeaveIfError(iSourceFile.Open(iFsSession, iInputFile, aFileMode ));
174 void C3GPLibParser_base::FileClose()
179 //Close the file server session
183 void C3GPLibParser_base::FileOpen64L(TUint aFileMode)
185 iSourceFile64.Close();
186 //Create a connection to the file server
187 User::LeaveIfError(iFsSession.Connect());
189 //Open the source file passing in the file server session handle, source
190 //file path and file access mode
191 User::LeaveIfError(iSourceFile64.Open(iFsSession, iInputFile, aFileMode ));
194 void C3GPLibParser_base::FileClose64()
197 iSourceFile64.Close();
199 //Close the file server session
203 void C3GPLibParser_base::ParserOpenFileHandleL(C3GPParse* aParser, TUint aFileMode, TInt aExpectedError)
207 FileOpenL(aFileMode);
208 TInt err = aParser->Open(iSourceFile);
209 if (aExpectedError == KErrInUse && err == KErrNone)
211 err = aParser->Open(iSourceFile);
214 if (err != KErrNone && err != aExpectedError)
218 if (ShouldRunOOMTest())
220 INFO_PRINTF2(_L("Parser open using file handle (OOM), returns %d"), err);
225 if (!ShouldRunOOMTest())
227 INFO_PRINTF2(_L("Parser open using file handle, returns %d"), err);
230 if (err == aExpectedError )
234 User::LeaveIfError(err);
237 void C3GPLibParser_base::ParserCompleteHandleL(C3GPParse* aParser)
241 TInt err = aParser->Complete();
244 ERR_PRINTF2(_L("aParser->Complete() file handle failed with %d"), err);
248 User::LeaveIfError(err);
251 void C3GPLibParser_base::ParserOpenFileHandle64L(C3GPParse* aParser, TUint aFileMode, TInt aExpectedError)
255 FileOpen64L(aFileMode);
256 TInt err = aParser->Open(iSourceFile64);
257 if (aExpectedError == KErrInUse && err == KErrNone)
259 err = aParser->Open(iSourceFile64);
262 if (err != KErrNone && err != aExpectedError)
266 if (ShouldRunOOMTest())
268 INFO_PRINTF2(_L("Parser open using 64bit file handle (OOM), returns %d"), err);
273 if (!ShouldRunOOMTest())
275 INFO_PRINTF2(_L("Parser open using 64bit file handle, returns %d"), err);
278 if (err == aExpectedError )
282 User::LeaveIfError(err);
285 void C3GPLibParser_base::ParserCompleteHandle64L(C3GPParse* aParser)
289 TInt err = aParser->Complete();
292 ERR_PRINTF2(_L("aParser->Complete() 64bit file handle failed with %d"), err);
296 User::LeaveIfError(err);
299 void C3GPLibParser_base::ParserOpenCafLC(C3GPParse* aParser, TInt aExpectedError)
302 CContent* content = CContent::NewLC(iInputFile, EContentShareReadWrite);
303 CData* data = content->OpenContentL(EPeek);
305 CleanupStack::PushL(data);
307 TInt err = aParser->Open(*data);
308 if (aExpectedError == KErrInUse && err == KErrNone)
310 err = aParser->Open(*data);
313 if (ShouldRunOOMTest() && err != KErrNone && err != aExpectedError)
315 INFO_PRINTF2(_L("Parser open using CAF (OOM), returns %d"), err);
319 if (!ShouldRunOOMTest())
321 INFO_PRINTF2(_L("Parser open using CAF, returns %d"), err);
324 if (err == aExpectedError)
328 User::LeaveIfError(err);
331 void C3GPLibParser_base::ParserCompleteCafL(C3GPParse* aParser)
334 TInt err = aParser->Complete();
335 if ( err != KErrNone )
337 ERR_PRINTF2(_L("parse->Complete() CAF failed with %d."), err);
340 CleanupStack::PopAndDestroy(2); // content, data
341 User::LeaveIfError(err);
344 // Retrieve both video & audio stream properties
345 TInt C3GPLibParser_base::GetClipProperties(C3GPParse* aParse, TInt& aVideoError, TUint& aVideoLength, TUint& aAudioLength)
347 TInt err = KErrCorrupt;
348 T3GPVideoType videoType;
354 aVideoError = aParse->GetVideoProperties(videoType, aVideoLength, frameRate, avgBitRate, videoSize, timeScale);
356 if (aVideoError == KErrNone || aVideoError == KErrNotSupported || aVideoError == KErr3gpLibMoreDataRequired)
358 T3GPAudioType audioType;
359 TInt framesPerSample;
360 err = aParse->GetAudioProperties(audioType, aAudioLength, framesPerSample, avgBitRate, timeScale);
365 // Get both audio and video decorder information
366 TInt C3GPLibParser_base::ParserGetDecoderInfo(C3GPParse* aParser)
371 TInt err = aParser->GetAudioDecoderSpecificInfoSize(dsiSize);
372 if ( err == KErrNone )
374 err = dsiBuffer.Create(dsiSize);
375 if ( err != KErrNone )
377 ERR_PRINTF2(_L("dsiBuffer.Create failed with %d"), err);
382 err = aParser->GetAudioDecoderSpecificInfo(dsiBuffer);
384 if ( err != KErrNone )
386 if (!ShouldRunOOMTest())
388 ERR_PRINTF3(_L("GetAudioDecoderSpecificInfo/Size() failed with %d, size %d"), err, dsiSize);
394 err = aParser->GetVideoDecoderSpecificInfoSize(dsiSize);
395 if ( err != KErrNone && err != KErrNotSupported)
398 ERR_PRINTF2(_L("parse->GetVideoDecoderSpecificInfoSize() failed with %d"), err);
401 if (err != KErrNotSupported)
404 err = dsiBuffer.Create(dsiSize);
405 if ( err != KErrNone )
407 ERR_PRINTF2(_L("dsiBuffer.Create failed with %d"), err);
412 err = aParser->GetVideoDecoderSpecificInfo(dsiBuffer);
413 if ( err != KErrNone )
415 ERR_PRINTF2(_L("VideoDecoderSpecificInfo() failed with %d"), err);
422 // Read data from file and insert it to the buffer
423 void C3GPLibParser_base::InsertDataL(C3GPParse* aParse, RFile aFile, TInt aBufferSize, TInt aPos)
427 CleanupClosePushL(buffer);
428 buffer.CreateL(aBufferSize);
429 err = aFile.Read(aPos, buffer);
432 err = aParse->InsertData(buffer);
433 if ( err != KErrNone )
435 ERR_PRINTF2(_L("parse->InsertData() failed with %d"), err);
440 ERR_PRINTF2(_L("aFile.Read(aPos, buffer) failed with %d"), err);
443 CleanupStack::PopAndDestroy(&buffer);
444 User::LeaveIfError(err);
447 // Read audio or video frame(s) depending on the input parameter synchronously
448 TInt C3GPLibParser_base::ReadAudioVideoFrame(C3GPParse* aParse, TBool aRepeat, TBool aReadAudio)
451 // If repeat, read all frames; otherwise, read only one frame
452 while (err == KErrNone)
457 err = aParse->GetAudioFramesSize(size);
461 err = aParse->GetVideoFrameSize(size);
467 TUint timeStampInTimescale;
469 err = buffer.Create(size);
472 ERR_PRINTF2(_L("buffer.Create(size) failed with %d"), err);
480 err = aParse->ReadAudioFrames(buffer, returnedFrames, timeStampInMs, timeStampInTimescale);
485 err = aParse->ReadVideoFrame(buffer, keyframe, timeStampInMs, timeStampInTimescale);
488 if (err != KErrNone && err != KErrNotFound && err != KErr3gpLibMoreDataRequired)
492 ERR_PRINTF3(_L("parse->GetAudioFrames() failed with %d; frame size: %d"), err, size);
496 ERR_PRINTF3(_L("parse->GetVideoFrame() failed with %d; frame size: %d"), err, size);
512 // Retrieve user data atom.
513 TInt C3GPLibParser_base::CallUDTApi(C3GPParse* aParse, TUint32 aUdtType, TUint& aIndex, T3GPUdtaLocation aLocation)
518 // use a copy of the target index requested by the user, so it does not get overwritten
519 // when calling the APIs GetUserDataAtomSize & GetUserDataAtom
520 TUint tempIndex1 = aIndex;
521 TUint tempIndex2 = aIndex;
523 err = aParse->GetUserDataAtomSize(aUdtType, aLocation, tempIndex1, udtSize);
528 err = buffer.Create(udtSize); // Use size retrieved from GetUserDataAtomSize
531 err = aParse->GetUserDataAtom(aUdtType, aLocation, buffer, tempIndex2);
532 if (err == KErrNone && tempIndex1 != tempIndex2)
534 ERR_PRINTF1(_L("C3GPLibParser_base::CallUDTApi - Highest Index returned is different when calling GetUserDataAtomSize vs GetUserDataAtom"));
540 ERR_PRINTF2(_L("buffer.Create(size) failed with %d"), err);
547 // return the highest index found
554 void C3GPLibParser_base::DoGetVideoAudioAttributesL(C3GPParse* aParser)
556 // Retrieve video & audio stream attributes
557 T3GPVideoType videoType;
564 TInt err = aParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
565 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->GetVideoProperties()")));
567 T3GPAudioType audioType;
568 TInt framesPerSample;
569 err = aParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
570 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->GetAudioProperties()")));
572 err = ParserGetDecoderInfo(aParser);
573 User::LeaveIfError(CheckError(err, KErrNone, _L("ParserGetDecoderInfo(aParser)")));
575 TUint numVideoFrames;
576 err = aParser->GetNumberOfVideoFrames(numVideoFrames);
577 User::LeaveIfError(CheckError(err, KErrNone, _L("parse->GetNumberOfVideoFrames")));
579 TUint startIndex = 0;
580 RArray<T3GPFrameInfoParameters> array;
581 err = aParser->GetVideoFrameProperties(startIndex, numVideoFrames, array);
583 User::LeaveIfError(CheckError(err, KErrNone, _L("parse->GetVideoFrameProperties")));
586 TInt C3GPLibParser_base::DoReadFrame(C3GPParse* aParse)
588 TInt numBufferedBytes;
589 TInt err = aParse->GetNumBufferedBytes(numBufferedBytes);
590 if (err != KErrNone && numBufferedBytes != 0)
592 // when GetNumBufferedBytes returns error, numBufferedBytes is set to zero.
595 err = CheckError(err, KErrNotSupported, _L("parse->GetNumBufferedBytes()"));
599 err = ReadAudioVideoFrame(aParse, ETrue, ETrue);
600 // When finishing reading all frames, it returns KErrNotFound
601 err = CheckError(err, KErrNotFound, _L("ReadAudioVideoFrame(aParse, ETrue)"));
606 err = ReadAudioVideoFrame(aParse, ETrue, EFalse);
607 // When finishing reading all frames, it returns KErrNotFound
608 err = CheckError(err, KErrNotFound, _L("ReadAudioVideoFrame(aParse, EFalse)"));
611 // After finishing reading all frame, the next video time stamp should return with KErrEof
613 TUint timeStampInTimescale;
614 err = aParse->GetVideoTimestamp(timeStampInMs, timeStampInTimescale);
615 err = CheckError(err, KErrEof, _L("GetVideoTimestamp()"));
621 void C3GPLibParser_base::DoSeekTestL(C3GPParse* aParser)
623 // testclip_h263_qcif_15fps_armnb_8khz_onlyvideo.3GP with some key frame
627 TUint timeStampInMs = 0; // for key frame
628 TUint timeStampInTimescale = 0; // for key frame
629 TUint timeStampInMs1 = 0; // for non key frame immediately after key frame
630 TUint timeStampInTimescale1 = 0; // for non-key frame immediately after key frame
631 TUint keyFrameIndex = 0;
633 TInt err = aParser->GetNumberOfVideoFrames(num);
636 for (TInt i = 0; i < num; i++)
638 err = aParser->GetVideoFrameKeyType(i, keyFrame);
639 if (err == KErrNone && keyFrame)
642 err = aParser->GetVideoFrameStartTime(keyFrameIndex, timeStampInMs, timeStampInTimescale);
644 if (err == KErrNone && !keyFrame && keyFrameIndex > 0)
647 err = aParser->GetVideoFrameStartTime(keyFrameIndex, timeStampInMs1, timeStampInTimescale1);
652 ERR_PRINTF3(_L("aParser->GetVideoFrameKeyType() failed with %d at i %d"), err, i);
659 ERR_PRINTF2(_L("aParser->GetNumberOfVideoFrames() failed with %d"), err);
662 err = aParser->Seek(timeStampInMs, ETrue, audioPos, videoPos);
663 if (err != KErrNone || timeStampInMs != videoPos)
665 ERR_PRINTF4(_L("aParser->Seek() return %d, timeStampInMs %d, videoPos %d"), err, timeStampInMs, videoPos);
667 if (err == KErrNone && timeStampInMs != videoPos)
669 User::LeaveIfError(KErrGeneral);
671 User::LeaveIfError(err);
673 err = aParser->Seek(timeStampInMs1, EFalse, audioPos, videoPos);
674 if (err != KErrNone || timeStampInMs1 != videoPos)
676 ERR_PRINTF4(_L("aParser->Seek() return %d, timeStampInMs1 %d, videoPos %d"), err, timeStampInMs1, videoPos);
678 if (err == KErrNone && timeStampInMs1 != videoPos)
680 User::LeaveIfError(KErrGeneral);
682 User::LeaveIfError(err);
685 void C3GPLibParser_base::ReadFrameBufferModeL(C3GPParse* aParser)
687 ParserOpenL(aParser);
689 TInt errReadAudio = KErrNone;
690 TInt errReadVideo = KErrNone;
691 // Insert 1K data into the library
693 TInt bufferSize = 1000;
695 InsertDataL(aParser, iSourceFile, bufferSize, pos);
696 errReadAudio = ReadAudioVideoFrame(aParser, ETrue, ETrue);
697 errReadVideo = ReadAudioVideoFrame(aParser, ETrue, EFalse);
699 while (errReadAudio == KErr3gpLibMoreDataRequired || errReadVideo == KErr3gpLibMoreDataRequired)
701 pos = pos + bufferSize;
702 InsertDataL(aParser, iSourceFile, bufferSize, pos);
703 if (errReadAudio == KErr3gpLibMoreDataRequired)
705 errReadAudio = ReadAudioVideoFrame(aParser, ETrue, ETrue);
708 if (errReadVideo == KErr3gpLibMoreDataRequired)
710 errReadVideo = ReadAudioVideoFrame(aParser, ETrue, EFalse);
714 // When last frame has been read, it should return KErrNotFound
715 if (errReadAudio != KErrNotFound)
717 ERR_PRINTF1(_L("parse->ReadAudioFrames() expects KErrNotFound. "));
718 User::Leave(errReadAudio);
720 if (errReadVideo != KErrNotFound)
722 ERR_PRINTF1(_L("parse->ReadVideoFrame expects KErrNotFound. "));
723 User::Leave(errReadVideo);
726 ParserCompleteL(aParser);
729 C3GPLib_AsyncObserver::C3GPLib_AsyncObserver()
733 TVerdict C3GPLib_AsyncObserver::doTestStepPreambleL()
735 C3GPLibParser_base::doTestStepPreambleL();
737 iSchedulerWait = new (ELeave) CActiveSchedulerWait;
740 SetTestStepResult(EInconclusive);
742 return TestStepResult();
745 // -----------------------------------------------------------------------------
746 // C3GPLib_AsyncObserver for asynchronous read
747 // -----------------------------------------------------------------------------
749 TVerdict C3GPLib_AsyncObserver::doTestStepPostambleL()
751 C3GPLibParser_base::doTestStepPostambleL();
754 if (iSchedulerWait->IsStarted())
756 iSchedulerWait->AsyncStop();
758 delete iSchedulerWait;
759 iSchedulerWait = NULL;
761 return TestStepResult();
764 // Read audio or video frame(s) depending on the input parameter asynchronously
765 TInt C3GPLib_AsyncObserver::ReadAudioVideoFrameAsync(C3GPParse* aParse, TBool aReadAudio, TBool aCancel)
770 while (err == KErrNone)
774 err = aParse->GetAudioFramesSize(size);
778 err = aParse->GetVideoFrameSize(size);
784 err = buffer.Create(size);
788 err = buffer.Create(KBufferSize);
793 ERR_PRINTF2(_L("buffer.Create(KBufferSize) failed with %d"), err);
798 iWaitForNotification = ETrue;
801 aParse->ReadAudioFrames(*this, buffer);
805 aParse->ReadVideoFrame(*this, buffer);
808 if (aCancel && iAsyncError == KErrNone)
810 aParse->CancelReadFrame();
811 // Calling cancel again won't have effects
812 aParse->CancelReadFrame();
814 // Do read frame again
817 aParse->ReadAudioFrames(*this, buffer);
821 aParse->ReadVideoFrame(*this, buffer);
825 if (iWaitForNotification)
827 iSchedulerWait->Start();
834 if ( iSchedulerWait->IsStarted() )
836 iSchedulerWait->AsyncStop();
839 if (err != KErrNone && err != KErrNotFound)
841 if (!ShouldRunOOMTest())
843 ERR_PRINTF2(_L("ReadAudioVideoFrameAsync failed with %d;"), err);
854 void C3GPLib_AsyncObserver::AudioFramesAvailable(TInt aError, TUint aReturnedFrames,
855 TUint aTimeStampInMs, TUint aTimeStampInTimescale)
857 iWaitForNotification = EFalse;
858 iAsyncLastNotificationFromAudio = EFalse;
859 iAsyncError = aError;
860 iAsyncAudioTimeStampInMs = aTimeStampInMs;
861 iAsyncAudioReturnedFrames = aReturnedFrames;
862 iAsyncAudioTimestampInTimescale = aTimeStampInTimescale;
863 if (iSchedulerWait->IsStarted())
865 iSchedulerWait->AsyncStop();
870 void C3GPLib_AsyncObserver::VideoFrameAvailable(TInt aError, TBool aKeyFrame, TUint
871 aTimeStampInMs, TUint aTimeStampInTimescale)
873 iWaitForNotification = EFalse;
874 iAsyncLastNotificationFromAudio = EFalse;
875 iAsyncError = aError;
876 iAsyncVideoTimeStampInMs = aTimeStampInMs;
877 iAsyncVideoKeyFrame = aKeyFrame;
878 iAsyncVideoTimestampInTimescale = aTimeStampInTimescale;
880 if (iSchedulerWait->IsStarted())
882 iSchedulerWait->AsyncStop();
889 // -----------------------------------------------------------------------------
890 // Setup parser to read file by file path.
891 // -----------------------------------------------------------------------------
893 C3GPLibParser_0001::C3GPLibParser_0001()
897 TVerdict C3GPLibParser_0001::doTestStepL()
899 if(TestStepResult() == EPass)
901 C3GPParse* parser = C3GPParse::NewL();
902 CleanupStack::PushL(parser);
904 OpenCompleteL(parser);
906 CleanupStack::PopAndDestroy(parser);
908 return TestStepResult();
911 void C3GPLibParser_0001::OpenCompleteL(C3GPParse* aParser)
913 // Test open and complete with default file access mode
914 ParserOpenFileL(aParser);
915 ParserCompleteL(aParser);
918 ParserOpenFileL(aParser);
919 ParserCompleteL(aParser);
920 ParserCompleteL(aParser); // Should not fail when calling complete twice
923 //Open the source file passing in the file server session handle, source
924 //file path and file access mode (read-write)
925 FileOpenL(EFileShareReadersOrWriters | EFileWrite);
926 ParserOpenFileL(aParser);
927 ParserCompleteL(aParser);
928 ParserCompleteL(aParser);
931 //Open the source file passing in the file server session handle, source
932 //file path and file access mode (read-write)
933 FileOpenL(EFileShareReadersOrWriters | EFileRead);
934 ParserOpenFileL(aParser);
935 ParserCompleteL(aParser);
938 //Open the source file passing in the file server session handle, source
939 //file path and file access mode (read-write)
940 FileOpenL(EFileShareAny | EFileWrite);
941 ParserOpenFileL(aParser);
942 ParserCompleteL(aParser);
945 //Open the source file passing in the file server session handle, source
946 //file path and file access mode (read-write)
947 FileOpenL(EFileShareAny | EFileRead);
948 ParserOpenFileL(aParser);
949 ParserCompleteL(aParser);
953 // -----------------------------------------------------------------------------
954 // Setup parser to read file by buffer mode.
955 // -----------------------------------------------------------------------------
957 C3GPLibParser_0002::C3GPLibParser_0002()
961 TVerdict C3GPLibParser_0002::doTestStepL()
963 if(TestStepResult() == EPass)
965 C3GPParse* parser = C3GPParse::NewL();
966 CleanupStack::PushL(parser);
968 OpenCompleteBufferModeL(parser);
970 CleanupStack::PopAndDestroy(parser);
972 return TestStepResult();
975 void C3GPLibParser_0002::OpenCompleteBufferModeL(C3GPParse* aParser)
979 ParserOpenL(aParser);
981 ParserCompleteL(aParser);
985 // -----------------------------------------------------------------------------
986 // Setup parser to read file by file handle.
987 // -----------------------------------------------------------------------------
989 C3GPLibParser_0003::C3GPLibParser_0003()
993 TVerdict C3GPLibParser_0003::doTestStepL()
995 if(TestStepResult() == EPass)
997 C3GPParse* parser = C3GPParse::NewL();
998 CleanupStack::PushL(parser);
1000 OpenCompleteFileHandleL(parser);
1002 CleanupStack::PopAndDestroy(parser);
1004 return TestStepResult();
1007 void C3GPLibParser_0003::OpenCompleteFileHandleL(C3GPParse* aParser)
1009 ParserOpenFileHandleL(aParser);
1010 ParserCompleteHandleL(aParser);
1012 //Open the source file passing in the file server session handle, source
1013 //file path and file access mode (read-only)
1014 ParserOpenFileHandleL(aParser, EFileRead | EFileShareReadersOnly);
1015 ParserCompleteHandleL(aParser);
1017 //Open the source file passing in the file server session handle, source
1018 //file path and file access mode (read-only)
1019 ParserOpenFileHandleL(aParser, EFileShareReadersOrWriters | EFileWrite);
1020 ParserCompleteHandleL(aParser);
1022 //Open the source file passing in the file server session handle, source
1023 //file path and file access mode (read-only)
1024 ParserOpenFileHandleL(aParser, EFileShareReadersOrWriters | EFileRead);
1025 ParserCompleteHandleL(aParser);
1027 //Open the source file passing in the file server session handle, source
1028 //file path and file access mode (read-only)
1029 ParserOpenFileHandleL(aParser, EFileShareAny | EFileWrite);
1030 ParserCompleteHandleL(aParser);
1032 //Open the source file passing in the file server session handle, source
1033 //file path and file access mode (read-only)
1034 ParserOpenFileHandleL(aParser, EFileShareAny | EFileRead);
1035 ParserCompleteHandleL(aParser);
1038 // -----------------------------------------------------------------------------
1039 // Setup parser to read file by CAF.
1040 // -----------------------------------------------------------------------------
1042 C3GPLibParser_0004::C3GPLibParser_0004()
1046 TVerdict C3GPLibParser_0004::doTestStepL()
1048 if(TestStepResult() == EPass)
1050 CContent* content = CContent::NewLC(iInputFile, EContentShareReadWrite);
1052 CData* data = content->OpenContentL(EPeek);
1053 CleanupStack::PushL(data);
1055 C3GPParse* parser = C3GPParse::NewL();
1056 CleanupStack::PushL(parser);
1058 TInt err = parser->Open(*data);
1060 if (err != KErrNone)
1062 SetTestStepResult(EFail);
1063 CleanupStack::PopAndDestroy(parser);
1064 CleanupStack::PopAndDestroy(2); // content, data
1065 return TestStepResult();
1068 err = parser->Complete();
1069 if (err != KErrNone)
1071 SetTestStepResult(EFail);
1074 CleanupStack::PopAndDestroy(parser);
1075 CleanupStack::PopAndDestroy(2); // content, data
1077 return TestStepResult();
1080 // -----------------------------------------------------------------------------
1081 // Retrieve video & audio stream attributes from a mp4/3gp/3g2 file with supported
1082 // video and audio streams using file mode - file path / file handle and CAF object.
1083 // -----------------------------------------------------------------------------
1085 C3GPLibParser_0005::C3GPLibParser_0005()
1089 TVerdict C3GPLibParser_0005::doTestStepL()
1091 if(TestStepResult() == EPass)
1093 C3GPParse* parser = C3GPParse::NewL();
1094 CleanupStack::PushL(parser);
1096 TRAPD(err, GetVideoAudioAttributesL(parser));
1097 if (err != KErrNone)
1099 SetTestStepResult(EFail);
1102 CleanupStack::PopAndDestroy(parser);
1104 return TestStepResult();
1107 void C3GPLibParser_0005::GetVideoAudioAttributesL(C3GPParse* aParser)
1109 // Open parser in File path
1110 ParserOpenFileL(aParser);
1111 DoGetVideoAudioAttributesL(aParser);
1112 ParserCompleteL(aParser);
1114 // open parser in file handle
1115 ParserOpenFileHandleL(aParser);
1116 DoGetVideoAudioAttributesL(aParser);
1117 ParserCompleteHandleL(aParser);
1119 // Open parser in CAF
1120 ParserOpenCafLC(aParser);
1121 DoGetVideoAudioAttributesL(aParser);
1122 ParserCompleteCafL(aParser);
1125 // -----------------------------------------------------------------------------
1126 // Retrieve video & audio stream attributes from a mp4/3gp/3g2 file
1127 // with supported video and audio streams using buffer mode.
1128 // -----------------------------------------------------------------------------
1130 C3GPLibParser_0006::C3GPLibParser_0006()
1134 TVerdict C3GPLibParser_0006::doTestStepL()
1136 if(TestStepResult() == EPass)
1138 C3GPParse* parser = C3GPParse::NewL();
1139 CleanupStack::PushL(parser);
1141 TRAPD(err, VideoAudioAttributesBufferModeL(parser));
1142 if (err != KErrNone)
1144 SetTestStepResult(EFail);
1148 CleanupStack::PopAndDestroy(parser);
1150 return TestStepResult();
1153 void C3GPLibParser_0006::VideoAudioAttributesBufferModeL(C3GPParse* aParser)
1157 ParserOpenL(aParser);
1159 TInt err = KErrNone;
1160 // Retrieve number of buffered bytes before and after data is supplied to the parser.
1161 err = GetVideoAudioAttributes(aParser, ENumBufferedBytes);
1162 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoAudioAttributes(aParser, ENumBufferedBytes)")));
1164 ParserCompleteL(aParser);
1167 // Open the parser again
1169 ParserOpenL(aParser);
1171 // Retrieve video and audio descriptions before and after data is supplied to the parser.
1172 err = GetVideoAudioAttributes(aParser, EClipProperties);
1173 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoAudioAttributes(aParser, EClipProperties)")));
1175 ParserCompleteL(aParser);
1178 // Open the parser again
1180 ParserOpenL(aParser);
1182 // Retrieve video and audio decoder before and after data is supplied to the parser.
1183 err = GetVideoAudioAttributes(aParser, EDecoderInfo);
1184 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoAudioAttributes(aParser, EDecoderInfo)")));
1186 ParserCompleteL(aParser);
1189 // Open the parser again
1191 ParserOpenL(aParser);
1194 // Retrieve video frame properties and number of frames before and after data is supplied to the parser.
1196 err = GetVideoAudioAttributes(aParser, EVideoFrameProp);
1197 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoAudioAttributes(aParser, EVideoFrameProp)")));
1199 ParserCompleteL(aParser);
1203 TInt C3GPLibParser_0006::CallTest(C3GPParse* aParser, TBufferModeTest aTest, TInt aExpectedNumBuffered)
1205 TInt err = KErrNone;
1206 TInt numBufferedBytes;
1208 // Before insert any data. Retrieving video and audio attributes should fail
1211 case (ENumBufferedBytes):
1212 err = aParser->GetNumBufferedBytes(numBufferedBytes);
1213 if (err == KErrNone && numBufferedBytes != aExpectedNumBuffered)
1218 case (EClipProperties):
1222 err = GetClipProperties(aParser, videoError, videoLength, audioLength);
1223 if ((videoError != KErrNone && videoError != KErr3gpLibMoreDataRequired) ||
1224 (err != KErrNone && err != KErr3gpLibMoreDataRequired))
1229 case (EDecoderInfo):
1230 err = ParserGetDecoderInfo(aParser);
1232 case (EVideoFrameProp):
1233 if (aExpectedNumBuffered == 0)
1235 err = GetVideoFramePropAndNumVideoFrame(aParser, EFalse);
1239 err = GetVideoFramePropAndNumVideoFrame(aParser, ETrue);
1248 TInt C3GPLibParser_0006::GetVideoAudioAttributes(C3GPParse* aParser, TBufferModeTest aTest)
1250 TInt err = KErrNone;
1252 // Before insert any data. Retrieving video and audio attributes should fail
1253 err = CallTest(aParser, aTest, 0);
1254 if (aTest != ENumBufferedBytes)
1256 err = CheckError(err, KErr3gpLibMoreDataRequired, _L("CallTest(aParser, aTest, 0)"));
1260 err = CheckError(err, KErrNone, _L("CallTest()"));
1263 if (err != KErrNone)
1265 ERR_PRINTF2(_L("GetVideoAudioAttributes failed with %d; "), err);
1269 // Insert 1K data to buffer
1270 TInt bufferSize = 0;
1271 TInt pos = 0; // from begining of the file
1272 err = KErr3gpLibMoreDataRequired;
1273 // Insert data until enough data has been inserted
1274 while (err == KErr3gpLibMoreDataRequired)
1276 // Insert more data to buffer
1277 pos = bufferSize + pos;
1278 bufferSize = KBufferSize;
1280 err = buffer.Create(bufferSize);
1281 if (err == KErrNone)
1283 err = iSourceFile.Read(pos, buffer);
1284 if (err == KErrNone)
1286 err = aParser->InsertData(buffer);
1287 if ( err == KErrNone )
1289 err = CallTest(aParser, aTest, (bufferSize + pos));
1296 err = CheckError(err, KErrNone, _L("CallTest()"));
1300 TInt C3GPLibParser_0006::GetVideoFramePropAndNumVideoFrame(C3GPParse* aParse, TBool aExpectPass)
1302 TInt err = KErrNone;
1303 TUint numVideoFrames;
1304 err = aParse->GetNumberOfVideoFrames(numVideoFrames);
1307 if ( err == KErrNone )
1309 // Only when GetNumberOfVideoFrames returns KErrNone, the method GetVideoFrameProperties
1311 TUint startIndex = 0;
1312 RArray<T3GPFrameInfoParameters> array;
1313 err = aParse->GetVideoFrameProperties(startIndex, numVideoFrames, array);
1319 // When there is no data in the handler, GetNumberOfVideoFrames will fail with KErrGeneral,
1320 // not the KErr3gpLibMoreDataRequired
1321 if ( err == KErr3gpLibMoreDataRequired || err == KErrGeneral)
1323 if (!ShouldRunOOMTest())
1325 INFO_PRINTF2(_L("Expect parse->GetNumberOfVideoFrames() failed with %d"), err);
1327 err = KErr3gpLibMoreDataRequired;
1329 // expected failure, but get KErrNone.
1330 if (err == KErrNone)
1332 INFO_PRINTF1(_L("parse->GetNumberOfVideoFrames() should fail due to buffer too small"));
1340 // -----------------------------------------------------------------------------
1341 // Check if the clip is streamable in file mode from a mp4/3gp/3g2 file
1342 // -----------------------------------------------------------------------------
1344 C3GPLibParser_0007::C3GPLibParser_0007()
1348 TVerdict C3GPLibParser_0007::doTestStepL()
1350 if(TestStepResult() == EPass)
1352 C3GPParse* parser = C3GPParse::NewL();
1353 CleanupStack::PushL(parser);
1355 TRAPD(err, GetstreamableL(parser));
1356 if (err != KErrNone)
1358 SetTestStepResult(EFail);
1361 CleanupStack::PopAndDestroy(parser);
1363 return TestStepResult();
1366 void C3GPLibParser_0007::GetstreamableL(C3GPParse* aParser)
1368 // Open parser in File mode
1369 ParserOpenFileL(aParser);
1371 // Check if the file is streamable
1373 TInt err = aParser->GetStreamable(streamable);
1374 if (err != KErrNone)
1376 SetTestStepError(err);
1378 else if (!streamable)
1380 INFO_PRINTF2(_L("aParser->GetStreamable() returns %d"), streamable);
1381 SetTestStepError(KErrNotSupported);
1384 ParserCompleteL(aParser);
1387 // -----------------------------------------------------------------------------
1388 // Check if the clip is streamable in buffer mode from a mp4/3gp/3g2 file
1389 // -----------------------------------------------------------------------------
1391 C3GPLibParser_0008::C3GPLibParser_0008()
1395 TVerdict C3GPLibParser_0008::doTestStepL()
1397 if(TestStepResult() == EPass)
1399 C3GPParse* parser = C3GPParse::NewL();
1400 CleanupStack::PushL(parser);
1402 TRAPD(err, GetstreamableL(parser));
1403 if (err != KErrNone)
1405 SetTestStepResult(EFail);
1408 CleanupStack::PopAndDestroy(parser);
1410 return TestStepResult();
1413 void C3GPLibParser_0008::GetstreamableL(C3GPParse* aParser)
1417 ParserOpenL(aParser);
1419 // Check if the file is streamable before the data is inserted
1421 TInt err = aParser->GetStreamable(streamable);
1423 // Insert 1K data to buffer
1424 TInt bufferSize = 0;
1425 TInt pos = 0; // from begining of the file
1427 // Insert data until enough data has been inserted
1428 while (err == KErr3gpLibMoreDataRequired)
1430 // Insert more data to buffer
1431 pos = bufferSize + pos;
1432 bufferSize = KBufferSize;
1433 InsertDataL(aParser, iSourceFile, bufferSize, pos);
1435 err = aParser->GetStreamable(streamable);
1438 if (err != KErrNone)
1440 if (!ShouldRunOOMTest())
1442 ERR_PRINTF2(_L("aParser->GetStreamable() returns %d"), err);
1444 SetTestStepError(err);
1447 ParserCompleteL(aParser);
1451 // -----------------------------------------------------------------------------
1452 // Retrieve buffered bytes, and video & audio frames synchronously in file mode
1453 // -----------------------------------------------------------------------------
1455 C3GPLibParser_0011::C3GPLibParser_0011()
1459 TVerdict C3GPLibParser_0011::doTestStepL()
1461 if(TestStepResult() == EPass)
1463 C3GPParse* parser = C3GPParse::NewL();
1464 CleanupStack::PushL(parser);
1466 TRAPD(err, ReadFrameL(parser));
1467 if (err != KErrNone)
1469 SetTestStepResult(EFail);
1472 CleanupStack::PopAndDestroy(parser);
1474 return TestStepResult();
1477 void C3GPLibParser_0011::ReadFrameL(C3GPParse* aParse)
1479 // Parser open using File path
1480 ParserOpenFileL(aParse);
1481 User::LeaveIfError(DoReadFrame(aParse));
1482 ParserCompleteL(aParse);
1484 // Parser open using file handler
1485 ParserOpenFileHandleL(aParse);
1486 User::LeaveIfError(DoReadFrame(aParse));
1487 ParserCompleteHandleL(aParse);
1489 // Parser open using CAF
1490 ParserOpenCafLC(aParse);
1491 User::LeaveIfError(DoReadFrame(aParse));
1492 ParserCompleteCafL(aParse);
1495 // -----------------------------------------------------------------------------
1496 // Parse video & audio frames from a mp4/3gp file asynchronously in file mode
1497 // -----------------------------------------------------------------------------
1499 C3GPLibParser_0014::C3GPLibParser_0014()
1503 TVerdict C3GPLibParser_0014::doTestStepPreambleL()
1505 C3GPLib_AsyncObserver::doTestStepPreambleL();
1506 if (TestStepResult() == EPass)
1508 iScheduler = new (ELeave) CActiveScheduler;
1509 CActiveScheduler::Install(iScheduler);
1511 return TestStepResult();
1514 TVerdict C3GPLibParser_0014::doTestStepPostambleL()
1516 C3GPLib_AsyncObserver::doTestStepPostambleL();
1519 INFO_PRINTF1(_L("delete iScheduler"));
1520 CActiveScheduler::Install(NULL);
1525 return TestStepResult();
1528 TVerdict C3GPLibParser_0014::doTestStepL()
1530 if(TestStepResult() == EPass)
1532 C3GPParse* parser = C3GPParse::NewL();
1533 CleanupStack::PushL(parser);
1535 TRAPD(err, ReadFrameAsyncL(parser));
1536 if (err != KErrNone)
1538 SetTestStepResult(EFail);
1541 CleanupStack::PopAndDestroy(parser);
1543 return TestStepResult();
1546 void C3GPLibParser_0014::ReadFrameAsyncL(C3GPParse* aParser)
1548 ParserOpenFileL(aParser);
1549 User::LeaveIfError(DoReadFrameAsync(aParser));
1550 if (!ShouldRunOOMTest())
1552 INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL()"));
1554 ParserCompleteL(aParser);
1556 ParserOpenFileL(aParser);
1557 User::LeaveIfError(DoReadFrameAsync(aParser, ETrue));
1558 if (!ShouldRunOOMTest())
1560 INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL(), then cancel the read"));
1562 ParserCompleteL(aParser);
1564 ParserOpenFileHandleL(aParser);
1565 User::LeaveIfError(DoReadFrameAsync(aParser));
1566 if (!ShouldRunOOMTest())
1568 INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL() using file handler"));
1570 ParserCompleteHandleL(aParser);
1572 ParserOpenCafLC(aParser);
1573 User::LeaveIfError(DoReadFrameAsync(aParser));
1574 if (!ShouldRunOOMTest())
1576 INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL() using CAF"));
1578 ParserCompleteCafL(aParser);
1581 TInt C3GPLibParser_0014::DoReadFrameAsync(C3GPParse* aParser, TBool aCancel)
1583 TInt err = KErrNone;
1587 err = ReadAudioVideoFrameAsync(aParser, ETrue);
1588 if (err == KErrNone)
1590 err = ReadAudioVideoFrameAsync(aParser, EFalse);
1595 err = ReadAudioVideoFrameAsync(aParser, EFalse, ETrue);
1601 // -----------------------------------------------------------------------------
1602 // Parse video & audio frames from a mp4/3gp file synchronously
1603 // -----------------------------------------------------------------------------
1605 C3GPLibParser_0015::C3GPLibParser_0015()
1609 TVerdict C3GPLibParser_0015::doTestStepL()
1611 if(TestStepResult() == EPass)
1613 C3GPParse* parser = C3GPParse::NewL();
1614 CleanupStack::PushL(parser);
1616 TRAPD(err, ReadFrameL(parser));
1617 if (err != KErrNone)
1619 SetTestStepResult(EFail);
1622 CleanupStack::PopAndDestroy(parser);
1624 return TestStepResult();
1627 void C3GPLibParser_0015::ReadFrameL(C3GPParse* aParser)
1630 ReadFrameBufferModeL(aParser);
1634 // -----------------------------------------------------------------------------
1635 // Get frame type using file path
1636 // -----------------------------------------------------------------------------
1638 C3GPLibParser_0016::C3GPLibParser_0016()
1643 TVerdict C3GPLibParser_0016::doTestStepL()
1645 if(TestStepResult() == EPass)
1647 C3GPParse* parser = C3GPParse::NewL();
1648 CleanupStack::PushL(parser);
1650 TRAPD(err, GetFrameTypeL(parser));
1651 if (err != KErrNone)
1653 SetTestStepResult(EFail);
1656 CleanupStack::PopAndDestroy(parser);
1658 return TestStepResult();
1661 void C3GPLibParser_0016::GetFrameTypeL(C3GPParse* aParser)
1663 ParserOpenFileL(aParser);
1666 TInt err = aParser->GetFrameType(type);
1667 if (err == KErrNone)
1670 err = aParser->GetNumberOfVideoFrames(num);
1671 if (err == KErrNone)
1673 // There is number of video in the file. Calling GetFrameType num+1 time won't affect
1674 //the parser’s current position. It should return the same results
1675 for (TInt i = 0; i < num; i++)
1677 err = aParser->GetFrameType(type);
1678 User::LeaveIfError(err);
1680 err = aParser->GetFrameType(type);
1681 User::LeaveIfError(err);
1684 if (!ShouldRunOOMTest())
1686 INFO_PRINTF2(_L("GetFrameType return type %d. "), type);
1688 if (type == E3GPAudio)
1690 // read 1 audio frame
1691 err = ReadAudioVideoFrame(aParser, EFalse, ETrue);
1692 User::LeaveIfError(CheckError(err, KErrNone, _L("ReadAudioVideoFrame")));
1694 err = aParser->GetFrameType(type);
1695 if (!ShouldRunOOMTest())
1697 INFO_PRINTF3(_L("After read 1 audio frame, GetFrameType return err %d; type %d. "), err, type);
1699 SetTestStepError(err);
1701 if (err == KErrNone && type == E3GPVideo)
1703 // read 1 video frame
1704 err = ReadAudioVideoFrame(aParser, EFalse, EFalse);
1705 User::LeaveIfError(CheckError(err, KErrNone, _L("ReadAudioVideoFrame")));
1707 err = aParser->GetFrameType(type);
1708 SetTestStepError(err);
1713 SetTestStepError(err);
1715 ParserCompleteL(aParser);
1718 // -----------------------------------------------------------------------------
1719 // Get the QCELP storage mode in file path and buffer mode
1720 // -----------------------------------------------------------------------------
1722 C3GPLibParser_0017::C3GPLibParser_0017()
1726 TVerdict C3GPLibParser_0017::doTestStepL()
1728 if(TestStepResult() == EPass)
1730 C3GPParse* parser = C3GPParse::NewL();
1731 CleanupStack::PushL(parser);
1733 TRAPD(err, GetQcelModeL(parser));
1734 if (err != KErrNone)
1736 SetTestStepResult(EFail);
1739 CleanupStack::PopAndDestroy(parser);
1741 return TestStepResult();
1744 void C3GPLibParser_0017::GetQcelModeL(C3GPParse* aParser)
1747 ParserOpenFileL(aParser);
1748 TInt err = KErrNone;
1749 T3GPQcelpStorageMode mode;
1750 err = aParser->GetQcelpStorageMode(mode);
1751 if (err != KErrNone)
1753 if (!ShouldRunOOMTest())
1755 ERR_PRINTF3(_L("aParser->GetQcelpStorageMode(mode) file mode return %d; mode %d. "), err, mode);
1757 SetTestStepError(err);
1760 if ((iTestSection.Compare(KEsds) == 0 && mode != E3GPQcelpSampleEntryBox ) ||
1761 (iTestSection.Compare(KSqcp) == 0 && mode != E3GPMP4AudioDescriptionBox ))
1763 User::Leave(KErrGeneral);
1766 ParserCompleteL(aParser);
1769 ParserOpenL(aParser);
1772 // Insert 1K data into the library
1774 TInt bufferSize = 1000;
1776 InsertDataL(aParser, iSourceFile, bufferSize, pos);
1777 err = aParser->GetQcelpStorageMode(mode);
1779 while (err == KErr3gpLibMoreDataRequired )
1781 pos = pos + bufferSize;
1782 InsertDataL(aParser, iSourceFile, bufferSize, pos);
1783 err = aParser->GetQcelpStorageMode(mode);
1786 if (err != KErrNone)
1788 if (!ShouldRunOOMTest())
1790 ERR_PRINTF3(_L("aParser->GetQcelpStorageMode(mode) file mode return %d; mode %d. "), err, mode);
1792 SetTestStepError(err);
1795 if ((iTestSection.Compare(KEsds) == 0 && mode != E3GPQcelpSampleEntryBox ) ||
1796 (iTestSection.Compare(KSqcp) == 0 && mode != E3GPMP4AudioDescriptionBox ))
1798 User::Leave(KErrGeneral);
1801 ParserCompleteL(aParser);
1805 // -----------------------------------------------------------------------------
1806 // Get H263 video leve in file path and buffer mode.
1807 // -----------------------------------------------------------------------------
1809 C3GPLibParser_0021::C3GPLibParser_0021()
1813 TVerdict C3GPLibParser_0021::doTestStepL()
1815 if(TestStepResult() == EPass)
1817 C3GPParse* parser = C3GPParse::NewL();
1818 CleanupStack::PushL(parser);
1820 TRAPD(err, GetH263LevelL(parser));
1821 if (err != KErrNone)
1823 SetTestStepResult(EFail);
1826 CleanupStack::PopAndDestroy(parser);
1828 return TestStepResult();
1831 void C3GPLibParser_0021::GetH263LevelL(C3GPParse* aParser)
1834 ParserOpenFileL(aParser);
1835 TInt err = KErrNone;
1837 err = aParser->GetH263VideoLevel(level);
1838 if (err != KErrNone)
1840 if (!ShouldRunOOMTest())
1842 ERR_PRINTF3(_L("aParser->GetH263VideoLevel() file mode return %d; level %d. "), err, level);
1844 SetTestStepError(err);
1847 ParserCompleteL(aParser);
1850 ParserOpenL(aParser);
1853 // Insert 1K data into the library
1855 TInt bufferSize = KBufferSize;
1857 InsertDataL(aParser, iSourceFile, bufferSize, pos);
1858 err = aParser->GetH263VideoLevel(level);;
1860 while (err == KErr3gpLibMoreDataRequired )
1862 pos = pos + bufferSize;
1863 InsertDataL(aParser, iSourceFile, bufferSize, pos);
1864 err = aParser->GetH263VideoLevel(level);;
1867 if (err != KErrNone)
1869 if (!ShouldRunOOMTest())
1871 ERR_PRINTF3(_L("aParser->GetH263VideoLevel() file mode return %d; level %d. "), err, level);
1873 SetTestStepError(err);
1876 ParserCompleteL(aParser);
1880 // -----------------------------------------------------------------------------
1881 // Read Video and audio Decoder Info size and info in file path and buffer mode.
1882 // -----------------------------------------------------------------------------
1884 C3GPLibParser_0023::C3GPLibParser_0023()
1888 TVerdict C3GPLibParser_0023::doTestStepL()
1890 if(TestStepResult() == EPass)
1892 C3GPParse* parser = C3GPParse::NewL();
1893 CleanupStack::PushL(parser);
1895 TRAPD(err, GetDecoderInfoL(parser));
1896 if (err != KErrNone)
1898 SetTestStepResult(EFail);
1901 CleanupStack::PopAndDestroy(parser);
1903 return TestStepResult();
1906 void C3GPLibParser_0023::GetDecoderInfoL(C3GPParse* aParser)
1909 ParserOpenFileL(aParser);
1911 TInt errReadAudio = KErrNone;
1912 TInt errReadVideo = KErrNone;
1913 // Retrieve the info with buffer size = 0. Should fail with KErrOverflow
1915 CleanupClosePushL(dsiBuffer);
1916 dsiBuffer.CreateL(0);
1917 errReadAudio = aParser->GetAudioDecoderSpecificInfo(dsiBuffer);
1918 errReadVideo = aParser->GetVideoDecoderSpecificInfo(dsiBuffer);
1920 if (errReadAudio == KErrOverflow && errReadVideo == KErrOverflow)
1922 errReadAudio = ParserGetDecoderInfo(aParser);
1924 if (errReadAudio != KErrNone)
1926 ERR_PRINTF2(_L("ParserGetDecoderInfo file mode return %d; "), errReadAudio);
1927 User::Leave(errReadAudio);
1932 ERR_PRINTF2(_L("ParserGetDecoderInfo file mode expected KErrOverflow, but return %d; "), errReadAudio);
1933 User::Leave(errReadAudio);
1936 ParserCompleteL(aParser);
1939 ParserOpenL(aParser);
1942 // Insert 1K data into the library
1944 TInt bufferSize = KBufferSize;
1946 InsertDataL(aParser, iSourceFile, bufferSize, pos);
1948 // Retrieve the info with buffer size = 0. Should fail with KErrOverflow
1950 dsiBuffer.CreateL(0);
1951 errReadAudio = aParser->GetAudioDecoderSpecificInfo(dsiBuffer);
1952 errReadVideo = aParser->GetVideoDecoderSpecificInfo(dsiBuffer);
1953 CleanupStack::PopAndDestroy(&dsiBuffer);
1955 if (errReadAudio != KErrOverflow || errReadVideo != KErrOverflow)
1957 ERR_PRINTF2(_L("ParserGetDecoderInfo buffer mode expected KErrOverflow, but return %d; "), errReadAudio);
1958 User::Leave(errReadAudio);
1960 errReadAudio = ParserGetDecoderInfo(aParser);
1962 while (errReadAudio == KErr3gpLibMoreDataRequired )
1964 pos = pos + bufferSize;
1965 InsertDataL(aParser, iSourceFile, bufferSize, pos);
1966 errReadAudio = ParserGetDecoderInfo(aParser);
1968 if (!ShouldRunOOMTest())
1970 INFO_PRINTF2(_L("ParserGetDecoderInfo(aParser) buffer mode return %d. "), errReadAudio);
1972 ParserCompleteL(aParser);
1976 // -----------------------------------------------------------------------------
1977 // Seek different position of a video/audio file
1978 // -----------------------------------------------------------------------------
1980 C3GPLibParser_0027::C3GPLibParser_0027()
1984 TVerdict C3GPLibParser_0027::doTestStepL()
1986 if(TestStepResult() == EPass)
1988 C3GPParse* parser = C3GPParse::NewL();
1989 CleanupStack::PushL(parser);
1991 TRAPD(err, SeekTestL(parser));
1992 if (err != KErrNone)
1994 SetTestStepResult(EFail);
1997 CleanupStack::PopAndDestroy(parser);
1999 return TestStepResult();
2002 void C3GPLibParser_0027::SeekTestL(C3GPParse* aParse)
2005 ParserOpenFileL(aParse);
2009 TUint timeStampInMs = 0;
2011 // Seek to position 0.
2012 TInt err = KErrNone;
2013 if (iTestSection.Compare(KNoAudioNoVideo) != 0)
2015 // Retrieve video & audio stream length
2020 err = GetClipProperties(aParse, videoError, videoLength, audioLength);
2021 if (iTestSection.Compare(KAudioOnly) == 0)
2023 // audio only, GetVideoProperties should fail with KErrNotSupported. Set video length to 0
2024 User::LeaveIfError(CheckError(videoError, KErrNotSupported, _L("GetClipProperties(aParse, videoError, videoLength, audioLength))")));
2027 else if (iTestSection.Compare(KVideoOnly) == 0)
2029 // video only, GetAudioProperties should fail with KErrNotSupported. Set audio length to 0
2030 User::LeaveIfError(CheckError(err, KErrNotSupported, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
2035 // All other files contains audio and video data
2036 User::LeaveIfError(CheckError(videoError, KErrNone, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
2037 User::LeaveIfError(CheckError(err, KErrNone, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
2040 if (audioLength >= videoLength)
2042 timeStampInMs = audioLength;
2046 timeStampInMs = videoLength;
2049 if (iTestSection.Compare(KSameLenAudioVideo) == 0 || iTestSection.Compare(KAudioOnly) == 0)
2051 err = ParserSeek(aParse, timeStampInMs, audioPos, videoPos);
2052 User::LeaveIfError(err);
2055 if (iTestSection.Compare(KAudioMore) == 0 || iTestSection.Compare(KVideoMore) == 0 )
2057 timeStampInMs = (audioLength + videoLength)/2;
2058 err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
2059 User::LeaveIfError(err);
2063 ParserCompleteL(aParse);
2066 // Seek position 0, half the length and the length of the stream
2067 TInt C3GPLibParser_0027::ParserSeek(C3GPParse* aParser, TInt aLen, TUint& aAudioPos, TUint& aVideoPos)
2069 TInt err = KErrNone;
2071 while (err == KErrNone && position <= aLen)
2073 err = aParser->Seek(position, ETrue, aAudioPos, aVideoPos);
2074 if (err == KErrNone)
2076 err = aParser->Seek(position, EFalse, aAudioPos, aVideoPos);
2078 position = position + aLen/2;
2081 if (err != KErrNone)
2083 ERR_PRINTF3(_L("aParser->Seek() failed with %d when positon is %d"), err, position);
2088 // -----------------------------------------------------------------------------
2089 // Seek positions after any keyframe and immediately after a non-key frame.
2090 // -----------------------------------------------------------------------------
2092 C3GPLibParser_0031::C3GPLibParser_0031()
2096 TVerdict C3GPLibParser_0031::doTestStepL()
2098 if(TestStepResult() == EPass)
2100 C3GPParse* parser = C3GPParse::NewL();
2101 CleanupStack::PushL(parser);
2103 TRAPD(err, SeekTestL(parser));
2104 if (err != KErrNone)
2106 SetTestStepResult(EFail);
2109 CleanupStack::PopAndDestroy(parser);
2111 return TestStepResult();
2114 void C3GPLibParser_0031::SeekTestL(C3GPParse* aParser)
2117 ParserOpenFileL(aParser);
2118 DoSeekTestL(aParser);
2119 ParserCompleteL(aParser);
2122 // -----------------------------------------------------------------------------
2123 // Check frame availability using file path
2124 // -----------------------------------------------------------------------------
2126 C3GPLibParser_0032::C3GPLibParser_0032()
2130 TVerdict C3GPLibParser_0032::doTestStepL()
2132 if(TestStepResult() == EPass)
2134 C3GPParse* parser = C3GPParse::NewL();
2135 CleanupStack::PushL(parser);
2137 TRAPD(err, GetFrameAvailabilityL(parser));
2138 if (err != KErrNone)
2140 SetTestStepResult(EFail);
2143 CleanupStack::PopAndDestroy(parser);
2145 return TestStepResult();
2148 void C3GPLibParser_0032::GetFrameAvailabilityL(C3GPParse* aParser)
2151 ParserOpenFileL(aParser);
2152 DoGetFrameAvailabilityL(aParser);
2153 ParserCompleteL(aParser);
2156 void C3GPLibParser_0032::DoGetFrameAvailabilityL(C3GPParse* aParser)
2158 T3GPFrameType audioType = E3GPAudio;
2159 T3GPFrameType videoType = E3GPVideo;
2160 TBool audioAvailable;
2161 TBool videoAvailable;
2163 TInt audioErr = aParser->GetFrameAvailability(audioType, audioAvailable);
2164 if (audioErr != KErrNone && audioErr != KErrNotFound)
2166 SetTestStepError(audioErr);
2167 User::LeaveIfError(audioErr);
2170 TInt videoErr = aParser->GetFrameAvailability(videoType, videoAvailable);
2171 if (videoErr != KErrNone && videoErr != KErrNotFound)
2173 SetTestStepError(videoErr);
2174 User::LeaveIfError(videoErr);
2177 TInt err = aParser->GetNumberOfVideoFrames(num);
2178 if (err != KErrNone && err != KErrNotSupported)
2180 SetTestStepError(err);
2181 User::LeaveIfError(err);
2184 if (iTestSection.Compare(KNoAudioNoVideo) == 0)
2186 if (audioErr != KErrNotFound || videoErr != KErrNotFound
2187 || audioAvailable || videoAvailable)
2189 ERR_PRINTF2(_L("GetFrameAvailability() audio failed with %d, expected KErrNotFound"), audioErr);
2190 ERR_PRINTF2(_L("GetFrameAvailability() expected audioAvailable returns false, actual %d "), audioAvailable);
2191 ERR_PRINTF2(_L("GetFrameAvailability() video failed with %d, expected KErrNotFound;"), videoErr);
2192 ERR_PRINTF2(_L("GetFrameAvailability() expected videoAvailable returns false, actual %d "), videoAvailable);
2193 User::Leave(KErrGeneral);
2195 User::LeaveIfError(CheckError(err, KErrNotSupported, _L("aParser->GetNumberOfVideoFrames(num)")));
2197 else if (iTestSection.Compare(KAudioOnly) == 0)
2199 if (audioErr != KErrNone || videoErr != KErrNotFound
2200 || !audioAvailable || videoAvailable)
2202 ERR_PRINTF2(_L("aParser->GetFrameAvailability() audio failed with %d, expected KErrNone"), audioErr);
2203 ERR_PRINTF2(_L("aParser->GetFrameAvailability() expected audioAvailable returns True, actual %d "), audioAvailable);
2204 ERR_PRINTF2(_L("aParser->GetFrameAvailability() video failed with %d, expected KErrNotFound;"), videoErr);
2205 ERR_PRINTF2(_L("aParser->GetFrameAvailability() expected videoAvailable returns false, actual %d"), videoAvailable);
2206 User::Leave(KErrGeneral);
2208 User::LeaveIfError(CheckError(err, KErrNotSupported, _L("aParser->GetNumberOfVideoFrames(num)")));
2210 else if (iTestSection.Compare(KVideoOnly) == 0)
2212 if (audioErr != KErrNotFound || videoErr != KErrNone
2213 || audioAvailable || !videoAvailable)
2215 ERR_PRINTF2(_L("aParser->GetFrameAvailability() audio failed with %d, expected KErrNotFound"), audioErr);
2216 ERR_PRINTF2(_L("aParser->GetFrameAvailability() expected audioAvailable returns false, actual %d "), audioAvailable);
2217 ERR_PRINTF2(_L("aParser->GetFrameAvailability() video failed with %d, expected KErrNone;"), videoErr);
2218 ERR_PRINTF2(_L("aParser->GetFrameAvailability() expected videoAvailable returns true, actual %d"), videoAvailable);
2219 User::Leave(KErrGeneral);
2221 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->GetNumberOfVideoFrames(num)")));
2224 ERR_PRINTF2(_L("file h263-no-audio.MP4 has 265 video frames. Got %d instread"), num);
2225 User::Leave(KErrGeneral);
2228 else // File contains both valid audio and video data
2230 // If file contains avc profile main or extended, videoErr could be KErrNotFound
2231 if (audioErr != KErrNone || !audioAvailable)
2233 ERR_PRINTF2(_L("aParser->GetFrameAvailability() audio failed with %d, expected KErrNone"), audioErr);
2234 ERR_PRINTF2(_L("aParser->GetFrameAvailability() expected audioAvailable returns True, actual %d "), audioAvailable);
2235 ERR_PRINTF2(_L("aParser->GetFrameAvailability() video failed with %d, expected KErrNone;"), videoErr);
2236 ERR_PRINTF2(_L("aParser->GetFrameAvailability() expected videoAvailable returns True, actual %d"), videoAvailable);
2237 User::Leave(KErrGeneral);
2239 if (videoErr != KErrNone)
2241 SetTestStepError(videoErr);
2245 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->GetNumberOfVideoFrames(num)")));
2250 // -----------------------------------------------------------------------------
2251 // Retrieve video frame size & start time without parsing the content file frame
2252 // by frame in file mode
2253 // -----------------------------------------------------------------------------
2255 C3GPLibParser_0033::C3GPLibParser_0033()
2259 TVerdict C3GPLibParser_0033::doTestStepL()
2261 if(TestStepResult() == EPass)
2263 C3GPParse* parser = C3GPParse::NewL();
2264 CleanupStack::PushL(parser);
2266 TRAPD(err, VideoInfoL(parser));
2267 if (err != KErrNone)
2269 SetTestStepResult(EFail);
2272 CleanupStack::PopAndDestroy(parser);
2274 return TestStepResult();
2277 void C3GPLibParser_0033::VideoInfoL(C3GPParse* aParser)
2280 ParserOpenFileL(aParser);
2284 TUint timeStampInMs = 0;
2285 TUint timeStampInTimescale = 0;
2286 TUint timeStampInMs1 = 0;
2287 TUint timeStampInTimescale1 = 0;
2291 User::LeaveIfError(aParser->GetNumberOfVideoFrames(num));
2294 CleanupClosePushL(buffer);
2296 TInt err = aParser->ReadVideoFrame(buffer, keyFrame, timeStampInMs, timeStampInTimescale);
2297 if (err != KErrOverflow)
2299 ERR_PRINTF2(_L("aParser->ReadVideoFrame() expected KErrOverflow, actual %d"), err);
2302 User::LeaveIfError(aParser->GetVideoSampleEntryIndex(frameIndex));
2303 CleanupStack::PopAndDestroy(&buffer);
2307 while (err == KErrNone)
2310 timeStampInTimescale = 0;
2312 timeStampInTimescale1 = 0;
2316 User::LeaveIfError(aParser->GetVideoFrameSize(num1, frameSize));
2317 User::LeaveIfError(aParser->GetVideoFrameStartTime(num1, timeStampInMs, timeStampInTimescale));
2321 err = aParser->GetVideoFrameStartTime(num1, timeStampInMs, timeStampInTimescale);
2322 err = aParser->GetVideoFrameSize(num1, frameSize);
2325 CleanupClosePushL(buffer1);
2326 buffer1.CreateL(frameSize);
2327 err = aParser->ReadVideoFrame(buffer1, keyFrame, timeStampInMs1, timeStampInTimescale1);
2329 if (timeStampInMs != timeStampInMs1)
2331 ERR_PRINTF3(_L("Two timestamps should be the same. timeStampInMs %d, timeStampInMs1 %d"), timeStampInMs, timeStampInMs1);
2332 User::Leave(KErrGeneral);
2334 CleanupStack::PopAndDestroy(&buffer1);
2338 if (err != KErrNotFound)
2340 ERR_PRINTF2(_L("expected KErrNotFound when finishing reading video frames. Actual err %d"), err);
2341 User::Leave(KErrGeneral);
2344 if ((num1 - 1) != num)
2346 ERR_PRINTF3(_L("Two numOfFrame should be the same. num %d, num1 %d"), num, num1);
2347 User::Leave(KErrGeneral);
2350 // use an invalid index to attempt retrieving video frame size & start time. Both should failed with error.
2351 err = aParser->GetVideoFrameSize((num + 100), frameSize);
2352 User::LeaveIfError(CheckError(err, KErrGeneral, _L("GetVideoFrameSize")));
2354 err = aParser->GetVideoFrameStartTime((num + 5), timeStampInMs, timeStampInTimescale);
2355 User::LeaveIfError(CheckError(err, KErrGeneral, _L("GetVideoFrameStartTime")));
2357 ParserCompleteL(aParser);
2360 // -----------------------------------------------------------------------------
2361 // Retrieve video frame size & start time without parsing the content file frame
2362 // by frame in buffe mode
2363 // -----------------------------------------------------------------------------
2365 C3GPLibParser_0034::C3GPLibParser_0034()
2369 TVerdict C3GPLibParser_0034::doTestStepL()
2371 if(TestStepResult() == EPass)
2373 C3GPParse* parser = C3GPParse::NewL();
2374 CleanupStack::PushL(parser);
2376 TRAPD(err, VideoInfoBufferModeL(parser));
2377 if (err != KErrNone)
2379 SetTestStepResult(EFail);
2382 CleanupStack::PopAndDestroy(parser);
2384 return TestStepResult();
2387 void C3GPLibParser_0034::VideoInfoBufferModeL(C3GPParse* aParser)
2390 ParserOpenL(aParser);
2394 TUint timeStampInMs = 0;
2395 TUint timeStampInTimescale = 0;
2398 // Insert 1K data into the library
2400 TInt bufferSize = KBufferSize;
2401 InsertDataL(aParser, iSourceFile, bufferSize, pos);
2402 TInt err = aParser->GetNumberOfVideoFrames(num);
2403 if (err != KErrNone && err != KErrNotSupported && err != KErr3gpLibMoreDataRequired)
2405 SetTestStepError(err);
2406 User::LeaveIfError(err);
2409 while (err == KErr3gpLibMoreDataRequired )
2411 pos = pos + bufferSize;
2412 InsertDataL(aParser, iSourceFile, bufferSize, pos);
2413 err = aParser->GetNumberOfVideoFrames(num);
2416 if (err != KErrNone)
2418 SetTestStepError(err);
2422 for (TUint i = 0; i < num; i++)
2424 User::LeaveIfError(aParser->GetVideoFrameSize(i, frameSize));
2425 User::LeaveIfError(aParser->GetVideoFrameStartTime(i, timeStampInMs, timeStampInTimescale));
2429 ParserCompleteL(aParser);
2433 // -----------------------------------------------------------------------------
2434 // Retrieve user atoms in all the possible locations
2435 // -----------------------------------------------------------------------------
2437 C3GPLibParser_0035::C3GPLibParser_0035()
2441 TVerdict C3GPLibParser_0035::doTestStepL()
2443 if(TestStepResult() == EPass)
2445 C3GPParse* parser = C3GPParse::NewL();
2446 CleanupStack::PushL(parser);
2448 TRAPD(err, GetUserDataAtomL(parser));
2449 if (err != KErrNone)
2451 SetTestStepResult(EFail);
2454 CleanupStack::PopAndDestroy(parser);
2456 return TestStepResult();
2459 void C3GPLibParser_0035::GetUserDataAtomL(C3GPParse* aParse)
2462 ParserOpenFileL(aParse);
2464 TUint32 udtType = 0x6d657461; // The udt type of test files is 'meta'
2465 T3GPUdtaLocation location = E3GPUdtaAudioTrak;
2466 TUint indexMoov = 0;
2467 TUint indexAudio = 0;
2468 TUint indexVideo = 0;
2470 TInt err = CallUDTApi(aParse, udtType, indexAudio, location);
2471 if (err == KErrNone)
2473 location = E3GPUdtaMoov;
2474 err = CallUDTApi(aParse, udtType, indexMoov, location);
2476 if (err == KErrNone)
2478 // By default, the location is video track
2479 err = CallUDTApi(aParse, udtType, indexVideo);
2481 if (err == KErrNone)
2483 // Test file KMultiUdta contains 1 udta at E3GPUdtaMoov, 5 udta at E3GPUdtaAudioTrak and
2484 // 3 udta at E3GPUdtaVideoTrak
2485 if (iTestSection.Compare(KMultiUdta) == 0 && (indexMoov != 0 || indexAudio != 4 || indexVideo != 2))
2487 SetTestStepError(KErrNotFound);
2492 SetTestStepError(err);
2494 ParserCompleteL(aParse);
2497 // -----------------------------------------------------------------------------
2498 // Retrieve user atoms from a valid mp4/3gp file containing multiple entries of
2499 // the same user atom type within a user atom
2500 // -----------------------------------------------------------------------------
2502 C3GPLibParser_0036::C3GPLibParser_0036()
2506 TVerdict C3GPLibParser_0036::doTestStepL()
2508 if(TestStepResult() == EPass)
2510 C3GPParse* parser = C3GPParse::NewL();
2511 CleanupStack::PushL(parser);
2513 TRAPD(err, GetUserDataAtomL(parser));
2514 if (err != KErrNone)
2516 SetTestStepResult(EFail);
2519 CleanupStack::PopAndDestroy(parser);
2521 return TestStepResult();
2524 void C3GPLibParser_0036::GetUserDataAtomL(C3GPParse* aParse)
2527 ParserOpenFileL(aParse);
2530 TUint32 udtType = 0x6d657461; // The udt type of test files could be 'meta'
2531 T3GPUdtaLocation location = E3GPUdtaMoov; // The test files should not contain udta in audio trak
2533 // First read user data atom with empty buffer. It should return KErrOverflow
2535 CleanupClosePushL(buffer);
2537 TInt err = aParse->GetUserDataAtom(udtType, location, buffer, index);
2539 CleanupStack::PopAndDestroy(&buffer);
2541 if (err != KErrOverflow)
2543 ERR_PRINTF2(_L("GetUserDataAtom with empty buffer should return KErrOverflow, failed with err %d"), err);
2547 err = CallUDTApi(aParse, udtType, index); // By default, the location is videoTrack
2549 if (err == KErrNotFound || err == KErrNone)
2551 err = CallUDTApi(aParse, udtType, index, location);
2553 if (err == KErrNotFound || err == KErrNone)
2555 location = E3GPUdtaAudioTrak;
2556 err = CallUDTApi(aParse, udtType, index, location);
2560 SetTestStepError(err);
2562 ParserCompleteL(aParse);
2565 // -----------------------------------------------------------------------------
2566 // Retrieve video frame dependencies
2567 // -----------------------------------------------------------------------------
2569 C3GPLibParser_0037::C3GPLibParser_0037()
2573 TVerdict C3GPLibParser_0037::doTestStepL()
2575 if(TestStepResult() == EPass)
2577 C3GPParse* parser = C3GPParse::NewL();
2578 CleanupStack::PushL(parser);
2580 TRAPD(err, VideoDependencyL(parser));
2581 if (err != KErrNone)
2583 SetTestStepResult(EFail);
2586 CleanupStack::PopAndDestroy(parser);
2588 return TestStepResult();
2591 void C3GPLibParser_0037::VideoDependencyL(C3GPParse* aParser)
2594 ParserOpenFileL(aParser);
2597 User::LeaveIfError(aParser->GetNumberOfVideoFrames(num));
2599 TInt err = KErrNone;
2600 T3GPFrameDependencies dependencies;
2601 for (TInt i = 0; i < num; i++)
2603 err = aParser->GetVideoFrameDependencies(dependencies);
2604 if (err != KErrNone)
2606 ERR_PRINTF2(_L("GetVideoFrameDependencies failed with %d"), err);
2607 SetTestStepError(err);
2611 ParserCompleteL(aParser);
2614 // -----------------------------------------------------------------------------
2615 // Get Video Frame Properties
2616 // -----------------------------------------------------------------------------
2618 C3GPLibParser_0038::C3GPLibParser_0038()
2622 TVerdict C3GPLibParser_0038::doTestStepL()
2624 if(TestStepResult() == EPass)
2626 C3GPParse* parser = C3GPParse::NewL();
2627 CleanupStack::PushL(parser);
2629 TRAPD(err, VideoInfoL(parser));
2630 if (err != KErrNone)
2632 SetTestStepResult(EFail);
2635 CleanupStack::PopAndDestroy(parser);
2637 return TestStepResult();
2640 void C3GPLibParser_0038::VideoInfoL(C3GPParse* aParser)
2643 ParserOpenFileL(aParser);
2646 TUint timeStampInMs = 0;
2647 TUint timeStampInTimescale = 0;
2650 User::LeaveIfError(aParser->GetNumberOfVideoFrames(num));
2651 User::LeaveIfError(aParser->GetVideoSampleEntryIndex(frameIndex));
2653 TInt err = KErrNone;
2654 for (TInt i = 0; i < num; i++)
2656 err = aParser->GetVideoFrameKeyType(i, keyFrame);
2657 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoFrameKeyType()")));
2659 err = aParser->GetVideoFrameStartTime(i, timeStampInMs, timeStampInTimescale);
2660 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoFrameStartTime()")));
2663 TUint startIndex = 0;
2664 RArray<T3GPFrameInfoParameters> array;
2665 CleanupClosePushL(array);
2667 err = aParser->GetVideoFrameProperties(startIndex, num, array);
2668 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoFrameProperties")));
2669 if (!ShouldRunOOMTest())
2671 INFO_PRINTF1(_L("aParser->GetVideoFrameProperties passed."));
2674 RArray<T3GPFrameInfoParameters> array1;
2675 CleanupClosePushL(array1);
2677 // Filled in array with some data, say array with size 3
2679 T3GPFrameInfoParameters fip;
2680 for (TInt i = 0; i < arraySize; i++)
2683 fip.iStartTime = 1000;
2684 fip.iIsRandomAccessPoint = ETrue;
2685 array1.AppendL(fip);
2688 if (!ShouldRunOOMTest())
2690 INFO_PRINTF1(_L("Filled in array with some junk data and call aParser->GetVideoFrameProperties() ago."));
2693 err = aParser->GetVideoFrameProperties(startIndex, num, array1);
2694 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoFrameProperties")));
2696 // Check two arrays are the same
2697 if (array.Count() != array1.Count())
2699 ERR_PRINTF3(_L("array1.Count() is %d; expected array.Count() is %d."), array1.Count(), array.Count());
2700 User::Leave(KErrGeneral);
2702 for (TInt j = 0; j < array.Count(); j++)
2704 if (array1[j].iSize != array[j].iSize || array1[j].iStartTime != array1[j].iStartTime ||
2705 array1[j].iIsRandomAccessPoint != array1[j].iIsRandomAccessPoint)
2707 ERR_PRINTF1(_L("Two array are not the same."));
2708 User::Leave(KErrGeneral);
2712 if (!ShouldRunOOMTest())
2714 INFO_PRINTF1(_L("Two arrays are the same."));
2716 CleanupStack::PopAndDestroy(&array1);
2717 CleanupStack::PopAndDestroy(&array);
2719 ParserCompleteL(aParser);
2722 // -----------------------------------------------------------------------------
2723 // Read a audio and a video frame into a buffer of filled with junk content and
2724 // ensure the buffer gets properly reset when retrieve video / audio frame data.
2725 // -----------------------------------------------------------------------------
2727 C3GPLibParser_0039::C3GPLibParser_0039()
2731 TVerdict C3GPLibParser_0039::doTestStepL()
2733 if(TestStepResult() == EPass)
2735 C3GPParse* parser = C3GPParse::NewL();
2736 CleanupStack::PushL(parser);
2738 TRAPD(err, AudioAndVideoFrameL(parser));
2739 if (err != KErrNone)
2741 SetTestStepResult(EFail);
2744 CleanupStack::PopAndDestroy(parser);
2746 return TestStepResult();
2749 void C3GPLibParser_0039::AudioAndVideoFrameL(C3GPParse* aParser)
2752 ParserOpenFileL(aParser);
2755 TInt err = aParser->GetVideoFrameSize(size);
2756 User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoFrameSize")));
2759 CleanupClosePushL(buffer);
2760 buffer.CreateL(size + 15); // Create a buffer bigger than the size returned by GetVideoFrameSize
2761 // Filled in junk data into the buffer
2763 buffer.AppendFill(c, (size + 15));
2766 TUint timeStampInMs;
2767 TUint timeStampInTimescale;
2768 err = aParser->ReadVideoFrame(buffer, keyFrame, timeStampInMs, timeStampInTimescale);
2769 User::LeaveIfError(CheckError(err, KErrNone, _L("ReadVideoFrame")));
2770 // Check the buffer size is the same as size returned by GetVideoFrameSize
2771 if (buffer.Length() != size)
2773 ERR_PRINTF3(_L("buffer size is %d; expected size is %d."), buffer.Length(), size);
2774 User::Leave(KErrGeneral);
2776 CleanupStack::PopAndDestroy(&buffer);
2778 err = aParser->GetAudioFramesSize(size);
2779 User::LeaveIfError(CheckError(err, KErrNone, _L("GetAudioFramesSize")));
2782 CleanupClosePushL(bufferBig);
2783 bufferBig.CreateL(size + 10); // Create a buffer bigger than the size returned by GetVideoFrameSize
2784 // Filled in junk data into the buffer
2785 bufferBig.AppendFill(c, (size + 10));
2787 TInt returnedFrames;
2788 err = aParser->ReadAudioFrames(bufferBig, returnedFrames, timeStampInMs, timeStampInTimescale);
2789 User::LeaveIfError(CheckError(err, KErrNone, _L("ReadAudioFrames")));
2790 // Check the buffer size is the same as size returned by GetVideoFrameSize
2791 if (bufferBig.Length() != size)
2793 ERR_PRINTF3(_L("buffer size is %d; expected size is %d."), buffer.Length(), size);
2794 User::Leave(KErrGeneral);
2797 CleanupStack::PopAndDestroy(&bufferBig);
2799 ParserCompleteL(aParser);
2802 // -----------------------------------------------------------------------------
2803 // Multiple parser working simultaneously.
2804 // -----------------------------------------------------------------------------
2806 C3GPLibParser_0041::C3GPLibParser_0041()
2810 TVerdict C3GPLibParser_0041::doTestStepPreambleL()
2812 // Add the names of the new files to the following file list array.
2813 TInt numOfFiles = 2; // This is the array number. Should be the same as the number of the array.
2814 const TText* SelectedFiles[] =
2816 _S("mpeg4-aac.3gp"), // File with both audio and video
2817 _S("arm-nb-acelp-only.3gp") // File with audio only
2820 for (TInt index = 0; index < numOfFiles; index++)
2822 // Create a zero terminated version of the file name
2823 TFileName inputFile(K3GPLibTestFilePath);
2824 inputFile += TPtrC(SelectedFiles[index]);
2825 inputFile.ZeroTerminate();
2829 User::LeaveIfError(iInputFile1.Create(inputFile.Length() + 1));
2830 iInputFile1.Copy(inputFile);
2834 User::LeaveIfError(iInputFile2.Create(inputFile.Length() + 1));
2835 iInputFile2.Copy(inputFile);
2838 return TestStepResult();
2841 TVerdict C3GPLibParser_0041::doTestStepPostambleL()
2843 iInputFile1.Close();
2844 iInputFile2.Close();
2845 return TestStepResult();
2848 TVerdict C3GPLibParser_0041::doTestStepL()
2850 if(TestStepResult() == EPass)
2852 C3GPParse* parser1 = C3GPParse::NewL();
2853 CleanupStack::PushL(parser1);
2855 TInt err = parser1->Open(iInputFile1);
2856 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser1->Open")));
2858 C3GPParse* parser2 = C3GPParse::NewL();
2859 CleanupStack::PushL(parser2);
2861 err = parser2->Open(iInputFile1);
2862 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser2->Open")));
2864 C3GPParse* parser3 = C3GPParse::NewL();
2865 CleanupStack::PushL(parser3);
2867 err = parser3->Open(iInputFile2);
2868 User::LeaveIfError(CheckError(err, KErrNone, _L("aParser3->Open")));
2870 TRAP(err, MultipleParserL(parser1, parser2, parser3));
2871 if (err != KErrNone)
2873 SetTestStepResult(EFail);
2876 ParserCompleteL(parser1);
2877 ParserCompleteL(parser2);
2878 ParserCompleteL(parser3);
2880 CleanupStack::PopAndDestroy(parser3);
2881 CleanupStack::PopAndDestroy(parser2);
2882 CleanupStack::PopAndDestroy(parser1);
2884 return TestStepResult();
2887 void C3GPLibParser_0041::MultipleParserL(C3GPParse* aParser1, C3GPParse* aParser2, C3GPParse* aParser3)
2889 TInt err = ReadAudioVideoFrame(aParser1);
2890 User::LeaveIfError(CheckError(err, KErrNotFound, _L("ReadAudioVideoFrame(aParser1)")));
2892 // Read one video frame with parser2
2893 err = ReadAudioVideoFrame(aParser2, EFalse, EFalse);
2894 User::LeaveIfError(CheckError(err, KErrNone, _L("ReadAudioVideoFrame(aParser2)")));
2896 // Read video properties with parser3. Expected failed with KErrNotSupported
2897 T3GPVideoType videoType;
2904 err = aParser3->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
2905 User::LeaveIfError(CheckError(err, KErrNotSupported, _L("aParser3->GetVideoProperties")));
2908 // -----------------------------------------------------------------------------
2909 // Seek position in buffer mode
2910 // -----------------------------------------------------------------------------
2912 C3GPLibParser_0043::C3GPLibParser_0043()
2916 TVerdict C3GPLibParser_0043::doTestStepL()
2918 if(TestStepResult() == EPass)
2920 C3GPParse* parser = C3GPParse::NewL();
2921 CleanupStack::PushL(parser);
2923 TRAPD(err, SeekBufferModeL(parser));
2924 if (err != KErrNone)
2926 SetTestStepResult(EFail);
2929 CleanupStack::PopAndDestroy(parser);
2931 return TestStepResult();
2934 void C3GPLibParser_0043::SeekBufferModeL(C3GPParse* aParser)
2937 ParserOpenL(aParser);
2940 // Insert buffer data into the library
2942 TInt bufferSize = KBufferSize;
2943 InsertDataL(aParser, iSourceFile, bufferSize, pos);
2947 TUint timeStampInMs = 0;
2949 // Seek the position
2950 TInt err = aParser->Seek(timeStampInMs, EFalse, audioPos, videoPos);
2951 while (err == KErr3gpLibMoreDataRequired)
2953 pos = pos + bufferSize;
2954 InsertDataL(aParser, iSourceFile, bufferSize, pos);
2955 err = aParser->Seek(timeStampInMs, EFalse, audioPos, videoPos);
2958 if (err != KErrNone)
2960 SetTestStepError(err);
2962 ParserCompleteL(aParser);
2966 // -----------------------------------------------------------------------------
2967 // Test C3GPParse with large file (>2GB)
2968 // -----------------------------------------------------------------------------
2970 C3GPLibParser_0045::C3GPLibParser_0045()
2974 TVerdict C3GPLibParser_0045::doTestStepPreambleL()
2976 C3GPLib_AsyncObserver::doTestStepPreambleL();
2977 if (TestStepResult() == EPass)
2979 iScheduler = new (ELeave) CActiveScheduler;
2980 CActiveScheduler::Install(iScheduler);
2982 return TestStepResult();
2985 TVerdict C3GPLibParser_0045::doTestStepPostambleL()
2987 C3GPLib_AsyncObserver::doTestStepPostambleL();
2990 INFO_PRINTF1(_L("delete iScheduler"));
2991 CActiveScheduler::Install(NULL);
2996 return TestStepResult();
2999 TVerdict C3GPLibParser_0045::doTestStepL()
3001 if(TestStepResult() == EPass)
3003 C3GPParse* parser = C3GPParse::NewL();
3004 CleanupStack::PushL(parser);
3006 TRAPD(err, TestParserWithLargeFileL(parser));
3007 if (err != KErrNone)
3009 SetTestStepResult(EFail);
3012 CleanupStack::PopAndDestroy(parser);
3014 return TestStepResult();
3017 void C3GPLibParser_0045::TestParserWithLargeFileL(C3GPParse* aParser)
3019 INFO_PRINTF1(_L("Test Parser With Large File (>2GB)"));
3020 INFO_PRINTF1(_L("Open and complete parser with 64 bit file handle"));
3022 ParserOpenFileHandle64L(aParser);
3023 ParserCompleteHandle64L(aParser);
3025 ParserOpenFileHandle64L(aParser, EFileRead | EFileShareReadersOnly);
3026 ParserCompleteHandle64L(aParser);
3028 ParserOpenFileHandle64L(aParser, EFileShareReadersOrWriters | EFileWrite);
3029 ParserCompleteHandle64L(aParser);
3031 ParserOpenFileHandle64L(aParser, EFileShareReadersOrWriters | EFileRead);
3032 ParserCompleteHandle64L(aParser);
3034 ParserOpenFileHandle64L(aParser, EFileShareAny | EFileWrite);
3035 ParserCompleteHandle64L(aParser);
3037 ParserOpenFileHandle64L(aParser, EFileShareAny | EFileRead);
3038 ParserCompleteHandle64L(aParser);
3040 INFO_PRINTF1(_L("Test parser with 64 bit file handle"));
3042 // Read audio/video attributes
3043 ParserOpenFileHandle64L(aParser);
3044 DoGetVideoAudioAttributesL(aParser);
3045 ParserCompleteHandle64L(aParser);
3047 // Read audio/video frames
3048 ParserOpenFileHandle64L(aParser);
3049 User::LeaveIfError(DoReadFrame(aParser));
3050 ParserCompleteHandle64L(aParser);
3052 // Asynchronous Read of audio/video frames
3053 ParserOpenFileHandle64L(aParser);
3054 User::LeaveIfError(DoReadFrameAsync(aParser));
3055 if (!ShouldRunOOMTest())
3057 INFO_PRINTF1(_L("C3GPLibParser_0045::ReadFrameAsyncL() using 64 bit file handle"));
3059 ParserCompleteHandle64L(aParser);
3061 // Seek positions after any keyframe and immediately after a non-key frame
3062 ParserOpenFileHandle64L(aParser);
3063 DoSeekTestL(aParser);
3064 ParserCompleteHandle64L(aParser);
3066 INFO_PRINTF1(_L("Test parser in File path"));
3068 // Read audio/video attributes
3069 ParserOpenFileL(aParser);
3070 DoGetVideoAudioAttributesL(aParser);
3071 ParserCompleteL(aParser);
3073 // Read audio/video frames
3074 ParserOpenFileL(aParser);
3075 User::LeaveIfError(DoReadFrame(aParser));
3076 ParserCompleteL(aParser);
3078 // Asynchronous Read of audio/video frames
3079 ParserOpenFileL(aParser);
3080 User::LeaveIfError(DoReadFrameAsync(aParser));
3081 if (!ShouldRunOOMTest())
3083 INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL()"));
3085 ParserCompleteL(aParser);
3087 ParserOpenFileL(aParser);
3088 User::LeaveIfError(DoReadFrameAsync(aParser, ETrue));
3089 if (!ShouldRunOOMTest())
3091 INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL(), then cancel the read"));
3093 ParserCompleteL(aParser);
3095 INFO_PRINTF1(_L("Test parser in CAF"));
3097 // Read audio/video attributes
3098 ParserOpenCafLC(aParser);
3099 DoGetVideoAudioAttributesL(aParser);
3100 ParserCompleteCafL(aParser);
3102 // Read audio/video frames
3103 ParserOpenCafLC(aParser);
3104 User::LeaveIfError(DoReadFrame(aParser));
3105 ParserCompleteCafL(aParser);
3107 // Asynchronous Read of audio/video frames
3108 ParserOpenCafLC(aParser);
3109 User::LeaveIfError(DoReadFrameAsync(aParser));
3110 if (!ShouldRunOOMTest())
3112 INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL() using CAF"));
3114 ParserCompleteCafL(aParser);
3117 TInt C3GPLibParser_0045::DoReadFrameAsync(C3GPParse* aParser, TBool aCancel)
3119 TInt err = KErrNone;
3123 err = ReadAudioVideoFrameAsync(aParser, ETrue);
3124 if (err == KErrNone)
3126 err = ReadAudioVideoFrameAsync(aParser, EFalse);
3131 err = ReadAudioVideoFrameAsync(aParser, EFalse, ETrue);
3137 // -----------------------------------------------------------------------------
3138 // Parse video & audio frames from >2GB file synchronously in buffer mode
3139 // -----------------------------------------------------------------------------
3141 C3GPLibParser_0047::C3GPLibParser_0047()
3145 TVerdict C3GPLibParser_0047::doTestStepL()
3147 if(TestStepResult() == EPass)
3149 C3GPParse* parser = C3GPParse::NewL();
3150 CleanupStack::PushL(parser);
3152 TRAPD(err, ReadFrameL(parser));
3153 if (err != KErrNone)
3155 SetTestStepResult(EFail);
3158 CleanupStack::PopAndDestroy(parser);
3160 return TestStepResult();
3163 void C3GPLibParser_0047::ReadFrameL(C3GPParse* aParser)
3166 ReadFrameBufferModeL(aParser);
3170 // -----------------------------------------------------------------------------
3171 // Retrieve User Data Atoms with Multiple atoms
3172 // -----------------------------------------------------------------------------
3174 _LIT(KAtomFileNamePrefix, "AtomFile");
3176 C3GPUserDataAtomRetrieval::C3GPUserDataAtomRetrieval()
3180 TVerdict C3GPUserDataAtomRetrieval::doTestStepL()
3182 // ensure test step error & result reset before each test
3183 if (TestStepResult() != EPass)
3185 return TestStepResult();
3187 SetTestStepError(KErrNone);
3189 C3GPParse* parser = C3GPParse::NewL();
3190 CleanupStack::PushL(parser);
3194 User::LeaveIfError(parser->Open(iInputFile64));
3198 User::LeaveIfError(parser->Open(iInputFile));
3201 TBool keepLooking = ETrue;
3204 TUint atomIndex = 0;
3205 TUint atomHighestIndex1 = 0;
3206 TUint atomHighestIndex2 = 0;
3207 TInt err = KErrNone;
3211 CleanupClosePushL(fileContent);
3212 CleanupClosePushL(atomFile);
3213 CleanupClosePushL(atomContent);
3215 while(keepLooking && err == KErrNone)
3217 TInt atomIndexInput = atomIndex;
3218 err = parser->GetUserDataAtomSize(iAtomType, iAtomLocation, atomIndex, atomSize);
3219 if (err == KErrNone)
3221 atomHighestIndex1 = atomIndex;
3222 atomIndex = atomIndexInput;
3223 atomContent.CreateL(atomSize);
3225 err = parser->GetUserDataAtom(iAtomType, iAtomLocation, atomContent, atomIndex);
3226 if (err == KErrNone)
3230 // remember the highest atom index found during first run
3231 atomHighestIndex2 = atomIndex;
3232 if (atomHighestIndex1 != atomHighestIndex2)
3234 if (!ShouldRunOOMTest())
3236 ERR_PRINTF1(_L("Highest Atom Index returned is different when calling GetUserDataAtomSize vs GetUserDataAtom"));
3242 User::LeaveIfError(atomFile.Open(iFs, (*iAtomFileArray)[atomIndexInput], EFileRead | EFileStream));
3244 User::LeaveIfError(atomFile.Size(fileSize));
3245 if (atomContent.Size() != fileSize)
3247 if (!ShouldRunOOMTest())
3249 ERR_PRINTF4(_L("Atom %d retrieved is of different size as expected. Expected=%d Retrieved=%d"), atomIndexInput, fileSize, atomContent.Size());
3251 SetTestStepResult(EFail);
3252 keepLooking = EFalse;
3256 fileContent.CreateL(fileSize);
3257 User::LeaveIfError(atomFile.Read(fileContent));
3258 if (fileContent != atomContent)
3260 if (!ShouldRunOOMTest())
3262 ERR_PRINTF4(_L("Atom %d retrieved is of different content. Expected=%S Retrieved=%S"), atomIndexInput, &fileContent, &atomContent);
3264 SetTestStepResult(EFail);
3265 keepLooking = EFalse;
3269 if (atomIndex != atomHighestIndex2)
3271 // seems like there's an error occurred, as the highest index for this atom
3272 // type should stay the same throughout
3273 keepLooking = EFalse;
3274 if (!ShouldRunOOMTest())
3276 ERR_PRINTF3(_L("Previous highest atom index is %d but now it is %d. Data inconsistency."), atomHighestIndex2, atomIndex);
3278 SetTestStepResult(EFail);
3282 // look for the next atom of the same type now
3283 atomIndex = atomIndexInput + 1;
3286 fileContent.Close();
3292 if (!ShouldRunOOMTest())
3294 ERR_PRINTF4(_L("Fail to get user atom: index = %d, location = %d, type = %d"), atomIndex, iAtomLocation, iAtomType);
3299 atomContent.Close();
3302 if (TestStepResult() == EPass && atomFound != iExpectedNumAtom && atomFound == (atomHighestIndex2 + 1))
3304 if (!ShouldRunOOMTest())
3306 ERR_PRINTF3(_L("Number of atoms found (%d) does not match expected # of atoms (%d)."), atomFound, iExpectedNumAtom);
3308 SetTestStepResult(EFail);
3311 CleanupStack::PopAndDestroy(&atomContent);
3312 CleanupStack::PopAndDestroy(&atomFile);
3313 CleanupStack::PopAndDestroy(&fileContent);
3317 CleanupStack::PopAndDestroy(parser);
3318 return TestStepResult();
3321 TVerdict C3GPUserDataAtomRetrieval::doTestStepPreambleL()
3323 SetTestStepResult(ETestSuiteError);
3326 _LIT(KFileToParse, "FileToParseEmu");
3328 _LIT(KFileToParse, "FileToParseHw");
3331 TPtrC inputFilename;
3332 if (!GetStringFromConfig(ConfigSection(), KFileToParse, inputFilename))
3334 // file need to be specified
3335 ERR_PRINTF1(_L("Specify the file to be parsed."));
3336 return TestStepResult();
3339 if (!GetBoolFromConfig(ConfigSection(), _L("largeFile"), iLargeFile))
3341 ERR_PRINTF1(_L("Specify whether the file is larger than 2GB."));
3342 return TestStepResult();
3345 User::LeaveIfError(iFs.Connect());
3348 User::LeaveIfError(iInputFile64.Open(iFs, inputFilename, EFileRead | EFileStream | EFileShareReadersOnly));
3352 User::LeaveIfError(iInputFile.Open(iFs, inputFilename, EFileRead | EFileStream | EFileShareReadersOnly));
3355 if (!GetIntFromConfig(ConfigSection(), _L("ExpectedNumOfAtom"), iExpectedNumAtom))
3357 // Number of expected number of atoms needs to be specified
3358 ERR_PRINTF1(_L("Specify the number of atoms to be expected."));
3359 return TestStepResult();
3362 iAtomFileArray = new CDesCArrayFlat(4);
3364 if (!GetIntFromConfig(ConfigSection(), _L("AtomType"), temp))
3366 // atom type to retrieve needs to be specified
3367 ERR_PRINTF1(_L("Specify the atoms type to be retrieved."));
3368 return TestStepResult();
3372 iAtomType = (TUint32) temp;
3375 if (!GetIntFromConfig(ConfigSection(), _L("AtomLocation"), temp))
3377 // atom location to retrieve needs to be specified
3378 ERR_PRINTF1(_L("Specify the atoms location for the atoms to be retrieved."));
3379 return TestStepResult();
3383 iAtomLocation = (T3GPUdtaLocation) temp;
3386 if (iExpectedNumAtom > 0)
3390 for (TInt i = 1; i <= iExpectedNumAtom; i++)
3393 keyName.AppendFormat(_L("%S%d"), &KAtomFileNamePrefix, i);
3395 if (!GetStringFromConfig(ConfigSection(), keyName, fileName))
3397 // atom content file needs to be specified
3398 ERR_PRINTF1(_L("Specify the file name that contents the matching atom content."));
3399 return TestStepResult();
3402 iAtomFileArray->AppendL(fileName);
3406 SetTestStepResult(EPass);
3407 return TestStepResult();
3410 TVerdict C3GPUserDataAtomRetrieval::doTestStepPostambleL()
3414 iAtomFileArray->Reset();
3415 delete iAtomFileArray;
3420 iInputFile64.Close();
3428 return TestStepResult();