sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef TSU_3GPLIBRARY_COMPOSER_API_H sl@0: #define TSU_3GPLIBRARY_COMPOSER_API_H sl@0: sl@0: #include sl@0: #include sl@0: sl@0: class CActiveScheduler; sl@0: sl@0: // sl@0: // Base class for testing composer. Provides a framework for: sl@0: // sl@0: // 1. Setup sl@0: // 2. Add video/audio data sl@0: // 3. Add user data sl@0: // sl@0: class C3GPLibComposeBase : public CTestStep sl@0: { sl@0: public: sl@0: C3GPLibComposeBase(); sl@0: sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: TVerdict doTestStepL(); sl@0: sl@0: protected: sl@0: virtual C3GPCompose* doTestStepCreateComposerL(); sl@0: sl@0: virtual void doTestStepComposeOpenL(C3GPCompose& aComposer) = 0; sl@0: sl@0: // default to do nothing & return the current test result sl@0: virtual void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer); sl@0: virtual void doTestStepComposeSetUserDataL(C3GPCompose& aComposer); sl@0: sl@0: private: sl@0: CActiveScheduler* iScheduler; sl@0: }; sl@0: sl@0: // sl@0: // Setup a composer via filepath supplied by the configuration file sl@0: // sl@0: _LIT(K3GPComposeFilename, "3GPComposeFilename"); sl@0: class C3GPLibComposeFilename : public C3GPLibComposeBase sl@0: { sl@0: public: sl@0: C3GPLibComposeFilename(); sl@0: sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: sl@0: protected: sl@0: virtual void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: sl@0: protected: sl@0: RBuf iFilename; sl@0: }; sl@0: sl@0: // sl@0: // Class to test execution of composer APIs without any setup. sl@0: // sl@0: _LIT(K3GPComposeWithoutOpen, "3GPComposeWithoutOpen"); sl@0: class C3GPLibComposeWithoutOpen : public C3GPLibComposeBase sl@0: { sl@0: public: sl@0: C3GPLibComposeWithoutOpen(); sl@0: sl@0: private: sl@0: // virtual functions overriding base class implementations sl@0: void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer); sl@0: void doTestStepComposeSetUserDataL(C3GPCompose& aComposer); sl@0: }; sl@0: sl@0: // sl@0: // Class to test composer with video/audio properties supplied by sl@0: // the configuration file. sl@0: // sl@0: _LIT(K3GPComposeFile, "3GPComposeFile"); sl@0: class C3GPLibComposeFile : public C3GPLibComposeBase sl@0: { sl@0: public: sl@0: C3GPLibComposeFile(); sl@0: sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: sl@0: protected: sl@0: virtual void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: virtual void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer); sl@0: sl@0: T3GPVideoPropertiesBase* SetupVideoPropertiesL(); sl@0: virtual T3GPVideoPropertiesBase* SetupAvcVideoL(); sl@0: virtual T3GPVideoPropertiesBase* SetupH263VideoL(); sl@0: virtual T3GPVideoPropertiesBase* SetupMpeg4VideoL(); sl@0: sl@0: T3GPAudioPropertiesBase* SetupAudioPropertiesL(); sl@0: virtual T3GPAudioPropertiesBase* SetupQcelpAudioL(); sl@0: virtual T3GPAudioPropertiesBase* SetupAmrAudioL(); sl@0: virtual T3GPAudioPropertiesBase* SetupMpeg4AudioL(); sl@0: sl@0: protected: sl@0: T3GPFileFormatType iInputFileFormat; // requested file format sl@0: T3GPVideoType iVideoType; sl@0: T3GPAudioType iAudioType; sl@0: RFs iFs; sl@0: RFile iFile; sl@0: RBuf iFileName; sl@0: RFile64 iFile64; sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file conforms to the expected file format as supplied by sl@0: // the test configuration. sl@0: // sl@0: _LIT(K3GPComposeFileWithFileFormatCheck, "3GPComposeFileWithFileFormatCheck"); sl@0: class C3GPLibComposeFileWithFileFormatCheck : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeFileWithFileFormatCheck(); sl@0: sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepL(); sl@0: sl@0: private: sl@0: TVerdict VerifyFileFormatL(const RFile& aFile); sl@0: sl@0: private: sl@0: T3GPFileFormatType iOutputFileFormat; // expected file format sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file with video frames of all possible combinations of different sl@0: // dependencies sl@0: // sl@0: _LIT(K3GPComposeFrameDependency, "3GPComposeFrameDependency"); sl@0: class C3GPLibComposeFrameDependency : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeFrameDependency(); sl@0: sl@0: private: sl@0: void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer); sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file with video properties as specified in the test sl@0: // configuration sl@0: // sl@0: _LIT(K3GPComposeVideoProperties, "3GPComposeVideoProperties"); sl@0: class C3GPLibComposeVideoProperties : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeVideoProperties(); sl@0: sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: sl@0: private: sl@0: virtual T3GPVideoPropertiesBase* SetupAvcVideoL(); sl@0: virtual T3GPVideoPropertiesBase* SetupH263VideoL(); sl@0: virtual T3GPVideoPropertiesBase* SetupMpeg4VideoL(); sl@0: sl@0: private: sl@0: TSize iSize; sl@0: TUint iMaxBitRate; sl@0: TUint iAvgBitRate; sl@0: RBuf8 iDecoderSpecInfo; sl@0: TUint iTimescale; sl@0: TInt iVideoLevel; sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file with audio properties as specified in the test sl@0: // configuration sl@0: // sl@0: _LIT(K3GPComposeAudioProperties, "3GPComposeAudioProperties"); sl@0: class C3GPLibComposeAudioProperties : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeAudioProperties(); sl@0: sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: sl@0: private: sl@0: T3GPAudioPropertiesBase* SetupQcelpAudioL(); sl@0: T3GPAudioPropertiesBase* SetupAmrAudioL(); sl@0: T3GPAudioPropertiesBase* SetupMpeg4AudioL(); sl@0: sl@0: private: sl@0: TInt iFps; sl@0: RBuf8 iDecoderSpecInfo; sl@0: TInt iTimescale; sl@0: T3GPQcelpStorageMode iQCelpMode; sl@0: TInt iModeSet; sl@0: }; sl@0: sl@0: // sl@0: // Class to create composer using buffer sizes and counts specified by test sl@0: // configuration sl@0: // sl@0: _LIT(K3GPComposeWithSpecificBufferSize, "3GPComposeWithSpecificBufferSize"); sl@0: class C3GPLibComposeWithSpecificBufferSize : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeWithSpecificBufferSize(); sl@0: sl@0: TVerdict doTestStepPreambleL(); sl@0: sl@0: private: sl@0: C3GPCompose* doTestStepCreateComposerL(); sl@0: sl@0: private: sl@0: TInt iBufferSize; sl@0: TInt iBufferMaxCount; sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file with user data as specified by the test sl@0: // configuration sl@0: // sl@0: _LIT(K3GPComposeUserData, "3GPComposeUserData"); sl@0: class C3GPLibComposeUserData : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeUserData(); sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: sl@0: private: sl@0: void doTestStepComposeSetUserDataL(C3GPCompose& aComposer); sl@0: sl@0: private: sl@0: RBuf8 iUserData; sl@0: TBool iUdtaMoov; sl@0: TBool iUdtaVideo; sl@0: TBool iUdtaAudio; sl@0: TInt iUdtaLocation; sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file using different composer flags as specified in the test sl@0: // configuration sl@0: // sl@0: _LIT(K3GPComposeWithFlag, "3GPComposeWithFlag"); sl@0: class C3GPLibComposeWithFlag : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeWithFlag(); sl@0: TVerdict doTestStepPreambleL(); sl@0: sl@0: protected: sl@0: virtual void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: sl@0: protected: sl@0: TInt iComposeFlag; sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file specifying no video nor audio. sl@0: // sl@0: _LIT(K3GPComposeWithNoAudioVideo, "3GPComposeWithNoAudioVideo"); sl@0: class C3GPLibComposeWithNoAudioVideo : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeWithNoAudioVideo(); sl@0: TVerdict doTestStepPreambleL(); sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file with audio frames of properties specified by test sl@0: // configuration sl@0: // sl@0: _LIT(K3GPComposeAudioFrames, "3GPComposeAudioFrames"); sl@0: class C3GPLibComposeAudioFrames : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeAudioFrames(); sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: sl@0: private: sl@0: void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer); sl@0: sl@0: private: sl@0: TInt iDuration; sl@0: RBuf8 iAudioFrames; sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file with video frames of properties specified by test sl@0: // configuration sl@0: // sl@0: _LIT(K3GPComposeVideoFrame, "3GPComposeVideoFrame"); sl@0: class C3GPLibComposeVideoFrame : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeVideoFrame(); sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: sl@0: private: sl@0: void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer); sl@0: sl@0: private: sl@0: TBool iKeyFrame; sl@0: TInt iDuration; sl@0: RBuf8 iVideoFrame; sl@0: T3GPFrameDependencies* iDependencies; sl@0: }; sl@0: sl@0: sl@0: // sl@0: // Class to open the composer again before closing it sl@0: // sl@0: _LIT(K3GPComposeOpenAgain, "3GPComposeOpenAgain"); sl@0: class C3GPLibComposeOpenAgain: public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeOpenAgain(); sl@0: sl@0: private: sl@0: void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: }; sl@0: sl@0: // sl@0: // Class to setup composer with a Read-Only file via file handle sl@0: // sl@0: _LIT(K3GPComposeOpenReadOnlyFile, "3GPComposeOpenReadOnlyFile"); sl@0: class C3GPLibComposeOpenReadOnlyFile: public C3GPLibComposeWithFlag sl@0: { sl@0: public: sl@0: C3GPLibComposeOpenReadOnlyFile(); sl@0: TVerdict doTestStepL(); sl@0: sl@0: private: sl@0: void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: }; sl@0: sl@0: // sl@0: // Class to setup composer using file path of an opened file using sl@0: // ShareAny and then ShareReadersOrWriters mode. sl@0: // sl@0: _LIT(K3GPComposeOpenedFile, "3GPComposeOpenedFile"); sl@0: class C3GPLibComposeOpenedFile: public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeOpenedFile(); sl@0: sl@0: private: sl@0: void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: }; sl@0: sl@0: // sl@0: // Class to use 2 composer opening the same file sl@0: // sl@0: _LIT(K3GPComposeMultiComposeOnSameFile, "3GPComposeMultiComposeOnSameFile"); sl@0: class C3GPLibComposeMultiComposeOnSameFile : public C3GPLibComposeFilename sl@0: { sl@0: public: sl@0: C3GPLibComposeMultiComposeOnSameFile(); sl@0: sl@0: private: sl@0: void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: }; sl@0: sl@0: // sl@0: // Class to have multiple composers / parser working at the same time sl@0: // sl@0: _LIT(K3GPComposeMultiComposers, "3GPComposeMultiComposers"); sl@0: class C3GPLibComposeMultiComposers : public C3GPLibComposeFilename sl@0: { sl@0: public: sl@0: C3GPLibComposeMultiComposers(); sl@0: sl@0: private: sl@0: void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file without calling complete first sl@0: // sl@0: _LIT(K3GPComposeCloseComposerWithoutComplete, "3GPComposeCloseComposerWithoutComplete"); sl@0: class C3GPLibComposeCloseComposerWithoutComplete : public C3GPLibComposeFilename sl@0: { sl@0: public: sl@0: C3GPLibComposeCloseComposerWithoutComplete(); sl@0: sl@0: private: sl@0: void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: }; sl@0: sl@0: // sl@0: // Class to test cleanup of temporary files when composer panics sl@0: // sl@0: _LIT(K3GPComposePanic, "3GPComposePanic"); sl@0: class C3GPLibComposePanic : public C3GPLibComposeFilename sl@0: { sl@0: public: sl@0: C3GPLibComposePanic(); sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: sl@0: private: sl@0: void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: sl@0: private: sl@0: TBool iPanic; sl@0: RBuf iDir; sl@0: }; sl@0: sl@0: // sl@0: // Class to compose a large file >2GB sl@0: // sl@0: _LIT(K3GPComposeLargeFile, "3GPComposeLargeFile"); sl@0: class C3GPLibComposeLargeFile : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeLargeFile(); sl@0: sl@0: TVerdict doTestStepPreambleL(); sl@0: TVerdict doTestStepPostambleL(); sl@0: sl@0: private: sl@0: C3GPCompose* doTestStepCreateComposerL(); sl@0: sl@0: void doTestStepComposeOpenL(C3GPCompose& aComposer); sl@0: void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer); sl@0: sl@0: private: sl@0: TInt iComposeFlag; sl@0: }; sl@0: sl@0: // sl@0: // Class to compose a large file >2GB with user data sl@0: // sl@0: _LIT(K3GPComposeLargeFileUserData, "3GPComposeLargeFileUserData"); sl@0: class C3GPLibComposeLargeFileUserData : public C3GPLibComposeLargeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeLargeFileUserData(); sl@0: sl@0: private: sl@0: void doTestStepComposeSetUserDataL(C3GPCompose& aComposer); sl@0: void WriteInt32(TUint8* aPtr, TInt32 aData); sl@0: sl@0: private: sl@0: }; sl@0: sl@0: // sl@0: // Class to compose a large file >2GB using 32bit APIs sl@0: // sl@0: _LIT(K3GPComposeLargeFile32bitAPI, "3GPComposeLargeFile32bitAPI"); sl@0: class C3GPLibComposeLargeFile32bitAPI : public C3GPLibComposeWithFlag sl@0: { sl@0: public: sl@0: C3GPLibComposeLargeFile32bitAPI(); sl@0: sl@0: private: sl@0: C3GPCompose* doTestStepCreateComposerL(); sl@0: void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer); sl@0: sl@0: private: sl@0: }; sl@0: sl@0: // sl@0: // Class to compose a large file on an mmc card until the disk is full sl@0: // sl@0: _LIT(K3GPComposeLargeFileDiskFull, "3GPComposeLargeFileDiskFull"); sl@0: class C3GPLibComposeLargeFileDiskFull : public C3GPLibComposeLargeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeLargeFileDiskFull(); sl@0: sl@0: private: sl@0: void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer); sl@0: sl@0: private: sl@0: }; sl@0: sl@0: // sl@0: // Class to compose file with AVC video that conforms to the expected AVC profile. sl@0: // sl@0: _LIT(K3GPComposeFileWithAvcProfileCheck, "3GPComposeFileWithAvcProfileCheck"); sl@0: class C3GPLibComposeFileWithAvcProfileCheck : public C3GPLibComposeFile sl@0: { sl@0: public: sl@0: C3GPLibComposeFileWithAvcProfileCheck(); sl@0: virtual T3GPVideoPropertiesBase* SetupAvcVideoL(); sl@0: TVerdict doTestStepL(); sl@0: sl@0: private: sl@0: TVerdict VerifyAvcProfileL(const RFile& aFile); sl@0: sl@0: private: sl@0: TBuf8<7> iAvcDecoderConfigRecord; sl@0: }; sl@0: sl@0: sl@0: #endif // TSU_3GPLIBRARY_COMPOSER_API_H sl@0: