mmplugins/lib3gpunittest/inc/tsu_3gplibrary_composer_api.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef TSU_3GPLIBRARY_COMPOSER_API_H
       
    17 #define TSU_3GPLIBRARY_COMPOSER_API_H
       
    18 
       
    19 #include <test/testexecutestepbase.h>
       
    20 #include <c3gplibrary.h>
       
    21 
       
    22 class CActiveScheduler;
       
    23 
       
    24 //
       
    25 // Base class for testing composer.  Provides a framework for:
       
    26 //
       
    27 // 1. Setup
       
    28 // 2. Add video/audio data
       
    29 // 3. Add user data
       
    30 //
       
    31 class C3GPLibComposeBase : public CTestStep
       
    32 	{
       
    33 	public:
       
    34 		C3GPLibComposeBase();
       
    35 		
       
    36 		TVerdict doTestStepPreambleL();
       
    37 		TVerdict doTestStepPostambleL();
       
    38 		TVerdict doTestStepL();
       
    39 		
       
    40 	protected:		
       
    41 		virtual C3GPCompose* doTestStepCreateComposerL();
       
    42 
       
    43 		virtual void doTestStepComposeOpenL(C3GPCompose& aComposer) = 0;
       
    44 		
       
    45 		// default to do nothing & return the current test result
       
    46 		virtual void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer);		
       
    47 		virtual void doTestStepComposeSetUserDataL(C3GPCompose& aComposer);		
       
    48 
       
    49 	private:
       
    50 		CActiveScheduler* iScheduler;
       
    51 	};
       
    52 
       
    53 //
       
    54 // Setup a composer via filepath supplied by the configuration file
       
    55 // 
       
    56 _LIT(K3GPComposeFilename, "3GPComposeFilename");
       
    57 class C3GPLibComposeFilename : public C3GPLibComposeBase
       
    58 	{
       
    59 	public:
       
    60 		C3GPLibComposeFilename();
       
    61 		
       
    62 		TVerdict doTestStepPreambleL();
       
    63 		TVerdict doTestStepPostambleL();	
       
    64 
       
    65 	protected:
       
    66 		virtual void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
    67 
       
    68 	protected:
       
    69 		RBuf iFilename;
       
    70 	};
       
    71 
       
    72 //
       
    73 // Class to test execution of composer APIs without any setup.
       
    74 //
       
    75 _LIT(K3GPComposeWithoutOpen, "3GPComposeWithoutOpen");
       
    76 class C3GPLibComposeWithoutOpen : public C3GPLibComposeBase
       
    77 	{
       
    78 	public:
       
    79 		C3GPLibComposeWithoutOpen();
       
    80 		
       
    81 	private:
       
    82 		// virtual functions overriding base class implementations
       
    83 		void doTestStepComposeOpenL(C3GPCompose& aComposer);		
       
    84 		void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer);		
       
    85 		void doTestStepComposeSetUserDataL(C3GPCompose& aComposer);				
       
    86 	};
       
    87 
       
    88 //
       
    89 // Class to test composer with video/audio properties supplied by 
       
    90 // the configuration file.
       
    91 //
       
    92 _LIT(K3GPComposeFile, "3GPComposeFile");
       
    93 class C3GPLibComposeFile : public C3GPLibComposeBase
       
    94 	{
       
    95 	public:
       
    96 		C3GPLibComposeFile();
       
    97 		
       
    98 		TVerdict doTestStepPreambleL();
       
    99 		TVerdict doTestStepPostambleL();	
       
   100 
       
   101 	protected:
       
   102 		virtual void doTestStepComposeOpenL(C3GPCompose& aComposer);		
       
   103 		virtual void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer);
       
   104 		
       
   105 		T3GPVideoPropertiesBase* SetupVideoPropertiesL();
       
   106 		virtual T3GPVideoPropertiesBase* SetupAvcVideoL();
       
   107 		virtual T3GPVideoPropertiesBase* SetupH263VideoL();
       
   108 		virtual T3GPVideoPropertiesBase* SetupMpeg4VideoL();
       
   109 		
       
   110 		T3GPAudioPropertiesBase* SetupAudioPropertiesL();
       
   111 		virtual T3GPAudioPropertiesBase* SetupQcelpAudioL();
       
   112 		virtual T3GPAudioPropertiesBase* SetupAmrAudioL();
       
   113 		virtual T3GPAudioPropertiesBase* SetupMpeg4AudioL();		
       
   114 		
       
   115 	protected:
       
   116 		T3GPFileFormatType iInputFileFormat;	// requested file format
       
   117 		T3GPVideoType iVideoType;
       
   118 		T3GPAudioType iAudioType;
       
   119 		RFs iFs;
       
   120 		RFile iFile;
       
   121 		RBuf iFileName;
       
   122 		RFile64 iFile64;		
       
   123 	};
       
   124 
       
   125 //
       
   126 // Class to compose file conforms to the expected file format as supplied by 
       
   127 // the test configuration.
       
   128 //
       
   129 _LIT(K3GPComposeFileWithFileFormatCheck, "3GPComposeFileWithFileFormatCheck");
       
   130 class C3GPLibComposeFileWithFileFormatCheck : public C3GPLibComposeFile
       
   131 	{
       
   132 	public:
       
   133 		C3GPLibComposeFileWithFileFormatCheck();
       
   134 		
       
   135 		TVerdict doTestStepPreambleL();		
       
   136 		TVerdict doTestStepL();	
       
   137 
       
   138 	private:
       
   139 		TVerdict VerifyFileFormatL(const RFile& aFile);
       
   140 
       
   141 	private:
       
   142 		T3GPFileFormatType iOutputFileFormat;	// expected file format		
       
   143 	};
       
   144 
       
   145 //
       
   146 // Class to compose file with video frames of all possible combinations of different 
       
   147 // dependencies 
       
   148 //
       
   149 _LIT(K3GPComposeFrameDependency, "3GPComposeFrameDependency");
       
   150 class C3GPLibComposeFrameDependency : public C3GPLibComposeFile
       
   151 	{
       
   152 	public:
       
   153 		C3GPLibComposeFrameDependency();
       
   154 		
       
   155 	private:
       
   156 		void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer);
       
   157 	};
       
   158 
       
   159 //
       
   160 // Class to compose file with video properties as specified in the test
       
   161 // configuration
       
   162 //
       
   163 _LIT(K3GPComposeVideoProperties, "3GPComposeVideoProperties");
       
   164 class C3GPLibComposeVideoProperties : public C3GPLibComposeFile
       
   165 	{
       
   166 	public:
       
   167 		C3GPLibComposeVideoProperties();		
       
   168 		
       
   169 		TVerdict doTestStepPreambleL();
       
   170 		TVerdict doTestStepPostambleL();	
       
   171 		
       
   172 	private:
       
   173 		virtual T3GPVideoPropertiesBase* SetupAvcVideoL();
       
   174 		virtual T3GPVideoPropertiesBase* SetupH263VideoL();
       
   175 		virtual T3GPVideoPropertiesBase* SetupMpeg4VideoL();
       
   176 		
       
   177 	private:
       
   178 		TSize iSize;
       
   179 		TUint iMaxBitRate;
       
   180 		TUint iAvgBitRate;
       
   181 		RBuf8 iDecoderSpecInfo;
       
   182 		TUint iTimescale;
       
   183 		TInt iVideoLevel;
       
   184 	};
       
   185 
       
   186 //
       
   187 // Class to compose file with audio properties as specified in the test
       
   188 // configuration
       
   189 //
       
   190 _LIT(K3GPComposeAudioProperties, "3GPComposeAudioProperties");
       
   191 class C3GPLibComposeAudioProperties : public C3GPLibComposeFile
       
   192 	{
       
   193 	public:
       
   194 		C3GPLibComposeAudioProperties();		
       
   195 		
       
   196 		TVerdict doTestStepPreambleL();
       
   197 		TVerdict doTestStepPostambleL();	
       
   198 		
       
   199 	private:
       
   200 		T3GPAudioPropertiesBase* SetupQcelpAudioL();
       
   201 		T3GPAudioPropertiesBase* SetupAmrAudioL();
       
   202 		T3GPAudioPropertiesBase* SetupMpeg4AudioL();		
       
   203 		
       
   204 	private:
       
   205 		TInt iFps;
       
   206 		RBuf8 iDecoderSpecInfo;
       
   207 		TInt iTimescale;
       
   208 		T3GPQcelpStorageMode iQCelpMode;
       
   209 		TInt iModeSet;		
       
   210 	};
       
   211 
       
   212 //
       
   213 // Class to create composer using buffer sizes and counts specified by test
       
   214 // configuration
       
   215 //
       
   216 _LIT(K3GPComposeWithSpecificBufferSize, "3GPComposeWithSpecificBufferSize");
       
   217 class C3GPLibComposeWithSpecificBufferSize : public C3GPLibComposeFile
       
   218 	{
       
   219 	public:
       
   220 		C3GPLibComposeWithSpecificBufferSize();		
       
   221 		
       
   222 		TVerdict doTestStepPreambleL();		
       
   223 		
       
   224 	private:
       
   225 		C3GPCompose* doTestStepCreateComposerL();
       
   226 		
       
   227 	private:
       
   228 		TInt iBufferSize;
       
   229 		TInt iBufferMaxCount;
       
   230 	};
       
   231 
       
   232 //
       
   233 // Class to compose file with user data as specified by the test 
       
   234 // configuration
       
   235 //
       
   236 _LIT(K3GPComposeUserData, "3GPComposeUserData");
       
   237 class C3GPLibComposeUserData : public C3GPLibComposeFile
       
   238 	{
       
   239 	public:
       
   240 		C3GPLibComposeUserData();	
       
   241 		TVerdict doTestStepPreambleL();
       
   242 		TVerdict doTestStepPostambleL();
       
   243 		
       
   244 	private:	
       
   245 		void doTestStepComposeSetUserDataL(C3GPCompose& aComposer);
       
   246 		
       
   247 	private:
       
   248 		RBuf8 iUserData;		
       
   249 		TBool iUdtaMoov;
       
   250 		TBool iUdtaVideo;
       
   251 		TBool iUdtaAudio;	
       
   252 		TInt  iUdtaLocation;
       
   253 	};
       
   254 
       
   255 //
       
   256 // Class to compose file using different composer flags as specified in the test 
       
   257 // configuration
       
   258 //
       
   259 _LIT(K3GPComposeWithFlag, "3GPComposeWithFlag");
       
   260 class C3GPLibComposeWithFlag : public C3GPLibComposeFile
       
   261 	{
       
   262 	public:
       
   263 		C3GPLibComposeWithFlag();
       
   264 		TVerdict doTestStepPreambleL();
       
   265 		
       
   266 	protected:	
       
   267 		virtual void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
   268 		
       
   269 	protected:
       
   270 		TInt iComposeFlag;
       
   271 	};
       
   272 
       
   273 //
       
   274 // Class to compose file specifying no video nor audio.
       
   275 //
       
   276 _LIT(K3GPComposeWithNoAudioVideo, "3GPComposeWithNoAudioVideo");
       
   277 class C3GPLibComposeWithNoAudioVideo : public C3GPLibComposeFile
       
   278 	{
       
   279 	public:
       
   280 		C3GPLibComposeWithNoAudioVideo();
       
   281 		TVerdict doTestStepPreambleL();		
       
   282 	};
       
   283 
       
   284 //
       
   285 // Class to compose file with audio frames of properties specified by test
       
   286 // configuration
       
   287 //
       
   288 _LIT(K3GPComposeAudioFrames, "3GPComposeAudioFrames");
       
   289 class C3GPLibComposeAudioFrames : public C3GPLibComposeFile
       
   290 	{
       
   291 	public:
       
   292 		C3GPLibComposeAudioFrames();
       
   293 		TVerdict doTestStepPreambleL();
       
   294 		TVerdict doTestStepPostambleL();	
       
   295 		
       
   296 	private:
       
   297 		void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer);		
       
   298 	
       
   299 	private:
       
   300 		TInt iDuration;
       
   301 		RBuf8 iAudioFrames;
       
   302 	};
       
   303 
       
   304 //
       
   305 // Class to compose file with video frames of properties specified by test
       
   306 // configuration
       
   307 //
       
   308 _LIT(K3GPComposeVideoFrame, "3GPComposeVideoFrame");
       
   309 class C3GPLibComposeVideoFrame : public C3GPLibComposeFile
       
   310 	{
       
   311 	public:
       
   312 		C3GPLibComposeVideoFrame();
       
   313 		TVerdict doTestStepPreambleL();
       
   314 		TVerdict doTestStepPostambleL();	
       
   315 		
       
   316 	private:
       
   317 		void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer);		
       
   318 	
       
   319 	private:
       
   320 		TBool iKeyFrame;
       
   321 		TInt iDuration;
       
   322 		RBuf8 iVideoFrame;
       
   323 		T3GPFrameDependencies* iDependencies;
       
   324 	};
       
   325 
       
   326 
       
   327 //
       
   328 // Class to open the composer again before closing it
       
   329 //
       
   330 _LIT(K3GPComposeOpenAgain, "3GPComposeOpenAgain");
       
   331 class C3GPLibComposeOpenAgain: public C3GPLibComposeFile
       
   332 	{
       
   333 	public:
       
   334 		C3GPLibComposeOpenAgain();
       
   335 		
       
   336 	private:
       
   337 		void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
   338 	};
       
   339 
       
   340 //
       
   341 // Class to setup composer with a Read-Only file via file handle
       
   342 //
       
   343 _LIT(K3GPComposeOpenReadOnlyFile, "3GPComposeOpenReadOnlyFile");
       
   344 class C3GPLibComposeOpenReadOnlyFile: public C3GPLibComposeWithFlag
       
   345 	{
       
   346 	public:
       
   347 		C3GPLibComposeOpenReadOnlyFile();		
       
   348 		TVerdict doTestStepL();
       
   349 		
       
   350 	private:
       
   351 		void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
   352 	};
       
   353 
       
   354 //
       
   355 // Class to setup composer using file path of an opened file using 
       
   356 // ShareAny and then ShareReadersOrWriters mode.
       
   357 //
       
   358 _LIT(K3GPComposeOpenedFile, "3GPComposeOpenedFile");
       
   359 class C3GPLibComposeOpenedFile: public C3GPLibComposeFile
       
   360 	{
       
   361 	public:
       
   362 		C3GPLibComposeOpenedFile();
       
   363 		
       
   364 	private:
       
   365 		void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
   366 	};
       
   367 
       
   368 //
       
   369 // Class to use 2 composer opening the same file 
       
   370 //
       
   371 _LIT(K3GPComposeMultiComposeOnSameFile, "3GPComposeMultiComposeOnSameFile");
       
   372 class C3GPLibComposeMultiComposeOnSameFile : public C3GPLibComposeFilename
       
   373 	{
       
   374 	public:
       
   375 		C3GPLibComposeMultiComposeOnSameFile();
       
   376 		
       
   377 	private:
       
   378 		void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
   379 	};
       
   380 
       
   381 //
       
   382 // Class to have multiple composers / parser working at the same time 
       
   383 //
       
   384 _LIT(K3GPComposeMultiComposers, "3GPComposeMultiComposers");
       
   385 class C3GPLibComposeMultiComposers : public C3GPLibComposeFilename
       
   386 	{
       
   387 	public:
       
   388 		C3GPLibComposeMultiComposers();
       
   389 		
       
   390 	private:
       
   391 		void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
   392 	};
       
   393 
       
   394 //
       
   395 // Class to compose file without calling complete first 
       
   396 //
       
   397 _LIT(K3GPComposeCloseComposerWithoutComplete, "3GPComposeCloseComposerWithoutComplete");
       
   398 class C3GPLibComposeCloseComposerWithoutComplete : public C3GPLibComposeFilename
       
   399 	{
       
   400 	public:
       
   401 		C3GPLibComposeCloseComposerWithoutComplete();
       
   402 		
       
   403 	private:
       
   404 		void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
   405 	};
       
   406 
       
   407 //
       
   408 // Class to test cleanup of temporary files when composer panics    
       
   409 //
       
   410 _LIT(K3GPComposePanic, "3GPComposePanic");
       
   411 class C3GPLibComposePanic : public C3GPLibComposeFilename
       
   412 	{
       
   413 	public:
       
   414 		C3GPLibComposePanic();
       
   415 		TVerdict doTestStepPreambleL();
       
   416 		TVerdict doTestStepPostambleL();
       
   417 		
       
   418 	private:
       
   419 		void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
   420 		
       
   421 	private:
       
   422 		TBool iPanic;
       
   423 		RBuf iDir;
       
   424 	};
       
   425 
       
   426 //
       
   427 // Class to compose a large file >2GB
       
   428 //
       
   429 _LIT(K3GPComposeLargeFile, "3GPComposeLargeFile");
       
   430 class C3GPLibComposeLargeFile : public C3GPLibComposeFile
       
   431 	{
       
   432 	public:
       
   433 		C3GPLibComposeLargeFile();		
       
   434 		
       
   435 		TVerdict doTestStepPreambleL();
       
   436 		TVerdict doTestStepPostambleL();	
       
   437 		
       
   438 	private:
       
   439 		C3GPCompose* doTestStepCreateComposerL();
       
   440 
       
   441 		void doTestStepComposeOpenL(C3GPCompose& aComposer);
       
   442 		void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer);	
       
   443 
       
   444 	private:
       
   445 		TInt iComposeFlag;
       
   446 	};
       
   447 
       
   448 //
       
   449 // Class to compose a large file >2GB with user data
       
   450 //
       
   451 _LIT(K3GPComposeLargeFileUserData, "3GPComposeLargeFileUserData");
       
   452 class C3GPLibComposeLargeFileUserData : public C3GPLibComposeLargeFile
       
   453 	{
       
   454 	public:
       
   455 		C3GPLibComposeLargeFileUserData();		
       
   456 		
       
   457 	private:
       
   458 		void doTestStepComposeSetUserDataL(C3GPCompose& aComposer);
       
   459 		void WriteInt32(TUint8* aPtr, TInt32 aData);	
       
   460 
       
   461 	private:
       
   462 	};
       
   463 
       
   464 //
       
   465 // Class to compose a large file >2GB using 32bit APIs
       
   466 //
       
   467 _LIT(K3GPComposeLargeFile32bitAPI, "3GPComposeLargeFile32bitAPI");
       
   468 class C3GPLibComposeLargeFile32bitAPI : public C3GPLibComposeWithFlag
       
   469 	{
       
   470 	public:
       
   471 		C3GPLibComposeLargeFile32bitAPI();		
       
   472 				
       
   473 	private:
       
   474 		C3GPCompose* doTestStepCreateComposerL();
       
   475 		void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer);	
       
   476 
       
   477 	private:
       
   478 	};
       
   479 
       
   480 //
       
   481 // Class to compose a large file on an mmc card until the disk is full
       
   482 //
       
   483 _LIT(K3GPComposeLargeFileDiskFull, "3GPComposeLargeFileDiskFull");
       
   484 class C3GPLibComposeLargeFileDiskFull : public C3GPLibComposeLargeFile
       
   485 	{
       
   486 	public:
       
   487 		C3GPLibComposeLargeFileDiskFull();		
       
   488 		
       
   489 	private:
       
   490 		void doTestStepComposeWriteVideoAudioL(C3GPCompose& aComposer);
       
   491 
       
   492 	private:
       
   493 	};
       
   494 
       
   495 //
       
   496 // Class to compose file with AVC video that conforms to the expected AVC profile.
       
   497 //
       
   498 _LIT(K3GPComposeFileWithAvcProfileCheck, "3GPComposeFileWithAvcProfileCheck");
       
   499 class C3GPLibComposeFileWithAvcProfileCheck : public C3GPLibComposeFile
       
   500     {
       
   501     public:
       
   502         C3GPLibComposeFileWithAvcProfileCheck();
       
   503         virtual T3GPVideoPropertiesBase* SetupAvcVideoL();
       
   504         TVerdict doTestStepL(); 
       
   505 
       
   506     private:
       
   507         TVerdict VerifyAvcProfileL(const RFile& aFile);
       
   508         
       
   509     private:
       
   510         TBuf8<7> iAvcDecoderConfigRecord;
       
   511     };
       
   512 
       
   513 
       
   514 #endif // TSU_3GPLIBRARY_COMPOSER_API_H
       
   515