1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 #ifndef PVAETEST_H_INCLUDED 19 #include "pvaetest.h" 20 #endif 21 22 #ifndef PVAETESTINPUT_H_INCLUDED 23 #include "pvaetestinput.h" 24 #endif 25 26 #ifndef TEST_PV_MEDIAINPUT_AUTHOR_ENGINE_H 27 #include "test_pv_mediainput_author_engine.h" 28 #endif 29 30 #ifndef TEST_PV_AUTHOR_ENGINE_TESTSET1_H_INCLUDED 31 #include "test_pv_author_engine_testset1.h" 32 #endif 33 34 #ifndef TEST_PV_AUTHOR_ENGINE_TESTSET4_H_INCLUDED 35 #include "test_pv_author_engine_testset4.h" 36 #endif 37 38 #ifndef TEST_PV_MEDIAINPUT_AUTHOR_ENGINE_H 39 #include "test_pv_mediainput_author_engine.h" 40 #endif 41 42 #if USE_OMX_ENC_NODE 43 #include "OMX_Core.h" 44 #include "pv_omxcore.h" 45 #endif 46 47 FILE* file; 48 49 // Default input settings 50 const uint32 KVideoBitrate = 52000; 51 const uint32 KVideoFrameWidth = 176; 52 const uint32 KVideoFrameHeight = 144; 53 const uint32 KVideoTimescale = 1000; 54 const uint32 KNumLayers = 1; 55 56 const uint32 KVideoFrameRate = 15; 57 const uint32 KNum20msFramesPerChunk = 10; 58 const uint32 KAudioBitsPerSample = 16; 59 const uint16 KVideoIFrameInterval = 10; 60 const uint8 KH263VideoProfile = 0; 61 const uint8 KH263VideoLevel = 10; 62 const uint32 KAudioBitrate = 12200; 63 const uint32 KAudioBitrateWB = 15850; 64 const uint32 KAACAudioBitrate = 64000; 65 const uint32 KAudioTimescale = 8000; 66 const uint32 KAudioTimescaleWB = 16000; 67 const uint32 KAudioNumChannels = 1; 68 const uint32 KTextTimescale = 90000; 69 const uint32 KTextFrameWidth = 176; 70 const uint32 KTextFrameHeight = 177; 71 72 73 74 const uint32 KMaxFileSize = 50000; // 50 KB 75 const uint32 KMaxDuration = 5000; // 5 seconds 76 const uint32 KFileSizeProgressFreq = 1000; // 1 KB 77 const uint32 KDurationProgressFreq = 1000; // 1 second 78 const uint32 KTestDuration = 10; // for 10 sec 79 80 // it's for setting Authoring Time Unit for selecting counter loop 81 // this time unit is used as default authoring time for longetivity test 82 const uint32 KAuthoringSessionUnit = 60; //in seconds 83 const uint32 KPauseDuration = 5000000; // microseconds 84 85 #define MAXLINELENGTH 200 86 87 //////////////////////////////////////////////////////////////////////////// 88 89 PVAuthorEngineTest::PVAuthorEngineTest(FILE* aStdOut, int32 aFirstTest, int32 aLastTest, 90 const char* aInputFileNameAudio, const char* aInputFileNameVideo, const char* aInputFileNameText, const char* aOutputFileName, AVTConfig aAVTConfig, 91 PVAETestInputType aAudioInputType, PVAETestInputType aVideoInputType, PVAETestInputType aTextInputType, 92 const char* aComposerMimeType, const char* aAudioEncoderMimeType, const char* aVideoEncoderMimeType, const char* aTextEncoderMimeType, uint32 aAuthoringTime): 93 94 iCurrentTest(NULL), 95 iFirstTest(aFirstTest), 96 iLastTest(aLastTest), 97 iNextTestCase(aFirstTest), 98 iStdOut(aStdOut), 99 100 iAudioInputType(aAudioInputType), 101 iVideoInputType(aVideoInputType), 102 iTextInputType(aTextInputType), 103 iComposerMimeType(aComposerMimeType), 104 iAudioEncoderMimeType(aAudioEncoderMimeType), 105 iVideoEncoderMimeType(aVideoEncoderMimeType), 106 iTextEncoderMimeType(aTextEncoderMimeType), 107 iAVTConfig(aAVTConfig), 108 iAuthoringTime(aAuthoringTime) 109 110 { 111 iInputFileNameAudio = NULL; 112 iInputFileNameVideo = NULL; 113 iInputFileNameText = NULL; 114 iOutputFileName = NULL; 115 116 if (oscl_strlen(aInputFileNameAudio) != 0) 117 { 118 iInputFileNameAudio.set(aInputFileNameAudio, oscl_strlen(aInputFileNameAudio)); 119 } 120 121 if (oscl_strlen(aInputFileNameVideo) != 0) 122 { 123 iInputFileNameVideo.set(aInputFileNameVideo, oscl_strlen(aInputFileNameVideo)); 124 } 125 126 if (oscl_strlen(aInputFileNameText) != 0) 127 { 128 iInputFileNameText.set(aInputFileNameText, oscl_strlen(aInputFileNameText)); 129 } 130 131 if (oscl_strlen(aOutputFileName) != 0) 132 { 133 iOutputFileName.set(aOutputFileName, oscl_strlen(aOutputFileName)); 134 } 135 136 } 137 138 //////////////////////////////////////////////////////////////////////////// 139 PVAuthorEngineTest::~PVAuthorEngineTest() 140 { 141 } 142 143 //////////////////////////////////////////////////////////////////////////// 144 void PVAuthorEngineTest::test() 145 { 146 iTotalSuccess = iTotalFail = iTotalError = 0; 147 148 while ((iNextTestCase <= iLastTest) || (iNextTestCase < Invalid_Test)) 149 { 150 if (iCurrentTest) 151 { 152 delete iCurrentTest; 153 iCurrentTest = NULL; 154 155 // Shutdown PVLogger and scheduler before checking mem stats 156 CleanupLoggerScheduler(); 157 158 #if !(OSCL_BYPASS_MEMMGT) 159 // Print out the memory usage results for this test case 160 OsclAuditCB auditCB; 161 OsclMemInit(auditCB); 162 if (auditCB.pAudit) 163 { 164 MM_Stats_t* stats = auditCB.pAudit->MM_GetStats(""); 165 if (stats) 166 { 167 fprintf(file, " Mem stats: TotalAllocs(%d), TotalBytes(%d),\n AllocFailures(%d), AllocLeak(%d)\n", 168 stats->totalNumAllocs - iTotalAlloc, stats->totalNumBytes - iTotalBytes, stats->numAllocFails - iAllocFails, stats->numAllocs - iNumAllocs); 169 } 170 else 171 { 172 fprintf(file, "Retrieving memory statistics after running test case failed! Memory statistics result is not available.\n"); 173 } 174 } 175 else 176 { 177 fprintf(file, "Memory audit not available! Memory statistics result is not available.\n"); 178 } 179 #endif 180 } 181 182 #if !(OSCL_BYPASS_MEMMGT) 183 // Obtain the current mem stats before running the test case 184 OsclAuditCB auditCB; 185 OsclMemInit(auditCB); 186 if (auditCB.pAudit) 187 { 188 MM_Stats_t* stats = auditCB.pAudit->MM_GetStats(""); 189 if (stats) 190 { 191 iTotalAlloc = stats->totalNumAllocs; 192 iTotalBytes = stats->totalNumBytes; 193 iAllocFails = stats->numAllocFails; 194 iNumAllocs = stats->numAllocs; 195 } 196 else 197 { 198 fprintf(file, "Retrieving memory statistics before running test case failed! Memory statistics result would be invalid.\n"); 199 } 200 } 201 else 202 { 203 fprintf(file, "Memory audit not available! Memory statistics result would be invalid.\n"); 204 } 205 #endif 206 if (iNextTestCase > iLastTest) 207 { 208 iNextTestCase = Invalid_Test; 209 } 210 else 211 { 212 //skip the placeholders and empty ranges. 213 if ((iNextTestCase == K3GP_OUTPUT_TestEnd) 214 || (iNextTestCase == AMR_OUTPUT_TestEnd) || (iNextTestCase == AAC_OUTPUT_TestEnd) 215 || (iNextTestCase == CompressedLongetivityTestBegin) || (CompressedNormalTestEnd == iNextTestCase) 216 || (iNextTestCase == KCompressed_Errorhandling_TestBegin)) 217 { 218 fprintf(file, "\nPlace Holder Not actual testcase %d: ", iNextTestCase); 219 iNextTestCase++;//go to next test 220 } 221 if ((iNextTestCase >= CompressedNormalTestEnd && iNextTestCase <= CompressedLongetivityTestBegin) && (iLastTest >= CompressedLongetivityTestBegin)) 222 { 223 iNextTestCase = CompressedLongetivityTestBegin; 224 iNextTestCase++; 225 } 226 227 if ((iNextTestCase > CompressedNormalTestEnd) && (iLastTest < CompressedLongetivityTestBegin)) 228 { 229 iNextTestCase = Invalid_Test; 230 }//stop at last test of selected range. 231 else if ((Compressed_LongetivityTestEnd == iNextTestCase) || (KCompressed_Errorhandling_TestEnd == iNextTestCase)) 232 { 233 fprintf(file, "\nPlace Holder Not actual testcase %d: ", iNextTestCase); 234 iNextTestCase = Invalid_Test; 235 } 236 else 237 { 238 fprintf(file, "\nStarting Test %d: ", iNextTestCase); 239 InitLoggerScheduler(); 240 } 241 } 242 243 RunTestCases(); 244 if (iCurrentTest) 245 { 246 // Setup Scheduler 247 OsclExecScheduler *sched = OsclExecScheduler::Current(); 248 if (sched) 249 { 250 uint32 currticks = 0; 251 currticks = OsclTickCount::TickCount(); 252 uint32 starttime = OsclTickCount::TicksToMsec(currticks); 253 254 iCurrentTest->StartTest(); 255 #if USE_NATIVE_SCHEDULER 256 // Have PV scheduler use the scheduler native to the system 257 sched->StartNativeScheduler(); 258 #else 259 int32 err; 260 OSCL_TRY(err, sched->StartScheduler();); 261 #endif 262 currticks = OsclTickCount::TickCount(); 263 uint32 endtime = OsclTickCount::TicksToMsec(currticks); 264 fprintf(file, " Time taken by the test: %d\n", (endtime - starttime)); 265 266 } 267 else 268 { 269 fprintf(file, "ERROR! Scheduler is not available. Test case could not run."); 270 iNextTestCase++; 271 } 272 } 273 else 274 { 275 iNextTestCase++; 276 277 if (iNextTestCase < Invalid_Test) 278 { 279 CleanupLoggerScheduler(); 280 } 281 } 282 }//while iNextTest loop 283 } 284 285 //////////////////////////////////////////////////////////////////////////// 286 // Normal test set 287 void PVAuthorEngineTest::RunTestCases() 288 { 289 // Setup the standard test case parameters based on current unit test settings 290 PVAuthorAsyncTestParam testparam; 291 testparam.iObserver = this; 292 testparam.iTestCase = this; 293 testparam.iTestCaseNum = iNextTestCase; 294 testparam.iStdOut = iStdOut; 295 switch (iNextTestCase) 296 { 297 case AMR_Input_AOnly_3gpTest: 298 fprintf(iStdOut, "AMR to A-Only .3gp Test\n"); 299 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 300 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 301 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 302 break; 303 case H263_Input_VOnly_3gpTest: 304 fprintf(iStdOut, "H263 to V-Only .3gp Test\n"); 305 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 306 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 307 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 308 break; 309 case H264_AMR_Input_AV_3gpTest: 310 fprintf(iStdOut, "H264 & AMR to AV .3gp Test\n"); 311 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 312 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 313 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 314 break; 315 case AMR_YUV_Input_AV_3gpTest: 316 fprintf(iStdOut, "AMR & YUV to AV .3gp Test\n"); 317 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 318 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 319 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 320 break; 321 case AMR_H263_Input_AV_3gpTest: 322 fprintf(iStdOut, "AMR & H263 to AV .3gp Test\n"); 323 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 324 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 325 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 326 break; 327 case AMR_YUV_Input_AV_M4V_AMR_Output_3gpTest: 328 fprintf(iStdOut, "AMR & YUV to AV using M4V Encoder .3gp Test\n"); 329 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 330 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 331 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 332 break; 333 case AMR_FOutput_Test: 334 fprintf(iStdOut, "AMR Input to .amr Test\n"); 335 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 336 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 337 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 338 break; 339 case AACADIF_FOutput_Test: 340 fprintf(iStdOut, "AAC-ADIF Input to .aac Test\n"); 341 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 342 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 343 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 344 break; 345 case AACADTS_FOutput_Test: 346 fprintf(iStdOut, "AAC-ADTS Input to .aac Test\n"); 347 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 348 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 349 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 350 break; 351 case AMRWB_Input_AOnly_3gpTest: 352 fprintf(iStdOut, "AMR-WB to A-Only .3gp Test\n"); 353 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 354 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 355 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 356 break; 357 case AMRWB_FOutput_Test: 358 fprintf(iStdOut, "AMR-WB Input to .awb Test\n"); 359 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 360 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 361 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 362 break; 363 case ErrorHandling_WrongTextInputFileNameTest: 364 fprintf(iStdOut, "ErrorHandling_WrongTextInputFileNameTest Test\n"); 365 iCurrentTest = new pvauthor_async_compressed_test_errorhandling(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 366 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 367 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration, ERROR_NOSTATE); 368 break; 369 case ErrorHandling_WrongOutputPathTest: 370 fprintf(iStdOut, "ErrorHandling_WrongOutputPathTest Test\n"); 371 iCurrentTest = new pvauthor_async_compressed_test_errorhandling(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 372 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 373 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration, ERROR_NOSTATE); 374 break; 375 376 case ErrorHandling_MediaInputNodeStartFailed: 377 fprintf(iStdOut, "ErrorHandling_MediaInputNodeStartFailed Test\n"); 378 #ifndef _TEST_AE_ERROR_HANDLING 379 fprintf(iStdOut, "test not implemented\n"); 380 iCurrentTest = NULL; 381 break; 382 #else 383 iCurrentTest = new pvauthor_async_compressed_test_errorhandling(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 384 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 385 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration, ERROR_MEDIAINPUTNODE_ADDDATASOURCE_START); 386 break; 387 #endif 388 case TEXT_Input_TOnly_3gpTest: 389 fprintf(iStdOut, "TEXT Only .3gp Test\n"); 390 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 391 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 392 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 393 break; 394 case AMR_TEXT_Input_AT_3gpTest: 395 fprintf(iStdOut, "AMR/TEXT .3gp Test\n"); 396 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 397 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 398 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 399 break; 400 case YUV_TEXT_Input_VT_3gpTest: 401 fprintf(iStdOut, "YUV/TEXT .3gp Test\n"); 402 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 403 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 404 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 405 break; 406 case AMR_YUV_TEXT_Input_AVT_Mp4Test: 407 fprintf(iStdOut, "YUV/AMR/TEXT .3gp Test\n"); 408 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 409 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 410 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration); 411 break; 412 413 // longetivity test 414 415 case TEXT_Input_TOnly_3gp_LongetivityTest: 416 fprintf(iStdOut, "TEXT_Input_TOnly_3gp_LongetivityTest test \n"); 417 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 418 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 419 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, iAuthoringTime); 420 break; 421 422 case AMR_TEXT_Input_AT_3gp_LongetivityTest: 423 fprintf(iStdOut, "AMR_TEXT_Input_AT_3gp_LongetivityTest test \n"); 424 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 425 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 426 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, iAuthoringTime); 427 break; 428 429 case YUV_TEXT_Input_VT_3gp_LongetivityTest: 430 fprintf(iStdOut, "YUV_TEXT_Input_VT_3gp_LongetivityTest test \n"); 431 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 432 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 433 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, iAuthoringTime); 434 break; 435 436 case AMR_YUV_TEXT_Input_AVT_3gp_LongetivityTest: 437 fprintf(iStdOut, "AMR_YUV_TEXT_Input_AVT_3gp_LongetivityTest test \n"); 438 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 439 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 440 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, iAuthoringTime); 441 break; 442 443 case AMR_FileOutput_Test_UsingExternalFileHandle: 444 fprintf(iStdOut, "AMR Input to .amr using external file handle Test\n"); 445 iCurrentTest = new pvauthor_async_test_miscellaneous(testparam, (const char*)iInputFileNameAudio.get_cstr(), (const char*)iInputFileNameVideo.get_cstr(), (const char*)iInputFileNameText.get_cstr(), 446 (const char*)iOutputFileName.get_cstr(), iAudioInputType, iVideoInputType, iTextInputType, 447 iComposerMimeType.get_cstr(), iAudioEncoderMimeType.get_cstr(), iVideoEncoderMimeType.get_cstr(), iTextEncoderMimeType.get_cstr(), iAVTConfig, false, KTestDuration, true); 448 break; 449 450 default: 451 iCurrentTest = NULL; 452 break; 453 } 454 } 455 void PVAuthorEngineTest::CompleteTest(test_case &aTC) 456 { 457 // Print out the result for this test case 458 const test_result the_result = aTC.last_result(); 459 fprintf(file, " Successes %d, Failures %d\n" 460 , the_result.success_count() - iTotalSuccess, the_result.failures().size() - iTotalFail); 461 iTotalSuccess = the_result.success_count(); 462 iTotalFail = the_result.failures().size(); 463 iTotalError = the_result.errors().size(); 464 465 // Go to next test 466 ++iNextTestCase; 467 468 // Stop the scheduler 469 OsclExecScheduler *sched = OsclExecScheduler::Current(); 470 if (sched) 471 { 472 sched->StopScheduler(); 473 } 474 } 475 //This functions finds the name of AudioConfigFile from command line specified with switch -audioconfigfile <filename> 476 //Returns true if filename found, false otherwise 477 bool FindAudioConfigFile(cmd_line* aCommandLine, OSCL_HeapString<OsclMemAllocator> & aFileNameAudioConfig, FILE *aFile) 478 { 479 OSCL_UNUSED_ARG(aFile); 480 int iFileArgument = 0; 481 bool iFileFound = false; 482 bool cmdline_iswchar = aCommandLine->is_wchar(); 483 484 int count = aCommandLine->get_count(); 485 486 // Searcgh for the "-audioconfigfile" argument 487 // go through the each argument 488 489 for (int iFileSearch = 0; iFileSearch < count; iFileSearch++) 490 { 491 char argstr[128]; 492 // Convert to UTF8 if necessary 493 if (cmdline_iswchar) 494 { 495 oscl_wchar* argwstr = NULL; 496 aCommandLine->get_arg(iFileSearch, argwstr); 497 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 498 argstr[127] = '\0'; 499 } 500 else 501 { 502 char* tmpstr = NULL; 503 aCommandLine->get_arg(iFileSearch, tmpstr); 504 int32 tmpstrlen = oscl_strlen(tmpstr) + 1; 505 if (tmpstrlen > 128) 506 { 507 tmpstrlen = 128; 508 } 509 oscl_strncpy(argstr, tmpstr, tmpstrlen); 510 argstr[tmpstrlen-1] = '\0'; 511 } 512 513 // Do the string compare 514 if (oscl_strcmp(argstr, "-audioconfigfile") == 0) 515 { 516 iFileFound = true; 517 iFileArgument = ++iFileSearch; 518 break; 519 } 520 } 521 522 if (iFileFound) 523 { 524 // Convert to UTF8 if necessary 525 if (cmdline_iswchar) 526 { 527 oscl_wchar* cmd; 528 aCommandLine->get_arg(iFileArgument, cmd); 529 char tmpstr[256]; 530 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 531 tmpstr[255] = '\0'; 532 aFileNameAudioConfig = tmpstr; 533 } 534 else 535 { 536 char* cmdlinefilename = NULL; 537 aCommandLine->get_arg(iFileArgument, cmdlinefilename); 538 aFileNameAudioConfig = cmdlinefilename; 539 } 540 return true; 541 } 542 return false; 543 } 544 545 546 //This functions finds the name of VideoConfigFile from command line specified with switch -videoconfigfile <filename> 547 //Returns true if filename found, false otherwise 548 bool FindVideoConfigFile(cmd_line* aCommandLine, OSCL_HeapString<OsclMemAllocator>& aFileNameVideoConfig, FILE *aFile) 549 { 550 OSCL_UNUSED_ARG(aFile); 551 int iFileArgument = 0; 552 bool iFileFound = false; 553 bool cmdline_iswchar = aCommandLine->is_wchar(); 554 555 int count = aCommandLine->get_count(); 556 557 // Search for the "-videoconfigfile" argument 558 // go through the each argument 559 560 for (int iFileSearch = 0; iFileSearch < count; iFileSearch++) 561 { 562 char argstr[128]; 563 // Convert to UTF8 if necessary 564 if (cmdline_iswchar) 565 { 566 oscl_wchar* argwstr = NULL; 567 aCommandLine->get_arg(iFileSearch, argwstr); 568 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 569 argstr[127] = '\0'; 570 } 571 else 572 { 573 char* tmpstr = NULL; 574 aCommandLine->get_arg(iFileSearch, tmpstr); 575 int32 tmpstrlen = oscl_strlen(tmpstr) + 1; 576 if (tmpstrlen > 128) 577 { 578 tmpstrlen = 128; 579 } 580 oscl_strncpy(argstr, tmpstr, tmpstrlen); 581 argstr[tmpstrlen-1] = '\0'; 582 } 583 584 // Do the string compare 585 if (oscl_strcmp(argstr, "-videoconfigfile") == 0) 586 { 587 iFileFound = true; 588 iFileArgument = ++iFileSearch; 589 break; 590 } 591 } 592 593 if (iFileFound) 594 { 595 // Convert to UTF8 if necessary 596 if (cmdline_iswchar) 597 { 598 oscl_wchar* cmd; 599 aCommandLine->get_arg(iFileArgument, cmd); 600 char tmpstr[256]; 601 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 602 tmpstr[255] = '\0'; 603 aFileNameVideoConfig = tmpstr; 604 } 605 else 606 { 607 char* cmdlinefilename = NULL; 608 aCommandLine->get_arg(iFileArgument, cmdlinefilename); 609 aFileNameVideoConfig = cmdlinefilename; 610 } 611 return true; 612 } 613 return false; 614 } 615 616 //This functions finds the name of AVIConfigFile from command line specified with switch -aviconfigfile <filename> 617 //Returns true if filename found, false otherwise 618 bool FindAVIConfigFile(cmd_line* aCommandLine, OSCL_HeapString<OsclMemAllocator>& aFileNameAVIConfig, FILE *aFile) 619 { 620 OSCL_UNUSED_ARG(aFile); 621 int iFileArgument = 0; 622 bool iFileFound = false; 623 bool cmdline_iswchar = aCommandLine->is_wchar(); 624 625 int count = aCommandLine->get_count(); 626 627 // Search for the "-aviconfigfile" argument 628 // go through the each argument 629 630 for (int iFileSearch = 0; iFileSearch < count; iFileSearch++) 631 { 632 char argstr[128]; 633 // Convert to UTF8 if necessary 634 if (cmdline_iswchar) 635 { 636 oscl_wchar* argwstr = NULL; 637 aCommandLine->get_arg(iFileSearch, argwstr); 638 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 639 argstr[127] = '\0'; 640 } 641 else 642 { 643 char* tmpstr = NULL; 644 aCommandLine->get_arg(iFileSearch, tmpstr); 645 int32 tmpstrlen = oscl_strlen(tmpstr) + 1; 646 if (tmpstrlen > 128) 647 { 648 tmpstrlen = 128; 649 } 650 oscl_strncpy(argstr, tmpstr, tmpstrlen); 651 argstr[tmpstrlen-1] = '\0'; 652 } 653 654 // Do the string compare 655 if (oscl_strcmp(argstr, "-aviconfigfile") == 0) 656 { 657 iFileFound = true; 658 iFileArgument = ++iFileSearch; 659 break; 660 } 661 } 662 663 if (iFileFound) 664 { 665 // Convert to UTF8 if necessary 666 if (cmdline_iswchar) 667 { 668 oscl_wchar* cmd; 669 aCommandLine->get_arg(iFileArgument, cmd); 670 char tmpstr[256]; 671 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 672 tmpstr[255] = '\0'; 673 aFileNameAVIConfig = tmpstr; 674 } 675 else 676 { 677 char* cmdlinefilename = NULL; 678 aCommandLine->get_arg(iFileArgument, cmdlinefilename); 679 aFileNameAVIConfig = cmdlinefilename; 680 } 681 return true; 682 } 683 return false; 684 } 685 686 //This functions finds the name of audio input file from command line specified with switch -audio <filename> 687 //Sets the name of audio input file in reference parameter 688 void FindAudioSourceFile(cmd_line* aCommandLine, OSCL_HeapString<OsclMemAllocator>& aFileNameAudioInfo, FILE* aFile) 689 { 690 int iFileArgument = 0; 691 bool iFileFound = false; 692 bool cmdline_iswchar = aCommandLine->is_wchar(); 693 694 int count = aCommandLine->get_count(); 695 696 // Search for the "-audio" argument 697 // Go through each argument 698 for (int iFileSearch = 0; iFileSearch < count; iFileSearch++) 699 { 700 char argstr[128]; 701 // Convert to UTF8 if necessary 702 if (cmdline_iswchar) 703 { 704 oscl_wchar* argwstr = NULL; 705 aCommandLine->get_arg(iFileSearch, argwstr); 706 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 707 argstr[127] = '\0'; 708 } 709 else 710 { 711 char* tmpstr = NULL; 712 aCommandLine->get_arg(iFileSearch, tmpstr); 713 int32 tmpstrlen = oscl_strlen(tmpstr) + 1; 714 if (tmpstrlen > 128) 715 { 716 tmpstrlen = 128; 717 } 718 oscl_strncpy(argstr, tmpstr, tmpstrlen); 719 argstr[tmpstrlen-1] = '\0'; 720 } 721 722 // Do the string compare 723 if (0 == oscl_strcmp(argstr, "-help")) 724 { 725 fprintf(aFile, "Source specification option for audio.:\n"); 726 fprintf(aFile, " -audio sourcename\n"); 727 fprintf(aFile, " Specify the source filename or URL to use for test cases which\n"); 728 fprintf(aFile, " allow user-specified source name. The unit test determines the\n"); 729 fprintf(aFile, " source format type using extension or URL header.\n\n"); 730 } 731 else if (0 == oscl_strcmp(argstr, "-audio")) 732 { 733 iFileFound = true; 734 iFileArgument = ++iFileSearch; 735 break; 736 } 737 } 738 739 if (iFileFound) 740 { 741 // Convert to UTF8 if necessary 742 if (cmdline_iswchar) 743 { 744 oscl_wchar* cmd; 745 aCommandLine->get_arg(iFileArgument, cmd); 746 char tmpstr[256]; 747 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 748 tmpstr[255] = '\0'; 749 aFileNameAudioInfo = tmpstr; 750 } 751 else 752 { 753 char* cmdlinefilename = NULL; 754 aCommandLine->get_arg(iFileArgument, cmdlinefilename); 755 aFileNameAudioInfo = cmdlinefilename; 756 } 757 } 758 else //if the -audio tag is missing from cmd line 759 { 760 aFileNameAudioInfo = NULL; 761 } 762 } 763 764 765 766 //This functions finds the name of video input file from command line specified with switch -video <filename> 767 //Sets the name of video input file in reference parameter 768 void FindVideoSourceFile(cmd_line* aCommandLine, OSCL_HeapString<OsclMemAllocator>& aFileNameVideoInfo, FILE* aFile) 769 { 770 int iFileArgument = 0; 771 bool iFileFound = false; 772 bool cmdline_iswchar = aCommandLine->is_wchar(); 773 774 int count = aCommandLine->get_count(); 775 776 // Search for the "-video" argument 777 // Go through each argument 778 for (int iFileSearch = 0; iFileSearch < count; iFileSearch++) 779 { 780 char argstr[128]; 781 // Convert to UTF8 if necessary 782 if (cmdline_iswchar) 783 { 784 oscl_wchar* argwstr = NULL; 785 aCommandLine->get_arg(iFileSearch, argwstr); 786 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 787 argstr[127] = '\0'; 788 } 789 else 790 { 791 char* tmpstr = NULL; 792 aCommandLine->get_arg(iFileSearch, tmpstr); 793 int32 tmpstrlen = oscl_strlen(tmpstr) + 1; 794 if (tmpstrlen > 128) 795 { 796 tmpstrlen = 128; 797 } 798 oscl_strncpy(argstr, tmpstr, tmpstrlen); 799 argstr[tmpstrlen-1] = '\0'; 800 } 801 802 // Do the string compare 803 if (0 == oscl_strcmp(argstr, "-help")) 804 { 805 fprintf(aFile, "Source specification option for video.:\n"); 806 fprintf(aFile, " -video sourcename\n"); 807 fprintf(aFile, " Specify the source filename or URL to use for test cases which\n"); 808 fprintf(aFile, " allow user-specified source name. The unit test determines the\n"); 809 fprintf(aFile, " source format type using extension or URL header.\n\n"); 810 } 811 else if (0 == oscl_strcmp(argstr, "-video")) 812 { 813 iFileFound = true; 814 iFileArgument = ++iFileSearch; 815 break; 816 } 817 } 818 819 if (iFileFound) 820 { 821 // Convert to UTF8 if necessary 822 if (cmdline_iswchar) 823 { 824 oscl_wchar* cmd; 825 aCommandLine->get_arg(iFileArgument, cmd); 826 char tmpstr[256]; 827 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 828 tmpstr[255] = '\0'; 829 aFileNameVideoInfo = tmpstr; 830 } 831 else 832 { 833 char* cmdlinefilename = NULL; 834 aCommandLine->get_arg(iFileArgument, cmdlinefilename); 835 aFileNameVideoInfo = cmdlinefilename; 836 } 837 } 838 else //if the -video tag is missing from cmd line 839 { 840 aFileNameVideoInfo = NULL; 841 } 842 } 843 844 //This functions finds the name of text input file from command line specified with switch -text <filename> 845 //Sets the name of text input file in reference parameter 846 void FindTextSourceFile(cmd_line* aCommandLine, OSCL_HeapString<OsclMemAllocator>& aFileNameTextInfo, OSCL_HeapString<OsclMemAllocator>& aFileTextLogInfo, OSCL_HeapString<OsclMemAllocator>& aFileTextConfigInfo, FILE* aFile) 847 { 848 int iFileArgument = 0; 849 int iLogFileArgument = 0; 850 int iTextFileArgument = 0; 851 bool iFileFound = false; 852 bool iLogFileFound = false; 853 bool iTextFileFound = false; 854 bool cmdline_iswchar = aCommandLine->is_wchar(); 855 856 int count = aCommandLine->get_count(); 857 858 // Search for the "-text" argument 859 // Go through each argument 860 for (int iFileSearch = 0; iFileSearch < count; iFileSearch++) 861 { 862 char argstr[128]; 863 // Convert to UTF8 if necessary 864 if (cmdline_iswchar) 865 { 866 oscl_wchar* argwstr = NULL; 867 aCommandLine->get_arg(iFileSearch, argwstr); 868 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 869 argstr[127] = '\0'; 870 } 871 else 872 { 873 char* tmpstr = NULL; 874 aCommandLine->get_arg(iFileSearch, tmpstr); 875 int32 tmpstrlen = oscl_strlen(tmpstr) + 1; 876 if (tmpstrlen > 128) 877 { 878 tmpstrlen = 128; 879 } 880 oscl_strncpy(argstr, tmpstr, tmpstrlen); 881 argstr[tmpstrlen-1] = '\0'; 882 } 883 884 // Do the string compare 885 if (0 == oscl_strcmp(argstr, "-help")) 886 { 887 fprintf(aFile, "Source specification option for text.:\n"); 888 fprintf(aFile, " -text sourcename\n"); 889 fprintf(aFile, " Specify the source filename or URL to use for test cases which\n"); 890 fprintf(aFile, " allow user-specified source name. The unit test determines the\n"); 891 fprintf(aFile, " source format type using extension or URL header.\n\n"); 892 } 893 else if (0 == oscl_strcmp(argstr, "-text")) 894 { 895 iFileFound = true; 896 iFileArgument = ++iFileSearch; 897 } 898 else if (iFileFound && (0 == oscl_strcmp(argstr, "-textlogfile"))) 899 { 900 iLogFileFound = true; 901 iLogFileArgument = ++iFileSearch; 902 } 903 else if (iLogFileFound && iFileFound && (0 == oscl_strcmp(argstr, "-textconfigfile"))) 904 { 905 iTextFileFound = true; 906 iTextFileArgument = ++iFileSearch; 907 break; 908 } 909 } 910 911 if (iFileFound) 912 { 913 // Convert to UTF8 if necessary 914 if (cmdline_iswchar) 915 { 916 oscl_wchar* cmd; 917 aCommandLine->get_arg(iFileArgument, cmd); 918 char tmpstr[256]; 919 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 920 tmpstr[255] = '\0'; 921 aFileNameTextInfo = tmpstr; 922 } 923 else 924 { 925 char* cmdlinefilename = NULL; 926 aCommandLine->get_arg(iFileArgument, cmdlinefilename); 927 aFileNameTextInfo = cmdlinefilename; 928 } 929 } 930 else //if the -text tag is missing from cmd line 931 { 932 aFileNameTextInfo = NULL; 933 } 934 935 if (iFileFound && iLogFileFound) 936 { 937 // Convert to UTF8 if necessary 938 if (cmdline_iswchar) 939 { 940 oscl_wchar* cmd; 941 aCommandLine->get_arg(iLogFileArgument, cmd); 942 char tmpstr[256]; 943 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 944 tmpstr[255] = '\0'; 945 aFileTextLogInfo = tmpstr; 946 } 947 else 948 { 949 char* cmdlinefilename = NULL; 950 aCommandLine->get_arg(iLogFileArgument, cmdlinefilename); 951 aFileTextLogInfo = cmdlinefilename; 952 } 953 } 954 else 955 { 956 aFileTextLogInfo = NULL; 957 } 958 959 if (iFileFound && iLogFileFound && iTextFileFound) 960 { 961 // Convert to UTF8 if necessary 962 if (cmdline_iswchar) 963 { 964 oscl_wchar* cmd; 965 aCommandLine->get_arg(iTextFileArgument, cmd); 966 char tmpstr[256]; 967 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 968 tmpstr[255] = '\0'; 969 aFileTextConfigInfo = tmpstr; 970 } 971 else 972 { 973 char* cmdlinefilename = NULL; 974 aCommandLine->get_arg(iTextFileArgument, cmdlinefilename); 975 aFileTextConfigInfo = cmdlinefilename; 976 } 977 } 978 else 979 { 980 aFileTextConfigInfo = NULL; 981 } 982 } 983 //This functions finds the name of output input file from command line specified with switch -output <filename> 984 //Sets the name of output file in reference parameter 985 void FindOutputFile(cmd_line* aCommandLine, OSCL_HeapString<OsclMemAllocator>& aOutputFileNameInfo, FILE* aFile) 986 { 987 int iFileArgument = 0; 988 bool iFileFound = false; 989 bool cmdline_iswchar = aCommandLine->is_wchar(); 990 991 int count = aCommandLine->get_count(); 992 993 // Search for the "-output" argument 994 // Go through each argument 995 for (int iFileSearch = 0; iFileSearch < count; iFileSearch++) 996 { 997 char argstr[128]; 998 // Convert to UTF8 if necessary 999 if (cmdline_iswchar) 1000 { 1001 oscl_wchar* argwstr = NULL; 1002 aCommandLine->get_arg(iFileSearch, argwstr); 1003 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 1004 argstr[127] = '\0'; 1005 } 1006 else 1007 { 1008 char* tmpstr = NULL; 1009 aCommandLine->get_arg(iFileSearch, tmpstr); 1010 int32 tmpstrlen = oscl_strlen(tmpstr) + 1; 1011 if (tmpstrlen > 128) 1012 { 1013 tmpstrlen = 128; 1014 } 1015 oscl_strncpy(argstr, tmpstr, tmpstrlen); 1016 argstr[tmpstrlen-1] = '\0'; 1017 } 1018 1019 // Do the string compare 1020 if (oscl_strcmp(argstr, "-help") == 0) 1021 { 1022 fprintf(aFile, "Output specification option.\n"); 1023 fprintf(aFile, " -output outputname\n"); 1024 fprintf(aFile, " Specify the output filename to use for test cases which\n"); 1025 fprintf(aFile, " allow user-specified source name. \n\n"); 1026 } 1027 else if (oscl_strcmp(argstr, "-output") == 0) 1028 { 1029 iFileFound = true; 1030 iFileArgument = ++iFileSearch; 1031 break; 1032 } 1033 } 1034 1035 if (iFileFound) 1036 { 1037 // Convert to UTF8 if necessary 1038 if (cmdline_iswchar) 1039 { 1040 oscl_wchar* cmd; 1041 aCommandLine->get_arg(iFileArgument, cmd); 1042 char tmpstr[256]; 1043 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 1044 tmpstr[255] = '\0'; 1045 aOutputFileNameInfo = tmpstr; 1046 } 1047 else 1048 { 1049 char* cmdlinefilename = NULL; 1050 aCommandLine->get_arg(iFileArgument, cmdlinefilename); 1051 aOutputFileNameInfo = cmdlinefilename; 1052 } 1053 } 1054 else //if the -output tag is missing from cmd line 1055 { 1056 aOutputFileNameInfo = NULL; 1057 } 1058 } 1059 1060 //Find test range args: 1061 //To run a range of tests by enum ID: 1062 // -test 17 29 1063 //if -test is not specified in the command line, it assumes running tests from 0 to CompressedNormalTestEnd-1 1064 void FindTestRange(cmd_line *aCommandLine, int32 &iFirstTest, int32 &iLastTest, FILE *aFile) 1065 { 1066 //default is to run all tests. 1067 iFirstTest = 0; 1068 iLastTest = 999; 1069 1070 int iTestArgument = 0; 1071 char *iTestArgStr1 = NULL; 1072 char *iTestArgStr2 = NULL; 1073 bool iTestFound = false; 1074 bool cmdline_iswchar = aCommandLine->is_wchar(); 1075 1076 int count = aCommandLine->get_count(); 1077 1078 // Search for the "-test" argument 1079 char *SourceFind = NULL; 1080 if (cmdline_iswchar) 1081 { 1082 SourceFind = new char[256]; 1083 } 1084 1085 // Go through each argument 1086 for (int iTestSearch = 0; iTestSearch < count; iTestSearch++) 1087 { 1088 // Convert to UTF8 if necessary 1089 if (cmdline_iswchar) 1090 { 1091 OSCL_TCHAR* cmd = NULL; 1092 aCommandLine->get_arg(iTestSearch, cmd); 1093 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), SourceFind, 256); 1094 } 1095 else 1096 { 1097 SourceFind = NULL; 1098 aCommandLine->get_arg(iTestSearch, SourceFind); 1099 } 1100 1101 // Do the string compare 1102 if (oscl_strcmp(SourceFind, "-help") == 0) 1103 { 1104 fprintf(aFile, "Test cases to run option. Default is ALL:\n"); 1105 fprintf(aFile, " -test x x\n"); 1106 fprintf(aFile, " Specify a range of test cases to run. To run one test case, use the\n"); 1107 fprintf(aFile, " same index for x and y.\n\n"); 1108 1109 iFirstTest = Invalid_Test; 1110 return; 1111 } 1112 else if (oscl_strcmp(SourceFind, "-test") == 0) 1113 { 1114 iTestFound = true; 1115 iTestArgument = ++iTestSearch; 1116 break; 1117 } 1118 } 1119 1120 if (cmdline_iswchar) 1121 { 1122 delete[] SourceFind; 1123 SourceFind = NULL; 1124 } 1125 1126 if (iTestFound) 1127 { 1128 // Convert to UTF8 if necessary 1129 if (cmdline_iswchar) 1130 { 1131 iTestArgStr1 = new char[256]; 1132 OSCL_TCHAR* cmd; 1133 aCommandLine->get_arg(iTestArgument, cmd); 1134 if (cmd) 1135 { 1136 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), iTestArgStr1, 256); 1137 } 1138 1139 iTestArgStr2 = new char[256]; 1140 aCommandLine->get_arg(iTestArgument + 1, cmd); 1141 if (cmd) 1142 { 1143 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), iTestArgStr2, 256); 1144 } 1145 } 1146 else 1147 { 1148 aCommandLine->get_arg(iTestArgument, iTestArgStr1); 1149 aCommandLine->get_arg(iTestArgument + 1, iTestArgStr2); 1150 } 1151 1152 //Pull out 2 integers... 1153 if (iTestArgStr1 && '0' <= iTestArgStr1[0] && iTestArgStr1[0] <= '9' && iTestArgStr2 && '0' <= iTestArgStr2[0] && iTestArgStr2[0] <= '9') 1154 { 1155 int len = oscl_strlen(iTestArgStr1); 1156 switch (len) 1157 { 1158 case 3: 1159 iFirstTest = 0; 1160 if ('0' <= iTestArgStr1[0] && iTestArgStr1[0] <= '9') 1161 { 1162 iFirstTest = iFirstTest + 100 * (iTestArgStr1[0] - '0'); 1163 } 1164 1165 if ('0' <= iTestArgStr1[1] && iTestArgStr1[1] <= '9') 1166 { 1167 iFirstTest = iFirstTest + 10 * (iTestArgStr1[1] - '0'); 1168 } 1169 1170 if ('0' <= iTestArgStr1[2] && iTestArgStr1[2] <= '9') 1171 { 1172 iFirstTest = iFirstTest + 1 * (iTestArgStr1[2] - '0'); 1173 } 1174 break; 1175 1176 case 2: 1177 iFirstTest = 0; 1178 if ('0' <= iTestArgStr1[0] && iTestArgStr1[0] <= '9') 1179 { 1180 iFirstTest = iFirstTest + 10 * (iTestArgStr1[0] - '0'); 1181 } 1182 1183 if ('0' <= iTestArgStr1[1] && iTestArgStr1[1] <= '9') 1184 { 1185 iFirstTest = iFirstTest + 1 * (iTestArgStr1[1] - '0'); 1186 } 1187 break; 1188 1189 case 1: 1190 iFirstTest = 0; 1191 if ('0' <= iTestArgStr1[0] && iTestArgStr1[0] <= '9') 1192 { 1193 iFirstTest = iFirstTest + 1 * (iTestArgStr1[0] - '0'); 1194 } 1195 break; 1196 1197 default: 1198 break; 1199 } 1200 1201 len = oscl_strlen(iTestArgStr2); 1202 switch (len) 1203 { 1204 case 3: 1205 iLastTest = 0; 1206 if ('0' <= iTestArgStr2[0] && iTestArgStr2[0] <= '9') 1207 { 1208 iLastTest = iLastTest + 100 * (iTestArgStr2[0] - '0'); 1209 } 1210 1211 if ('0' <= iTestArgStr2[1] && iTestArgStr2[1] <= '9') 1212 { 1213 iLastTest = iLastTest + 10 * (iTestArgStr2[1] - '0'); 1214 } 1215 1216 if ('0' <= iTestArgStr2[2] && iTestArgStr2[2] <= '9') 1217 { 1218 iLastTest = iLastTest + 1 * (iTestArgStr2[2] - '0'); 1219 } 1220 break; 1221 1222 case 2: 1223 iLastTest = 0; 1224 if ('0' <= iTestArgStr2[0] && iTestArgStr2[0] <= '9') 1225 { 1226 iLastTest = iLastTest + 10 * (iTestArgStr2[0] - '0'); 1227 } 1228 1229 if ('0' <= iTestArgStr2[1] && iTestArgStr2[1] <= '9') 1230 { 1231 iLastTest = iLastTest + 1 * (iTestArgStr2[1] - '0'); 1232 } 1233 break; 1234 1235 case 1: 1236 iLastTest = 0; 1237 if ('0' <= iTestArgStr2[0] && iTestArgStr2[0] <= '9') 1238 { 1239 iLastTest = iLastTest + 1 * (iTestArgStr2[0] - '0'); 1240 } 1241 break; 1242 1243 default: 1244 break; 1245 } 1246 } 1247 } 1248 else //-test arg not given, assuming run tests from 0 to CompressedNormalTestEnd-1 1249 { 1250 iFirstTest = 0; 1251 iLastTest = CompressedNormalTestEnd - 1; 1252 } 1253 1254 if (cmdline_iswchar) 1255 { 1256 if (iTestArgStr1) 1257 { 1258 delete[] iTestArgStr1; 1259 iTestArgStr1 = NULL; 1260 } 1261 1262 if (iTestArgStr2) 1263 { 1264 delete[] iTestArgStr2; 1265 iTestArgStr2 = NULL; 1266 } 1267 1268 if (SourceFind) 1269 { 1270 delete[] SourceFind; 1271 SourceFind = NULL; 1272 } 1273 } 1274 } 1275 1276 //Look for switch to print mem leaks at the end of test. Use switch -leakinfo for finding memory leaks 1277 void FindMemMgmtRelatedCmdLineParams(cmd_line* aCommandLine, bool& aPrintDetailedMemLeakInfo, FILE* aFile) 1278 { 1279 aPrintDetailedMemLeakInfo = false; 1280 1281 bool cmdline_iswchar = aCommandLine->is_wchar(); 1282 1283 int count = aCommandLine->get_count(); 1284 1285 // Search for the "-leakinfo" argument 1286 char *SourceFind = NULL; 1287 if (cmdline_iswchar) 1288 { 1289 SourceFind = new char[256]; 1290 } 1291 1292 // Go through each argument 1293 for (int iTestSearch = 0; iTestSearch < count; iTestSearch++) 1294 { 1295 // Convert to UTF8 if necessary 1296 if (cmdline_iswchar) 1297 { 1298 OSCL_TCHAR* cmd = NULL; 1299 aCommandLine->get_arg(iTestSearch, cmd); 1300 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), SourceFind, 256); 1301 } 1302 else 1303 { 1304 SourceFind = NULL; 1305 aCommandLine->get_arg(iTestSearch, SourceFind); 1306 } 1307 1308 // Do the string compare 1309 if (oscl_strcmp(SourceFind, "-help") == 0) 1310 { 1311 fprintf(aFile, "Printing leak info option. Default is OFF:\n"); 1312 fprintf(aFile, " -leakinfo\n"); 1313 fprintf(aFile, " If there is a memory leak, prints out the memory leak information\n"); 1314 fprintf(aFile, " after all specified test cases have finished running.\n\n"); 1315 } 1316 else if (oscl_strcmp(SourceFind, "-leakinfo") == 0) 1317 { 1318 aPrintDetailedMemLeakInfo = true; 1319 } 1320 } 1321 1322 if (cmdline_iswchar) 1323 { 1324 delete[] SourceFind; 1325 SourceFind = NULL; 1326 } 1327 } 1328 1329 //This function is used to read the contents of AudioConfigFile and VideoConfigFile, one line at a time. 1330 int fgetline(Oscl_File* aFp, char aLine[], int aMax) 1331 { 1332 int nch = 0; 1333 char cc[2] = "\0"; 1334 aMax = aMax - 1; 1335 1336 while (aFp->Read((char*)cc, 1, 1) != 0) 1337 { 1338 if (cc[0] == '\n') 1339 { 1340 break; 1341 } 1342 if (nch < aMax) 1343 { 1344 aLine[nch] = cc[0]; 1345 nch = nch + 1; 1346 } 1347 } 1348 1349 if ((int)cc[0] == 0 && nch == 0) 1350 { 1351 return EOF; 1352 } 1353 aLine[nch] = '\0'; 1354 return nch; 1355 } 1356 1357 //This function is used to read the audioconfigfile and set the AVTConfig structure 1358 bool LoadAudioConfiguration(OSCL_HeapString<OsclMemAllocator>& aAudioConfigFileName, AVTConfig& aAVTConfig, FILE* aFile) 1359 { 1360 OSCL_UNUSED_ARG(aFile); 1361 char maxLine[200] = "\0"; 1362 Oscl_FileServer iFileServer; 1363 Oscl_File fileConfig; 1364 iFileServer.Connect(); 1365 if (fileConfig.Open(aAudioConfigFileName.get_cstr(), Oscl_File::MODE_READ | Oscl_File::MODE_TEXT, iFileServer) != 0) 1366 { 1367 return false; 1368 } 1369 1370 while (fgetline(&fileConfig, maxLine, 200) != EOF) 1371 { 1372 // retrieve Sampling Rate 1373 if (oscl_CIstrncmp(maxLine, "SamplingRate", 12) == 0) 1374 { 1375 char* pcPtr = oscl_strchr(maxLine, '='); 1376 pcPtr++; 1377 PV_atoi(pcPtr, '0', (uint32&)(aAVTConfig.iSamplingRate)); // atoi syntax has to be checked once 1378 } 1379 1380 // retrieve num of channels 1381 if (oscl_CIstrncmp(maxLine, "NumChannels", 11) == 0) 1382 { 1383 char* pcPtr = oscl_strchr(maxLine, '='); 1384 pcPtr++; 1385 PV_atoi(pcPtr, '0', (uint32&)aAVTConfig.iNumChannels); // atoi syntax has to be checked once 1386 } 1387 } 1388 fileConfig.Close(); 1389 iFileServer.Close(); 1390 return true; 1391 } 1392 1393 1394 //This function is used to read the videoconfigfile and set the AVTConfig structure 1395 bool LoadVideoConfiguration(OSCL_HeapString<OsclMemAllocator>& aVideoConfigFileName, AVTConfig& aAVTConfig, FILE* aFile) 1396 { 1397 OSCL_UNUSED_ARG(aFile); 1398 char maxLine[200] = "\0"; 1399 Oscl_FileServer iFileServer; 1400 Oscl_File fileConfig; 1401 1402 iFileServer.Connect(); 1403 1404 if (fileConfig.Open(aVideoConfigFileName.get_cstr(), Oscl_File::MODE_READ | Oscl_File::MODE_TEXT, iFileServer) != 0) 1405 { 1406 return false; 1407 } 1408 1409 while (fgetline(&fileConfig, maxLine, 200) != EOF) 1410 { 1411 // retrieve width 1412 if (oscl_CIstrncmp(maxLine, "width", 5) == 0) 1413 { 1414 char* pcPtr = oscl_strchr(maxLine, '='); 1415 pcPtr++; 1416 PV_atoi(pcPtr, '0', (uint32&)aAVTConfig.iWidth); // atoi syntax has to be checked once 1417 1418 } 1419 1420 // retrieve height 1421 if (oscl_CIstrncmp(maxLine, "height", 6) == 0) 1422 { 1423 char* pcPtr = oscl_strchr(maxLine, '='); 1424 pcPtr++; 1425 PV_atoi(pcPtr, '0', (uint32&)aAVTConfig.iHeight); // atoi syntax has to be checked once 1426 1427 } 1428 1429 // retrieve frames per second 1430 if (oscl_CIstrncmp(maxLine, "fps", 3) == 0) 1431 { 1432 char* pcPtr = oscl_strchr(maxLine, '='); 1433 pcPtr++; 1434 PV_atof(pcPtr, (OsclFloat&)aAVTConfig.iFps); // atoi syntax has to be checked once 1435 } 1436 1437 // retrieve IFrame Interval 1438 if (oscl_CIstrncmp(maxLine, "iframeinterval", 14) == 0) 1439 { 1440 char* pcPtr = oscl_strchr(maxLine, '='); 1441 pcPtr++; 1442 PV_atoi(pcPtr, '0', (uint32&)aAVTConfig.iFrameInterval); // atoi syntax has to be checked once 1443 } 1444 } 1445 fileConfig.Close(); 1446 iFileServer.Close(); 1447 return true; 1448 } 1449 1450 //This function is used to read the AVIconfigfile and set the MediaInputTestParam structure 1451 bool LoadAVIConfiguration(OSCL_HeapString<OsclMemAllocator>& aAVIConfigFileName, PVMediaInputAuthorEngineTestParam& aTestParam, FILE* aFile) 1452 { 1453 OSCL_UNUSED_ARG(aFile); 1454 char maxLine[200] = "\0"; 1455 Oscl_FileServer iFileServer; 1456 Oscl_File fileConfig; 1457 1458 iFileServer.Connect(); 1459 1460 if (fileConfig.Open(aAVIConfigFileName.get_cstr(), Oscl_File::MODE_READ | Oscl_File::MODE_TEXT, iFileServer) != 0) 1461 { 1462 return false; 1463 } 1464 1465 while (fgetline(&fileConfig, maxLine, MAXLINELENGTH) != EOF) 1466 { 1467 // retrieve video bitrate 1468 if (oscl_CIstrncmp(maxLine, "videobitrate", oscl_strlen("videobitrate")) == 0) 1469 { 1470 char* pcPtr = oscl_strchr(maxLine, ':'); 1471 pcPtr++; 1472 PV_atoi(pcPtr, '0', (uint32&)aTestParam.iMediainputParam.iVideoBitrate); 1473 } 1474 // retrieve Audio bitrate 1475 if (oscl_CIstrncmp(maxLine, "audiobitrate", oscl_strlen("audiobitrate")) == 0) 1476 { 1477 char* pcPtr = oscl_strchr(maxLine, ':'); 1478 pcPtr++; 1479 PV_atoi(pcPtr, '0', (uint32&)aTestParam.iMediainputParam.iAudioBitrate); 1480 } 1481 1482 // retrieve Sampling rate 1483 if (oscl_CIstrncmp(maxLine, "samplingrate", oscl_strlen("samplingrate")) == 0) 1484 { 1485 char* pcPtr = oscl_strchr(maxLine, ':'); 1486 pcPtr++; 1487 PV_atoi(pcPtr, '0', (uint32&)aTestParam.iMediainputParam.iSamplingRate); 1488 } 1489 // retrieve framerate 1490 if (oscl_CIstrncmp(maxLine, "framerate", oscl_strlen("framerate")) == 0) 1491 { 1492 char* pcPtr = oscl_strchr(maxLine, ':'); 1493 pcPtr++; 1494 PV_atof(pcPtr, (OsclFloat&)aTestParam.iMediainputParam.iFrameRate); 1495 } 1496 1497 1498 } 1499 fileConfig.Close(); 1500 iFileServer.Close(); 1501 return true; 1502 } 1503 1504 //Depending on the Test Nos, check the validity of input and output files extensions as specified in command line 1505 //Also set the AVTConfig param by loading the contents of audio and video config files 1506 //This function is used only for Test No 0 to CompressedNormalTestEnd-1 1507 bool CheckSourceAndOutputFiles(cmd_line* aCommandLine, int32 firsttest, int32 lasttest, OSCL_HeapString<OsclMemAllocator> &aInputAudioFileName, OSCL_HeapString<OsclMemAllocator> &aInputVideoFileName, OSCL_HeapString<OsclMemAllocator> &aInputTextFileName, OSCL_HeapString<OsclMemAllocator> &aOutputFileName, AVTConfig &aAVTConfig, OSCL_HeapString<OsclMemAllocator> &audioconfigfilename, OSCL_HeapString<OsclMemAllocator> &videoconfigfilename, FILE* file) 1508 { 1509 bool bAudioTest = false;//To track if the test is Audio 1510 bool bVideoTest = false;//To track if the test is Video 1511 bool bTextTest = false;//To track if the test is Text 1512 1513 switch (firsttest) 1514 { 1515 case AMR_FOutput_Test: 1516 case AMR_Input_AOnly_3gpTest: 1517 case AMR_YUV_Input_AV_3gpTest: 1518 case AMR_H263_Input_AV_3gpTest: 1519 case AMR_YUV_Input_AV_M4V_AMR_Output_3gpTest: 1520 case H264_AMR_Input_AV_3gpTest: 1521 case AMR_FileOutput_Test_UsingExternalFileHandle: 1522 //Longetivity Tests 1523 case AMR_TEXT_Input_AT_3gp_LongetivityTest: 1524 case AMR_YUV_TEXT_Input_AVT_3gp_LongetivityTest: 1525 bAudioTest = true; 1526 if (!(oscl_strstr(aInputAudioFileName.get_cstr(), ".amr") != NULL || oscl_strstr(aInputAudioFileName.get_cstr(), ".AMR") != NULL)) 1527 { 1528 fprintf(file, " Input Filename incorrect!!! TestNo:%d - %d needs Input File: -audio <xxx>.amr\n\n", firsttest, lasttest); 1529 return false; 1530 } 1531 break; 1532 1533 case AMRWB_Input_AOnly_3gpTest: 1534 case AMRWB_FOutput_Test: 1535 bAudioTest = true; 1536 if (!(oscl_strstr(aInputAudioFileName.get_cstr(), ".awb") != NULL || oscl_strstr(aInputAudioFileName.get_cstr(), ".AWB") != NULL)) 1537 { 1538 fprintf(file, " Input Filename incorrect!!! TestNo:%d - %d needs Input File: -audio <xxx>.awb\n\n", firsttest, lasttest); 1539 return false; 1540 } 1541 break; 1542 1543 case AACADIF_FOutput_Test: 1544 bAudioTest = true; 1545 if (!(oscl_strstr(aInputAudioFileName.get_cstr(), ".aacadif") != NULL || oscl_strstr(aInputAudioFileName.get_cstr(), ".AACADIF") != NULL)) 1546 { 1547 fprintf(file, " Input Filename incorrect!!! TestNo:%d - %d needs Input File:-audio <xxx>.aacadif\n\n", firsttest, lasttest); 1548 return false; 1549 } 1550 break; 1551 case AACADTS_FOutput_Test: 1552 bAudioTest = true; 1553 if (!(oscl_strstr(aInputAudioFileName.get_cstr(), ".aacadts") != NULL || oscl_strstr(aInputAudioFileName.get_cstr(), ".AACADTS") != NULL)) 1554 { 1555 fprintf(file, " Input Filename incorrect!!! TestNo:%d - %d needs Input File:-audio <xxx>.aacadts\n\n", firsttest, lasttest); 1556 return false; 1557 } 1558 break; 1559 //Used for generic testcases 1560 default: 1561 if (!(aInputAudioFileName == NULL)) 1562 { 1563 bAudioTest = true; 1564 } 1565 break; 1566 } 1567 if (bAudioTest) //If the test involves audio input, look for audio config file 1568 { 1569 bool bRetVal = false; 1570 // Load audio configuration 1571 if (FindAudioConfigFile(aCommandLine, audioconfigfilename, file)) 1572 { 1573 bRetVal = LoadAudioConfiguration(audioconfigfilename, aAVTConfig, file); 1574 } 1575 1576 if (!bRetVal) //Could not find Config File 1577 { 1578 fprintf(file, " Audio Config File not available!!! Specify -audioconfigfile <filename>\n\n"); 1579 return false; 1580 } 1581 } 1582 switch (firsttest) 1583 { 1584 case AMR_YUV_Input_AV_3gpTest: 1585 case AMR_YUV_Input_AV_M4V_AMR_Output_3gpTest: 1586 case YUV_TEXT_Input_VT_3gp_LongetivityTest: 1587 case AMR_YUV_TEXT_Input_AVT_3gp_LongetivityTest: 1588 bVideoTest = true; 1589 if (!(oscl_strstr(aInputVideoFileName.get_cstr(), ".yuv") != NULL || oscl_strstr(aInputVideoFileName.get_cstr(), ".YUV") != NULL)) 1590 { 1591 fprintf(file, " Input Filename incorrect!!! TestNo:%d - %d needs Input File:-video <xxx>.yuv\n\n", firsttest, lasttest); 1592 return false; 1593 } 1594 break; 1595 case H263_Input_VOnly_3gpTest: 1596 case AMR_H263_Input_AV_3gpTest: 1597 bVideoTest = true; 1598 if (!(oscl_strstr(aInputVideoFileName.get_cstr(), ".h263") != NULL || oscl_strstr(aInputVideoFileName.get_cstr(), ".H263") != NULL)) 1599 { 1600 fprintf(file, " Input Filename incorrect!!! TestNo:%d - %d needs Input File:-video <xxx>.h263\n\n", firsttest, lasttest); 1601 return false; 1602 } 1603 break; 1604 case H264_AMR_Input_AV_3gpTest: 1605 bVideoTest = true; 1606 if (!(oscl_strstr(aInputVideoFileName.get_cstr(), ".h264") != NULL || oscl_strstr(aInputVideoFileName.get_cstr(), ".H264") != NULL)) 1607 { 1608 fprintf(file, " Input Filename incorrect!!! TestNo:%d - %d needs Input File:-video <xxx>.h264\n\n", firsttest, lasttest); 1609 return false; 1610 } 1611 break; 1612 //Used for generic testcases 1613 default: 1614 if (!(aInputVideoFileName == NULL)) 1615 { 1616 bVideoTest = true; 1617 } 1618 break; 1619 } 1620 if (bVideoTest) //If the test involves video input, look for audio config file 1621 { 1622 bool bRetVal = false; 1623 // Load video configuration 1624 if (FindVideoConfigFile(aCommandLine, videoconfigfilename, file)) 1625 { 1626 bRetVal = LoadVideoConfiguration(videoconfigfilename, aAVTConfig, file); 1627 } 1628 1629 if (!bRetVal) //Could not find Config File 1630 { 1631 fprintf(file, " Video Config File not available!!! Specify -videoconfigfile <filename>\n\n"); 1632 return false; 1633 } 1634 } 1635 switch (firsttest) 1636 { 1637 case TEXT_Input_TOnly_3gpTest: 1638 case AMR_TEXT_Input_AT_3gpTest: 1639 case YUV_TEXT_Input_VT_3gpTest: 1640 case AMR_YUV_TEXT_Input_AVT_Mp4Test: 1641 case TEXT_Input_TOnly_3gp_LongetivityTest: 1642 case AMR_TEXT_Input_AT_3gp_LongetivityTest: 1643 case YUV_TEXT_Input_VT_3gp_LongetivityTest: 1644 case AMR_YUV_TEXT_Input_AVT_3gp_LongetivityTest: 1645 bTextTest = true; 1646 if (!(oscl_strstr(aInputTextFileName.get_cstr(), ".txt") != NULL || oscl_strstr(aInputTextFileName.get_cstr(), ".TXT") != NULL)) 1647 { 1648 fprintf(file, " Input Filename incorrect!!! TestNo:%d - %d needs Input File:-text <xxx>.txt\n\n", firsttest, lasttest); 1649 return false; 1650 } 1651 break; 1652 default: 1653 if (!(aInputTextFileName == NULL)) 1654 { 1655 bTextTest = true; 1656 } 1657 break; 1658 } 1659 1660 if (bTextTest) 1661 { 1662 if (((aAVTConfig.iTextLogFile).get_size() == 0) && ((aAVTConfig.iTextConfigFile).get_size() == 0)) 1663 { 1664 fprintf(file, " Text Config File/LogFile not available!!! Specify -textlogfile <filename> -textconfigfile <filename>\n\n"); 1665 return false; 1666 } 1667 } 1668 if ((firsttest >= 0 && lasttest < K3GP_OUTPUT_TestEnd) || (firsttest >= CompressedLongetivityTestBegin && lasttest < Compressed_LongetivityTestEnd)) 1669 { 1670 if (!(oscl_strstr(aOutputFileName.get_cstr(), ".3gp") != NULL || oscl_strstr(aOutputFileName.get_cstr(), ".3GP") != NULL)) 1671 { 1672 fprintf(file, " Output Filename incorrect!!! TestNo:%d - %d needs Output File:-output <xxx>.3gp\n\n", firsttest, lasttest); 1673 return false; 1674 } 1675 } 1676 else if ((firsttest > K3GP_OUTPUT_TestEnd && lasttest < AMR_OUTPUT_TestEnd)) 1677 { 1678 if (!(oscl_strstr(aOutputFileName.get_cstr(), ".amr") != NULL || oscl_strstr(aOutputFileName.get_cstr(), ".AMR") != NULL)) 1679 { 1680 fprintf(file, "Output Filename incorrect!!! Output File:-output <xxx>.amr\n\n"); 1681 return false; 1682 } 1683 } 1684 else if ((firsttest == AACADIF_FOutput_Test)) 1685 { 1686 if (!(oscl_strstr(aOutputFileName.get_cstr(), ".aacadif") != NULL || oscl_strstr(aOutputFileName.get_cstr(), ".AACADIF") != NULL)) 1687 { 1688 fprintf(file, "Output Filename incorrect!!! Output File:-output <xxx>.aacadif\n\n"); 1689 return false; 1690 } 1691 } 1692 else if ((firsttest == AACADTS_FOutput_Test)) 1693 { 1694 if (!(oscl_strstr(aOutputFileName.get_cstr(), ".aacadts") != NULL || oscl_strstr(aOutputFileName.get_cstr(), ".AACADTS") != NULL)) 1695 { 1696 fprintf(file, "Output Filename incorrect!!! Output File:-output <xxx>.aacadts\n\n"); 1697 return false; 1698 } 1699 } 1700 return true; 1701 } 1702 1703 1704 //////////////////////////////////////////////////////////////////////////// 1705 int _local_main(FILE *filehandle, cmd_line* command_line); 1706 1707 int local_main(FILE* filehandle, cmd_line* command_line) 1708 { 1709 int retVal; 1710 retVal = 0; 1711 OsclBase::Init(); 1712 OsclErrorTrap::Init(); 1713 OsclMem::Init(); 1714 1715 #if USE_OMX_ENC_NODE 1716 OMX_MasterInit(); 1717 #endif 1718 1719 { 1720 PVSDKInfo aSdkInfo; 1721 PVAuthorEngineInterface::GetSDKInfo(aSdkInfo); 1722 fprintf(filehandle, "SDK Labeled: %s built on %x\n\n", // display SDK info 1723 aSdkInfo.iLabel.get_cstr(), aSdkInfo.iDate); 1724 } 1725 1726 file = filehandle; 1727 fprintf(file, "PVAuthorEngine Unit Test\n\n"); 1728 1729 bool oPrintDetailedMemLeakInfo = false; 1730 FindMemMgmtRelatedCmdLineParams(command_line, oPrintDetailedMemLeakInfo, filehandle); 1731 1732 //Run the test under a trap 1733 int32 err; 1734 1735 OSCL_TRY(err, retVal = _local_main(filehandle, command_line);); 1736 1737 //Show any exception. 1738 if (err != 0) 1739 { 1740 fprintf(file, "Error! Leave %d\n", err); 1741 } 1742 #if USE_OMX_ENC_NODE 1743 OMX_MasterDeinit(); 1744 #endif 1745 //Cleanup 1746 #if !(OSCL_BYPASS_MEMMGT) 1747 { 1748 //Check for memory leaks before cleaning up OsclMem. 1749 OsclAuditCB auditCB; 1750 OsclMemInit(auditCB); 1751 if (auditCB.pAudit) 1752 { 1753 MM_Stats_t *stats = auditCB.pAudit->MM_GetStats(""); 1754 if (stats) 1755 { 1756 fprintf(file, "\nMemory Stats:\n"); 1757 fprintf(file, " peakNumAllocs %d\n", stats->peakNumAllocs); 1758 fprintf(file, " peakNumBytes %d\n", stats->peakNumBytes); 1759 fprintf(file, " totalNumAllocs %d\n", stats->totalNumAllocs); 1760 fprintf(file, " totalNumBytes %d\n", stats->totalNumBytes); 1761 fprintf(file, " numAllocFails %d\n", stats->numAllocFails); 1762 if (stats->numAllocs) 1763 { 1764 fprintf(file, " ERROR: Memory Leaks! numAllocs %d, numBytes %d\n", stats->numAllocs, stats->numBytes); 1765 } 1766 } 1767 uint32 leaks = auditCB.pAudit->MM_GetNumAllocNodes(); 1768 if (leaks != 0) 1769 { 1770 if (oPrintDetailedMemLeakInfo) 1771 { 1772 fprintf(file, "ERROR: %d Memory leaks detected!\n", leaks); 1773 MM_AllocQueryInfo*info = auditCB.pAudit->MM_CreateAllocNodeInfo(leaks); 1774 uint32 leakinfo = auditCB.pAudit->MM_GetAllocNodeInfo(info, leaks, 0); 1775 if (leakinfo != leaks) 1776 { 1777 fprintf(file, "ERROR: Leak info is incomplete.\n"); 1778 } 1779 for (uint32 ii = 0; ii < leakinfo; ii++) 1780 { 1781 fprintf(file, "Leak Info:\n"); 1782 fprintf(file, " allocNum %d\n", info[ii].allocNum); 1783 fprintf(file, " fileName %s\n", info[ii].fileName); 1784 fprintf(file, " lineNo %d\n", info[ii].lineNo); 1785 fprintf(file, " size %d\n", info[ii].size); 1786 fprintf(file, " pMemBlock 0x%x\n", (uint32)info[ii].pMemBlock); 1787 fprintf(file, " tag %s\n", info[ii].tag); 1788 } 1789 auditCB.pAudit->MM_ReleaseAllocNodeInfo(info); 1790 } 1791 } 1792 } 1793 } 1794 1795 #endif 1796 1797 OsclMem::Cleanup(); 1798 OsclErrorTrap::Cleanup(); 1799 OsclBase::Cleanup(); 1800 1801 return retVal; 1802 } 1803 1804 1805 void FindAuthoringTime(cmd_line* aCmdLine, uint32& aAuthoringTime, FILE* aFile) 1806 { 1807 int timeArgument = 0; 1808 bool timeArgFound = false; 1809 bool cmdline_iswchar = aCmdLine->is_wchar(); 1810 1811 int count = aCmdLine->get_count(); 1812 1813 // Search for the "-duration" argument 1814 // Go through each argument 1815 for (int argSearch = 0; argSearch < count; argSearch++) 1816 { 1817 char argstr[128]; 1818 // Convert to UTF8 if necessary 1819 if (cmdline_iswchar) 1820 { 1821 oscl_wchar* argwstr = NULL; 1822 aCmdLine->get_arg(argSearch, argwstr); 1823 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 1824 argstr[127] = '\0'; 1825 } 1826 else 1827 { 1828 char* tmpstr = NULL; 1829 aCmdLine->get_arg(argSearch, tmpstr); 1830 int32 tmpstrlen = oscl_strlen(tmpstr) + 1; 1831 if (tmpstrlen > 128) 1832 { 1833 tmpstrlen = 128; 1834 } 1835 oscl_strncpy(argstr, tmpstr, tmpstrlen); 1836 argstr[tmpstrlen-1] = '\0'; 1837 } 1838 1839 // Do the string compare 1840 if (0 == oscl_strcmp(argstr, "-help")) 1841 { 1842 fprintf(aFile, "Authoring Time specification option for Author.:\n"); 1843 fprintf(aFile, " -duration time_in_seconds\n"); 1844 fprintf(aFile, " Specify the time argument to use for test cases which\n"); 1845 fprintf(aFile, " allow user-specified source name.\n\n"); 1846 } 1847 else if (0 == oscl_strcmp(argstr, "-duration")) 1848 { 1849 timeArgFound = true; 1850 timeArgument = ++argSearch; 1851 break; 1852 } 1853 } 1854 1855 if (timeArgFound) 1856 { 1857 // Convert to UTF8 if necessary 1858 if (cmdline_iswchar) 1859 { 1860 oscl_wchar* wCharTime; 1861 aCmdLine->get_arg(timeArgument, wCharTime); 1862 char tmpstr[256]; 1863 oscl_UnicodeToUTF8(wCharTime, oscl_strlen(wCharTime), tmpstr, 256); 1864 tmpstr[255] = '\0'; 1865 PV_atoi(tmpstr, '0', aAuthoringTime); // ash liz 1866 } 1867 else 1868 { 1869 char* CharTime; 1870 aCmdLine->get_arg(timeArgument, CharTime); 1871 PV_atoi(CharTime, '0', aAuthoringTime); 1872 } 1873 } 1874 else //if the -duration tag is missing from cmd line 1875 { 1876 aAuthoringTime = 0; 1877 } 1878 } 1879 1880 // Pull out source file name from arguments 1881 // -source sometestfile.mp4 1882 // 1883 // 1884 void FindSourceFile(cmd_line* command_line, OSCL_HeapString<OsclMemAllocator> &aFileNameInfo, PVMFFormatType &aInputFileFormatType, FILE *aFile) 1885 { 1886 int iFileArgument = 0; 1887 bool iFileFound = false; 1888 bool cmdline_iswchar = command_line->is_wchar(); 1889 1890 int count = command_line->get_count(); 1891 1892 // Search for the "-source" argument 1893 // Go through each argument 1894 for (int iFileSearch = 0; iFileSearch < count; iFileSearch++) 1895 { 1896 char argstr[128]; 1897 // Convert to UTF8 if necessary 1898 if (cmdline_iswchar) 1899 { 1900 oscl_wchar* argwstr = NULL; 1901 command_line->get_arg(iFileSearch, argwstr); 1902 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 1903 argstr[127] = '\0'; 1904 } 1905 else 1906 { 1907 char* tmpstr = NULL; 1908 command_line->get_arg(iFileSearch, tmpstr); 1909 int32 tmpstrlen = oscl_strlen(tmpstr) + 1; 1910 if (tmpstrlen > 128) 1911 { 1912 tmpstrlen = 128; 1913 } 1914 oscl_strncpy(argstr, tmpstr, tmpstrlen); 1915 argstr[tmpstrlen-1] = '\0'; 1916 } 1917 1918 // Do the string compare 1919 if (oscl_strcmp(argstr, "-help") == 0) 1920 { 1921 fprintf(aFile, "Source specification option.:\n"); 1922 fprintf(aFile, " -source sourcename\n"); 1923 fprintf(aFile, " Specify the source filename or URL to use for test cases which\n"); 1924 fprintf(aFile, " allow user-specified source name. The unit test determines the\n"); 1925 fprintf(aFile, " source format type using extension or URL header.\n\n"); 1926 } 1927 else if (oscl_strcmp(argstr, "-source") == 0) 1928 { 1929 iFileFound = true; 1930 iFileArgument = ++iFileSearch; 1931 break; 1932 } 1933 } 1934 1935 if (iFileFound) 1936 { 1937 // Convert to UTF8 if necessary 1938 if (cmdline_iswchar) 1939 { 1940 oscl_wchar* cmd; 1941 command_line->get_arg(iFileArgument, cmd); 1942 char tmpstr[256]; 1943 oscl_UnicodeToUTF8(cmd, oscl_strlen(cmd), tmpstr, 256); 1944 tmpstr[255] = '\0'; 1945 aFileNameInfo = tmpstr; 1946 } 1947 else 1948 { 1949 char* cmdlinefilename = NULL; 1950 command_line->get_arg(iFileArgument, cmdlinefilename); 1951 aFileNameInfo = cmdlinefilename; 1952 } 1953 1954 // Check the file extension to determine format type 1955 // AVI file 1956 if (oscl_strstr(aFileNameInfo.get_cstr(), ".avi") != NULL || oscl_strstr(aFileNameInfo.get_cstr(), ".AAC") != NULL) 1957 { 1958 aInputFileFormatType = PVMF_MIME_AVIFF; 1959 } 1960 // WAV file 1961 else if (oscl_strstr(aFileNameInfo.get_cstr(), ".wav") != NULL || oscl_strstr(aFileNameInfo.get_cstr(), ".MP3") != NULL) 1962 { 1963 aInputFileFormatType = PVMF_MIME_WAVFF; 1964 } 1965 // Unknown so set to unknown try to have the player engine recognize 1966 else 1967 { 1968 fprintf(file, "Source type unknown so setting to unknown and have the player engine recognize it\n"); 1969 aInputFileFormatType = PVMF_MIME_FORMAT_UNKNOWN; 1970 } 1971 } 1972 } 1973 1974 //get video encoder type from arguments 1975 // -encV 0: M4V 1976 // 1: H263 1977 // 2: H264 1978 1979 void FindVideoEncoder(cmd_line* command_line, OSCL_HeapString<OsclMemAllocator>& aVideoEncoderInfo, FILE *aFile) 1980 { 1981 aVideoEncoderInfo = SOURCENAME_PREPEND_STRING; 1982 aVideoEncoderInfo += KMp4EncMimeType; 1983 1984 int cmdArgIndex = 0; 1985 bool cmdline_iswchar = command_line->is_wchar(); 1986 1987 int count = command_line->get_count(); 1988 1989 // Search for the "-encV" argument 1990 for (int ii = 0; ii < count; ii++) 1991 { 1992 char argstr[128]; 1993 1994 // Convert to UTF8 if necessary 1995 if (cmdline_iswchar) 1996 { 1997 oscl_wchar* argwstr = NULL; 1998 command_line->get_arg(ii, argwstr); 1999 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 2000 argstr[127] = '\0'; 2001 } 2002 else 2003 { 2004 char* tmpargstr = NULL; 2005 command_line->get_arg(ii, tmpargstr); 2006 uint32 len = oscl_strlen(tmpargstr); 2007 oscl_strncpy(argstr, tmpargstr, len); 2008 argstr[len] = '\0'; 2009 } 2010 2011 // Do the string compare 2012 if (oscl_strcmp(argstr, "-help") == 0) 2013 { 2014 fprintf(aFile, "Video Encoder Type option. Default is M4V:\n"); 2015 fprintf(aFile, " -encV encodertype\n"); 2016 fprintf(aFile, " specifies the encoder to be used for authoring\n 0:M4V\n 1:H263\n 2:H264\n"); 2017 fprintf(aFile, " e.g -encV 0 \n\n"); 2018 } 2019 else if (oscl_strcmp(argstr, "-encV") == 0) 2020 { 2021 cmdArgIndex = ++ii; 2022 break; 2023 } 2024 } 2025 2026 if (cmdArgIndex > 0) 2027 { 2028 uint32 encType = 0; 2029 2030 // Convert to UTF8 if necessary 2031 if (cmdline_iswchar) 2032 { 2033 oscl_wchar* cmdArg; 2034 command_line->get_arg(cmdArgIndex, cmdArg); 2035 char tmpstr[3]; 2036 oscl_UnicodeToUTF8(cmdArg, oscl_strlen(cmdArg), tmpstr, 3); 2037 tmpstr[2] = '\0'; 2038 PV_atoi(tmpstr, 'd', 1, encType); 2039 } 2040 else 2041 { 2042 char* cmdArg = NULL; 2043 command_line->get_arg(cmdArgIndex, cmdArg); 2044 PV_atoi(cmdArg, 'd', 1, encType); 2045 2046 } 2047 2048 switch (encType) 2049 { 2050 case 0: 2051 aVideoEncoderInfo = KMp4EncMimeType; 2052 break; 2053 case 1: 2054 aVideoEncoderInfo = KH263EncMimeType; 2055 break; 2056 case 2: 2057 aVideoEncoderInfo = KH264EncMimeType; 2058 break; 2059 default: 2060 fprintf(aFile, "Encoder Type not supported\n Using M4V encoder\n"); 2061 break; 2062 } 2063 2064 } 2065 } 2066 2067 //get audio encoder type from arguments 2068 // -encA 0: AMR-NB 2069 // 1: AMR-WB 2070 // 2: AAC-ADIF 2071 // 3: AAC-ADTS 2072 // 4: AAC-MPEG4_AUDIO 2073 2074 void FindAudioEncoder(cmd_line* command_line, OSCL_HeapString<OsclMemAllocator>& aAudioEncoderInfo, FILE *aFile) 2075 { 2076 aAudioEncoderInfo = SOURCENAME_PREPEND_STRING; 2077 aAudioEncoderInfo += KAMRNbEncMimeType; 2078 2079 int cmdArgIndex = 0; 2080 bool cmdline_iswchar = command_line->is_wchar(); 2081 2082 int count = command_line->get_count(); 2083 2084 // Search for the "-encA" argument 2085 for (int ii = 0; ii < count; ii++) 2086 { 2087 char argstr[128]; 2088 2089 // Convert to UTF8 if necessary 2090 if (cmdline_iswchar) 2091 { 2092 oscl_wchar* argwstr = NULL; 2093 command_line->get_arg(ii, argwstr); 2094 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 2095 argstr[127] = '\0'; 2096 } 2097 else 2098 { 2099 char* tmpargstr = NULL; 2100 command_line->get_arg(ii, tmpargstr); 2101 uint32 len = oscl_strlen(tmpargstr); 2102 oscl_strncpy(argstr, tmpargstr, len); 2103 argstr[len] = '\0'; 2104 } 2105 2106 // Do the string compare 2107 if (oscl_strcmp(argstr, "-help") == 0) 2108 { 2109 fprintf(aFile, "Audio Encoder Type option. Default is AMRNb:\n"); 2110 fprintf(aFile, " -encA encodertype\n"); 2111 fprintf(aFile, " specifies the encoder to be used for authoring\n 0:AMRNb\n 1:AMRWb\n 2:AAC_ADIF\n 3:AAC_ADTS\n 4:AAC MPEG4\n"); 2112 fprintf(aFile, " e.g -encA 0 \n\n"); 2113 } 2114 else if (oscl_strcmp(argstr, "-encA") == 0) 2115 { 2116 cmdArgIndex = ++ii; 2117 break; 2118 } 2119 } 2120 2121 if (cmdArgIndex > 0) 2122 { 2123 uint32 encType = 0; 2124 2125 // Convert to UTF8 if necessary 2126 if (cmdline_iswchar) 2127 { 2128 oscl_wchar* cmdArg; 2129 command_line->get_arg(cmdArgIndex, cmdArg); 2130 char tmpstr[3]; 2131 oscl_UnicodeToUTF8(cmdArg, oscl_strlen(cmdArg), tmpstr, 3); 2132 tmpstr[2] = '\0'; 2133 PV_atoi(tmpstr, 'd', 1, encType); 2134 } 2135 else 2136 { 2137 char* cmdArg = NULL; 2138 command_line->get_arg(cmdArgIndex, cmdArg); 2139 PV_atoi(cmdArg, 'd', 1, encType); 2140 2141 } 2142 2143 switch (encType) 2144 { 2145 case 0: 2146 aAudioEncoderInfo = KAMRNbEncMimeType; 2147 break; 2148 case 1: 2149 aAudioEncoderInfo = KAMRWbEncMimeType; 2150 break; 2151 case 2: 2152 aAudioEncoderInfo = KAACADIFEncMimeType; 2153 break; 2154 case 3: 2155 aAudioEncoderInfo = KAACADTSEncMimeType; 2156 break; 2157 case 4: 2158 aAudioEncoderInfo = KAACMP4EncMimeType; 2159 break; 2160 default: 2161 fprintf(aFile, "Encoder Type not supported\n Using AMR-NB encoder\n"); 2162 break; 2163 } 2164 2165 } 2166 } 2167 2168 bool FindAuthoringMode(cmd_line* command_line, FILE *aFile) 2169 { 2170 bool iAuthoringMode = false; 2171 bool cmdline_iswchar = command_line->is_wchar(); 2172 2173 int count = command_line->get_count(); 2174 2175 // Search for the "-realtime" argument 2176 for (int ii = 0; ii < count; ii++) 2177 { 2178 char argstr[128]; 2179 2180 // Convert to UTF8 if necessary 2181 if (cmdline_iswchar) 2182 { 2183 oscl_wchar* argwstr = NULL; 2184 command_line->get_arg(ii, argwstr); 2185 oscl_UnicodeToUTF8(argwstr, oscl_strlen(argwstr), argstr, 128); 2186 argstr[127] = '\0'; 2187 } 2188 else 2189 { 2190 char* tmpargstr = NULL; 2191 command_line->get_arg(ii, tmpargstr); 2192 uint32 len = oscl_strlen(tmpargstr); 2193 oscl_strncpy(argstr, tmpargstr, len); 2194 argstr[len] = '\0'; 2195 } 2196 2197 // Do the string compare 2198 if (oscl_strcmp(argstr, "-help") == 0) 2199 { 2200 fprintf(aFile, " -realtime \n"); 2201 fprintf(aFile, " specifies the authoring of output file will be done in real time mode\n"); 2202 fprintf(aFile, " test cases should be run one by one to author a file in realtime mode\n"); 2203 fprintf(aFile, " by default file will be authored in ASAP mode\n\n"); 2204 } 2205 else if (0 == oscl_strcmp(argstr, "-realtime")) 2206 { 2207 iAuthoringMode = true; 2208 break; 2209 } 2210 } 2211 2212 return iAuthoringMode; 2213 } 2214 OSCL_HeapString<OsclMemAllocator> FindComposerType(OSCL_HeapString<OsclMemAllocator> aFileName, FILE* aFile) 2215 { 2216 OSCL_HeapString<OsclMemAllocator> compType; 2217 if (oscl_strstr(aFileName.get_str(), ".3gp")) 2218 { 2219 compType = K3gpComposerMimeType; 2220 } 2221 else if (oscl_strstr(aFileName.get_str(), ".amr")) 2222 { 2223 compType = KAMRNbComposerMimeType; 2224 } 2225 else if (oscl_strstr(aFileName.get_str(), ".awb")) 2226 { 2227 compType = KAMRWBComposerMimeType; 2228 } 2229 else 2230 { 2231 fprintf(aFile, "\n\nNo output file specified\n, Using default MP4 Composer\n"); 2232 compType = K3gpComposerMimeType; 2233 } 2234 2235 return compType; 2236 } 2237 ////////////////////////////////////////////////////////////////////////////////////////////// 2238 ////////////////////////////////////////////////////////////////////////////////////////////// 2239 2240 int RunCompressedTest(cmd_line *aCommandLine, int32 &iFirstTest, int32 &iLastTest, FILE *afilehandle) 2241 { 2242 int retVal = 1; 2243 file = afilehandle; 2244 int32 err; 2245 2246 OSCL_HeapString<OsclMemAllocator> audiofilenameinfo = NULL; 2247 OSCL_HeapString<OsclMemAllocator> videofilenameinfo = NULL; 2248 OSCL_HeapString<OsclMemAllocator> textfilenameinfo = NULL; 2249 OSCL_HeapString<OsclMemAllocator> outputfilenameinfo = NULL; 2250 2251 OSCL_HeapString<OsclMemAllocator> audioconfigfilename = NULL; 2252 OSCL_HeapString<OsclMemAllocator> videoconfigfilename = NULL; 2253 AVTConfig aAVTConfig; 2254 2255 //Hard Coded Audio/Video values 2256 aAVTConfig.iWidth = KVideoFrameWidth; 2257 aAVTConfig.iHeight = KVideoFrameHeight; 2258 aAVTConfig.iFps = KVideoFrameRate; 2259 aAVTConfig.iFrameInterval = KVideoIFrameInterval; 2260 2261 aAVTConfig.iNumChannels = KAudioNumChannels; 2262 aAVTConfig.iSamplingRate = KAudioTimescale; 2263 aAVTConfig.iLoopingEnable = false; 2264 // Check -audio, -video and -output tag if user wants to use command line given compressed inputs 2265 if (iFirstTest == iLastTest) 2266 { 2267 FindAudioSourceFile(aCommandLine, audiofilenameinfo, file); 2268 2269 FindVideoSourceFile(aCommandLine, videofilenameinfo, file); 2270 2271 FindTextSourceFile(aCommandLine, textfilenameinfo, aAVTConfig.iTextLogFile, aAVTConfig.iTextConfigFile, file); 2272 2273 FindOutputFile(aCommandLine, outputfilenameinfo, file); 2274 } 2275 2276 PVAETestInputType aAudioInputType = INVALID_INPUT_TYPE; // param1 2277 PVAETestInputType aVideoInputType = INVALID_INPUT_TYPE; // param2 2278 PVAETestInputType aTextInputType = INVALID_INPUT_TYPE; // param3 2279 OSCL_HeapString<OsclMemAllocator> aComposerMimeType = NULL; // param3 2280 OSCL_HeapString<OsclMemAllocator> aAudioEncoderMimeType = NULL; // param4 2281 OSCL_HeapString<OsclMemAllocator> aVideoEncoderMimeType = NULL; // param5 2282 OSCL_HeapString<OsclMemAllocator> aTextEncoderMimeType = NULL; // param6 2283 2284 //If -audio , -video, -text and -output tags are not specified, we will assume hard coded input and output filenames(So no need to check validity of args) 2285 if (!((audiofilenameinfo == NULL) && (videofilenameinfo == NULL) && (textfilenameinfo == NULL) && (outputfilenameinfo == NULL))) 2286 { 2287 //This function will be used for only non generic tests 2288 if (CheckSourceAndOutputFiles(aCommandLine, iFirstTest, iLastTest, audiofilenameinfo, videofilenameinfo, textfilenameinfo, outputfilenameinfo, aAVTConfig, audioconfigfilename, videoconfigfilename, file) == false) 2289 { 2290 return 1; 2291 } 2292 } 2293 2294 2295 uint32 AuthoringTime; 2296 if ((iLastTest >= CompressedLongetivityTestBegin) && (iFirstTest <= Compressed_LongetivityTestEnd)) 2297 2298 { 2299 FindAuthoringTime(aCommandLine, AuthoringTime, file); 2300 aAVTConfig.iLoopingEnable = true; 2301 } 2302 2303 fprintf(file, " \nInput audio file name:%s\n Input video filename:%s\n Output filename:%s \n", audiofilenameinfo.get_cstr(), videofilenameinfo.get_cstr(), outputfilenameinfo.get_cstr()); 2304 fprintf(file, " Audio Configfile name:%s\n Video Configfilename:%s\n", audioconfigfilename.get_cstr(), videoconfigfilename.get_cstr()); 2305 fprintf(file, " Test case range %d to %d\n", iFirstTest, iLastTest); 2306 2307 OSCL_TRY(err, 2308 2309 PVAuthorEngineTestSuite* testSuite = new PVAuthorEngineTestSuite(file, iFirstTest, iLastTest, 2310 audiofilenameinfo.get_cstr(), videofilenameinfo.get_cstr(), textfilenameinfo.get_cstr(), 2311 outputfilenameinfo.get_cstr(), aAVTConfig, 2312 aAudioInputType, aVideoInputType, aTextInputType, 2313 aComposerMimeType.get_cstr(), aAudioEncoderMimeType.get_cstr(), aVideoEncoderMimeType.get_cstr(), aTextEncoderMimeType.get_cstr(), AuthoringTime); 2314 2315 testSuite->run_test(); 2316 //if (runTestErr != OSCL_ERR_NONE) 2317 // fprintf(file, "ERROR: Leave Occurred! Reason %d \n", runTestErr); 2318 2319 text_test_interpreter interp; 2320 _STRING rs = interp.interpretation(testSuite->last_result()); 2321 fprintf(file, rs.c_str()); 2322 const test_result the_result = testSuite->last_result(); 2323 retVal = (int)(the_result.success_count() != the_result.total_test_count()); 2324 2325 delete testSuite; 2326 testSuite = NULL; 2327 ); 2328 // end if statement if ((iFirstTest <= CompressedNormalTestEnd)) 2329 if (err != OSCL_ERR_NONE) 2330 { 2331 fprintf(file, "ERROR: Leave Occurred! Reason %d \n", err); 2332 return 1; 2333 } 2334 return retVal; 2335 } 2336 ///////////////////////////////////////////////////////////////////////////////////////// 2337 2338 int RunUnCompressedTest(cmd_line *aCommandLine, int32 &aFirstTest, int32 &aLastTest, FILE *afilehandle) 2339 { 2340 int retVal = 1; 2341 file = afilehandle; 2342 int32 err; 2343 2344 OSCL_HeapString<OsclMemAllocator> filenameinfo; 2345 OSCL_HeapString<OsclMemAllocator> outputfilenameinfo; 2346 OSCL_HeapString<OsclMemAllocator> videoencoderinfo; 2347 OSCL_HeapString<OsclMemAllocator> audioencoderinfo; 2348 OSCL_HeapString<OsclMemAllocator> configfileinfo; 2349 PVMFFormatType inputformattype ; 2350 PVMediaInputAuthorEngineTestParam testparam; 2351 2352 2353 FindSourceFile(aCommandLine, filenameinfo, inputformattype, file); 2354 FindOutputFile(aCommandLine, outputfilenameinfo, file); 2355 FindVideoEncoder(aCommandLine, videoencoderinfo, file); 2356 FindAudioEncoder(aCommandLine, audioencoderinfo, file); 2357 2358 testparam.iFirstTest = aFirstTest; 2359 testparam.iLastTest = aLastTest; 2360 testparam.iMediainputParam.iFile = file; 2361 testparam.iMediainputParam.iInputFormat = inputformattype; 2362 testparam.iMediainputParam.iIPFileInfo = filenameinfo; 2363 testparam.iMediainputParam.iOPFileInfo = outputfilenameinfo; 2364 testparam.iMediainputParam.iVideoEncInfo = videoencoderinfo; 2365 testparam.iMediainputParam.iAudioEncInfo = audioencoderinfo; //KAMRNbEncMimeType; 2366 testparam.iMediainputParam.iComposerInfo = FindComposerType(outputfilenameinfo, file); 2367 2368 //setting the default configuration info 2369 testparam.iMediainputParam.iAudioBitrate = 0; 2370 testparam.iMediainputParam.iVideoBitrate = 0; 2371 testparam.iMediainputParam.iFrameRate = 0.0; 2372 testparam.iMediainputParam.iSamplingRate = 0; 2373 2374 //checks authoring mode (-realtime).By default is ASAP mode 2375 testparam.iMediainputParam.iRealTimeAuthoring = FindAuthoringMode(aCommandLine, file); 2376 2377 // Load video configuration 2378 if (FindAVIConfigFile(aCommandLine, configfileinfo, file)) 2379 { 2380 LoadAVIConfiguration(configfileinfo, testparam, file); 2381 } 2382 2383 //iAsap is used when we run testcases in one go i.e running TC 0 to TC 569 2384 if (testparam.iMediainputParam.iRealTimeAuthoring) 2385 { 2386 testparam.iAsap = false; 2387 } 2388 else 2389 { 2390 testparam.iAsap = true; 2391 } 2392 2393 FindAuthoringTime(aCommandLine, testparam.iMediainputParam.iLoopTime, file); 2394 if ((PVMediaInput_ErrorHandling_Test_WrongFormat != aFirstTest) 2395 && (PVMediaInput_ErrorHandling_Test_WrongIPFileName != aFirstTest)) 2396 { 2397 fprintf(file, "Begin test with the following parameters:\ 2398 \nInput File Name : %s\nOutput File Name: %s,\nVideo Encoder: %s,\nAudio Encoder: %s,\ 2399 \nComposer: %s\n", testparam.iMediainputParam.iIPFileInfo.get_cstr(), testparam.iMediainputParam.iOPFileInfo.get_cstr(), 2400 testparam.iMediainputParam.iVideoEncInfo.get_cstr(), testparam.iMediainputParam.iAudioEncInfo.get_cstr(), 2401 testparam.iMediainputParam.iComposerInfo.get_cstr()); 2402 } 2403 2404 OSCL_TRY(err, 2405 PVMediaInputAuthorEngineTestSuite* test_suite = 2406 new PVMediaInputAuthorEngineTestSuite(testparam); 2407 test_suite->run_test(); 2408 text_test_interpreter interp; 2409 _STRING rs = interp.interpretation(test_suite->last_result()); 2410 fprintf(file, rs.c_str()); 2411 const test_result the_result = test_suite->last_result(); 2412 retVal = (int)(the_result.success_count() != the_result.total_test_count()); 2413 2414 delete test_suite; 2415 test_suite = NULL; 2416 ); 2417 if (err != OSCL_ERR_NONE) 2418 { 2419 fprintf(file, "ERROR: Leave Occurred! Reason %d \n", err); 2420 return 1; 2421 } 2422 return retVal; 2423 } 2424 2425 2426 2427 int _local_main(FILE *filehandle, cmd_line *command_line) 2428 { 2429 int retVal = 1; 2430 file = filehandle; 2431 2432 // Print out the extension for help if no argument 2433 int32 firsttest, lasttest; 2434 if (command_line->get_count() == 0) 2435 { 2436 fprintf(file, "****Specify '-help' to get CommandLine arguments information options****\n\n"); 2437 fprintf(file, "****Running all Author test cases****\n\n"); 2438 //return 0; 2439 firsttest = 0; 2440 lasttest = KUnCompressed_Errorhandling_TestEnd; 2441 } 2442 else 2443 { 2444 FindTestRange(command_line, firsttest, lasttest, file); 2445 fprintf(file, "[test range from: %d to: %d]\n\n", firsttest, lasttest); 2446 } 2447 2448 PVMFFormatType formaterr = PVMF_MIME_FORMAT_UNKNOWN; 2449 int32 err = 0; 2450 2451 OSCL_HeapString<OsclMemAllocator> filenameinfo; 2452 2453 if (Invalid_Test == firsttest) 2454 { 2455 //functions called to print command line arguments. 2456 fprintf(file, "CMD LINE ARGS FOR COMPRESSED TESTS [test range from: %d to: %d]\n\n", AMR_Input_AOnly_3gpTest, Compressed_LongetivityTestEnd); 2457 2458 FindAudioSourceFile(command_line, filenameinfo, file); 2459 FindVideoSourceFile(command_line, filenameinfo, file); 2460 FindOutputFile(command_line, filenameinfo, file); 2461 FindAuthoringTime(command_line, (uint32&)err, file); 2462 2463 fprintf(file, "CMD LINE ARGS FOR UNCOMPRESSED TESTS(with AVI/WAV inputs)[test range from %d to %d]\n\n", UnCompressed_NormalTestBegin, UnCompressed_LongetivityTestEnd); 2464 2465 FindSourceFile(command_line, filenameinfo, (PVMFFormatType&)formaterr, file); 2466 FindOutputFile(command_line, filenameinfo, file); 2467 FindVideoEncoder(command_line, filenameinfo, file); 2468 FindAudioEncoder(command_line, filenameinfo, file); 2469 FindAuthoringTime(command_line, (uint32&)err, file); 2470 2471 fprintf(file, "NO CMD LINE ARGS WERE REQUIRED TO RUN COMPRESSED ERROR HANDLING TESTS [test range from:%d to %d]\n\n", KCompressed_Errorhandling_TestBegin, KCompressed_Errorhandling_TestEnd); 2472 fprintf(file, "NO CMD LINE ARGS WERE REQUIRED TO RUN UNCOMPRESSED ERROR HANDLING TESTS [test range from:%d to %d]\n\n", KUnCompressed_Errorhandling_TestBegin, KUnCompressed_Errorhandling_TestEnd); 2473 2474 return 0; 2475 } 2476 2477 ///////////////////////Normal Compressed tests////////////////////// 2478 if (firsttest <= Compressed_LongetivityTestEnd) 2479 { 2480 retVal = RunCompressedTest(command_line, firsttest, lasttest, file); 2481 } 2482 ///////End of Normal Compressed tests/////////////////////////////////////// 2483 2484 ///////////////Uncompressed AVI normal and longetivity tests/////////////// 2485 if (((firsttest >= UnCompressed_NormalTestBegin) && (firsttest <= UnCompressed_LongetivityTestEnd)) 2486 || ((firsttest <= UnCompressed_NormalTestBegin) && (lasttest > UnCompressed_NormalTestBegin))) 2487 { 2488 retVal = RunUnCompressedTest(command_line, firsttest, lasttest, file); 2489 } 2490 //////////////////End of AVI normal and longetivity tests//////////////////// 2491 2492 //////////////////Compressed Errorhandling test begin///////////////////// 2493 if (((firsttest >= KCompressed_Errorhandling_TestBegin) && (firsttest <= KCompressed_Errorhandling_TestEnd)) 2494 || ((firsttest <= KCompressed_Errorhandling_TestBegin) && (lasttest > KCompressed_Errorhandling_TestBegin))) 2495 { 2496 2497 if (firsttest < KCompressed_Errorhandling_TestBegin) 2498 { 2499 firsttest = KCompressed_Errorhandling_TestBegin; 2500 } 2501 2502 retVal = RunCompressedTest(command_line, firsttest, lasttest, file); 2503 2504 }//////////////////Compressed Errorhandling test end///////////////////// 2505 2506 //////////////////UnCompressed Errorhandling test begin///////////////////// 2507 if (((lasttest > KUnCompressed_Errorhandling_TestBegin) && (lasttest <= KUnCompressed_Errorhandling_TestEnd)) 2508 || (((firsttest <= KUnCompressed_Errorhandling_TestBegin) || (firsttest >= KUnCompressed_Errorhandling_TestBegin)) 2509 && (lasttest > KUnCompressed_Errorhandling_TestEnd))) 2510 { 2511 if (firsttest < KUnCompressed_Errorhandling_TestBegin) 2512 { 2513 firsttest = KUnCompressed_Errorhandling_TestBegin; 2514 } 2515 retVal = RunUnCompressedTest(command_line, firsttest, lasttest, file); 2516 2517 } 2518 return retVal; 2519 } 2520 2521