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 TEST_PV_PLAYER_ENGINE_TESTSET1_H_INCLUDED 19 #include "test_pv_player_engine_testset1.h" 20 #endif 21 22 #ifndef OSCL_ERROR_CODES_H_INCLUDED 23 #include "oscl_error_codes.h" 24 #endif 25 26 #ifndef OSCL_TICKCOUNT_H_INCLUDED 27 #include "oscl_tickcount.h" 28 #endif 29 30 #ifndef PV_PLAYER_DATASINKPVMFNODE_H_INCLUDED 31 #include "pv_player_datasinkpvmfnode.h" 32 #endif 33 34 #ifndef PVMI_MEDIA_IO_FILEOUTPUT_H_INCLUDED 35 #include "pvmi_media_io_fileoutput.h" 36 #endif 37 38 #ifndef PV_MEDIA_OUTPUT_NODE_FACTORY_H_INCLUDED 39 #include "pv_media_output_node_factory.h" 40 #endif 41 42 #ifndef OSCL_UTF8CONV_H 43 #include "oscl_utf8conv.h" 44 #endif 45 46 #ifndef PVMI_KVP_H_INCLUDED 47 #include "pvmi_kvp.h" 48 #endif 49 50 #ifndef PVMI_KVP_UTIL_H_INCLUDED 51 #include "pvmi_kvp_util.h" 52 #endif 53 54 #ifndef PVMF_TIMESTAMP_H_INCLUDED 55 #include "pvmf_timestamp.h" 56 #endif 57 58 #ifndef PVMF_TRACK_LEVEL_INFO_EXTENSION_H_INCLUDED 59 #include "pvmf_track_level_info_extension.h" 60 #endif 61 62 #ifndef PVMF_ERRORINFOMESSAGE_EXTENSION_H_INCLUDED 63 #include "pvmf_errorinfomessage_extension.h" 64 #endif 65 66 #ifndef PVMI_CONFIG_AND_CAPABILITY_H_INCLUDED 67 #include "pvmi_config_and_capability.h" 68 #endif 69 70 #ifndef PVMF_LOCAL_DATA_SOURCE_H_INCLUDED 71 #include "pvmf_local_data_source.h" 72 #endif 73 74 #ifndef PVMF_CPMPLUGIN_PASSTHRU_OMA1_FACTORY_H_INCLUDED 75 #include "pvmf_cpmplugin_passthru_oma1_factory.h" 76 #endif 77 78 #ifndef PVMF_CPMPLUGIN_PASSTHRU_OMA1_TYPES_H_INCLUDED 79 #include "pvmf_cpmplugin_passthru_oma1_types.h" 80 #endif 81 82 #include "pvmi_media_io_fileoutput.h" 83 #include "pv_media_output_node_factory.h" 84 85 #ifndef PVMF_SOURCE_CONTEXT_DATA_H_INCLUDED 86 #include "pvmf_source_context_data.h" 87 #endif 88 89 #ifndef PVMI_DATASTREAMSYNCINTERFACE_REF_FACTORY_H_INCLUDED 90 #include "pvmi_datastreamsyncinterface_ref_factory.h" 91 #endif 92 93 extern FILE* file; 94 95 #define MAX_AUDIO_TRACKS 256 96 #define MAX_VIDEO_TRACKS 256 97 98 99 // 100 // pvplayer_async_test_newdelete section 101 // 102 void pvplayer_async_test_newdelete::StartTest() 103 { 104 AddToScheduler(); 105 RunIfNotReady(); 106 } 107 108 109 void pvplayer_async_test_newdelete::Run() 110 { 111 PVPlayerInterface *temp = NULL; 112 int error = 0; 113 114 OSCL_TRY(error, temp = PVPlayerFactory::CreatePlayer(this, this, this)); 115 if (error) 116 { 117 PVPATB_TEST_IS_TRUE(false); 118 } 119 else 120 { 121 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(temp)); 122 temp = NULL; 123 124 PVPATB_TEST_IS_TRUE(true); 125 } 126 127 iObserver->TestCompleted(*iTestCase); 128 } 129 130 131 void pvplayer_async_test_newdelete::CommandCompleted(const PVCmdResponse& /*aResponse*/) 132 { 133 // No callbacks in this test. 134 } 135 136 137 void pvplayer_async_test_newdelete::HandleErrorEvent(const PVAsyncErrorEvent& /*aEvent*/) 138 { 139 // No callbacks in this test 140 } 141 142 143 void pvplayer_async_test_newdelete::HandleInformationalEvent(const PVAsyncInformationalEvent& /*aEvent*/) 144 { 145 // No callbacks in this test 146 } 147 148 149 150 // 151 // pvplayer_async_test_openplaystopreset section 152 // 153 void pvplayer_async_test_openplaystopreset::StartTest() 154 { 155 AddToScheduler(); 156 iState = STATE_CREATE; 157 RunIfNotReady(); 158 } 159 160 161 void pvplayer_async_test_openplaystopreset::Run() 162 { 163 int error = 0; 164 165 switch (iState) 166 { 167 case STATE_CREATE: 168 { 169 iPlayer = NULL; 170 171 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 172 if (error) 173 { 174 PVPATB_TEST_IS_TRUE(false); 175 iObserver->TestCompleted(*iTestCase); 176 } 177 else 178 { 179 iState = STATE_ADDDATASOURCE; 180 RunIfNotReady(); 181 } 182 } 183 break; 184 185 case STATE_ADDDATASOURCE: 186 { 187 iDataSource = new PVPlayerDataSourceURL; 188 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 512); 189 wFileName.set(output, oscl_strlen(output)); 190 iDataSource->SetDataSourceURL(wFileName); 191 iDataSource->SetDataSourceFormatType(iFileType); 192 193 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 194 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 195 } 196 197 break; 198 199 case STATE_INIT: 200 { 201 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 202 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 203 } 204 break; 205 206 case STATE_ADDDATASINK_VIDEO: 207 { 208 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 209 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 210 SinkFileName += _STRLIT_WCHAR("test_player_openplaystop_"); 211 OSCL_wHeapString<OsclMemAllocator> inputfilename; 212 RetrieveFilename(wFileName.get_str(), inputfilename); 213 SinkFileName += inputfilename; 214 SinkFileName += _STRLIT_WCHAR("_video.dat"); 215 216 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & SinkFileName, MEDIATYPE_VIDEO, iCompressedVideo); 217 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 218 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 219 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 220 221 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 222 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 223 } 224 break; 225 226 case STATE_ADDDATASINK_AUDIO: 227 { 228 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 229 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 230 SinkFileName += _STRLIT_WCHAR("test_player_openplaystop_"); 231 OSCL_wHeapString<OsclMemAllocator> inputfilename; 232 RetrieveFilename(wFileName.get_str(), inputfilename); 233 SinkFileName += inputfilename; 234 SinkFileName += _STRLIT_WCHAR("_audio.dat"); 235 236 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & SinkFileName, MEDIATYPE_AUDIO, iCompressedAudio); 237 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 238 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 239 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 240 241 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 242 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 243 } 244 break; 245 246 case STATE_ADDDATASINK_TEXT: 247 { 248 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 249 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 250 SinkFileName += _STRLIT_WCHAR("test_player_openplaystop_"); 251 OSCL_wHeapString<OsclMemAllocator> inputfilename; 252 RetrieveFilename(wFileName.get_str(), inputfilename); 253 SinkFileName += inputfilename; 254 SinkFileName += _STRLIT_WCHAR("_text.dat"); 255 256 iMIOFileOutText = iMioFactory->CreateTextOutput((OsclAny*) & SinkFileName, MEDIATYPE_TEXT); 257 iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutText); 258 iDataSinkText = new PVPlayerDataSinkPVMFNode; 259 ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText); 260 261 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 262 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 263 } 264 break; 265 266 case STATE_PREPARE: 267 { 268 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 269 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 270 } 271 break; 272 273 case STATE_START: 274 { 275 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 276 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 277 } 278 break; 279 280 case STATE_STOP: 281 { 282 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 283 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 284 } 285 break; 286 287 case STATE_REMOVEDATASINK_VIDEO: 288 { 289 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 290 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 291 } 292 break; 293 294 case STATE_REMOVEDATASINK_AUDIO: 295 { 296 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 297 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 298 } 299 break; 300 301 case STATE_REMOVEDATASINK_TEXT: 302 { 303 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 304 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 305 } 306 break; 307 308 case STATE_RESET: 309 { 310 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 311 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 312 } 313 break; 314 315 case STATE_REMOVEDATASOURCE: 316 { 317 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 318 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 319 } 320 break; 321 322 case STATE_CLEANUPANDCOMPLETE: 323 { 324 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 325 iPlayer = NULL; 326 327 delete iDataSource; 328 iDataSource = NULL; 329 330 delete iDataSinkVideo; 331 iDataSinkVideo = NULL; 332 333 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 334 iIONodeVideo = NULL; 335 336 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 337 iMIOFileOutVideo = NULL; 338 339 delete iDataSinkAudio; 340 iDataSinkAudio = NULL; 341 342 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 343 iIONodeAudio = NULL; 344 345 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 346 iMIOFileOutAudio = NULL; 347 348 delete iDataSinkText; 349 iDataSinkText = NULL; 350 351 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText); 352 iIONodeText = NULL; 353 354 iMioFactory->DestroyTextOutput(iMIOFileOutText); 355 iMIOFileOutText = NULL; 356 357 iObserver->TestCompleted(*iTestCase); 358 } 359 break; 360 361 default: 362 break; 363 364 } 365 } 366 367 368 void pvplayer_async_test_openplaystopreset::CommandCompleted(const PVCmdResponse& aResponse) 369 { 370 if (aResponse.GetCmdId() != iCurrentCmdId) 371 { 372 // Wrong command ID. 373 PVPATB_TEST_IS_TRUE(false); 374 iState = STATE_CLEANUPANDCOMPLETE; 375 RunIfNotReady(); 376 return; 377 } 378 379 if (aResponse.GetContext() != NULL) 380 { 381 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 382 { 383 if (iContextObject != iContextObjectRefValue) 384 { 385 // Context data value was corrupted 386 PVPATB_TEST_IS_TRUE(false); 387 iState = STATE_CLEANUPANDCOMPLETE; 388 RunIfNotReady(); 389 return; 390 } 391 } 392 else 393 { 394 // Context data pointer was corrupted 395 PVPATB_TEST_IS_TRUE(false); 396 iState = STATE_CLEANUPANDCOMPLETE; 397 RunIfNotReady(); 398 return; 399 } 400 } 401 402 switch (iState) 403 { 404 case STATE_ADDDATASOURCE: 405 if (aResponse.GetCmdStatus() == PVMFSuccess) 406 { 407 iState = STATE_INIT; 408 RunIfNotReady(); 409 } 410 else 411 { 412 // AddDataSource failed 413 PVPATB_TEST_IS_TRUE(false); 414 iState = STATE_CLEANUPANDCOMPLETE; 415 RunIfNotReady(); 416 } 417 break; 418 419 case STATE_INIT: 420 if (aResponse.GetCmdStatus() == PVMFSuccess) 421 { 422 iState = STATE_ADDDATASINK_VIDEO; 423 RunIfNotReady(); 424 } 425 else 426 { 427 // Init failed 428 PVPATB_TEST_IS_TRUE(false); 429 iState = STATE_CLEANUPANDCOMPLETE; 430 RunIfNotReady(); 431 } 432 break; 433 434 case STATE_ADDDATASINK_VIDEO: 435 if (aResponse.GetCmdStatus() == PVMFSuccess) 436 { 437 iState = STATE_ADDDATASINK_AUDIO; 438 RunIfNotReady(); 439 } 440 else 441 { 442 // AddDataSink failed 443 PVPATB_TEST_IS_TRUE(false); 444 iState = STATE_CLEANUPANDCOMPLETE; 445 RunIfNotReady(); 446 } 447 break; 448 449 case STATE_ADDDATASINK_AUDIO: 450 if (aResponse.GetCmdStatus() == PVMFSuccess) 451 { 452 iState = STATE_ADDDATASINK_TEXT; 453 RunIfNotReady(); 454 } 455 else 456 { 457 // AddDataSink failed 458 PVPATB_TEST_IS_TRUE(false); 459 iState = STATE_CLEANUPANDCOMPLETE; 460 RunIfNotReady(); 461 } 462 break; 463 464 case STATE_ADDDATASINK_TEXT: 465 if (aResponse.GetCmdStatus() == PVMFSuccess) 466 { 467 iState = STATE_PREPARE; 468 RunIfNotReady(); 469 } 470 else 471 { 472 // AddDataSink failed 473 PVPATB_TEST_IS_TRUE(false); 474 iState = STATE_CLEANUPANDCOMPLETE; 475 RunIfNotReady(); 476 } 477 break; 478 479 case STATE_PREPARE: 480 if (aResponse.GetCmdStatus() == PVMFSuccess) 481 { 482 iState = STATE_START; 483 RunIfNotReady(); 484 } 485 else 486 { 487 // Prepare failed 488 PVPATB_TEST_IS_TRUE(false); 489 iState = STATE_CLEANUPANDCOMPLETE; 490 RunIfNotReady(); 491 } 492 break; 493 494 case STATE_START: 495 if (aResponse.GetCmdStatus() == PVMFSuccess) 496 { 497 iState = STATE_STOP; 498 RunIfNotReady(15000000); 499 } 500 else 501 { 502 // Start failed 503 PVPATB_TEST_IS_TRUE(false); 504 iState = STATE_CLEANUPANDCOMPLETE; 505 RunIfNotReady(); 506 } 507 break; 508 509 case STATE_STOP: 510 if (aResponse.GetCmdStatus() == PVMFSuccess) 511 { 512 iState = STATE_REMOVEDATASINK_VIDEO; 513 RunIfNotReady(); 514 } 515 else 516 { 517 // Stop failed 518 PVPATB_TEST_IS_TRUE(false); 519 iState = STATE_CLEANUPANDCOMPLETE; 520 RunIfNotReady(); 521 } 522 break; 523 524 case STATE_REMOVEDATASINK_VIDEO: 525 if (aResponse.GetCmdStatus() == PVMFSuccess) 526 { 527 iState = STATE_REMOVEDATASINK_AUDIO; 528 RunIfNotReady(); 529 } 530 else 531 { 532 // RemoveDataSink failed 533 PVPATB_TEST_IS_TRUE(false); 534 iState = STATE_CLEANUPANDCOMPLETE; 535 RunIfNotReady(); 536 } 537 break; 538 539 case STATE_REMOVEDATASINK_AUDIO: 540 if (aResponse.GetCmdStatus() == PVMFSuccess) 541 { 542 iState = STATE_REMOVEDATASINK_TEXT; 543 RunIfNotReady(); 544 } 545 else 546 { 547 // RemoveDataSink failed 548 PVPATB_TEST_IS_TRUE(false); 549 iState = STATE_CLEANUPANDCOMPLETE; 550 RunIfNotReady(); 551 } 552 break; 553 554 case STATE_REMOVEDATASINK_TEXT: 555 if (aResponse.GetCmdStatus() == PVMFSuccess) 556 { 557 iState = STATE_RESET; 558 RunIfNotReady(); 559 } 560 else 561 { 562 // RemoveDataSink failed 563 PVPATB_TEST_IS_TRUE(false); 564 iState = STATE_CLEANUPANDCOMPLETE; 565 RunIfNotReady(); 566 } 567 break; 568 569 case STATE_RESET: 570 if (aResponse.GetCmdStatus() == PVMFSuccess) 571 { 572 iState = STATE_REMOVEDATASOURCE; 573 RunIfNotReady(); 574 } 575 else 576 { 577 // Reset failed 578 PVPATB_TEST_IS_TRUE(false); 579 iState = STATE_CLEANUPANDCOMPLETE; 580 RunIfNotReady(); 581 } 582 break; 583 584 case STATE_REMOVEDATASOURCE: 585 if (aResponse.GetCmdStatus() == PVMFSuccess) 586 { 587 PVPATB_TEST_IS_TRUE(true); 588 iState = STATE_CLEANUPANDCOMPLETE; 589 RunIfNotReady(); 590 } 591 else 592 { 593 // RemoveDataSource failed 594 PVPATB_TEST_IS_TRUE(false); 595 iState = STATE_CLEANUPANDCOMPLETE; 596 RunIfNotReady(); 597 } 598 break; 599 600 default: 601 { 602 // Testing error if this is reached 603 PVPATB_TEST_IS_TRUE(false); 604 iState = STATE_CLEANUPANDCOMPLETE; 605 RunIfNotReady(); 606 } 607 break; 608 } 609 } 610 611 612 void pvplayer_async_test_openplaystopreset::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 613 { 614 switch (aEvent.GetEventType()) 615 { 616 case PVMFErrResourceConfiguration: 617 // Just log the error 618 PVPATB_TEST_IS_TRUE(false); 619 break; 620 621 case PVMFErrResource: 622 // Just log the error 623 PVPATB_TEST_IS_TRUE(false); 624 break; 625 626 case PVMFErrCorrupt: 627 // Just log the error 628 PVPATB_TEST_IS_TRUE(false); 629 break; 630 631 case PVMFErrProcessing: 632 // Just log the error 633 PVPATB_TEST_IS_TRUE(false); 634 break; 635 636 default: 637 // Unknown error and just log the error 638 PVPATB_TEST_IS_TRUE(false); 639 break; 640 } 641 642 // Wait for engine to handle the error 643 Cancel(); 644 } 645 646 647 void pvplayer_async_test_openplaystopreset::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 648 { 649 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 650 { 651 // do nothing 652 } 653 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 654 { 655 iState = STATE_CLEANUPANDCOMPLETE; 656 RunIfNotReady(); 657 } 658 if (aEvent.GetEventType() == PVMFInfoPositionStatus) 659 { 660 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 661 if (iface == NULL) 662 { 663 return; 664 } 665 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 666 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 667 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 668 { 669 int32 infocode; 670 PVUuid infouuid; 671 infomsgiface->GetCodeUUID(infocode, infouuid); 672 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoPlaybackPositionStatus)) 673 { 674 PVPPlaybackPosition aPos1; 675 uint32 aPos2; 676 677 aPos1.iPosUnit = PVPPBPOSUNIT_MILLISEC; 678 iPlayer->GetCurrentPositionSync(aPos1); 679 680 uint8* localbuf = aEvent.GetLocalBuffer(); 681 if (aEvent.GetLocalBufferSize() == 8 && localbuf[0] == 1) 682 { 683 oscl_memcpy(&aPos2, &localbuf[4], sizeof(uint32)); 684 } 685 else 686 { 687 aPos2 = 0; 688 } 689 690 if (!(aPos1.iPosValue.millisec_value <= aPos2 + 50)) 691 { 692 PVPATB_TEST_IS_TRUE(false); 693 } 694 } 695 } 696 } 697 } 698 699 700 // 701 // pvplayer_async_test_cpmopenplaystopreset section 702 // 703 void pvplayer_async_test_cpmopenplaystopreset::StartTest() 704 { 705 AddToScheduler(); 706 iState = STATE_CREATE; 707 RunIfNotReady(); 708 } 709 710 711 void pvplayer_async_test_cpmopenplaystopreset::Run() 712 { 713 int error = 0; 714 715 switch (iState) 716 { 717 case STATE_CREATE: 718 { 719 iPlayer = NULL; 720 721 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 722 if (error) 723 { 724 PVPATB_TEST_IS_TRUE(false); 725 iObserver->TestCompleted(*iTestCase); 726 } 727 else 728 { 729 iState = STATE_ADDDATASOURCE; 730 RunIfNotReady(); 731 } 732 } 733 break; 734 735 case STATE_ADDDATASOURCE: 736 { 737 iDataSource = new PVPlayerDataSourceURL; 738 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 512); 739 wFileName.set(output, oscl_strlen(output)); 740 iDataSource->SetDataSourceURL(wFileName); 741 iDataSource->SetDataSourceFormatType(iFileType); 742 743 //This illustrates the use of CPM with a file source. 744 745 //Connect to plugin registry 746 PVMFStatus status; 747 status = iPluginRegistryClient.Connect(); 748 if (status != PVMFSuccess) 749 { 750 PVPATB_TEST_IS_TRUE(false); 751 iState = STATE_CLEANUPANDCOMPLETE; 752 RunIfNotReady(); 753 break; 754 } 755 //Create & the passthru plugin factory. 756 iPluginFactory = new PVMFOma1PassthruPluginFactory(); 757 if (!iPluginFactory) 758 { 759 PVPATB_TEST_IS_TRUE(false); 760 iState = STATE_CLEANUPANDCOMPLETE; 761 RunIfNotReady(); 762 break; 763 } 764 //Register the passthru plugin factory. 765 iPluginMimeType = PVMF_CPM_MIME_PASSTHRU_OMA1; 766 if (iPluginRegistryClient.RegisterPlugin(iPluginMimeType, *iPluginFactory) != PVMFSuccess) 767 { 768 PVPATB_TEST_IS_TRUE(false); 769 iState = STATE_CLEANUPANDCOMPLETE; 770 RunIfNotReady(); 771 break; 772 } 773 774 if (iUsingDataStreamInput) 775 { 776 //Create a data stream factory for recognizer (a) 777 int32 leavecode = 0; 778 OSCL_TRY(leavecode, iDataStreamFactory = OSCL_STATIC_CAST(PVMFDataStreamFactory*, new PVMIDataStreamSyncInterfaceRefFactory(wFileName))); 779 OSCL_FIRST_CATCH_ANY(leavecode, 780 PVPATB_TEST_IS_TRUE(false); 781 iState = STATE_CLEANUPANDCOMPLETE; 782 RunIfNotReady(); 783 break; 784 ); 785 786 iSourceContextData = new PVMFSourceContextData(); 787 iSourceContextData->EnableCommonSourceContext(); 788 iSourceContextData->CommonData()->iRecognizerDataStreamFactory = iDataStreamFactory; 789 790 iDataSource->SetDataSourceContextData((OsclAny*)iSourceContextData); 791 } 792 else 793 { 794 //Create a data source 795 iLocalDataSource = new PVMFLocalDataSource(); 796 797 iDataSource->SetDataSourceContextData((OsclAny*)iLocalDataSource); 798 } 799 800 801 //Add the data source 802 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 803 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 804 } 805 806 break; 807 808 case STATE_INIT: 809 { 810 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 811 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 812 } 813 break; 814 815 case STATE_ADDDATASINK_VIDEO: 816 { 817 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 818 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 819 SinkFileName += _STRLIT_WCHAR("test_player_cpmopenplaystop_"); 820 OSCL_wHeapString<OsclMemAllocator> inputfilename; 821 RetrieveFilename(wFileName.get_str(), inputfilename); 822 SinkFileName += inputfilename; 823 SinkFileName += _STRLIT_WCHAR("_video.dat"); 824 825 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & SinkFileName, MEDIATYPE_VIDEO, iCompressedVideo); 826 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 827 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 828 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 829 830 831 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 832 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 833 } 834 break; 835 836 case STATE_ADDDATASINK_AUDIO: 837 { 838 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 839 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 840 SinkFileName += _STRLIT_WCHAR("test_player_cpmopenplaystop_"); 841 OSCL_wHeapString<OsclMemAllocator> inputfilename; 842 RetrieveFilename(wFileName.get_str(), inputfilename); 843 SinkFileName += inputfilename; 844 SinkFileName += _STRLIT_WCHAR("_audio.dat"); 845 846 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & SinkFileName, MEDIATYPE_AUDIO, iCompressedAudio); 847 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 848 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 849 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 850 851 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 852 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 853 } 854 break; 855 856 case STATE_ADDDATASINK_TEXT: 857 { 858 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 859 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 860 SinkFileName += _STRLIT_WCHAR("test_player_cpmopenplaystop_"); 861 OSCL_wHeapString<OsclMemAllocator> inputfilename; 862 RetrieveFilename(wFileName.get_str(), inputfilename); 863 SinkFileName += inputfilename; 864 SinkFileName += _STRLIT_WCHAR("_text.dat"); 865 866 iMIOFileOutText = iMioFactory->CreateTextOutput((OsclAny*) & SinkFileName, MEDIATYPE_TEXT); 867 iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutText); 868 iDataSinkText = new PVPlayerDataSinkPVMFNode; 869 ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText); 870 871 872 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 873 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 874 } 875 break; 876 877 case STATE_PREPARE: 878 { 879 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 880 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 881 } 882 break; 883 884 case STATE_START: 885 { 886 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 887 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 888 } 889 break; 890 891 case STATE_STOP: 892 { 893 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 894 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 895 } 896 break; 897 898 case STATE_REMOVEDATASINK_VIDEO: 899 { 900 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 901 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 902 } 903 break; 904 905 case STATE_REMOVEDATASINK_AUDIO: 906 { 907 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 908 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 909 } 910 break; 911 912 case STATE_REMOVEDATASINK_TEXT: 913 { 914 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 915 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 916 } 917 break; 918 919 case STATE_RESET: 920 { 921 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 922 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 923 } 924 break; 925 926 case STATE_REMOVEDATASOURCE: 927 { 928 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 929 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 930 } 931 break; 932 933 case STATE_CLEANUPANDCOMPLETE: 934 { 935 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 936 iPlayer = NULL; 937 938 delete iDataSource; 939 iDataSource = NULL; 940 941 delete iDataSinkVideo; 942 iDataSinkVideo = NULL; 943 944 delete iDataStreamFactory; 945 iDataStreamFactory = NULL; 946 947 delete iSourceContextData; 948 iSourceContextData = NULL; 949 950 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 951 iIONodeVideo = NULL; 952 953 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 954 iMIOFileOutVideo = NULL; 955 956 delete iDataSinkAudio; 957 iDataSinkAudio = NULL; 958 959 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 960 iIONodeAudio = NULL; 961 962 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 963 iMIOFileOutAudio = NULL; 964 965 delete iDataSinkText; 966 iDataSinkText = NULL; 967 968 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText); 969 iIONodeText = NULL; 970 971 iMioFactory->DestroyTextOutput(iMIOFileOutText); 972 iMIOFileOutText = NULL; 973 974 //close and cleanup the CPM plugin registry. 975 iPluginRegistryClient.Close(); 976 977 //delete the plugin factory. 978 if (iPluginFactory) 979 { 980 delete iPluginFactory; 981 iPluginFactory = NULL; 982 } 983 984 delete iLocalDataSource; 985 iLocalDataSource = NULL; 986 987 iObserver->TestCompleted(*iTestCase); 988 } 989 break; 990 991 default: 992 break; 993 994 } 995 } 996 997 998 void pvplayer_async_test_cpmopenplaystopreset::CommandCompleted(const PVCmdResponse& aResponse) 999 { 1000 if (aResponse.GetCmdId() != iCurrentCmdId) 1001 { 1002 // Wrong command ID. 1003 PVPATB_TEST_IS_TRUE(false); 1004 iState = STATE_CLEANUPANDCOMPLETE; 1005 RunIfNotReady(); 1006 return; 1007 } 1008 1009 if (aResponse.GetContext() != NULL) 1010 { 1011 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 1012 { 1013 if (iContextObject != iContextObjectRefValue) 1014 { 1015 // Context data value was corrupted 1016 PVPATB_TEST_IS_TRUE(false); 1017 iState = STATE_CLEANUPANDCOMPLETE; 1018 RunIfNotReady(); 1019 return; 1020 } 1021 } 1022 else 1023 { 1024 // Context data pointer was corrupted 1025 PVPATB_TEST_IS_TRUE(false); 1026 iState = STATE_CLEANUPANDCOMPLETE; 1027 RunIfNotReady(); 1028 return; 1029 } 1030 } 1031 1032 switch (iState) 1033 { 1034 case STATE_ADDDATASOURCE: 1035 if (aResponse.GetCmdStatus() == PVMFSuccess) 1036 { 1037 iState = STATE_INIT; 1038 RunIfNotReady(); 1039 } 1040 else 1041 { 1042 // AddDataSource failed 1043 PVPATB_TEST_IS_TRUE(false); 1044 iState = STATE_CLEANUPANDCOMPLETE; 1045 RunIfNotReady(); 1046 } 1047 break; 1048 1049 case STATE_INIT: 1050 if (aResponse.GetCmdStatus() == PVMFSuccess) 1051 { 1052 iState = STATE_ADDDATASINK_VIDEO; 1053 RunIfNotReady(); 1054 } 1055 else 1056 { 1057 // Init failed 1058 PVPATB_TEST_IS_TRUE(false); 1059 iState = STATE_CLEANUPANDCOMPLETE; 1060 RunIfNotReady(); 1061 } 1062 break; 1063 1064 case STATE_ADDDATASINK_VIDEO: 1065 if (aResponse.GetCmdStatus() == PVMFSuccess) 1066 { 1067 iState = STATE_ADDDATASINK_AUDIO; 1068 RunIfNotReady(); 1069 } 1070 else 1071 { 1072 // AddDataSink failed 1073 PVPATB_TEST_IS_TRUE(false); 1074 iState = STATE_CLEANUPANDCOMPLETE; 1075 RunIfNotReady(); 1076 } 1077 break; 1078 1079 case STATE_ADDDATASINK_AUDIO: 1080 if (aResponse.GetCmdStatus() == PVMFSuccess) 1081 { 1082 iState = STATE_ADDDATASINK_TEXT; 1083 RunIfNotReady(); 1084 } 1085 else 1086 { 1087 // AddDataSink failed 1088 PVPATB_TEST_IS_TRUE(false); 1089 iState = STATE_CLEANUPANDCOMPLETE; 1090 RunIfNotReady(); 1091 } 1092 break; 1093 1094 case STATE_ADDDATASINK_TEXT: 1095 if (aResponse.GetCmdStatus() == PVMFSuccess) 1096 { 1097 iState = STATE_PREPARE; 1098 RunIfNotReady(); 1099 } 1100 else 1101 { 1102 // AddDataSink failed 1103 PVPATB_TEST_IS_TRUE(false); 1104 iState = STATE_CLEANUPANDCOMPLETE; 1105 RunIfNotReady(); 1106 } 1107 break; 1108 1109 case STATE_PREPARE: 1110 if (aResponse.GetCmdStatus() == PVMFSuccess) 1111 { 1112 iState = STATE_START; 1113 RunIfNotReady(); 1114 } 1115 else 1116 { 1117 // Prepare failed 1118 PVPATB_TEST_IS_TRUE(false); 1119 iState = STATE_CLEANUPANDCOMPLETE; 1120 RunIfNotReady(); 1121 } 1122 break; 1123 1124 case STATE_START: 1125 if (aResponse.GetCmdStatus() == PVMFSuccess) 1126 { 1127 iState = STATE_STOP; 1128 RunIfNotReady(15000000); 1129 } 1130 else 1131 { 1132 // Start failed 1133 PVPATB_TEST_IS_TRUE(false); 1134 iState = STATE_CLEANUPANDCOMPLETE; 1135 RunIfNotReady(); 1136 } 1137 break; 1138 1139 case STATE_STOP: 1140 if (aResponse.GetCmdStatus() == PVMFSuccess) 1141 { 1142 iState = STATE_REMOVEDATASINK_VIDEO; 1143 RunIfNotReady(); 1144 } 1145 else 1146 { 1147 // Stop failed 1148 PVPATB_TEST_IS_TRUE(false); 1149 iState = STATE_CLEANUPANDCOMPLETE; 1150 RunIfNotReady(); 1151 } 1152 break; 1153 1154 case STATE_REMOVEDATASINK_VIDEO: 1155 if (aResponse.GetCmdStatus() == PVMFSuccess) 1156 { 1157 iState = STATE_REMOVEDATASINK_AUDIO; 1158 RunIfNotReady(); 1159 } 1160 else 1161 { 1162 // RemoveDataSink failed 1163 PVPATB_TEST_IS_TRUE(false); 1164 iState = STATE_CLEANUPANDCOMPLETE; 1165 RunIfNotReady(); 1166 } 1167 break; 1168 1169 case STATE_REMOVEDATASINK_AUDIO: 1170 if (aResponse.GetCmdStatus() == PVMFSuccess) 1171 { 1172 iState = STATE_REMOVEDATASINK_TEXT; 1173 RunIfNotReady(); 1174 } 1175 else 1176 { 1177 // RemoveDataSink failed 1178 PVPATB_TEST_IS_TRUE(false); 1179 iState = STATE_CLEANUPANDCOMPLETE; 1180 RunIfNotReady(); 1181 } 1182 break; 1183 1184 case STATE_REMOVEDATASINK_TEXT: 1185 if (aResponse.GetCmdStatus() == PVMFSuccess) 1186 { 1187 iState = STATE_RESET; 1188 RunIfNotReady(); 1189 } 1190 else 1191 { 1192 // RemoveDataSink failed 1193 PVPATB_TEST_IS_TRUE(false); 1194 iState = STATE_CLEANUPANDCOMPLETE; 1195 RunIfNotReady(); 1196 } 1197 break; 1198 1199 case STATE_RESET: 1200 if (aResponse.GetCmdStatus() == PVMFSuccess) 1201 { 1202 iState = STATE_REMOVEDATASOURCE; 1203 RunIfNotReady(); 1204 } 1205 else 1206 { 1207 // Reset failed 1208 PVPATB_TEST_IS_TRUE(false); 1209 iState = STATE_CLEANUPANDCOMPLETE; 1210 RunIfNotReady(); 1211 } 1212 break; 1213 1214 case STATE_REMOVEDATASOURCE: 1215 if (aResponse.GetCmdStatus() == PVMFSuccess) 1216 { 1217 PVPATB_TEST_IS_TRUE(true); 1218 iState = STATE_CLEANUPANDCOMPLETE; 1219 RunIfNotReady(); 1220 } 1221 else 1222 { 1223 // RemoveDataSource failed 1224 PVPATB_TEST_IS_TRUE(false); 1225 iState = STATE_CLEANUPANDCOMPLETE; 1226 RunIfNotReady(); 1227 } 1228 break; 1229 1230 default: 1231 { 1232 // Testing error if this is reached 1233 PVPATB_TEST_IS_TRUE(false); 1234 iState = STATE_CLEANUPANDCOMPLETE; 1235 RunIfNotReady(); 1236 } 1237 break; 1238 } 1239 } 1240 1241 1242 void pvplayer_async_test_cpmopenplaystopreset::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 1243 { 1244 switch (aEvent.GetEventType()) 1245 { 1246 case PVMFErrResourceConfiguration: 1247 // Just log the error 1248 PVPATB_TEST_IS_TRUE(false); 1249 break; 1250 1251 case PVMFErrResource: 1252 // Just log the error 1253 PVPATB_TEST_IS_TRUE(false); 1254 break; 1255 1256 case PVMFErrCorrupt: 1257 // Just log the error 1258 PVPATB_TEST_IS_TRUE(false); 1259 break; 1260 1261 case PVMFErrProcessing: 1262 // Just log the error 1263 PVPATB_TEST_IS_TRUE(false); 1264 break; 1265 1266 default: 1267 // Unknown error and just log the error 1268 PVPATB_TEST_IS_TRUE(false); 1269 break; 1270 } 1271 1272 // Wait for engine to handle the error 1273 Cancel(); 1274 } 1275 1276 1277 void pvplayer_async_test_cpmopenplaystopreset::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 1278 { 1279 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 1280 { 1281 // do nothing 1282 } 1283 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 1284 { 1285 iState = STATE_CLEANUPANDCOMPLETE; 1286 RunIfNotReady(); 1287 } 1288 if (aEvent.GetEventType() == PVMFInfoPositionStatus) 1289 { 1290 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 1291 if (iface == NULL) 1292 { 1293 return; 1294 } 1295 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 1296 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 1297 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 1298 { 1299 int32 infocode; 1300 PVUuid infouuid; 1301 infomsgiface->GetCodeUUID(infocode, infouuid); 1302 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoPlaybackPositionStatus)) 1303 { 1304 PVPPlaybackPosition aPos1; 1305 uint32 aPos2; 1306 1307 aPos1.iPosUnit = PVPPBPOSUNIT_MILLISEC; 1308 iPlayer->GetCurrentPositionSync(aPos1); 1309 1310 uint8* localbuf = aEvent.GetLocalBuffer(); 1311 if (aEvent.GetLocalBufferSize() == 8 && localbuf[0] == 1) 1312 { 1313 oscl_memcpy(&aPos2, &localbuf[4], sizeof(uint32)); 1314 } 1315 else 1316 { 1317 aPos2 = 0; 1318 } 1319 1320 if (!(aPos1.iPosValue.millisec_value <= aPos2 + 50)) 1321 { 1322 PVPATB_TEST_IS_TRUE(false); 1323 } 1324 } 1325 } 1326 } 1327 } 1328 1329 // 1330 // pvplayer_async_test_metadata section 1331 // 1332 1333 // Expected number of keys and values 1334 #define METADATA_GETMETADATAKEYS1_NUMKEYS 21 1335 #define METADATA_GETMETADATAVALUES1_NUMVALUES 28 1336 #define METADATA_GETMETADATAKEYS2_QUERYSTRING "codec-info/video" 1337 #define METADATA_GETMETADATAKEYS2_NUMKEYS 3 1338 #define METADATA_GETMETADATAVALUES2_NUMVALUES 3 1339 #define METADATA_GETMETADATAKEYS3_NUMKEYS 21 1340 #define METADATA_GETMETADATAVALUES3_NUMVALUES 28 1341 #define METADATA_GETMETADATAKEYSSEG_NUMKEYS 24 1342 #define METADATA_GETMETADATAVALUESSEG_NUMVALUES 31 1343 1344 // The metadata keys and values to compare 1345 // Modify the following #defines for different source files 1346 #define METADATA_TITLE_KEY "title;valtype=wchar*" 1347 #define METADATA_TITLE_VALUE "alien-14-x-1d66-x-128-10-g4.mp4" 1348 #define METADATA_TITLE_VALUE_W _STRLIT_WCHAR("alien-14-x-1d66-x-128-10-g4.mp4") 1349 #define METADATA_AUTHOR_KEY "author;valtype=wchar*" 1350 #define METADATA_AUTHOR_VALUE "PacketVideo Embedded Solutions Test Content" 1351 #define METADATA_AUTHOR_VALUE_W _STRLIT_WCHAR("PacketVideo Embedded Solutions Test Content") 1352 #define METADATA_DESCRIPTION_KEY "description;valtype=wchar*" 1353 #define METADATA_DESCRIPTION_VALUE "This test clip is in support of Embedded Solutions project testing." 1354 #define METADATA_DESCRIPTION_VALUE_W _STRLIT_WCHAR("This test clip is in support of Embedded Solutions project testing.") 1355 #define METADATA_RATING_KEY "rating;valtype=wchar*" 1356 #define METADATA_RATING_VALUE "Test Material Only; Not for general distribution" 1357 #define METADATA_RATING_VALUE_W _STRLIT_WCHAR("Test Material Only; Not for general distribution") 1358 #define METADATA_COPYRIGHT_KEY "copyright;valtype=wchar*" 1359 #define METADATA_COPYRIGHT_VALUE "PacketVideo, Corp, Test Suite 2003" 1360 #define METADATA_COPYRIGHT_VALUE_W _STRLIT_WCHAR("PacketVideo, Corp, Test Suite 2003") 1361 #define METADATA_VERSION_KEY "version;valtype=wchar*" 1362 #define METADATA_VERSION_VALUE "Content V3.3 PVAuthor V3.3 Build 005" 1363 #define METADATA_VERSION_VALUE_W _STRLIT_WCHAR("Content V3.3 PVAuthor V3.3 Build 005") 1364 #define METADATA_DATE_KEY "date;valtype=wchar*" 1365 #define METADATA_DATE_VALUE "20030210T193127.546Z" 1366 #define METADATA_DATE_VALUE_W _STRLIT_WCHAR("20030210T193127.546Z") 1367 #define METADATA_DURATION_KEY "duration;valtype=uint32;timescale=1000" 1368 #define METADATA_DURATION_VALUE 42749 1369 #define METADATA_NUMTRACKS_KEY "num-tracks;valtype=uint32" 1370 #define METADATA_NUMTRACKS_VALUE 2 1371 #define METADATA_TRACKINFOTYPE0_KEY "track-info/type;valtype=char*;index=0" 1372 #define METADATA_TRACKINFOTYPE0_VALUE "video/MP4V-ES" 1373 #define METADATA_TRACKINFOTYPE1_KEY "track-info/type;valtype=char*;index=1" 1374 #define METADATA_TRACKINFOTYPE1_VALUE "X-AMR-IETF-SEPARATE" 1375 #define METADATA_TRACKINFO_AUDIOFORMAT1_KEY "track-info/audio/format;valtype=char*;index=1" 1376 #define METADATA_TRACKINFO_AUDIOFORMAT1_VALUE "X-AMR-IETF-SEPARATE" 1377 #define METADATA_TRACKINFODURATION0_KEY "track-info/duration;valtype=uint32;index=0;timescale=1000" 1378 #define METADATA_TRACKINFODURATION0_VALUE 42749 1379 #define METADATA_TRACKINFODURATION1_KEY "track-info/duration;valtype=uint32;index=1;timescale=1000" 1380 #define METADATA_TRACKINFODURATION1_VALUE 42360 1381 #define METADATA_TRACKINFOBITRATE0_KEY "track-info/bit-rate;valtype=uint32;index=0" 1382 #define METADATA_TRACKINFOBITRATE0_VALUE 6770 1383 #define METADATA_TRACKINFOBITRATE1_KEY "track-info/bit-rate;valtype=uint32;index=1" 1384 #define METADATA_TRACKINFOBITRATE1_VALUE 4750 1385 #define METADATA_TRACKINFOVIDEOWIDTH0_KEY "track-info/video/width;valtype=uint32;index=0" 1386 #define METADATA_TRACKINFOVIDEOWIDTH0_VALUE 128 1387 #define METADATA_TRACKINFOVIDEOWIDTH1_KEY "track-info/video/width;valtype=uint32;index=1" 1388 #define METADATA_TRACKINFOVIDEOWIDTH1_VALUE 0 1389 #define METADATA_TRACKINFOVIDEOHEIGHT0_KEY "track-info/video/height;valtype=uint32;index=0" 1390 #define METADATA_TRACKINFOVIDEOHEIGHT0_VALUE 96 1391 #define METADATA_TRACKINFOVIDEOHEIGHT1_KEY "track-info/video/height;valtype=uint32;index=1" 1392 #define METADATA_TRACKINFOVIDEOHEIGHT1_VALUE 0 1393 #define METADATA_CODECINFOVIDEOWIDTH_KEY "codec-info/video/width;valtype=uint32" 1394 #define METADATA_CODECINFOVIDEOWIDTH_VALUE 128 1395 #define METADATA_CODECINFOVIDEOHEIGHT_KEY "codec-info/video/height;valtype=uint32" 1396 #define METADATA_CODECINFOVIDEOHEIGHT_VALUE 96 1397 1398 int32 pvplayer_async_test_metadata::CheckMetadataValue(Oscl_Vector<PvmiKvp, OsclMemAllocator>& aValueList) 1399 { 1400 uint32 valcount = 0; 1401 int32 errorbitarray = 0; // 0x1=> Error in returned value; 1402 // 0x2=> Number of values entries do not match the known expected 1403 // 0x4=> Unknown value type 1404 1405 for (uint32 i = 0; i < aValueList.size(); i++) 1406 { 1407 if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TITLE_KEY)) == 0) 1408 { 1409 valcount++; 1410 1411 switch (GetValTypeFromKeyString(aValueList[i].key)) 1412 { 1413 case PVMI_KVPVALTYPE_WCHARPTR: 1414 if (oscl_strcmp(aValueList[i].value.pWChar_value, METADATA_TITLE_VALUE_W) != 0) 1415 { 1416 errorbitarray |= 0x1; 1417 } 1418 break; 1419 1420 case PVMI_KVPVALTYPE_CHARPTR: 1421 if (oscl_strcmp(aValueList[i].value.pChar_value, _STRLIT_CHAR(METADATA_TITLE_VALUE)) != 0) 1422 { 1423 errorbitarray |= 0x1; 1424 } 1425 break; 1426 default: 1427 // Unknown value type so can't compare 1428 errorbitarray |= 0x4; 1429 break; 1430 } 1431 } 1432 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_AUTHOR_KEY)) == 0) 1433 { 1434 valcount++; 1435 1436 switch (GetValTypeFromKeyString(aValueList[i].key)) 1437 { 1438 case PVMI_KVPVALTYPE_WCHARPTR: 1439 if (oscl_strcmp(aValueList[i].value.pWChar_value, METADATA_AUTHOR_VALUE_W) != 0) 1440 { 1441 errorbitarray |= 0x1; 1442 } 1443 break; 1444 1445 case PVMI_KVPVALTYPE_CHARPTR: 1446 if (oscl_strcmp(aValueList[i].value.pChar_value, _STRLIT_CHAR(METADATA_AUTHOR_VALUE)) != 0) 1447 { 1448 errorbitarray |= 0x1; 1449 } 1450 break; 1451 1452 default: 1453 // Unknown value type so can't compare 1454 errorbitarray |= 0x4; 1455 break; 1456 } 1457 } 1458 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_DESCRIPTION_KEY)) == 0) 1459 { 1460 valcount++; 1461 1462 switch (GetValTypeFromKeyString(aValueList[i].key)) 1463 { 1464 case PVMI_KVPVALTYPE_WCHARPTR: 1465 if (oscl_strcmp(aValueList[i].value.pWChar_value, METADATA_DESCRIPTION_VALUE_W) != 0) 1466 { 1467 errorbitarray |= 0x1; 1468 } 1469 break; 1470 1471 case PVMI_KVPVALTYPE_CHARPTR: 1472 if (oscl_strcmp(aValueList[i].value.pChar_value, _STRLIT_CHAR(METADATA_DESCRIPTION_VALUE)) != 0) 1473 { 1474 errorbitarray |= 0x1; 1475 } 1476 break; 1477 1478 default: 1479 // Unknown value type so can't compare 1480 errorbitarray |= 0x4; 1481 break; 1482 } 1483 } 1484 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_RATING_KEY)) == 0) 1485 { 1486 valcount++; 1487 1488 switch (GetValTypeFromKeyString(aValueList[i].key)) 1489 { 1490 case PVMI_KVPVALTYPE_WCHARPTR: 1491 if (oscl_strcmp(aValueList[i].value.pWChar_value, METADATA_RATING_VALUE_W) != 0) 1492 { 1493 errorbitarray |= 0x1; 1494 } 1495 break; 1496 1497 case PVMI_KVPVALTYPE_CHARPTR: 1498 if (oscl_strcmp(aValueList[i].value.pChar_value, _STRLIT_CHAR(METADATA_RATING_VALUE)) != 0) 1499 { 1500 errorbitarray |= 0x1; 1501 } 1502 break; 1503 1504 default: 1505 // Unknown value type so can't compare 1506 errorbitarray |= 0x4; 1507 break; 1508 } 1509 } 1510 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_COPYRIGHT_KEY)) == 0) 1511 { 1512 valcount++; 1513 1514 switch (GetValTypeFromKeyString(aValueList[i].key)) 1515 { 1516 case PVMI_KVPVALTYPE_WCHARPTR: 1517 if (oscl_strcmp(aValueList[i].value.pWChar_value, METADATA_COPYRIGHT_VALUE_W) != 0) 1518 { 1519 errorbitarray |= 0x1; 1520 } 1521 break; 1522 1523 case PVMI_KVPVALTYPE_CHARPTR: 1524 if (oscl_strcmp(aValueList[i].value.pChar_value, _STRLIT_CHAR(METADATA_COPYRIGHT_VALUE)) != 0) 1525 { 1526 errorbitarray |= 0x1; 1527 } 1528 break; 1529 1530 default: 1531 // Unknown value type so can't compare 1532 errorbitarray |= 0x4; 1533 break; 1534 } 1535 } 1536 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_VERSION_KEY)) == 0) 1537 { 1538 valcount++; 1539 1540 switch (GetValTypeFromKeyString(aValueList[i].key)) 1541 { 1542 case PVMI_KVPVALTYPE_WCHARPTR: 1543 if (oscl_strcmp(aValueList[i].value.pWChar_value, METADATA_VERSION_VALUE_W) != 0) 1544 { 1545 errorbitarray |= 0x1; 1546 } 1547 break; 1548 1549 case PVMI_KVPVALTYPE_CHARPTR: 1550 if (oscl_strcmp(aValueList[i].value.pChar_value, _STRLIT_CHAR(METADATA_VERSION_VALUE)) != 0) 1551 { 1552 errorbitarray |= 0x1; 1553 } 1554 break; 1555 1556 default: 1557 // Unknown value type so can't compare 1558 errorbitarray |= 0x4; 1559 break; 1560 } 1561 } 1562 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_DATE_KEY)) == 0) 1563 { 1564 valcount++; 1565 1566 switch (GetValTypeFromKeyString(aValueList[i].key)) 1567 { 1568 case PVMI_KVPVALTYPE_WCHARPTR: 1569 if (oscl_strcmp(aValueList[i].value.pWChar_value, METADATA_DATE_VALUE_W) != 0) 1570 { 1571 errorbitarray |= 0x1; 1572 } 1573 break; 1574 1575 case PVMI_KVPVALTYPE_CHARPTR: 1576 if (oscl_strcmp(aValueList[i].value.pChar_value, _STRLIT_CHAR(METADATA_DATE_VALUE)) != 0) 1577 { 1578 errorbitarray |= 0x1; 1579 } 1580 break; 1581 1582 default: 1583 // Unknown value type so can't compare 1584 errorbitarray |= 0x4; 1585 break; 1586 } 1587 } 1588 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_DURATION_KEY)) == 0) 1589 { 1590 valcount++; 1591 1592 switch (GetValTypeFromKeyString(aValueList[i].key)) 1593 { 1594 case PVMI_KVPVALTYPE_UINT32: 1595 if (aValueList[i].value.uint32_value != METADATA_DURATION_VALUE) 1596 { 1597 errorbitarray |= 0x1; 1598 } 1599 break; 1600 1601 case PVMI_KVPVALTYPE_INT32: 1602 if (aValueList[i].value.int32_value != METADATA_DURATION_VALUE) 1603 { 1604 errorbitarray |= 0x1; 1605 } 1606 break; 1607 1608 default: 1609 // Unknown value type so can't compare 1610 errorbitarray |= 0x4; 1611 break; 1612 } 1613 } 1614 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_NUMTRACKS_KEY)) == 0) 1615 { 1616 valcount++; 1617 1618 switch (GetValTypeFromKeyString(aValueList[i].key)) 1619 { 1620 case PVMI_KVPVALTYPE_UINT32: 1621 if (aValueList[i].value.uint32_value != METADATA_NUMTRACKS_VALUE) 1622 { 1623 errorbitarray |= 0x1; 1624 } 1625 break; 1626 1627 case PVMI_KVPVALTYPE_INT32: 1628 if (aValueList[i].value.int32_value != METADATA_NUMTRACKS_VALUE) 1629 { 1630 errorbitarray |= 0x1; 1631 } 1632 break; 1633 1634 case PVMI_KVPVALTYPE_UINT8: 1635 if (aValueList[i].value.uint8_value != METADATA_NUMTRACKS_VALUE) 1636 { 1637 errorbitarray |= 0x1; 1638 } 1639 break; 1640 1641 default: 1642 // Unknown value type so can't compare 1643 errorbitarray |= 0x4; 1644 break; 1645 } 1646 } 1647 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFOTYPE0_KEY)) == 0) 1648 { 1649 valcount++; 1650 1651 switch (GetValTypeFromKeyString(aValueList[i].key)) 1652 { 1653 case PVMI_KVPVALTYPE_CHARPTR: 1654 if (oscl_strcmp(aValueList[i].value.pChar_value, _STRLIT_CHAR(METADATA_TRACKINFOTYPE0_VALUE)) != 0) 1655 { 1656 errorbitarray |= 0x1; 1657 } 1658 break; 1659 1660 default: 1661 // Unknown value type so can't compare 1662 errorbitarray |= 0x4; 1663 break; 1664 } 1665 } 1666 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFOTYPE1_KEY)) == 0) 1667 { 1668 valcount++; 1669 1670 switch (GetValTypeFromKeyString(aValueList[i].key)) 1671 { 1672 case PVMI_KVPVALTYPE_CHARPTR: 1673 if (oscl_strcmp(aValueList[i].value.pChar_value, _STRLIT_CHAR(METADATA_TRACKINFOTYPE1_VALUE)) != 0) 1674 { 1675 errorbitarray |= 0x1; 1676 } 1677 break; 1678 1679 default: 1680 // Unknown value type so can't compare 1681 errorbitarray |= 0x4; 1682 break; 1683 } 1684 } 1685 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFODURATION0_KEY)) == 0) 1686 { 1687 valcount++; 1688 1689 switch (GetValTypeFromKeyString(aValueList[i].key)) 1690 { 1691 case PVMI_KVPVALTYPE_UINT32: 1692 if (aValueList[i].value.uint32_value != METADATA_TRACKINFODURATION0_VALUE) 1693 { 1694 errorbitarray |= 0x1; 1695 } 1696 break; 1697 1698 case PVMI_KVPVALTYPE_INT32: 1699 if (aValueList[i].value.int32_value != METADATA_TRACKINFODURATION0_VALUE) 1700 { 1701 errorbitarray |= 0x1; 1702 } 1703 break; 1704 1705 default: 1706 // Unknown value type so can't compare 1707 errorbitarray |= 0x4; 1708 break; 1709 } 1710 } 1711 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFODURATION1_KEY)) == 0) 1712 { 1713 valcount++; 1714 1715 switch (GetValTypeFromKeyString(aValueList[i].key)) 1716 { 1717 case PVMI_KVPVALTYPE_UINT32: 1718 if (aValueList[i].value.uint32_value != METADATA_TRACKINFODURATION1_VALUE) 1719 { 1720 errorbitarray |= 0x1; 1721 } 1722 break; 1723 1724 case PVMI_KVPVALTYPE_INT32: 1725 if (aValueList[i].value.int32_value != METADATA_TRACKINFODURATION1_VALUE) 1726 { 1727 errorbitarray |= 0x1; 1728 } 1729 break; 1730 1731 default: 1732 // Unknown value type so can't compare 1733 errorbitarray |= 0x4; 1734 break; 1735 } 1736 } 1737 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFOBITRATE0_KEY)) == 0) 1738 { 1739 valcount++; 1740 1741 switch (GetValTypeFromKeyString(aValueList[i].key)) 1742 { 1743 case PVMI_KVPVALTYPE_UINT32: 1744 if (aValueList[i].value.uint32_value != METADATA_TRACKINFOBITRATE0_VALUE) 1745 { 1746 errorbitarray |= 0x1; 1747 } 1748 break; 1749 1750 case PVMI_KVPVALTYPE_INT32: 1751 if (aValueList[i].value.int32_value != METADATA_TRACKINFOBITRATE0_VALUE) 1752 { 1753 errorbitarray |= 0x1; 1754 } 1755 break; 1756 1757 default: 1758 // Unknown value type so can't compare 1759 errorbitarray |= 0x4; 1760 break; 1761 } 1762 } 1763 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFOBITRATE1_KEY)) == 0) 1764 { 1765 valcount++; 1766 1767 switch (GetValTypeFromKeyString(aValueList[i].key)) 1768 { 1769 case PVMI_KVPVALTYPE_UINT32: 1770 if (aValueList[i].value.uint32_value != METADATA_TRACKINFOBITRATE1_VALUE) 1771 { 1772 errorbitarray |= 0x1; 1773 } 1774 break; 1775 1776 case PVMI_KVPVALTYPE_INT32: 1777 if (aValueList[i].value.int32_value != METADATA_TRACKINFOBITRATE1_VALUE) 1778 { 1779 errorbitarray |= 0x1; 1780 } 1781 break; 1782 1783 default: 1784 // Unknown value type so can't compare 1785 errorbitarray |= 0x4; 1786 break; 1787 } 1788 } 1789 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFOVIDEOWIDTH0_KEY)) == 0) 1790 { 1791 valcount++; 1792 1793 switch (GetValTypeFromKeyString(aValueList[i].key)) 1794 { 1795 case PVMI_KVPVALTYPE_UINT32: 1796 if (aValueList[i].value.uint32_value != METADATA_TRACKINFOVIDEOWIDTH0_VALUE) 1797 { 1798 errorbitarray |= 0x1; 1799 } 1800 break; 1801 1802 case PVMI_KVPVALTYPE_INT32: 1803 if (aValueList[i].value.int32_value != METADATA_TRACKINFOVIDEOWIDTH0_VALUE) 1804 { 1805 errorbitarray |= 0x1; 1806 } 1807 break; 1808 1809 case PVMI_KVPVALTYPE_UINT8: 1810 if (aValueList[i].value.uint8_value != METADATA_TRACKINFOVIDEOWIDTH0_VALUE) 1811 { 1812 errorbitarray |= 0x1; 1813 } 1814 break; 1815 1816 default: 1817 // Unknown value type so can't compare 1818 errorbitarray |= 0x4; 1819 break; 1820 } 1821 } 1822 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFOVIDEOWIDTH1_KEY)) == 0) 1823 { 1824 valcount++; 1825 1826 switch (GetValTypeFromKeyString(aValueList[i].key)) 1827 { 1828 case PVMI_KVPVALTYPE_UINT32: 1829 if (aValueList[i].value.uint32_value != METADATA_TRACKINFOVIDEOWIDTH1_VALUE) 1830 { 1831 errorbitarray |= 0x1; 1832 } 1833 break; 1834 1835 case PVMI_KVPVALTYPE_INT32: 1836 if (aValueList[i].value.int32_value != METADATA_TRACKINFOVIDEOWIDTH1_VALUE) 1837 { 1838 errorbitarray |= 0x1; 1839 } 1840 break; 1841 1842 case PVMI_KVPVALTYPE_UINT8: 1843 if (aValueList[i].value.uint8_value != METADATA_TRACKINFOVIDEOWIDTH1_VALUE) 1844 { 1845 errorbitarray |= 0x1; 1846 } 1847 break; 1848 1849 default: 1850 // Unknown value type so can't compare 1851 errorbitarray |= 0x4; 1852 break; 1853 } 1854 } 1855 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFOVIDEOHEIGHT0_KEY)) == 0) 1856 { 1857 valcount++; 1858 1859 switch (GetValTypeFromKeyString(aValueList[i].key)) 1860 { 1861 case PVMI_KVPVALTYPE_UINT32: 1862 if (aValueList[i].value.uint32_value != METADATA_TRACKINFOVIDEOHEIGHT0_VALUE) 1863 { 1864 errorbitarray |= 0x1; 1865 } 1866 break; 1867 1868 case PVMI_KVPVALTYPE_INT32: 1869 if (aValueList[i].value.int32_value != METADATA_TRACKINFOVIDEOHEIGHT0_VALUE) 1870 { 1871 errorbitarray |= 0x1; 1872 } 1873 break; 1874 1875 case PVMI_KVPVALTYPE_UINT8: 1876 if (aValueList[i].value.uint8_value != METADATA_TRACKINFOVIDEOHEIGHT0_VALUE) 1877 { 1878 errorbitarray |= 0x1; 1879 } 1880 break; 1881 1882 default: 1883 // Unknown value type so can't compare 1884 errorbitarray |= 0x4; 1885 break; 1886 } 1887 } 1888 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_TRACKINFOVIDEOHEIGHT1_KEY)) == 0) 1889 { 1890 valcount++; 1891 1892 switch (GetValTypeFromKeyString(aValueList[i].key)) 1893 { 1894 case PVMI_KVPVALTYPE_UINT32: 1895 if (aValueList[i].value.uint32_value != METADATA_TRACKINFOVIDEOHEIGHT1_VALUE) 1896 { 1897 errorbitarray |= 0x1; 1898 } 1899 break; 1900 1901 case PVMI_KVPVALTYPE_INT32: 1902 if (aValueList[i].value.int32_value != METADATA_TRACKINFOVIDEOHEIGHT1_VALUE) 1903 { 1904 errorbitarray |= 0x1; 1905 } 1906 break; 1907 1908 case PVMI_KVPVALTYPE_UINT8: 1909 if (aValueList[i].value.uint8_value != METADATA_TRACKINFOVIDEOHEIGHT1_VALUE) 1910 { 1911 errorbitarray |= 0x1; 1912 } 1913 break; 1914 1915 default: 1916 // Unknown value type so can't compare 1917 errorbitarray |= 0x4; 1918 break; 1919 } 1920 } 1921 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_CODECINFOVIDEOWIDTH_KEY)) == 0) 1922 { 1923 valcount++; 1924 1925 switch (GetValTypeFromKeyString(aValueList[i].key)) 1926 { 1927 case PVMI_KVPVALTYPE_UINT32: 1928 if (aValueList[i].value.uint32_value != METADATA_CODECINFOVIDEOWIDTH_VALUE) 1929 { 1930 errorbitarray |= 0x1; 1931 } 1932 break; 1933 1934 case PVMI_KVPVALTYPE_INT32: 1935 if (aValueList[i].value.int32_value != METADATA_CODECINFOVIDEOWIDTH_VALUE) 1936 { 1937 errorbitarray |= 0x1; 1938 } 1939 break; 1940 1941 case PVMI_KVPVALTYPE_UINT8: 1942 if (aValueList[i].value.uint8_value != METADATA_CODECINFOVIDEOWIDTH_VALUE) 1943 { 1944 errorbitarray |= 0x1; 1945 } 1946 break; 1947 1948 default: 1949 // Unknown value type so can't compare 1950 errorbitarray |= 0x4; 1951 break; 1952 } 1953 } 1954 else if (oscl_strcmp(aValueList[i].key, _STRLIT_CHAR(METADATA_CODECINFOVIDEOHEIGHT_KEY)) == 0) 1955 { 1956 valcount++; 1957 1958 switch (GetValTypeFromKeyString(aValueList[i].key)) 1959 { 1960 case PVMI_KVPVALTYPE_UINT32: 1961 if (aValueList[i].value.uint32_value != METADATA_CODECINFOVIDEOHEIGHT_VALUE) 1962 { 1963 errorbitarray |= 0x1; 1964 } 1965 break; 1966 1967 case PVMI_KVPVALTYPE_INT32: 1968 if (aValueList[i].value.int32_value != METADATA_CODECINFOVIDEOHEIGHT_VALUE) 1969 { 1970 errorbitarray |= 0x1; 1971 } 1972 break; 1973 1974 case PVMI_KVPVALTYPE_UINT8: 1975 if (aValueList[i].value.uint8_value != METADATA_CODECINFOVIDEOHEIGHT_VALUE) 1976 { 1977 errorbitarray |= 0x1; 1978 } 1979 break; 1980 1981 default: 1982 // Unknown value type so can't compare 1983 errorbitarray |= 0x4; 1984 break; 1985 } 1986 } 1987 } 1988 1989 if (aValueList.size() != valcount) 1990 { 1991 errorbitarray |= 0x2; 1992 } 1993 1994 return errorbitarray; 1995 } 1996 1997 1998 void pvplayer_async_test_metadata::StartTest() 1999 { 2000 AddToScheduler(); 2001 iState = STATE_CREATE; 2002 RunIfNotReady(); 2003 } 2004 2005 2006 void pvplayer_async_test_metadata::Run() 2007 { 2008 int32 error = 0; 2009 2010 switch (iState) 2011 { 2012 case STATE_CREATE: 2013 { 2014 iPlayer = NULL; 2015 2016 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 2017 if (error) 2018 { 2019 PVPATB_TEST_IS_TRUE(false); 2020 iObserver->TestCompleted(*iTestCase); 2021 } 2022 else 2023 { 2024 iState = STATE_ADDDATASOURCE; 2025 RunIfNotReady(); 2026 } 2027 } 2028 break; 2029 2030 case STATE_ADDDATASOURCE: 2031 { 2032 iDataSource = new PVPlayerDataSourceURL; 2033 2034 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 2035 sourcefile += _STRLIT_WCHAR("test_metadata.mp4"); 2036 iDataSource->SetDataSourceURL(sourcefile); 2037 2038 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 2039 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 2040 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2041 } 2042 2043 break; 2044 2045 case STATE_INIT: 2046 { 2047 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 2048 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2049 } 2050 break; 2051 2052 // Tests the Ability to get Metadata after the Init State 2053 case STATE_GETMETADATAKEYS1: 2054 { 2055 iKeyList.clear(); 2056 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataKeys(iKeyList, 0, -1, NULL, (OsclAny*) & iContextObject)); 2057 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2058 } 2059 break; 2060 2061 case STATE_GETMETADATAVALUES1: 2062 { 2063 iValueList.clear(); 2064 iNumAvailableValues = 0; 2065 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iKeyList, 0, -1, iNumAvailableValues, iValueList, (OsclAny*) & iContextObject)); 2066 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2067 } 2068 break; 2069 2070 2071 case STATE_ADDDATASINK_VIDEO: 2072 { 2073 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 2074 sinkfile += _STRLIT_WCHAR("test_player_metadata_video.dat"); 2075 2076 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 2077 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 2078 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 2079 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 2080 2081 2082 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 2083 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2084 } 2085 break; 2086 2087 case STATE_ADDDATASINK_AUDIO: 2088 { 2089 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 2090 sinkfile += _STRLIT_WCHAR("test_player_metadata_audio.dat"); 2091 2092 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 2093 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 2094 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 2095 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 2096 2097 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 2098 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2099 } 2100 break; 2101 2102 case STATE_PREPARE: 2103 { 2104 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 2105 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2106 } 2107 break; 2108 2109 // Check The Ability to return MetaData At the prepared state 2110 case STATE_GETMETADATAKEYS2: 2111 { 2112 iKeyList.clear(); 2113 iKeyQueryString = _STRLIT_CHAR(METADATA_GETMETADATAKEYS2_QUERYSTRING); 2114 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataKeys(iKeyList, 0, -1, iKeyQueryString.get_str(), (OsclAny*) & iContextObject)); 2115 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2116 } 2117 break; 2118 2119 case STATE_GETMETADATAVALUES2: 2120 { 2121 iValueList.clear(); 2122 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iKeyList, 0, -1, iNumAvailableValues, iValueList, (OsclAny*) & iContextObject)); 2123 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2124 } 2125 break; 2126 2127 case STATE_GETMETADATAKEYSSEG: 2128 { 2129 iKeyList.clear(); 2130 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataKeys(iKeyList, 0, -1, NULL, (OsclAny*) & iContextObject)); 2131 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2132 } 2133 break; 2134 2135 case STATE_GETMETADATAVALUESSEG1: 2136 { 2137 iValueList.clear(); 2138 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iKeyList, 0, -1, iNumAvailableValues, iValueList, (OsclAny*) & iContextObject)); 2139 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2140 } 2141 break; 2142 2143 case STATE_GETMETADATAVALUESSEG2: 2144 { 2145 iValueListSeg1.clear(); 2146 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iKeyList, 0, 6, iNumAvailableValues, iValueListSeg1, (OsclAny*) & iContextObject)); 2147 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2148 } 2149 break; 2150 2151 case STATE_GETMETADATAVALUESSEG3: 2152 { 2153 iValueListSeg2.clear(); 2154 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iKeyList, 6, -1, iNumAvailableValues, iValueListSeg2, (OsclAny*) & iContextObject)); 2155 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2156 } 2157 break; 2158 2159 case STATE_START: 2160 { 2161 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 2162 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2163 } 2164 break; 2165 2166 case STATE_STOP: 2167 { 2168 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 2169 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2170 } 2171 break; 2172 2173 // Check The Ability to return MetaData after Stop is called 2174 case STATE_GETMETADATAKEYS3: 2175 { 2176 iKeyList.clear(); 2177 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataKeys(iKeyList, 0, -1, NULL, (OsclAny*) & iContextObject)); 2178 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2179 } 2180 break; 2181 2182 case STATE_GETMETADATAVALUES3: 2183 { 2184 iValueList.clear(); 2185 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iKeyList, 0, -1, iNumAvailableValues, iValueList, (OsclAny*) & iContextObject)); 2186 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2187 } 2188 break; 2189 2190 2191 case STATE_REMOVEDATASINK_VIDEO: 2192 { 2193 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 2194 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2195 } 2196 break; 2197 2198 case STATE_REMOVEDATASINK_AUDIO: 2199 { 2200 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 2201 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2202 } 2203 break; 2204 2205 case STATE_RESET: 2206 { 2207 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 2208 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2209 } 2210 break; 2211 2212 case STATE_REMOVEDATASOURCE: 2213 { 2214 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 2215 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2216 } 2217 break; 2218 2219 case STATE_CLEANUPANDCOMPLETE: 2220 { 2221 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 2222 iPlayer = NULL; 2223 2224 delete iDataSource; 2225 iDataSource = NULL; 2226 2227 delete iDataSinkVideo; 2228 iDataSinkVideo = NULL; 2229 2230 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 2231 iIONodeVideo = NULL; 2232 2233 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 2234 iMIOFileOutVideo = NULL; 2235 2236 delete iDataSinkAudio; 2237 iDataSinkAudio = NULL; 2238 2239 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 2240 iIONodeAudio = NULL; 2241 2242 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 2243 iMIOFileOutAudio = NULL; 2244 2245 iObserver->TestCompleted(*iTestCase); 2246 } 2247 break; 2248 2249 default: 2250 break; 2251 2252 } 2253 } 2254 2255 2256 void pvplayer_async_test_metadata::CommandCompleted(const PVCmdResponse& aResponse) 2257 { 2258 if (aResponse.GetCmdId() != iCurrentCmdId) 2259 { 2260 // Wrong command ID. 2261 PVPATB_TEST_IS_TRUE(false); 2262 iState = STATE_CLEANUPANDCOMPLETE; 2263 RunIfNotReady(); 2264 return; 2265 } 2266 2267 if (aResponse.GetContext() != NULL) 2268 { 2269 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 2270 { 2271 if (iContextObject != iContextObjectRefValue) 2272 { 2273 // Context data value was corrupted 2274 PVPATB_TEST_IS_TRUE(false); 2275 iState = STATE_CLEANUPANDCOMPLETE; 2276 RunIfNotReady(); 2277 return; 2278 } 2279 } 2280 else 2281 { 2282 // Context data pointer was corrupted 2283 PVPATB_TEST_IS_TRUE(false); 2284 iState = STATE_CLEANUPANDCOMPLETE; 2285 RunIfNotReady(); 2286 return; 2287 } 2288 } 2289 2290 switch (iState) 2291 { 2292 case STATE_ADDDATASOURCE: 2293 if (aResponse.GetCmdStatus() == PVMFSuccess) 2294 { 2295 iState = STATE_INIT; 2296 RunIfNotReady(); 2297 } 2298 else 2299 { 2300 // AddDataSource failed 2301 PVPATB_TEST_IS_TRUE(false); 2302 iState = STATE_CLEANUPANDCOMPLETE; 2303 RunIfNotReady(); 2304 } 2305 break; 2306 2307 case STATE_INIT: 2308 if (aResponse.GetCmdStatus() == PVMFSuccess) 2309 { 2310 iState = STATE_GETMETADATAKEYS1; 2311 RunIfNotReady(); 2312 } 2313 else 2314 { 2315 // Init failed 2316 PVPATB_TEST_IS_TRUE(false); 2317 iState = STATE_CLEANUPANDCOMPLETE; 2318 RunIfNotReady(); 2319 } 2320 break; 2321 2322 case STATE_GETMETADATAKEYS1: 2323 if (aResponse.GetCmdStatus() == PVMFSuccess) 2324 { 2325 iState = STATE_GETMETADATAVALUES1; 2326 RunIfNotReady(); 2327 } 2328 else 2329 { 2330 // GetMetadataKeys failed 2331 PVPATB_TEST_IS_TRUE(false); 2332 iState = STATE_CLEANUPANDCOMPLETE; 2333 RunIfNotReady(); 2334 } 2335 break; 2336 2337 2338 case STATE_GETMETADATAVALUES1: 2339 if (aResponse.GetCmdStatus() == PVMFSuccess) 2340 { 2341 int32 retcode = CheckMetadataValue(iValueList); 2342 2343 if (retcode) 2344 { 2345 if (retcode&0x1) 2346 { 2347 // Error in returned value content 2348 PVPATB_TEST_IS_TRUE(false); 2349 } 2350 if (retcode&0x2) 2351 { 2352 // Known value entries does not match the number of entries 2353 // This is OK 2354 } 2355 if (retcode&0x4) 2356 { 2357 // Unknown valtype encountered 2358 PVPATB_TEST_IS_TRUE(false); 2359 } 2360 } 2361 else 2362 { 2363 PVPATB_TEST_IS_TRUE(true); 2364 } 2365 2366 iState = STATE_ADDDATASINK_VIDEO; 2367 RunIfNotReady(); 2368 break; 2369 } 2370 else 2371 { 2372 // GetMetadataValues failed 2373 PVPATB_TEST_IS_TRUE(false); 2374 iState = STATE_CLEANUPANDCOMPLETE; 2375 RunIfNotReady(); 2376 } 2377 break; 2378 2379 case STATE_ADDDATASINK_VIDEO: 2380 if (aResponse.GetCmdStatus() == PVMFSuccess) 2381 { 2382 iState = STATE_ADDDATASINK_AUDIO; 2383 RunIfNotReady(); 2384 } 2385 else 2386 { 2387 // AddDataSink failed 2388 PVPATB_TEST_IS_TRUE(false); 2389 iState = STATE_CLEANUPANDCOMPLETE; 2390 RunIfNotReady(); 2391 } 2392 break; 2393 2394 case STATE_ADDDATASINK_AUDIO: 2395 if (aResponse.GetCmdStatus() == PVMFSuccess) 2396 { 2397 iState = STATE_PREPARE; 2398 RunIfNotReady(); 2399 } 2400 else 2401 { 2402 // AddDataSink failed 2403 PVPATB_TEST_IS_TRUE(false); 2404 iState = STATE_CLEANUPANDCOMPLETE; 2405 RunIfNotReady(); 2406 } 2407 break; 2408 2409 case STATE_PREPARE: 2410 if (aResponse.GetCmdStatus() == PVMFSuccess) 2411 { 2412 iState = STATE_GETMETADATAKEYS2; 2413 RunIfNotReady(); 2414 } 2415 else 2416 { 2417 // Prepare failed 2418 PVPATB_TEST_IS_TRUE(false); 2419 iState = STATE_CLEANUPANDCOMPLETE; 2420 RunIfNotReady(); 2421 } 2422 break; 2423 2424 case STATE_GETMETADATAKEYS2: 2425 if (aResponse.GetCmdStatus() == PVMFSuccess) 2426 { 2427 iState = STATE_GETMETADATAVALUES2; 2428 RunIfNotReady(); 2429 } 2430 else 2431 { 2432 // GetMetadataKeys failed 2433 PVPATB_TEST_IS_TRUE(false); 2434 iState = STATE_CLEANUPANDCOMPLETE; 2435 RunIfNotReady(); 2436 } 2437 break; 2438 2439 case STATE_GETMETADATAVALUES2: 2440 if (aResponse.GetCmdStatus() == PVMFSuccess) 2441 { 2442 int32 retcode = CheckMetadataValue(iValueList); 2443 2444 if (retcode) 2445 { 2446 if (retcode&0x1) 2447 { 2448 // Error in returned value content 2449 PVPATB_TEST_IS_TRUE(false); 2450 } 2451 if (retcode&0x2) 2452 { 2453 // Known value entries does not match the number of entries 2454 // This is OK 2455 } 2456 if (retcode&0x4) 2457 { 2458 // Unknown valtype encountered 2459 PVPATB_TEST_IS_TRUE(false); 2460 } 2461 } 2462 else 2463 { 2464 PVPATB_TEST_IS_TRUE(true); 2465 } 2466 2467 iState = STATE_GETMETADATAKEYSSEG; 2468 RunIfNotReady(); 2469 break; 2470 } 2471 else 2472 { 2473 // GetMetadataValues failed 2474 PVPATB_TEST_IS_TRUE(false); 2475 iState = STATE_CLEANUPANDCOMPLETE; 2476 RunIfNotReady(); 2477 } 2478 break; 2479 2480 case STATE_GETMETADATAKEYSSEG: 2481 if (aResponse.GetCmdStatus() == PVMFSuccess) 2482 { 2483 iState = STATE_GETMETADATAVALUESSEG1; 2484 RunIfNotReady(); 2485 } 2486 else 2487 { 2488 // GetMetadataKeys failed 2489 PVPATB_TEST_IS_TRUE(false); 2490 iState = STATE_CLEANUPANDCOMPLETE; 2491 RunIfNotReady(); 2492 } 2493 break; 2494 2495 case STATE_GETMETADATAVALUESSEG1: 2496 if (aResponse.GetCmdStatus() == PVMFSuccess) 2497 { 2498 iState = STATE_GETMETADATAVALUESSEG2; 2499 RunIfNotReady(); 2500 break; 2501 } 2502 else 2503 { 2504 // GetMetadataValues failed 2505 PVPATB_TEST_IS_TRUE(false); 2506 iState = STATE_CLEANUPANDCOMPLETE; 2507 RunIfNotReady(); 2508 } 2509 break; 2510 2511 case STATE_GETMETADATAVALUESSEG2: 2512 if (aResponse.GetCmdStatus() == PVMFSuccess) 2513 { 2514 if (iValueListSeg1.size() != 6) 2515 { 2516 PVPATB_TEST_IS_TRUE(false); 2517 } 2518 else 2519 { 2520 PVPATB_TEST_IS_TRUE(true); 2521 } 2522 2523 iState = STATE_GETMETADATAVALUESSEG3; 2524 RunIfNotReady(); 2525 break; 2526 } 2527 else 2528 { 2529 // GetMetadataValues failed 2530 PVPATB_TEST_IS_TRUE(false); 2531 iState = STATE_CLEANUPANDCOMPLETE; 2532 RunIfNotReady(); 2533 } 2534 break; 2535 2536 case STATE_GETMETADATAVALUESSEG3: 2537 if (aResponse.GetCmdStatus() == PVMFSuccess) 2538 { 2539 if ((iValueListSeg1.size() + iValueListSeg2.size()) != iValueList.size()) 2540 { 2541 PVPATB_TEST_IS_TRUE(false); 2542 } 2543 else 2544 { 2545 PVPATB_TEST_IS_TRUE(true); 2546 } 2547 2548 iState = STATE_START; 2549 RunIfNotReady(); 2550 break; 2551 } 2552 else 2553 { 2554 // GetMetadataValues failed 2555 PVPATB_TEST_IS_TRUE(false); 2556 iState = STATE_CLEANUPANDCOMPLETE; 2557 RunIfNotReady(); 2558 } 2559 break; 2560 2561 case STATE_START: 2562 if (aResponse.GetCmdStatus() == PVMFSuccess) 2563 { 2564 iState = STATE_STOP; 2565 RunIfNotReady(3000000); 2566 } 2567 else 2568 { 2569 // Start failed 2570 PVPATB_TEST_IS_TRUE(false); 2571 iState = STATE_CLEANUPANDCOMPLETE; 2572 RunIfNotReady(); 2573 } 2574 break; 2575 2576 case STATE_STOP: 2577 if (aResponse.GetCmdStatus() == PVMFSuccess) 2578 { 2579 iState = STATE_GETMETADATAKEYS3; 2580 RunIfNotReady(); 2581 } 2582 else 2583 { 2584 // Stop failed 2585 PVPATB_TEST_IS_TRUE(false); 2586 iState = STATE_CLEANUPANDCOMPLETE; 2587 RunIfNotReady(); 2588 } 2589 break; 2590 2591 case STATE_GETMETADATAKEYS3: 2592 if (aResponse.GetCmdStatus() == PVMFSuccess) 2593 { 2594 iState = STATE_GETMETADATAVALUES3; 2595 RunIfNotReady(); 2596 } 2597 else 2598 { 2599 // GetMetadataKeys failed 2600 PVPATB_TEST_IS_TRUE(false); 2601 iState = STATE_CLEANUPANDCOMPLETE; 2602 RunIfNotReady(); 2603 } 2604 break; 2605 2606 case STATE_GETMETADATAVALUES3: 2607 if (aResponse.GetCmdStatus() == PVMFSuccess) 2608 { 2609 int32 retcode = CheckMetadataValue(iValueList); 2610 2611 if (retcode) 2612 { 2613 if (retcode&0x1) 2614 { 2615 // Error in returned value content 2616 PVPATB_TEST_IS_TRUE(false); 2617 } 2618 if (retcode&0x2) 2619 { 2620 // Known value entries does not match the number of entries 2621 // This is OK 2622 } 2623 if (retcode&0x4) 2624 { 2625 // Unknown valtype encountered 2626 PVPATB_TEST_IS_TRUE(false); 2627 } 2628 } 2629 else 2630 { 2631 PVPATB_TEST_IS_TRUE(true); 2632 } 2633 2634 iState = STATE_REMOVEDATASINK_VIDEO; 2635 RunIfNotReady(); 2636 break; 2637 } 2638 else 2639 { 2640 // GetMetadataValues failed 2641 PVPATB_TEST_IS_TRUE(false); 2642 iState = STATE_CLEANUPANDCOMPLETE; 2643 RunIfNotReady(); 2644 } 2645 break; 2646 2647 case STATE_REMOVEDATASINK_VIDEO: 2648 if (aResponse.GetCmdStatus() == PVMFSuccess) 2649 { 2650 iState = STATE_REMOVEDATASINK_AUDIO; 2651 RunIfNotReady(); 2652 } 2653 else 2654 { 2655 // RemoveDataSink failed 2656 PVPATB_TEST_IS_TRUE(false); 2657 iState = STATE_CLEANUPANDCOMPLETE; 2658 RunIfNotReady(); 2659 } 2660 break; 2661 2662 case STATE_REMOVEDATASINK_AUDIO: 2663 if (aResponse.GetCmdStatus() == PVMFSuccess) 2664 { 2665 iState = STATE_RESET; 2666 RunIfNotReady(); 2667 } 2668 else 2669 { 2670 // RemoveDataSink failed 2671 PVPATB_TEST_IS_TRUE(false); 2672 iState = STATE_CLEANUPANDCOMPLETE; 2673 RunIfNotReady(); 2674 } 2675 break; 2676 2677 case STATE_RESET: 2678 if (aResponse.GetCmdStatus() == PVMFSuccess) 2679 { 2680 iState = STATE_REMOVEDATASOURCE; 2681 RunIfNotReady(); 2682 } 2683 else 2684 { 2685 // Reset failed 2686 PVPATB_TEST_IS_TRUE(false); 2687 iState = STATE_CLEANUPANDCOMPLETE; 2688 RunIfNotReady(); 2689 } 2690 break; 2691 2692 case STATE_REMOVEDATASOURCE: 2693 if (aResponse.GetCmdStatus() == PVMFSuccess) 2694 { 2695 PVPATB_TEST_IS_TRUE(true); 2696 iState = STATE_CLEANUPANDCOMPLETE; 2697 RunIfNotReady(); 2698 } 2699 else 2700 { 2701 // RemoveDataSource failed 2702 PVPATB_TEST_IS_TRUE(false); 2703 iState = STATE_CLEANUPANDCOMPLETE; 2704 RunIfNotReady(); 2705 } 2706 break; 2707 2708 default: 2709 { 2710 // Testing error if this is reached 2711 PVPATB_TEST_IS_TRUE(false); 2712 iState = STATE_CLEANUPANDCOMPLETE; 2713 RunIfNotReady(); 2714 } 2715 break; 2716 } 2717 } 2718 2719 2720 void pvplayer_async_test_metadata::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 2721 { 2722 switch (aEvent.GetEventType()) 2723 { 2724 case PVMFErrResourceConfiguration: 2725 // Just log the error 2726 PVPATB_TEST_IS_TRUE(false); 2727 break; 2728 2729 case PVMFErrResource: 2730 // Just log the error 2731 PVPATB_TEST_IS_TRUE(false); 2732 break; 2733 2734 case PVMFErrCorrupt: 2735 // Just log the error 2736 PVPATB_TEST_IS_TRUE(false); 2737 break; 2738 2739 case PVMFErrProcessing: 2740 // Just log the error 2741 PVPATB_TEST_IS_TRUE(false); 2742 break; 2743 2744 default: 2745 // Unknown error and just log the error 2746 PVPATB_TEST_IS_TRUE(false); 2747 break; 2748 } 2749 2750 // Wait for engine to handle the error 2751 Cancel(); 2752 } 2753 2754 2755 void pvplayer_async_test_metadata::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 2756 { 2757 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 2758 { 2759 // do nothing 2760 } 2761 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 2762 { 2763 iState = STATE_CLEANUPANDCOMPLETE; 2764 RunIfNotReady(); 2765 } 2766 } 2767 2768 2769 2770 // 2771 // pvplayer_async_test_timing section 2772 // 2773 void pvplayer_async_test_timing::StartTest() 2774 { 2775 AddToScheduler(); 2776 iState = STATE_CREATE; 2777 RunIfNotReady(); 2778 } 2779 2780 #ifdef __WINS__ 2781 #define pvplayer_async_test_timing_TOLERANCE 200 2782 #else 2783 #define pvplayer_async_test_timing_TOLERANCE 150 2784 #endif 2785 2786 void pvplayer_async_test_timing::Run() 2787 { 2788 int error = 0; 2789 2790 switch (iState) 2791 { 2792 case STATE_CREATE: 2793 { 2794 iPlayer = NULL; 2795 2796 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 2797 if (error) 2798 { 2799 PVPATB_TEST_IS_TRUE(false); 2800 iObserver->TestCompleted(*iTestCase); 2801 } 2802 else 2803 { 2804 iState = STATE_ADDDATASOURCE; 2805 RunIfNotReady(); 2806 } 2807 } 2808 break; 2809 2810 case STATE_ADDDATASOURCE: 2811 { 2812 iDataSource = new PVPlayerDataSourceURL; 2813 OSCL_wHeapString<OsclMemAllocator> wFileName; 2814 oscl_wchar output[100]; 2815 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 100); 2816 wFileName.set(output, oscl_strlen(output)); 2817 iDataSource->SetDataSourceURL(wFileName); 2818 iDataSource->SetDataSourceFormatType(iFileType); 2819 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 2820 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2821 } 2822 break; 2823 2824 case STATE_INIT: 2825 { 2826 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 2827 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2828 } 2829 break; 2830 2831 case STATE_ADDDATASINK_VIDEO: 2832 { 2833 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 2834 sinkfile += _STRLIT_WCHAR("test_player_timing_video.dat"); 2835 2836 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 2837 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 2838 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 2839 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 2840 2841 2842 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 2843 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2844 } 2845 break; 2846 2847 case STATE_ADDDATASINK_AUDIO: 2848 { 2849 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 2850 sinkfile += _STRLIT_WCHAR("test_player_timing_audio.dat"); 2851 2852 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 2853 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 2854 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 2855 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 2856 2857 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 2858 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2859 } 2860 break; 2861 2862 case STATE_PREPARE: 2863 { 2864 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 2865 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2866 } 2867 break; 2868 2869 case STATE_START: 2870 { 2871 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 2872 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2873 } 2874 break; 2875 2876 case STATE_STOP: 2877 { 2878 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 2879 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2880 } 2881 break; 2882 2883 case STATE_REMOVEDATASINK_VIDEO: 2884 { 2885 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 2886 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2887 } 2888 break; 2889 2890 case STATE_REMOVEDATASINK_AUDIO: 2891 { 2892 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 2893 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2894 } 2895 break; 2896 2897 case STATE_RESET: 2898 { 2899 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 2900 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2901 } 2902 break; 2903 2904 case STATE_REMOVEDATASOURCE: 2905 { 2906 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 2907 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 2908 } 2909 break; 2910 2911 case STATE_WAIT: 2912 { 2913 aPos.iPosUnit = PVPPBPOSUNIT_MILLISEC; 2914 iPlayer->GetCurrentPositionSync(aPos); 2915 2916 uint32 curtime = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()) - iStartTime; 2917 2918 // Taking too long so stop playback 2919 if (curtime > 10000) 2920 { 2921 PVPATB_TEST_IS_TRUE(false); 2922 iState = STATE_STOP; 2923 RunIfNotReady(); 2924 } 2925 2926 //make sure reported playback position is within a small tolerance of elapsed clock time. 2927 int32 delta = aPos.iPosValue.millisec_value - curtime; 2928 //fprintf(file,"curtime %d, msec value %d, delta %d\n",curtime,aPos.iPosValue.millisec_value,delta); 2929 if (delta > pvplayer_async_test_timing_TOLERANCE || delta < (-pvplayer_async_test_timing_TOLERANCE)) 2930 { 2931 PVPATB_TEST_IS_TRUE(false); 2932 } 2933 2934 if (aPos.iPosValue.millisec_value <= 4000) 2935 { 2936 RunIfNotReady(100000); 2937 } 2938 else 2939 { 2940 iState = STATE_STOP; 2941 RunIfNotReady(); 2942 } 2943 } 2944 break; 2945 2946 case STATE_CLEANUPANDCOMPLETE: 2947 { 2948 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 2949 iPlayer = NULL; 2950 2951 delete iDataSource; 2952 iDataSource = NULL; 2953 2954 delete iDataSinkVideo; 2955 iDataSinkVideo = NULL; 2956 2957 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 2958 iIONodeVideo = NULL; 2959 2960 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 2961 iMIOFileOutVideo = NULL; 2962 2963 delete iDataSinkAudio; 2964 iDataSinkAudio = NULL; 2965 2966 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 2967 iIONodeAudio = NULL; 2968 2969 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 2970 iMIOFileOutAudio = NULL; 2971 2972 iObserver->TestCompleted(*iTestCase); 2973 } 2974 break; 2975 2976 default: 2977 break; 2978 2979 } 2980 } 2981 2982 2983 void pvplayer_async_test_timing::CommandCompleted(const PVCmdResponse& aResponse) 2984 { 2985 if (aResponse.GetCmdId() != iCurrentCmdId) 2986 { 2987 // Wrong command ID. 2988 PVPATB_TEST_IS_TRUE(false); 2989 iState = STATE_CLEANUPANDCOMPLETE; 2990 RunIfNotReady(); 2991 return; 2992 } 2993 2994 if (aResponse.GetContext() != NULL) 2995 { 2996 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 2997 { 2998 if (iContextObject != iContextObjectRefValue) 2999 { 3000 // Context data value was corrupted 3001 PVPATB_TEST_IS_TRUE(false); 3002 iState = STATE_CLEANUPANDCOMPLETE; 3003 RunIfNotReady(); 3004 return; 3005 } 3006 } 3007 else 3008 { 3009 // Context data pointer was corrupted 3010 PVPATB_TEST_IS_TRUE(false); 3011 iState = STATE_CLEANUPANDCOMPLETE; 3012 RunIfNotReady(); 3013 return; 3014 } 3015 } 3016 3017 switch (iState) 3018 { 3019 case STATE_ADDDATASOURCE: 3020 if (aResponse.GetCmdStatus() == PVMFSuccess) 3021 { 3022 iState = STATE_INIT; 3023 RunIfNotReady(); 3024 } 3025 else 3026 { 3027 // AddDataSource failed 3028 PVPATB_TEST_IS_TRUE(false); 3029 iState = STATE_CLEANUPANDCOMPLETE; 3030 RunIfNotReady(); 3031 } 3032 break; 3033 3034 case STATE_INIT: 3035 if (aResponse.GetCmdStatus() == PVMFSuccess) 3036 { 3037 iState = STATE_ADDDATASINK_VIDEO; 3038 RunIfNotReady(); 3039 } 3040 else 3041 { 3042 // Init failed 3043 PVPATB_TEST_IS_TRUE(false); 3044 iState = STATE_CLEANUPANDCOMPLETE; 3045 RunIfNotReady(); 3046 } 3047 break; 3048 3049 case STATE_ADDDATASINK_VIDEO: 3050 if (aResponse.GetCmdStatus() == PVMFSuccess) 3051 { 3052 iState = STATE_ADDDATASINK_AUDIO; 3053 RunIfNotReady(); 3054 } 3055 else 3056 { 3057 // AddDataSink failed 3058 PVPATB_TEST_IS_TRUE(false); 3059 iState = STATE_CLEANUPANDCOMPLETE; 3060 RunIfNotReady(); 3061 } 3062 break; 3063 3064 case STATE_ADDDATASINK_AUDIO: 3065 if (aResponse.GetCmdStatus() == PVMFSuccess) 3066 { 3067 iState = STATE_PREPARE; 3068 RunIfNotReady(); 3069 } 3070 else 3071 { 3072 // AddDataSink failed 3073 PVPATB_TEST_IS_TRUE(false); 3074 iState = STATE_CLEANUPANDCOMPLETE; 3075 RunIfNotReady(); 3076 } 3077 break; 3078 3079 case STATE_PREPARE: 3080 if (aResponse.GetCmdStatus() == PVMFSuccess) 3081 { 3082 iState = STATE_START; 3083 RunIfNotReady(); 3084 } 3085 else 3086 { 3087 // Prepare failed 3088 PVPATB_TEST_IS_TRUE(false); 3089 iState = STATE_CLEANUPANDCOMPLETE; 3090 RunIfNotReady(); 3091 } 3092 break; 3093 3094 case STATE_START: 3095 if (aResponse.GetCmdStatus() == PVMFSuccess) 3096 { 3097 iState = STATE_WAIT; 3098 iStartTime = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()); 3099 RunIfNotReady(); 3100 } 3101 else 3102 { 3103 // Start failed 3104 PVPATB_TEST_IS_TRUE(false); 3105 iState = STATE_CLEANUPANDCOMPLETE; 3106 RunIfNotReady(); 3107 } 3108 break; 3109 3110 case STATE_STOP: 3111 if (aResponse.GetCmdStatus() == PVMFSuccess) 3112 { 3113 iState = STATE_REMOVEDATASINK_VIDEO; 3114 RunIfNotReady(); 3115 } 3116 else 3117 { 3118 // Stop failed 3119 PVPATB_TEST_IS_TRUE(false); 3120 iState = STATE_CLEANUPANDCOMPLETE; 3121 RunIfNotReady(); 3122 } 3123 break; 3124 3125 case STATE_REMOVEDATASINK_VIDEO: 3126 if (aResponse.GetCmdStatus() == PVMFSuccess) 3127 { 3128 iState = STATE_REMOVEDATASINK_AUDIO; 3129 RunIfNotReady(); 3130 } 3131 else 3132 { 3133 // RemoveDataSink failed 3134 PVPATB_TEST_IS_TRUE(false); 3135 iState = STATE_CLEANUPANDCOMPLETE; 3136 RunIfNotReady(); 3137 } 3138 break; 3139 3140 case STATE_REMOVEDATASINK_AUDIO: 3141 if (aResponse.GetCmdStatus() == PVMFSuccess) 3142 { 3143 iState = STATE_RESET; 3144 RunIfNotReady(); 3145 } 3146 else 3147 { 3148 // RemoveDataSink failed 3149 PVPATB_TEST_IS_TRUE(false); 3150 iState = STATE_CLEANUPANDCOMPLETE; 3151 RunIfNotReady(); 3152 } 3153 break; 3154 3155 case STATE_RESET: 3156 if (aResponse.GetCmdStatus() == PVMFSuccess) 3157 { 3158 iState = STATE_REMOVEDATASOURCE; 3159 RunIfNotReady(); 3160 } 3161 else 3162 { 3163 // Reset failed 3164 PVPATB_TEST_IS_TRUE(false); 3165 iState = STATE_CLEANUPANDCOMPLETE; 3166 RunIfNotReady(); 3167 } 3168 break; 3169 3170 case STATE_REMOVEDATASOURCE: 3171 if (aResponse.GetCmdStatus() == PVMFSuccess) 3172 { 3173 PVPATB_TEST_IS_TRUE(true); 3174 iState = STATE_CLEANUPANDCOMPLETE; 3175 RunIfNotReady(); 3176 } 3177 else 3178 { 3179 // RemoveDataSource failed 3180 PVPATB_TEST_IS_TRUE(false); 3181 iState = STATE_CLEANUPANDCOMPLETE; 3182 RunIfNotReady(); 3183 } 3184 break; 3185 3186 default: 3187 { 3188 // Testing error if this is reached 3189 PVPATB_TEST_IS_TRUE(false); 3190 iState = STATE_CLEANUPANDCOMPLETE; 3191 RunIfNotReady(); 3192 } 3193 break; 3194 } 3195 } 3196 3197 3198 void pvplayer_async_test_timing::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 3199 { 3200 switch (aEvent.GetEventType()) 3201 { 3202 case PVMFErrResourceConfiguration: 3203 // Just log the error 3204 PVPATB_TEST_IS_TRUE(false); 3205 break; 3206 3207 case PVMFErrResource: 3208 // Just log the error 3209 PVPATB_TEST_IS_TRUE(false); 3210 break; 3211 3212 case PVMFErrCorrupt: 3213 // Just log the error 3214 PVPATB_TEST_IS_TRUE(false); 3215 break; 3216 3217 case PVMFErrProcessing: 3218 // Just log the error 3219 PVPATB_TEST_IS_TRUE(false); 3220 break; 3221 3222 default: 3223 // Unknown error and just log the error 3224 PVPATB_TEST_IS_TRUE(false); 3225 break; 3226 } 3227 } 3228 3229 3230 void pvplayer_async_test_timing::HandleInformationalEvent(const PVAsyncInformationalEvent& /*aEvent*/) 3231 { 3232 } 3233 3234 3235 3236 // 3237 // pvplayer_async_test_invalidstate section 3238 // 3239 void pvplayer_async_test_invalidstate::StartTest() 3240 { 3241 AddToScheduler(); 3242 iState = STATE_CREATE; 3243 RunIfNotReady(); 3244 } 3245 3246 3247 void pvplayer_async_test_invalidstate::Run() 3248 { 3249 int error = 0; 3250 3251 switch (iState) 3252 { 3253 case STATE_CREATE: 3254 { 3255 iPlayer = NULL; 3256 3257 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 3258 if (error) 3259 { 3260 PVPATB_TEST_IS_TRUE(false); 3261 iObserver->TestCompleted(*iTestCase); 3262 } 3263 else 3264 { 3265 iState = STATE_IDLE_INVALID_START; 3266 RunIfNotReady(); 3267 } 3268 } 3269 break; 3270 3271 case STATE_IDLE_INVALID_START: 3272 { 3273 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 3274 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3275 } 3276 break; 3277 3278 case STATE_IDLE_INVALID_STOP: 3279 { 3280 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 3281 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3282 } 3283 break; 3284 3285 case STATE_ADDDATASOURCE: 3286 { 3287 iDataSource = new PVPlayerDataSourceURL; 3288 3289 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 3290 sourcefile += _STRLIT_WCHAR("test.mp4"); 3291 iDataSource->SetDataSourceURL(sourcefile); 3292 3293 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 3294 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 3295 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3296 } 3297 break; 3298 3299 case STATE_INIT: 3300 { 3301 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 3302 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3303 } 3304 break; 3305 3306 case STATE_INITIALIZED_INVALID_ADDDATASOURCE: 3307 { 3308 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 3309 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3310 } 3311 break; 3312 3313 case STATE_INITIALIZED_INVALID_START: 3314 { 3315 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 3316 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3317 } 3318 break; 3319 3320 case STATE_ADDDATASINK_VIDEO: 3321 { 3322 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 3323 sinkfile += _STRLIT_WCHAR("test_player_invalid_video.dat"); 3324 3325 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 3326 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 3327 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 3328 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 3329 3330 3331 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 3332 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3333 } 3334 break; 3335 3336 case STATE_ADDDATASINK_AUDIO: 3337 { 3338 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 3339 sinkfile += _STRLIT_WCHAR("test_player_invalid_audio.dat"); 3340 3341 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 3342 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 3343 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 3344 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 3345 3346 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 3347 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3348 } 3349 break; 3350 3351 case STATE_PREPARE: 3352 { 3353 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 3354 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3355 } 3356 break; 3357 3358 case STATE_PREPARED_INVALID_INIT: 3359 { 3360 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 3361 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3362 } 3363 break; 3364 3365 case STATE_PREPARED_INVALID_PAUSE: 3366 { 3367 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 3368 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3369 } 3370 break; 3371 3372 case STATE_START: 3373 { 3374 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 3375 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3376 } 3377 break; 3378 3379 case STATE_STARTED_INVALID_RESUME: 3380 { 3381 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 3382 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3383 } 3384 break; 3385 3386 case STATE_STARTED_INVALID_PREPARE: 3387 { 3388 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 3389 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3390 } 3391 break; 3392 3393 case STATE_PAUSE: 3394 { 3395 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 3396 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3397 } 3398 break; 3399 3400 case STATE_PAUSED_INVALID_INIT: 3401 { 3402 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 3403 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3404 } 3405 break; 3406 3407 case STATE_PAUSED_INVALID_PREPARE: 3408 { 3409 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 3410 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3411 } 3412 break; 3413 3414 case STATE_STOP: 3415 { 3416 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 3417 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3418 } 3419 break; 3420 3421 case STATE_REMOVEDATASINK_VIDEO: 3422 { 3423 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 3424 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3425 } 3426 break; 3427 3428 case STATE_REMOVEDATASINK_AUDIO: 3429 { 3430 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 3431 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3432 } 3433 break; 3434 3435 case STATE_RESET: 3436 { 3437 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 3438 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3439 } 3440 break; 3441 3442 case STATE_REMOVEDATASOURCE: 3443 { 3444 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 3445 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3446 } 3447 break; 3448 3449 case STATE_CLEANUPANDCOMPLETE: 3450 { 3451 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 3452 iPlayer = NULL; 3453 3454 delete iDataSource; 3455 iDataSource = NULL; 3456 3457 delete iDataSinkVideo; 3458 iDataSinkVideo = NULL; 3459 3460 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 3461 iIONodeVideo = NULL; 3462 3463 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 3464 iMIOFileOutVideo = NULL; 3465 3466 delete iDataSinkAudio; 3467 iDataSinkAudio = NULL; 3468 3469 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 3470 iIONodeAudio = NULL; 3471 3472 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 3473 iMIOFileOutAudio = NULL; 3474 3475 iObserver->TestCompleted(*iTestCase); 3476 } 3477 break; 3478 3479 default: 3480 break; 3481 3482 } 3483 } 3484 3485 3486 void pvplayer_async_test_invalidstate::CommandCompleted(const PVCmdResponse& aResponse) 3487 { 3488 if (aResponse.GetCmdId() != iCurrentCmdId) 3489 { 3490 // Wrong command ID. 3491 PVPATB_TEST_IS_TRUE(false); 3492 iState = STATE_CLEANUPANDCOMPLETE; 3493 RunIfNotReady(); 3494 return; 3495 } 3496 3497 if (aResponse.GetContext() != NULL) 3498 { 3499 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 3500 { 3501 if (iContextObject != iContextObjectRefValue) 3502 { 3503 // Context data value was corrupted 3504 PVPATB_TEST_IS_TRUE(false); 3505 iState = STATE_CLEANUPANDCOMPLETE; 3506 RunIfNotReady(); 3507 return; 3508 } 3509 } 3510 else 3511 { 3512 // Context data pointer was corrupted 3513 PVPATB_TEST_IS_TRUE(false); 3514 iState = STATE_CLEANUPANDCOMPLETE; 3515 RunIfNotReady(); 3516 return; 3517 } 3518 } 3519 3520 switch (iState) 3521 { 3522 case STATE_IDLE_INVALID_START: 3523 if (aResponse.GetCmdStatus() == PVMFSuccess) 3524 { 3525 // Invalid call. Should not succeed 3526 PVPATB_TEST_IS_TRUE(false); 3527 iState = STATE_CLEANUPANDCOMPLETE; 3528 RunIfNotReady(); 3529 } 3530 else 3531 { 3532 iState = STATE_IDLE_INVALID_STOP; 3533 RunIfNotReady(); 3534 } 3535 break; 3536 3537 case STATE_IDLE_INVALID_STOP: 3538 if (aResponse.GetCmdStatus() == PVMFSuccess) 3539 { 3540 // Invalid call. Should not succeed 3541 PVPATB_TEST_IS_TRUE(false); 3542 iState = STATE_CLEANUPANDCOMPLETE; 3543 RunIfNotReady(); 3544 } 3545 else 3546 { 3547 iState = STATE_ADDDATASOURCE; 3548 RunIfNotReady(); 3549 } 3550 break; 3551 3552 case STATE_ADDDATASOURCE: 3553 if (aResponse.GetCmdStatus() == PVMFSuccess) 3554 { 3555 iState = STATE_INIT; 3556 RunIfNotReady(); 3557 } 3558 else 3559 { 3560 // AddDataSource failed 3561 PVPATB_TEST_IS_TRUE(false); 3562 iState = STATE_CLEANUPANDCOMPLETE; 3563 RunIfNotReady(); 3564 } 3565 break; 3566 3567 case STATE_INIT: 3568 if (aResponse.GetCmdStatus() == PVMFSuccess) 3569 { 3570 iState = STATE_INITIALIZED_INVALID_ADDDATASOURCE; 3571 RunIfNotReady(); 3572 } 3573 else 3574 { 3575 // Init failed 3576 PVPATB_TEST_IS_TRUE(false); 3577 iState = STATE_CLEANUPANDCOMPLETE; 3578 RunIfNotReady(); 3579 } 3580 break; 3581 3582 case STATE_INITIALIZED_INVALID_ADDDATASOURCE: 3583 if (aResponse.GetCmdStatus() == PVMFSuccess) 3584 { 3585 // Invalid call. Should not succeed 3586 PVPATB_TEST_IS_TRUE(false); 3587 iState = STATE_CLEANUPANDCOMPLETE; 3588 RunIfNotReady(); 3589 } 3590 else 3591 { 3592 iState = STATE_INITIALIZED_INVALID_START; 3593 RunIfNotReady(); 3594 } 3595 break; 3596 3597 case STATE_INITIALIZED_INVALID_START: 3598 if (aResponse.GetCmdStatus() == PVMFSuccess) 3599 { 3600 // Invalid call. Should not succeed 3601 PVPATB_TEST_IS_TRUE(false); 3602 iState = STATE_CLEANUPANDCOMPLETE; 3603 RunIfNotReady(); 3604 } 3605 else 3606 { 3607 iState = STATE_ADDDATASINK_VIDEO; 3608 RunIfNotReady(); 3609 } 3610 break; 3611 3612 case STATE_ADDDATASINK_VIDEO: 3613 if (aResponse.GetCmdStatus() == PVMFSuccess) 3614 { 3615 iState = STATE_ADDDATASINK_AUDIO; 3616 RunIfNotReady(); 3617 } 3618 else 3619 { 3620 // AddDataSink failed 3621 PVPATB_TEST_IS_TRUE(false); 3622 iState = STATE_CLEANUPANDCOMPLETE; 3623 RunIfNotReady(); 3624 } 3625 break; 3626 3627 case STATE_ADDDATASINK_AUDIO: 3628 if (aResponse.GetCmdStatus() == PVMFSuccess) 3629 { 3630 iState = STATE_PREPARE; 3631 RunIfNotReady(); 3632 } 3633 else 3634 { 3635 // AddDataSink failed 3636 PVPATB_TEST_IS_TRUE(false); 3637 iState = STATE_CLEANUPANDCOMPLETE; 3638 RunIfNotReady(); 3639 } 3640 break; 3641 3642 case STATE_PREPARE: 3643 if (aResponse.GetCmdStatus() == PVMFSuccess) 3644 { 3645 iState = STATE_PREPARED_INVALID_INIT; 3646 RunIfNotReady(); 3647 } 3648 else 3649 { 3650 // Prepare failed 3651 PVPATB_TEST_IS_TRUE(false); 3652 iState = STATE_CLEANUPANDCOMPLETE; 3653 RunIfNotReady(); 3654 } 3655 break; 3656 3657 case STATE_PREPARED_INVALID_INIT: 3658 if (aResponse.GetCmdStatus() == PVMFSuccess) 3659 { 3660 // Invalid call. Should not succeed 3661 PVPATB_TEST_IS_TRUE(false); 3662 iState = STATE_CLEANUPANDCOMPLETE; 3663 RunIfNotReady(); 3664 } 3665 else 3666 { 3667 iState = STATE_PREPARED_INVALID_PAUSE; 3668 RunIfNotReady(); 3669 } 3670 break; 3671 3672 case STATE_PREPARED_INVALID_PAUSE: 3673 if (aResponse.GetCmdStatus() == PVMFSuccess) 3674 { 3675 // Invalid call. Should not succeed 3676 PVPATB_TEST_IS_TRUE(false); 3677 iState = STATE_CLEANUPANDCOMPLETE; 3678 RunIfNotReady(); 3679 } 3680 else 3681 { 3682 iState = STATE_START; 3683 RunIfNotReady(); 3684 } 3685 break; 3686 3687 case STATE_START: 3688 if (aResponse.GetCmdStatus() == PVMFSuccess) 3689 { 3690 iState = STATE_STARTED_INVALID_RESUME; 3691 RunIfNotReady(1000); 3692 } 3693 else 3694 { 3695 // Start failed 3696 PVPATB_TEST_IS_TRUE(false); 3697 iState = STATE_CLEANUPANDCOMPLETE; 3698 RunIfNotReady(); 3699 } 3700 break; 3701 3702 case STATE_STARTED_INVALID_RESUME: 3703 if (aResponse.GetCmdStatus() == PVMFSuccess) 3704 { 3705 // Invalid Call, resume should not be called in Started state but engine will return 3706 // command success to Resume if its already in a started state. 3707 iState = STATE_STARTED_INVALID_PREPARE; 3708 RunIfNotReady(); 3709 } 3710 else 3711 { 3712 // Command failed. Resume should not fail if engine is already in started state. 3713 PVPATB_TEST_IS_TRUE(false); 3714 iState = STATE_CLEANUPANDCOMPLETE; 3715 RunIfNotReady(); 3716 } 3717 break; 3718 3719 case STATE_STARTED_INVALID_PREPARE: 3720 if (aResponse.GetCmdStatus() == PVMFSuccess) 3721 { 3722 // Invalid call. Should not succeed 3723 PVPATB_TEST_IS_TRUE(false); 3724 iState = STATE_CLEANUPANDCOMPLETE; 3725 RunIfNotReady(); 3726 } 3727 else 3728 { 3729 iState = STATE_PAUSE; 3730 RunIfNotReady(); 3731 } 3732 break; 3733 3734 case STATE_PAUSE: 3735 if (aResponse.GetCmdStatus() == PVMFSuccess) 3736 { 3737 iState = STATE_PAUSED_INVALID_INIT; 3738 RunIfNotReady(1000); 3739 } 3740 else 3741 { 3742 // Pause failed 3743 PVPATB_TEST_IS_TRUE(false); 3744 iState = STATE_CLEANUPANDCOMPLETE; 3745 RunIfNotReady(); 3746 } 3747 break; 3748 3749 case STATE_PAUSED_INVALID_INIT: 3750 if (aResponse.GetCmdStatus() == PVMFSuccess) 3751 { 3752 // Invalid call. Should not succeed 3753 PVPATB_TEST_IS_TRUE(false); 3754 iState = STATE_CLEANUPANDCOMPLETE; 3755 RunIfNotReady(); 3756 } 3757 else 3758 { 3759 iState = STATE_PAUSED_INVALID_PREPARE; 3760 RunIfNotReady(); 3761 } 3762 break; 3763 3764 case STATE_PAUSED_INVALID_PREPARE: 3765 if (aResponse.GetCmdStatus() == PVMFSuccess) 3766 { 3767 // Invalid call. Should not succeed 3768 PVPATB_TEST_IS_TRUE(false); 3769 iState = STATE_CLEANUPANDCOMPLETE; 3770 RunIfNotReady(); 3771 } 3772 else 3773 { 3774 iState = STATE_STOP; 3775 RunIfNotReady(); 3776 } 3777 break; 3778 3779 case STATE_STOP: 3780 if (aResponse.GetCmdStatus() == PVMFSuccess) 3781 { 3782 iState = STATE_REMOVEDATASINK_VIDEO; 3783 RunIfNotReady(); 3784 } 3785 else 3786 { 3787 // Stop failed 3788 PVPATB_TEST_IS_TRUE(false); 3789 iState = STATE_CLEANUPANDCOMPLETE; 3790 RunIfNotReady(); 3791 } 3792 break; 3793 3794 case STATE_REMOVEDATASINK_VIDEO: 3795 if (aResponse.GetCmdStatus() == PVMFSuccess) 3796 { 3797 iState = STATE_REMOVEDATASINK_AUDIO; 3798 RunIfNotReady(); 3799 } 3800 else 3801 { 3802 // RemoveDataSink failed 3803 PVPATB_TEST_IS_TRUE(false); 3804 iState = STATE_CLEANUPANDCOMPLETE; 3805 RunIfNotReady(); 3806 } 3807 break; 3808 3809 case STATE_REMOVEDATASINK_AUDIO: 3810 if (aResponse.GetCmdStatus() == PVMFSuccess) 3811 { 3812 iState = STATE_RESET; 3813 RunIfNotReady(); 3814 } 3815 else 3816 { 3817 // RemoveDataSink failed 3818 PVPATB_TEST_IS_TRUE(false); 3819 iState = STATE_CLEANUPANDCOMPLETE; 3820 RunIfNotReady(); 3821 } 3822 break; 3823 3824 case STATE_RESET: 3825 if (aResponse.GetCmdStatus() == PVMFSuccess) 3826 { 3827 iState = STATE_REMOVEDATASOURCE; 3828 RunIfNotReady(); 3829 } 3830 else 3831 { 3832 // Reset failed 3833 PVPATB_TEST_IS_TRUE(false); 3834 iState = STATE_CLEANUPANDCOMPLETE; 3835 RunIfNotReady(); 3836 } 3837 break; 3838 3839 case STATE_REMOVEDATASOURCE: 3840 if (aResponse.GetCmdStatus() == PVMFSuccess) 3841 { 3842 PVPATB_TEST_IS_TRUE(true); 3843 iState = STATE_CLEANUPANDCOMPLETE; 3844 RunIfNotReady(); 3845 } 3846 else 3847 { 3848 // RemoveDataSource failed 3849 PVPATB_TEST_IS_TRUE(false); 3850 iState = STATE_CLEANUPANDCOMPLETE; 3851 RunIfNotReady(); 3852 } 3853 break; 3854 3855 default: 3856 { 3857 // Testing error if this is reached 3858 PVPATB_TEST_IS_TRUE(false); 3859 iState = STATE_CLEANUPANDCOMPLETE; 3860 RunIfNotReady(); 3861 } 3862 break; 3863 } 3864 } 3865 3866 3867 void pvplayer_async_test_invalidstate::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 3868 { 3869 switch (aEvent.GetEventType()) 3870 { 3871 case PVMFErrResourceConfiguration: 3872 // Just log the error 3873 PVPATB_TEST_IS_TRUE(false); 3874 break; 3875 3876 case PVMFErrResource: 3877 // Just log the error 3878 PVPATB_TEST_IS_TRUE(false); 3879 break; 3880 3881 case PVMFErrCorrupt: 3882 // Just log the error 3883 PVPATB_TEST_IS_TRUE(false); 3884 break; 3885 3886 case PVMFErrProcessing: 3887 // Just log the error 3888 PVPATB_TEST_IS_TRUE(false); 3889 break; 3890 3891 default: 3892 // Unknown error and just log the error 3893 PVPATB_TEST_IS_TRUE(false); 3894 break; 3895 } 3896 } 3897 3898 3899 void pvplayer_async_test_invalidstate::HandleInformationalEvent(const PVAsyncInformationalEvent& /*aEvent*/) 3900 { 3901 } 3902 3903 3904 // 3905 // pvplayer_async_test_preparedstop section 3906 // 3907 void pvplayer_async_test_preparedstop::StartTest() 3908 { 3909 AddToScheduler(); 3910 iState = STATE_CREATE; 3911 RunIfNotReady(); 3912 } 3913 3914 3915 void pvplayer_async_test_preparedstop::Run() 3916 { 3917 int error = 0; 3918 3919 switch (iState) 3920 { 3921 case STATE_CREATE: 3922 { 3923 iPlayer = NULL; 3924 3925 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 3926 if (error) 3927 { 3928 PVPATB_TEST_IS_TRUE(false); 3929 iObserver->TestCompleted(*iTestCase); 3930 } 3931 else 3932 { 3933 iState = STATE_ADDDATASOURCE; 3934 RunIfNotReady(); 3935 } 3936 } 3937 break; 3938 3939 case STATE_ADDDATASOURCE: 3940 { 3941 iDataSource = new PVPlayerDataSourceURL; 3942 3943 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 3944 sourcefile += _STRLIT_WCHAR("test.mp4"); 3945 iDataSource->SetDataSourceURL(sourcefile); 3946 3947 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 3948 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 3949 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3950 } 3951 break; 3952 3953 case STATE_INIT: 3954 { 3955 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 3956 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3957 } 3958 break; 3959 3960 case STATE_ADDDATASINK_VIDEO: 3961 { 3962 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 3963 sinkfile += _STRLIT_WCHAR("test_player_preparedstop_video.dat"); 3964 3965 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 3966 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 3967 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 3968 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 3969 3970 3971 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 3972 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3973 } 3974 break; 3975 3976 case STATE_ADDDATASINK_AUDIO: 3977 { 3978 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 3979 sinkfile += _STRLIT_WCHAR("test_player_preparedstop_audio.dat"); 3980 3981 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 3982 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 3983 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 3984 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 3985 3986 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 3987 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3988 } 3989 break; 3990 3991 case STATE_PREPARE: 3992 { 3993 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 3994 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 3995 } 3996 break; 3997 3998 case STATE_STOP: 3999 { 4000 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 4001 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4002 } 4003 break; 4004 4005 case STATE_REMOVEDATASINK_VIDEO: 4006 { 4007 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 4008 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4009 } 4010 break; 4011 4012 case STATE_REMOVEDATASINK_AUDIO: 4013 { 4014 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 4015 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4016 } 4017 break; 4018 4019 case STATE_RESET: 4020 { 4021 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 4022 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4023 } 4024 break; 4025 4026 case STATE_REMOVEDATASOURCE: 4027 { 4028 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 4029 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4030 } 4031 break; 4032 4033 case STATE_CLEANUPANDCOMPLETE: 4034 { 4035 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 4036 iPlayer = NULL; 4037 4038 delete iDataSource; 4039 iDataSource = NULL; 4040 4041 delete iDataSinkVideo; 4042 iDataSinkVideo = NULL; 4043 4044 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 4045 iIONodeVideo = NULL; 4046 4047 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 4048 iMIOFileOutVideo = NULL; 4049 4050 delete iDataSinkAudio; 4051 iDataSinkAudio = NULL; 4052 4053 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 4054 iIONodeAudio = NULL; 4055 4056 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 4057 iMIOFileOutAudio = NULL; 4058 4059 iObserver->TestCompleted(*iTestCase); 4060 } 4061 break; 4062 4063 default: 4064 break; 4065 4066 } 4067 } 4068 4069 4070 void pvplayer_async_test_preparedstop::CommandCompleted(const PVCmdResponse& aResponse) 4071 { 4072 if (aResponse.GetCmdId() != iCurrentCmdId) 4073 { 4074 // Wrong command ID. 4075 PVPATB_TEST_IS_TRUE(false); 4076 iState = STATE_CLEANUPANDCOMPLETE; 4077 RunIfNotReady(); 4078 return; 4079 } 4080 4081 if (aResponse.GetContext() != NULL) 4082 { 4083 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 4084 { 4085 if (iContextObject != iContextObjectRefValue) 4086 { 4087 // Context data value was corrupted 4088 PVPATB_TEST_IS_TRUE(false); 4089 iState = STATE_CLEANUPANDCOMPLETE; 4090 RunIfNotReady(); 4091 return; 4092 } 4093 } 4094 else 4095 { 4096 // Context data pointer was corrupted 4097 PVPATB_TEST_IS_TRUE(false); 4098 iState = STATE_CLEANUPANDCOMPLETE; 4099 RunIfNotReady(); 4100 return; 4101 } 4102 } 4103 4104 switch (iState) 4105 { 4106 case STATE_ADDDATASOURCE: 4107 if (aResponse.GetCmdStatus() == PVMFSuccess) 4108 { 4109 iState = STATE_INIT; 4110 RunIfNotReady(); 4111 } 4112 else 4113 { 4114 // AddDataSource failed 4115 PVPATB_TEST_IS_TRUE(false); 4116 iState = STATE_CLEANUPANDCOMPLETE; 4117 RunIfNotReady(); 4118 } 4119 break; 4120 4121 case STATE_INIT: 4122 if (aResponse.GetCmdStatus() == PVMFSuccess) 4123 { 4124 iState = STATE_ADDDATASINK_VIDEO; 4125 RunIfNotReady(); 4126 } 4127 else 4128 { 4129 // Init failed 4130 PVPATB_TEST_IS_TRUE(false); 4131 iState = STATE_CLEANUPANDCOMPLETE; 4132 RunIfNotReady(); 4133 } 4134 break; 4135 4136 case STATE_ADDDATASINK_VIDEO: 4137 if (aResponse.GetCmdStatus() == PVMFSuccess) 4138 { 4139 iState = STATE_ADDDATASINK_AUDIO; 4140 RunIfNotReady(); 4141 } 4142 else 4143 { 4144 // AddDataSink failed 4145 PVPATB_TEST_IS_TRUE(false); 4146 iState = STATE_CLEANUPANDCOMPLETE; 4147 RunIfNotReady(); 4148 } 4149 break; 4150 4151 case STATE_ADDDATASINK_AUDIO: 4152 if (aResponse.GetCmdStatus() == PVMFSuccess) 4153 { 4154 iState = STATE_PREPARE; 4155 RunIfNotReady(); 4156 } 4157 else 4158 { 4159 // AddDataSink failed 4160 PVPATB_TEST_IS_TRUE(false); 4161 iState = STATE_CLEANUPANDCOMPLETE; 4162 RunIfNotReady(); 4163 } 4164 break; 4165 4166 case STATE_PREPARE: 4167 if (aResponse.GetCmdStatus() == PVMFSuccess) 4168 { 4169 iState = STATE_STOP; 4170 RunIfNotReady(); 4171 } 4172 else 4173 { 4174 // Prepare failed 4175 PVPATB_TEST_IS_TRUE(false); 4176 iState = STATE_CLEANUPANDCOMPLETE; 4177 RunIfNotReady(); 4178 } 4179 break; 4180 4181 case STATE_STOP: 4182 if (aResponse.GetCmdStatus() == PVMFSuccess) 4183 { 4184 iState = STATE_REMOVEDATASINK_VIDEO; 4185 RunIfNotReady(); 4186 } 4187 else 4188 { 4189 // Stop failed 4190 PVPATB_TEST_IS_TRUE(false); 4191 iState = STATE_CLEANUPANDCOMPLETE; 4192 RunIfNotReady(); 4193 } 4194 break; 4195 4196 case STATE_REMOVEDATASINK_VIDEO: 4197 if (aResponse.GetCmdStatus() == PVMFSuccess) 4198 { 4199 iState = STATE_REMOVEDATASINK_AUDIO; 4200 RunIfNotReady(); 4201 } 4202 else 4203 { 4204 // RemoveDataSink failed 4205 PVPATB_TEST_IS_TRUE(false); 4206 iState = STATE_CLEANUPANDCOMPLETE; 4207 RunIfNotReady(); 4208 } 4209 break; 4210 4211 case STATE_REMOVEDATASINK_AUDIO: 4212 if (aResponse.GetCmdStatus() == PVMFSuccess) 4213 { 4214 iState = STATE_RESET; 4215 RunIfNotReady(); 4216 } 4217 else 4218 { 4219 // RemoveDataSink failed 4220 PVPATB_TEST_IS_TRUE(false); 4221 iState = STATE_CLEANUPANDCOMPLETE; 4222 RunIfNotReady(); 4223 } 4224 break; 4225 4226 case STATE_RESET: 4227 if (aResponse.GetCmdStatus() == PVMFSuccess) 4228 { 4229 iState = STATE_REMOVEDATASOURCE; 4230 RunIfNotReady(); 4231 } 4232 else 4233 { 4234 // Reset failed 4235 PVPATB_TEST_IS_TRUE(false); 4236 iState = STATE_CLEANUPANDCOMPLETE; 4237 RunIfNotReady(); 4238 } 4239 break; 4240 4241 case STATE_REMOVEDATASOURCE: 4242 if (aResponse.GetCmdStatus() == PVMFSuccess) 4243 { 4244 PVPATB_TEST_IS_TRUE(true); 4245 iState = STATE_CLEANUPANDCOMPLETE; 4246 RunIfNotReady(); 4247 } 4248 else 4249 { 4250 // RemoveDataSource failed 4251 PVPATB_TEST_IS_TRUE(false); 4252 iState = STATE_CLEANUPANDCOMPLETE; 4253 RunIfNotReady(); 4254 } 4255 break; 4256 4257 default: 4258 { 4259 // Testing error if this is reached 4260 PVPATB_TEST_IS_TRUE(false); 4261 iState = STATE_CLEANUPANDCOMPLETE; 4262 RunIfNotReady(); 4263 } 4264 break; 4265 } 4266 } 4267 4268 4269 void pvplayer_async_test_preparedstop::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 4270 { 4271 switch (aEvent.GetEventType()) 4272 { 4273 case PVMFErrResourceConfiguration: 4274 // Just log the error 4275 PVPATB_TEST_IS_TRUE(false); 4276 break; 4277 4278 case PVMFErrResource: 4279 // Just log the error 4280 PVPATB_TEST_IS_TRUE(false); 4281 break; 4282 4283 case PVMFErrCorrupt: 4284 // Just log the error 4285 PVPATB_TEST_IS_TRUE(false); 4286 break; 4287 4288 case PVMFErrProcessing: 4289 // Just log the error 4290 PVPATB_TEST_IS_TRUE(false); 4291 break; 4292 4293 default: 4294 // Unknown error and just log the error 4295 PVPATB_TEST_IS_TRUE(false); 4296 break; 4297 } 4298 } 4299 4300 4301 void pvplayer_async_test_preparedstop::HandleInformationalEvent(const PVAsyncInformationalEvent& /*aEvent*/) 4302 { 4303 } 4304 4305 4306 // 4307 // pvplayer_async_test_videoonlyplay7seconds section 4308 // 4309 4310 void pvplayer_async_test_videoonlyplay7seconds::StartTest() 4311 { 4312 AddToScheduler(); 4313 iState = STATE_CREATE; 4314 RunIfNotReady(); 4315 } 4316 4317 4318 void pvplayer_async_test_videoonlyplay7seconds::Run() 4319 { 4320 int error = 0; 4321 4322 switch (iState) 4323 { 4324 case STATE_CREATE: 4325 { 4326 iPlayer = NULL; 4327 4328 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 4329 if (error) 4330 { 4331 PVPATB_TEST_IS_TRUE(false); 4332 iObserver->TestCompleted(*iTestCase); 4333 } 4334 else 4335 { 4336 iState = STATE_ADDDATASOURCE; 4337 RunIfNotReady(); 4338 } 4339 } 4340 break; 4341 4342 case STATE_ADDDATASOURCE: 4343 { 4344 iDataSource = new PVPlayerDataSourceURL; 4345 4346 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 4347 sourcefile += _STRLIT_WCHAR("test.mp4"); 4348 iDataSource->SetDataSourceURL(sourcefile); 4349 4350 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 4351 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 4352 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4353 } 4354 break; 4355 4356 case STATE_INIT: 4357 { 4358 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 4359 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4360 } 4361 break; 4362 4363 case STATE_ADDDATASINK_VIDEO: 4364 { 4365 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 4366 sinkfile += _STRLIT_WCHAR("test_player_videoonly7s_video.dat"); 4367 4368 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 4369 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 4370 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 4371 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 4372 4373 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 4374 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4375 } 4376 break; 4377 4378 4379 case STATE_PREPARE: 4380 { 4381 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 4382 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4383 } 4384 break; 4385 4386 case STATE_START: 4387 { 4388 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 4389 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4390 } 4391 break; 4392 4393 case STATE_STOP: 4394 { 4395 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 4396 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4397 } 4398 break; 4399 4400 case STATE_REMOVEDATASINK_VIDEO: 4401 { 4402 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 4403 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4404 } 4405 break; 4406 4407 case STATE_RESET: 4408 { 4409 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 4410 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4411 } 4412 break; 4413 4414 case STATE_REMOVEDATASOURCE: 4415 { 4416 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 4417 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4418 } 4419 break; 4420 4421 case STATE_CLEANUPANDCOMPLETE: 4422 { 4423 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 4424 iPlayer = NULL; 4425 4426 delete iDataSource; 4427 iDataSource = NULL; 4428 4429 delete iDataSinkVideo; 4430 iDataSinkVideo = NULL; 4431 4432 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 4433 iIONodeVideo = NULL; 4434 4435 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 4436 iMIOFileOutVideo = NULL; 4437 4438 iObserver->TestCompleted(*iTestCase); 4439 } 4440 break; 4441 4442 default: 4443 break; 4444 4445 } 4446 } 4447 4448 4449 void pvplayer_async_test_videoonlyplay7seconds::CommandCompleted(const PVCmdResponse& aResponse) 4450 { 4451 if (aResponse.GetCmdId() != iCurrentCmdId) 4452 { 4453 // Wrong command ID. 4454 PVPATB_TEST_IS_TRUE(false); 4455 iState = STATE_CLEANUPANDCOMPLETE; 4456 RunIfNotReady(); 4457 return; 4458 } 4459 4460 if (aResponse.GetContext() != NULL) 4461 { 4462 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 4463 { 4464 if (iContextObject != iContextObjectRefValue) 4465 { 4466 // Context data value was corrupted 4467 PVPATB_TEST_IS_TRUE(false); 4468 iState = STATE_CLEANUPANDCOMPLETE; 4469 RunIfNotReady(); 4470 return; 4471 } 4472 } 4473 else 4474 { 4475 // Context data pointer was corrupted 4476 PVPATB_TEST_IS_TRUE(false); 4477 iState = STATE_CLEANUPANDCOMPLETE; 4478 RunIfNotReady(); 4479 return; 4480 } 4481 } 4482 4483 switch (iState) 4484 { 4485 case STATE_ADDDATASOURCE: 4486 if (aResponse.GetCmdStatus() == PVMFSuccess) 4487 { 4488 iState = STATE_INIT; 4489 RunIfNotReady(); 4490 } 4491 else 4492 { 4493 // AddDataSource failed 4494 PVPATB_TEST_IS_TRUE(false); 4495 iState = STATE_CLEANUPANDCOMPLETE; 4496 RunIfNotReady(); 4497 } 4498 break; 4499 4500 case STATE_INIT: 4501 if (aResponse.GetCmdStatus() == PVMFSuccess) 4502 { 4503 iState = STATE_ADDDATASINK_VIDEO; 4504 RunIfNotReady(); 4505 } 4506 else 4507 { 4508 // Init failed 4509 PVPATB_TEST_IS_TRUE(false); 4510 iState = STATE_CLEANUPANDCOMPLETE; 4511 RunIfNotReady(); 4512 } 4513 break; 4514 4515 case STATE_ADDDATASINK_VIDEO: 4516 if (aResponse.GetCmdStatus() == PVMFSuccess) 4517 { 4518 iState = STATE_PREPARE; 4519 RunIfNotReady(); 4520 } 4521 else 4522 { 4523 // AddDataSink failed 4524 PVPATB_TEST_IS_TRUE(false); 4525 iState = STATE_CLEANUPANDCOMPLETE; 4526 RunIfNotReady(); 4527 } 4528 break; 4529 4530 4531 case STATE_PREPARE: 4532 if (aResponse.GetCmdStatus() == PVMFSuccess) 4533 { 4534 iState = STATE_START; 4535 RunIfNotReady(); 4536 } 4537 else 4538 { 4539 // Prepare failed 4540 PVPATB_TEST_IS_TRUE(false); 4541 iState = STATE_CLEANUPANDCOMPLETE; 4542 RunIfNotReady(); 4543 } 4544 break; 4545 4546 case STATE_START: 4547 if (aResponse.GetCmdStatus() == PVMFSuccess) 4548 { 4549 iState = STATE_STOP; 4550 RunIfNotReady(7000000); 4551 } 4552 else 4553 { 4554 // Start failed 4555 PVPATB_TEST_IS_TRUE(false); 4556 iState = STATE_CLEANUPANDCOMPLETE; 4557 RunIfNotReady(); 4558 } 4559 break; 4560 4561 case STATE_STOP: 4562 if (aResponse.GetCmdStatus() == PVMFSuccess) 4563 { 4564 iState = STATE_REMOVEDATASINK_VIDEO; 4565 RunIfNotReady(); 4566 } 4567 else 4568 { 4569 // Stop failed 4570 PVPATB_TEST_IS_TRUE(false); 4571 iState = STATE_CLEANUPANDCOMPLETE; 4572 RunIfNotReady(); 4573 } 4574 break; 4575 4576 case STATE_REMOVEDATASINK_VIDEO: 4577 if (aResponse.GetCmdStatus() == PVMFSuccess) 4578 { 4579 iState = STATE_RESET; 4580 RunIfNotReady(); 4581 } 4582 else 4583 { 4584 // RemoveDataSink failed 4585 PVPATB_TEST_IS_TRUE(false); 4586 iState = STATE_CLEANUPANDCOMPLETE; 4587 RunIfNotReady(); 4588 } 4589 break; 4590 4591 case STATE_RESET: 4592 if (aResponse.GetCmdStatus() == PVMFSuccess) 4593 { 4594 iState = STATE_REMOVEDATASOURCE; 4595 RunIfNotReady(); 4596 } 4597 else 4598 { 4599 // Reset failed 4600 PVPATB_TEST_IS_TRUE(false); 4601 iState = STATE_CLEANUPANDCOMPLETE; 4602 RunIfNotReady(); 4603 } 4604 break; 4605 4606 case STATE_REMOVEDATASOURCE: 4607 if (aResponse.GetCmdStatus() == PVMFSuccess) 4608 { 4609 PVPATB_TEST_IS_TRUE(true); 4610 iState = STATE_CLEANUPANDCOMPLETE; 4611 RunIfNotReady(); 4612 } 4613 else 4614 { 4615 // RemoveDataSource failed 4616 PVPATB_TEST_IS_TRUE(false); 4617 iState = STATE_CLEANUPANDCOMPLETE; 4618 RunIfNotReady(); 4619 } 4620 break; 4621 4622 default: 4623 { 4624 // Testing error if this is reached 4625 PVPATB_TEST_IS_TRUE(false); 4626 iState = STATE_CLEANUPANDCOMPLETE; 4627 RunIfNotReady(); 4628 } 4629 break; 4630 } 4631 } 4632 4633 4634 void pvplayer_async_test_videoonlyplay7seconds::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 4635 { 4636 switch (aEvent.GetEventType()) 4637 { 4638 case PVMFErrResourceConfiguration: 4639 // Just log the error 4640 PVPATB_TEST_IS_TRUE(false); 4641 break; 4642 4643 case PVMFErrResource: 4644 // Just log the error 4645 PVPATB_TEST_IS_TRUE(false); 4646 break; 4647 4648 case PVMFErrCorrupt: 4649 // Just log the error 4650 PVPATB_TEST_IS_TRUE(false); 4651 break; 4652 4653 case PVMFErrProcessing: 4654 // Just log the error 4655 PVPATB_TEST_IS_TRUE(false); 4656 break; 4657 4658 default: 4659 // Unknown error and just log the error 4660 PVPATB_TEST_IS_TRUE(false); 4661 break; 4662 } 4663 } 4664 4665 4666 void pvplayer_async_test_videoonlyplay7seconds::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 4667 { 4668 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 4669 { 4670 // do nothing 4671 } 4672 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 4673 { 4674 iState = STATE_CLEANUPANDCOMPLETE; 4675 RunIfNotReady(); 4676 } 4677 } 4678 4679 4680 // 4681 // pvplayer_async_test_play5stopplay10stopreset section 4682 // 4683 void pvplayer_async_test_play5stopplay10stopreset::StartTest() 4684 { 4685 AddToScheduler(); 4686 iState = STATE_CREATE; 4687 RunIfNotReady(); 4688 } 4689 4690 4691 void pvplayer_async_test_play5stopplay10stopreset::Run() 4692 { 4693 int error = 0; 4694 4695 switch (iState) 4696 { 4697 case STATE_CREATE: 4698 { 4699 iPlayer = NULL; 4700 4701 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 4702 if (error) 4703 { 4704 PVPATB_TEST_IS_TRUE(false); 4705 iObserver->TestCompleted(*iTestCase); 4706 } 4707 else 4708 { 4709 iState = STATE_ADDDATASOURCE; 4710 RunIfNotReady(); 4711 } 4712 } 4713 break; 4714 4715 case STATE_ADDDATASOURCE: 4716 { 4717 iDataSource = new PVPlayerDataSourceURL; 4718 OSCL_wHeapString<OsclMemAllocator> wFileName; 4719 oscl_wchar output[100]; 4720 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 100); 4721 wFileName.set(output, oscl_strlen(output)); 4722 iDataSource->SetDataSourceURL(wFileName); 4723 iDataSource->SetDataSourceFormatType(iFileType); 4724 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 4725 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4726 } 4727 break; 4728 4729 case STATE_INIT: 4730 { 4731 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 4732 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4733 } 4734 break; 4735 4736 case STATE_ADDDATASINK_VIDEO: 4737 { 4738 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 4739 sinkfile += _STRLIT_WCHAR("test_player_playstop2times_video.dat"); 4740 4741 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 4742 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 4743 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 4744 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 4745 4746 4747 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 4748 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4749 } 4750 break; 4751 4752 case STATE_ADDDATASINK_AUDIO: 4753 { 4754 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 4755 sinkfile += _STRLIT_WCHAR("test_player_playstop2times_audio.dat"); 4756 4757 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 4758 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 4759 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 4760 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 4761 4762 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 4763 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4764 } 4765 break; 4766 4767 case STATE_PREPARE_FIRST: 4768 { 4769 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 4770 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4771 } 4772 break; 4773 4774 case STATE_START_FIRST: 4775 { 4776 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 4777 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4778 } 4779 break; 4780 4781 case STATE_STOP_FIRST: 4782 { 4783 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 4784 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4785 } 4786 break; 4787 case STATE_PREPARE_SECOND: 4788 { 4789 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 4790 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4791 } 4792 break; 4793 case STATE_START_SECOND: 4794 { 4795 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 4796 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4797 } 4798 break; 4799 4800 case STATE_STOP_SECOND: 4801 { 4802 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 4803 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4804 } 4805 break; 4806 4807 case STATE_REMOVEDATASINK_VIDEO: 4808 { 4809 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 4810 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4811 } 4812 break; 4813 4814 case STATE_REMOVEDATASINK_AUDIO: 4815 { 4816 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 4817 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4818 } 4819 break; 4820 4821 case STATE_RESET: 4822 { 4823 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 4824 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4825 } 4826 break; 4827 4828 case STATE_REMOVEDATASOURCE: 4829 { 4830 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 4831 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 4832 } 4833 break; 4834 4835 case STATE_CLEANUPANDCOMPLETE: 4836 { 4837 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 4838 iPlayer = NULL; 4839 4840 delete iDataSource; 4841 iDataSource = NULL; 4842 4843 delete iDataSinkVideo; 4844 iDataSinkVideo = NULL; 4845 4846 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 4847 iIONodeVideo = NULL; 4848 4849 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 4850 iMIOFileOutVideo = NULL; 4851 4852 delete iDataSinkAudio; 4853 iDataSinkAudio = NULL; 4854 4855 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 4856 iIONodeAudio = NULL; 4857 4858 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 4859 iMIOFileOutAudio = NULL; 4860 4861 iObserver->TestCompleted(*iTestCase); 4862 } 4863 break; 4864 4865 default: 4866 break; 4867 4868 } 4869 } 4870 4871 4872 void pvplayer_async_test_play5stopplay10stopreset::CommandCompleted(const PVCmdResponse& aResponse) 4873 { 4874 if (aResponse.GetCmdId() != iCurrentCmdId) 4875 { 4876 // Wrong command ID. 4877 PVPATB_TEST_IS_TRUE(false); 4878 iState = STATE_CLEANUPANDCOMPLETE; 4879 RunIfNotReady(); 4880 return; 4881 } 4882 4883 if (aResponse.GetContext() != NULL) 4884 { 4885 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 4886 { 4887 if (iContextObject != iContextObjectRefValue) 4888 { 4889 // Context data value was corrupted 4890 PVPATB_TEST_IS_TRUE(false); 4891 iState = STATE_CLEANUPANDCOMPLETE; 4892 RunIfNotReady(); 4893 return; 4894 } 4895 } 4896 else 4897 { 4898 // Context data pointer was corrupted 4899 PVPATB_TEST_IS_TRUE(false); 4900 iState = STATE_CLEANUPANDCOMPLETE; 4901 RunIfNotReady(); 4902 return; 4903 } 4904 } 4905 4906 switch (iState) 4907 { 4908 case STATE_ADDDATASOURCE: 4909 if (aResponse.GetCmdStatus() == PVMFSuccess) 4910 { 4911 iState = STATE_INIT; 4912 RunIfNotReady(); 4913 } 4914 else 4915 { 4916 // AddDataSource failed 4917 PVPATB_TEST_IS_TRUE(false); 4918 iState = STATE_CLEANUPANDCOMPLETE; 4919 RunIfNotReady(); 4920 } 4921 break; 4922 4923 case STATE_INIT: 4924 if (aResponse.GetCmdStatus() == PVMFSuccess) 4925 { 4926 iState = STATE_ADDDATASINK_VIDEO; 4927 RunIfNotReady(); 4928 } 4929 else 4930 { 4931 // Init failed 4932 PVPATB_TEST_IS_TRUE(false); 4933 iState = STATE_CLEANUPANDCOMPLETE; 4934 RunIfNotReady(); 4935 } 4936 break; 4937 4938 case STATE_ADDDATASINK_VIDEO: 4939 if (aResponse.GetCmdStatus() == PVMFSuccess) 4940 { 4941 iState = STATE_ADDDATASINK_AUDIO; 4942 RunIfNotReady(); 4943 } 4944 else 4945 { 4946 // AddDataSink failed 4947 PVPATB_TEST_IS_TRUE(false); 4948 iState = STATE_CLEANUPANDCOMPLETE; 4949 RunIfNotReady(); 4950 } 4951 break; 4952 4953 case STATE_ADDDATASINK_AUDIO: 4954 if (aResponse.GetCmdStatus() == PVMFSuccess) 4955 { 4956 iState = STATE_PREPARE_FIRST; 4957 RunIfNotReady(); 4958 } 4959 else 4960 { 4961 // AddDataSink failed 4962 PVPATB_TEST_IS_TRUE(false); 4963 iState = STATE_CLEANUPANDCOMPLETE; 4964 RunIfNotReady(); 4965 } 4966 break; 4967 4968 case STATE_PREPARE_FIRST: 4969 if (aResponse.GetCmdStatus() == PVMFSuccess) 4970 { 4971 iState = STATE_START_FIRST; 4972 RunIfNotReady(); 4973 } 4974 else 4975 { 4976 // Prepare failed 4977 PVPATB_TEST_IS_TRUE(false); 4978 iState = STATE_CLEANUPANDCOMPLETE; 4979 RunIfNotReady(); 4980 } 4981 break; 4982 4983 case STATE_START_FIRST: 4984 if (aResponse.GetCmdStatus() == PVMFSuccess) 4985 { 4986 iState = STATE_STOP_FIRST; 4987 RunIfNotReady(5000000); 4988 } 4989 else 4990 { 4991 // Start failed 4992 PVPATB_TEST_IS_TRUE(false); 4993 iState = STATE_CLEANUPANDCOMPLETE; 4994 RunIfNotReady(); 4995 } 4996 break; 4997 4998 case STATE_STOP_FIRST: 4999 if (aResponse.GetCmdStatus() == PVMFSuccess) 5000 { 5001 iState = STATE_PREPARE_SECOND; 5002 RunIfNotReady(); 5003 } 5004 else 5005 { 5006 // Stop failed 5007 PVPATB_TEST_IS_TRUE(false); 5008 iState = STATE_CLEANUPANDCOMPLETE; 5009 RunIfNotReady(); 5010 } 5011 break; 5012 5013 case STATE_PREPARE_SECOND: 5014 if (aResponse.GetCmdStatus() == PVMFSuccess) 5015 { 5016 iState = STATE_START_SECOND; 5017 RunIfNotReady(); 5018 } 5019 else 5020 { 5021 // Prepare failed 5022 PVPATB_TEST_IS_TRUE(false); 5023 iState = STATE_CLEANUPANDCOMPLETE; 5024 RunIfNotReady(); 5025 } 5026 break; 5027 5028 case STATE_START_SECOND: 5029 if (aResponse.GetCmdStatus() == PVMFSuccess) 5030 { 5031 iState = STATE_STOP_SECOND; 5032 RunIfNotReady(10000000); 5033 } 5034 else 5035 { 5036 // Start failed 5037 PVPATB_TEST_IS_TRUE(false); 5038 iState = STATE_CLEANUPANDCOMPLETE; 5039 RunIfNotReady(); 5040 } 5041 break; 5042 5043 case STATE_STOP_SECOND: 5044 if (aResponse.GetCmdStatus() == PVMFSuccess) 5045 { 5046 iState = STATE_REMOVEDATASINK_VIDEO; 5047 RunIfNotReady(); 5048 } 5049 else 5050 { 5051 // Stop failed 5052 PVPATB_TEST_IS_TRUE(false); 5053 iState = STATE_CLEANUPANDCOMPLETE; 5054 RunIfNotReady(); 5055 } 5056 break; 5057 5058 5059 case STATE_REMOVEDATASINK_VIDEO: 5060 if (aResponse.GetCmdStatus() == PVMFSuccess) 5061 { 5062 iState = STATE_REMOVEDATASINK_AUDIO; 5063 RunIfNotReady(); 5064 } 5065 else 5066 { 5067 // RemoveDataSink failed 5068 PVPATB_TEST_IS_TRUE(false); 5069 iState = STATE_CLEANUPANDCOMPLETE; 5070 RunIfNotReady(); 5071 } 5072 break; 5073 5074 case STATE_REMOVEDATASINK_AUDIO: 5075 if (aResponse.GetCmdStatus() == PVMFSuccess) 5076 { 5077 iState = STATE_RESET; 5078 RunIfNotReady(); 5079 } 5080 else 5081 { 5082 // RemoveDataSink failed 5083 PVPATB_TEST_IS_TRUE(false); 5084 iState = STATE_CLEANUPANDCOMPLETE; 5085 RunIfNotReady(); 5086 } 5087 break; 5088 5089 case STATE_RESET: 5090 if (aResponse.GetCmdStatus() == PVMFSuccess) 5091 { 5092 iState = STATE_REMOVEDATASOURCE; 5093 RunIfNotReady(); 5094 } 5095 else 5096 { 5097 // Reset failed 5098 PVPATB_TEST_IS_TRUE(false); 5099 iState = STATE_CLEANUPANDCOMPLETE; 5100 RunIfNotReady(); 5101 } 5102 break; 5103 5104 case STATE_REMOVEDATASOURCE: 5105 if (aResponse.GetCmdStatus() == PVMFSuccess) 5106 { 5107 PVPATB_TEST_IS_TRUE(true); 5108 iState = STATE_CLEANUPANDCOMPLETE; 5109 RunIfNotReady(); 5110 } 5111 else 5112 { 5113 // RemoveDataSource failed 5114 PVPATB_TEST_IS_TRUE(false); 5115 iState = STATE_CLEANUPANDCOMPLETE; 5116 RunIfNotReady(); 5117 } 5118 break; 5119 5120 default: 5121 { 5122 // Testing error if this is reached 5123 PVPATB_TEST_IS_TRUE(false); 5124 iState = STATE_CLEANUPANDCOMPLETE; 5125 RunIfNotReady(); 5126 } 5127 break; 5128 } 5129 } 5130 5131 5132 void pvplayer_async_test_play5stopplay10stopreset::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 5133 { 5134 switch (aEvent.GetEventType()) 5135 { 5136 case PVMFErrResourceConfiguration: 5137 // Just log the error 5138 PVPATB_TEST_IS_TRUE(false); 5139 break; 5140 5141 case PVMFErrResource: 5142 // Just log the error 5143 PVPATB_TEST_IS_TRUE(false); 5144 break; 5145 5146 case PVMFErrCorrupt: 5147 // Just log the error 5148 PVPATB_TEST_IS_TRUE(false); 5149 break; 5150 5151 case PVMFErrProcessing: 5152 // Just log the error 5153 PVPATB_TEST_IS_TRUE(false); 5154 break; 5155 5156 default: 5157 // Unknown error and just log the error 5158 PVPATB_TEST_IS_TRUE(false); 5159 break; 5160 } 5161 } 5162 5163 5164 void pvplayer_async_test_play5stopplay10stopreset::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 5165 { 5166 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 5167 { 5168 // do nothing 5169 } 5170 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 5171 { 5172 iState = STATE_CLEANUPANDCOMPLETE; 5173 RunIfNotReady(); 5174 } 5175 } 5176 5177 5178 // 5179 // pvplayer_async_test_pauseresume section 5180 // 5181 void pvplayer_async_test_pauseresume::StartTest() 5182 { 5183 AddToScheduler(); 5184 iState = STATE_CREATE; 5185 RunIfNotReady(); 5186 } 5187 5188 5189 void pvplayer_async_test_pauseresume::Run() 5190 { 5191 int error = 0; 5192 5193 switch (iState) 5194 { 5195 case STATE_CREATE: 5196 { 5197 iPlayer = NULL; 5198 5199 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 5200 if (error) 5201 { 5202 PVPATB_TEST_IS_TRUE(false); 5203 iObserver->TestCompleted(*iTestCase); 5204 } 5205 else 5206 { 5207 iState = STATE_ADDDATASOURCE; 5208 RunIfNotReady(); 5209 } 5210 } 5211 break; 5212 5213 case STATE_ADDDATASOURCE: 5214 { 5215 iDataSource = new PVPlayerDataSourceURL; 5216 OSCL_wHeapString<OsclMemAllocator> wFileName; 5217 oscl_wchar output[100]; 5218 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 100); 5219 wFileName.set(output, oscl_strlen(output)); 5220 iDataSource->SetDataSourceURL(wFileName); 5221 iDataSource->SetDataSourceFormatType(iFileType); 5222 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 5223 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5224 } 5225 break; 5226 5227 case STATE_INIT: 5228 { 5229 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init()); 5230 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5231 } 5232 break; 5233 5234 case STATE_ADDDATASINK_VIDEO: 5235 { 5236 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 5237 sinkfile += _STRLIT_WCHAR("test_player_pauseresume_video.dat"); 5238 5239 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 5240 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 5241 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 5242 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 5243 5244 5245 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 5246 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5247 } 5248 break; 5249 5250 case STATE_ADDDATASINK_AUDIO: 5251 { 5252 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 5253 sinkfile += _STRLIT_WCHAR("test_player_pauseresume_audio.dat"); 5254 5255 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 5256 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 5257 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 5258 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 5259 5260 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 5261 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5262 } 5263 break; 5264 5265 case STATE_PREPARE: 5266 { 5267 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 5268 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5269 } 5270 break; 5271 5272 case STATE_START: 5273 { 5274 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 5275 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5276 } 5277 break; 5278 case STATE_PAUSE: 5279 { 5280 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 5281 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5282 } 5283 break; 5284 5285 case STATE_RESUME: 5286 { 5287 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 5288 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5289 } 5290 break; 5291 5292 case STATE_STOP: 5293 { 5294 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 5295 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5296 } 5297 break; 5298 5299 case STATE_REMOVEDATASINK_VIDEO: 5300 { 5301 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 5302 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5303 } 5304 break; 5305 5306 case STATE_REMOVEDATASINK_AUDIO: 5307 { 5308 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 5309 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5310 } 5311 break; 5312 5313 case STATE_RESET: 5314 { 5315 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 5316 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5317 } 5318 break; 5319 5320 case STATE_REMOVEDATASOURCE: 5321 { 5322 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 5323 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5324 } 5325 break; 5326 5327 case STATE_CLEANUPANDCOMPLETE: 5328 { 5329 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 5330 iPlayer = NULL; 5331 5332 delete iDataSource; 5333 iDataSource = NULL; 5334 5335 delete iDataSinkVideo; 5336 iDataSinkVideo = NULL; 5337 5338 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 5339 iIONodeVideo = NULL; 5340 5341 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 5342 iMIOFileOutVideo = NULL; 5343 5344 delete iDataSinkAudio; 5345 iDataSinkAudio = NULL; 5346 5347 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 5348 iIONodeAudio = NULL; 5349 5350 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 5351 iMIOFileOutAudio = NULL; 5352 5353 iObserver->TestCompleted(*iTestCase); 5354 } 5355 break; 5356 5357 default: 5358 break; 5359 5360 } 5361 } 5362 5363 5364 void pvplayer_async_test_pauseresume::CommandCompleted(const PVCmdResponse& aResponse) 5365 { 5366 if (aResponse.GetCmdId() != iCurrentCmdId) 5367 { 5368 // Wrong command ID. 5369 PVPATB_TEST_IS_TRUE(false); 5370 iState = STATE_CLEANUPANDCOMPLETE; 5371 RunIfNotReady(); 5372 return; 5373 } 5374 5375 if (aResponse.GetContext() != NULL) 5376 { 5377 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 5378 { 5379 if (iContextObject != iContextObjectRefValue) 5380 { 5381 // Context data value was corrupted 5382 PVPATB_TEST_IS_TRUE(false); 5383 iState = STATE_CLEANUPANDCOMPLETE; 5384 RunIfNotReady(); 5385 return; 5386 } 5387 } 5388 else 5389 { 5390 // Context data pointer was corrupted 5391 PVPATB_TEST_IS_TRUE(false); 5392 iState = STATE_CLEANUPANDCOMPLETE; 5393 RunIfNotReady(); 5394 return; 5395 } 5396 } 5397 5398 switch (iState) 5399 { 5400 case STATE_ADDDATASOURCE: 5401 if (aResponse.GetCmdStatus() == PVMFSuccess) 5402 { 5403 iState = STATE_INIT; 5404 RunIfNotReady(); 5405 } 5406 else 5407 { 5408 // AddDataSource failed 5409 PVPATB_TEST_IS_TRUE(false); 5410 iState = STATE_CLEANUPANDCOMPLETE; 5411 RunIfNotReady(); 5412 } 5413 break; 5414 5415 case STATE_INIT: 5416 if (aResponse.GetCmdStatus() == PVMFSuccess) 5417 { 5418 iState = STATE_ADDDATASINK_VIDEO; 5419 RunIfNotReady(); 5420 } 5421 else 5422 { 5423 // Init failed 5424 PVPATB_TEST_IS_TRUE(false); 5425 iState = STATE_CLEANUPANDCOMPLETE; 5426 RunIfNotReady(); 5427 } 5428 break; 5429 5430 case STATE_ADDDATASINK_VIDEO: 5431 if (aResponse.GetCmdStatus() == PVMFSuccess) 5432 { 5433 iState = STATE_ADDDATASINK_AUDIO; 5434 RunIfNotReady(); 5435 } 5436 else 5437 { 5438 // AddDataSink failed 5439 PVPATB_TEST_IS_TRUE(false); 5440 iState = STATE_CLEANUPANDCOMPLETE; 5441 RunIfNotReady(); 5442 } 5443 break; 5444 5445 case STATE_ADDDATASINK_AUDIO: 5446 if (aResponse.GetCmdStatus() == PVMFSuccess) 5447 { 5448 iState = STATE_PREPARE; 5449 RunIfNotReady(); 5450 } 5451 else 5452 { 5453 // AddDataSink failed 5454 PVPATB_TEST_IS_TRUE(false); 5455 iState = STATE_CLEANUPANDCOMPLETE; 5456 RunIfNotReady(); 5457 } 5458 break; 5459 5460 case STATE_PREPARE: 5461 if (aResponse.GetCmdStatus() == PVMFSuccess) 5462 { 5463 iState = STATE_START; 5464 RunIfNotReady(); 5465 } 5466 else 5467 { 5468 // Prepare failed 5469 PVPATB_TEST_IS_TRUE(false); 5470 iState = STATE_CLEANUPANDCOMPLETE; 5471 RunIfNotReady(); 5472 } 5473 break; 5474 5475 case STATE_START: 5476 if (aResponse.GetCmdStatus() == PVMFSuccess) 5477 { 5478 iState = STATE_PAUSE; 5479 RunIfNotReady(10000000); 5480 } 5481 else 5482 { 5483 // Start failed 5484 PVPATB_TEST_IS_TRUE(false); 5485 iState = STATE_CLEANUPANDCOMPLETE; 5486 RunIfNotReady(); 5487 } 5488 break; 5489 5490 case STATE_PAUSE: 5491 if (aResponse.GetCmdStatus() == PVMFSuccess) 5492 { 5493 iState = STATE_RESUME; 5494 RunIfNotReady(5000000); 5495 } 5496 else 5497 { 5498 // Pause failed 5499 PVPATB_TEST_IS_TRUE(false); 5500 iState = STATE_CLEANUPANDCOMPLETE; 5501 RunIfNotReady(); 5502 } 5503 break; 5504 5505 case STATE_RESUME: 5506 if (aResponse.GetCmdStatus() == PVMFSuccess) 5507 { 5508 iState = STATE_STOP; 5509 RunIfNotReady(10000000); 5510 } 5511 else 5512 { 5513 // Resume failed 5514 PVPATB_TEST_IS_TRUE(false); 5515 iState = STATE_CLEANUPANDCOMPLETE; 5516 RunIfNotReady(); 5517 } 5518 break; 5519 5520 case STATE_STOP: 5521 if (aResponse.GetCmdStatus() == PVMFSuccess) 5522 { 5523 iState = STATE_REMOVEDATASINK_VIDEO; 5524 RunIfNotReady(); 5525 } 5526 else 5527 { 5528 // Stop failed 5529 PVPATB_TEST_IS_TRUE(false); 5530 iState = STATE_CLEANUPANDCOMPLETE; 5531 RunIfNotReady(); 5532 } 5533 break; 5534 5535 case STATE_REMOVEDATASINK_VIDEO: 5536 if (aResponse.GetCmdStatus() == PVMFSuccess) 5537 { 5538 iState = STATE_REMOVEDATASINK_AUDIO; 5539 RunIfNotReady(); 5540 } 5541 else 5542 { 5543 // RemoveDataSink failed 5544 PVPATB_TEST_IS_TRUE(false); 5545 iState = STATE_CLEANUPANDCOMPLETE; 5546 RunIfNotReady(); 5547 } 5548 break; 5549 5550 case STATE_REMOVEDATASINK_AUDIO: 5551 if (aResponse.GetCmdStatus() == PVMFSuccess) 5552 { 5553 iState = STATE_RESET; 5554 RunIfNotReady(); 5555 } 5556 else 5557 { 5558 // RemoveDataSink failed 5559 PVPATB_TEST_IS_TRUE(false); 5560 iState = STATE_CLEANUPANDCOMPLETE; 5561 RunIfNotReady(); 5562 } 5563 break; 5564 5565 case STATE_RESET: 5566 if (aResponse.GetCmdStatus() == PVMFSuccess) 5567 { 5568 iState = STATE_REMOVEDATASOURCE; 5569 RunIfNotReady(); 5570 } 5571 else 5572 { 5573 // Reset failed 5574 PVPATB_TEST_IS_TRUE(false); 5575 iState = STATE_CLEANUPANDCOMPLETE; 5576 RunIfNotReady(); 5577 } 5578 break; 5579 5580 case STATE_REMOVEDATASOURCE: 5581 if (aResponse.GetCmdStatus() == PVMFSuccess) 5582 { 5583 PVPATB_TEST_IS_TRUE(true); 5584 iState = STATE_CLEANUPANDCOMPLETE; 5585 RunIfNotReady(); 5586 } 5587 else 5588 { 5589 // RemoveDataSource failed 5590 PVPATB_TEST_IS_TRUE(false); 5591 iState = STATE_CLEANUPANDCOMPLETE; 5592 RunIfNotReady(); 5593 } 5594 break; 5595 5596 default: 5597 { 5598 // Testing error if this is reached 5599 PVPATB_TEST_IS_TRUE(false); 5600 iState = STATE_CLEANUPANDCOMPLETE; 5601 RunIfNotReady(); 5602 } 5603 break; 5604 } 5605 } 5606 5607 5608 void pvplayer_async_test_pauseresume::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 5609 { 5610 switch (aEvent.GetEventType()) 5611 { 5612 case PVMFErrResourceConfiguration: 5613 // Just log the error 5614 PVPATB_TEST_IS_TRUE(false); 5615 break; 5616 5617 case PVMFErrResource: 5618 // Just log the error 5619 PVPATB_TEST_IS_TRUE(false); 5620 break; 5621 5622 case PVMFErrCorrupt: 5623 // Just log the error 5624 PVPATB_TEST_IS_TRUE(false); 5625 break; 5626 5627 case PVMFErrProcessing: 5628 // Just log the error 5629 PVPATB_TEST_IS_TRUE(false); 5630 break; 5631 5632 default: 5633 // Unknown error and just log the error 5634 PVPATB_TEST_IS_TRUE(false); 5635 break; 5636 } 5637 } 5638 5639 5640 void pvplayer_async_test_pauseresume::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 5641 { 5642 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 5643 { 5644 // do nothing 5645 } 5646 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 5647 { 5648 iState = STATE_CLEANUPANDCOMPLETE; 5649 RunIfNotReady(); 5650 } 5651 } 5652 5653 5654 // 5655 // pvplayer_async_test_playpausestop section 5656 // 5657 5658 5659 void pvplayer_async_test_playpausestop::StartTest() 5660 { 5661 AddToScheduler(); 5662 iState = STATE_CREATE; 5663 RunIfNotReady(); 5664 } 5665 5666 5667 void pvplayer_async_test_playpausestop::Run() 5668 { 5669 int error = 0; 5670 5671 switch (iState) 5672 { 5673 case STATE_CREATE: 5674 { 5675 iPlayer = NULL; 5676 5677 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 5678 if (error) 5679 { 5680 PVPATB_TEST_IS_TRUE(false); 5681 iObserver->TestCompleted(*iTestCase); 5682 } 5683 else 5684 { 5685 iState = STATE_ADDDATASOURCE; 5686 RunIfNotReady(); 5687 } 5688 } 5689 break; 5690 5691 case STATE_ADDDATASOURCE: 5692 { 5693 iDataSource = new PVPlayerDataSourceURL; 5694 OSCL_wHeapString<OsclMemAllocator> wFileName; 5695 oscl_wchar output[100]; 5696 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 100); 5697 wFileName.set(output, oscl_strlen(output)); 5698 iDataSource->SetDataSourceURL(wFileName); 5699 iDataSource->SetDataSourceFormatType(iFileType); 5700 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 5701 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5702 } 5703 break; 5704 5705 case STATE_INIT: 5706 { 5707 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 5708 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5709 } 5710 break; 5711 5712 case STATE_ADDDATASINK_VIDEO: 5713 { 5714 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 5715 sinkfile += _STRLIT_WCHAR("test_player_playpausestop_video.dat"); 5716 5717 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 5718 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 5719 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 5720 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 5721 5722 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 5723 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5724 } 5725 break; 5726 5727 case STATE_ADDDATASINK_AUDIO: 5728 { 5729 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 5730 sinkfile += _STRLIT_WCHAR("test_player_playpausestop_audio.dat"); 5731 5732 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 5733 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 5734 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 5735 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 5736 5737 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 5738 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5739 } 5740 break; 5741 5742 case STATE_PREPARE: 5743 { 5744 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 5745 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5746 } 5747 break; 5748 5749 case STATE_START: 5750 { 5751 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 5752 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5753 } 5754 break; 5755 5756 case STATE_PAUSE: 5757 { 5758 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 5759 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5760 } 5761 break; 5762 5763 case STATE_STOP: 5764 { 5765 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 5766 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5767 } 5768 break; 5769 5770 case STATE_REMOVEDATASINK_VIDEO: 5771 { 5772 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 5773 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5774 } 5775 break; 5776 5777 case STATE_REMOVEDATASINK_AUDIO: 5778 { 5779 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 5780 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5781 } 5782 break; 5783 5784 case STATE_RESET: 5785 { 5786 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 5787 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5788 } 5789 break; 5790 5791 case STATE_REMOVEDATASOURCE: 5792 { 5793 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 5794 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 5795 } 5796 break; 5797 5798 case STATE_CLEANUPANDCOMPLETE: 5799 { 5800 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 5801 iPlayer = NULL; 5802 5803 delete iDataSource; 5804 iDataSource = NULL; 5805 5806 delete iDataSinkVideo; 5807 iDataSinkVideo = NULL; 5808 5809 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 5810 iIONodeVideo = NULL; 5811 5812 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 5813 iMIOFileOutVideo = NULL; 5814 5815 delete iDataSinkAudio; 5816 iDataSinkAudio = NULL; 5817 5818 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 5819 iIONodeAudio = NULL; 5820 5821 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 5822 iMIOFileOutAudio = NULL; 5823 5824 iObserver->TestCompleted(*iTestCase); 5825 } 5826 break; 5827 5828 default: 5829 break; 5830 5831 } 5832 } 5833 5834 5835 void pvplayer_async_test_playpausestop::CommandCompleted(const PVCmdResponse& aResponse) 5836 { 5837 if (aResponse.GetCmdId() != iCurrentCmdId) 5838 { 5839 // Wrong command ID. 5840 PVPATB_TEST_IS_TRUE(false); 5841 iState = STATE_CLEANUPANDCOMPLETE; 5842 RunIfNotReady(); 5843 return; 5844 } 5845 5846 if (aResponse.GetContext() != NULL) 5847 { 5848 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 5849 { 5850 if (iContextObject != iContextObjectRefValue) 5851 { 5852 // Context data value was corrupted 5853 PVPATB_TEST_IS_TRUE(false); 5854 iState = STATE_CLEANUPANDCOMPLETE; 5855 RunIfNotReady(); 5856 return; 5857 } 5858 } 5859 else 5860 { 5861 // Context data pointer was corrupted 5862 PVPATB_TEST_IS_TRUE(false); 5863 iState = STATE_CLEANUPANDCOMPLETE; 5864 RunIfNotReady(); 5865 return; 5866 } 5867 } 5868 5869 switch (iState) 5870 { 5871 case STATE_ADDDATASOURCE: 5872 if (aResponse.GetCmdStatus() == PVMFSuccess) 5873 { 5874 iState = STATE_INIT; 5875 RunIfNotReady(); 5876 } 5877 else 5878 { 5879 // AddDataSource failed 5880 PVPATB_TEST_IS_TRUE(false); 5881 iState = STATE_CLEANUPANDCOMPLETE; 5882 RunIfNotReady(); 5883 } 5884 break; 5885 5886 case STATE_INIT: 5887 if (aResponse.GetCmdStatus() == PVMFSuccess) 5888 { 5889 iState = STATE_ADDDATASINK_VIDEO; 5890 RunIfNotReady(); 5891 } 5892 else 5893 { 5894 // Init failed 5895 PVPATB_TEST_IS_TRUE(false); 5896 iState = STATE_CLEANUPANDCOMPLETE; 5897 RunIfNotReady(); 5898 } 5899 break; 5900 5901 case STATE_ADDDATASINK_VIDEO: 5902 if (aResponse.GetCmdStatus() == PVMFSuccess) 5903 { 5904 iState = STATE_ADDDATASINK_AUDIO; 5905 RunIfNotReady(); 5906 } 5907 else 5908 { 5909 // AddDataSink failed 5910 PVPATB_TEST_IS_TRUE(false); 5911 iState = STATE_CLEANUPANDCOMPLETE; 5912 RunIfNotReady(); 5913 } 5914 break; 5915 5916 case STATE_ADDDATASINK_AUDIO: 5917 if (aResponse.GetCmdStatus() == PVMFSuccess) 5918 { 5919 iState = STATE_PREPARE; 5920 RunIfNotReady(); 5921 } 5922 else 5923 { 5924 // AddDataSink failed 5925 PVPATB_TEST_IS_TRUE(false); 5926 iState = STATE_CLEANUPANDCOMPLETE; 5927 RunIfNotReady(); 5928 } 5929 break; 5930 5931 case STATE_PREPARE: 5932 if (aResponse.GetCmdStatus() == PVMFSuccess) 5933 { 5934 iState = STATE_START; 5935 RunIfNotReady(); 5936 } 5937 else 5938 { 5939 // Prepare failed 5940 PVPATB_TEST_IS_TRUE(false); 5941 iState = STATE_CLEANUPANDCOMPLETE; 5942 RunIfNotReady(); 5943 } 5944 break; 5945 5946 case STATE_START: 5947 if (aResponse.GetCmdStatus() == PVMFSuccess) 5948 { 5949 iState = STATE_PAUSE; 5950 RunIfNotReady(30000000); 5951 } 5952 else 5953 { 5954 // Start failed 5955 PVPATB_TEST_IS_TRUE(false); 5956 iState = STATE_CLEANUPANDCOMPLETE; 5957 RunIfNotReady(); 5958 } 5959 break; 5960 case STATE_PAUSE: 5961 if (aResponse.GetCmdStatus() == PVMFSuccess) 5962 { 5963 iState = STATE_STOP; 5964 RunIfNotReady(); 5965 } 5966 else 5967 { 5968 // Pause failed 5969 PVPATB_TEST_IS_TRUE(false); 5970 iState = STATE_CLEANUPANDCOMPLETE; 5971 RunIfNotReady(); 5972 } 5973 break; 5974 5975 case STATE_STOP: 5976 if (aResponse.GetCmdStatus() == PVMFSuccess) 5977 { 5978 iState = STATE_REMOVEDATASINK_VIDEO; 5979 RunIfNotReady(); 5980 } 5981 else 5982 { 5983 // Stop failed 5984 PVPATB_TEST_IS_TRUE(false); 5985 iState = STATE_CLEANUPANDCOMPLETE; 5986 RunIfNotReady(); 5987 } 5988 break; 5989 5990 case STATE_REMOVEDATASINK_VIDEO: 5991 if (aResponse.GetCmdStatus() == PVMFSuccess) 5992 { 5993 iState = STATE_REMOVEDATASINK_AUDIO; 5994 RunIfNotReady(); 5995 } 5996 else 5997 { 5998 // RemoveDataSink failed 5999 PVPATB_TEST_IS_TRUE(false); 6000 iState = STATE_CLEANUPANDCOMPLETE; 6001 RunIfNotReady(); 6002 } 6003 break; 6004 6005 case STATE_REMOVEDATASINK_AUDIO: 6006 if (aResponse.GetCmdStatus() == PVMFSuccess) 6007 { 6008 iState = STATE_RESET; 6009 RunIfNotReady(); 6010 } 6011 else 6012 { 6013 // RemoveDataSink failed 6014 PVPATB_TEST_IS_TRUE(false); 6015 iState = STATE_CLEANUPANDCOMPLETE; 6016 RunIfNotReady(); 6017 } 6018 break; 6019 6020 case STATE_RESET: 6021 if (aResponse.GetCmdStatus() == PVMFSuccess) 6022 { 6023 iState = STATE_REMOVEDATASOURCE; 6024 RunIfNotReady(); 6025 } 6026 else 6027 { 6028 // Reset failed 6029 PVPATB_TEST_IS_TRUE(false); 6030 iState = STATE_CLEANUPANDCOMPLETE; 6031 RunIfNotReady(); 6032 } 6033 break; 6034 6035 case STATE_REMOVEDATASOURCE: 6036 if (aResponse.GetCmdStatus() == PVMFSuccess) 6037 { 6038 PVPATB_TEST_IS_TRUE(true); 6039 iState = STATE_CLEANUPANDCOMPLETE; 6040 RunIfNotReady(); 6041 } 6042 else 6043 { 6044 // RemoveDataSource failed 6045 PVPATB_TEST_IS_TRUE(false); 6046 iState = STATE_CLEANUPANDCOMPLETE; 6047 RunIfNotReady(); 6048 } 6049 break; 6050 6051 default: 6052 { 6053 // Testing error if this is reached 6054 PVPATB_TEST_IS_TRUE(false); 6055 iState = STATE_CLEANUPANDCOMPLETE; 6056 RunIfNotReady(); 6057 } 6058 break; 6059 } 6060 } 6061 6062 6063 void pvplayer_async_test_playpausestop::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 6064 { 6065 switch (aEvent.GetEventType()) 6066 { 6067 case PVMFErrResourceConfiguration: 6068 // Just log the error 6069 PVPATB_TEST_IS_TRUE(false); 6070 break; 6071 6072 case PVMFErrResource: 6073 // Just log the error 6074 PVPATB_TEST_IS_TRUE(false); 6075 break; 6076 6077 case PVMFErrCorrupt: 6078 // Just log the error 6079 PVPATB_TEST_IS_TRUE(false); 6080 break; 6081 6082 case PVMFErrProcessing: 6083 // Just log the error 6084 PVPATB_TEST_IS_TRUE(false); 6085 break; 6086 6087 default: 6088 // Unknown error and just log the error 6089 PVPATB_TEST_IS_TRUE(false); 6090 break; 6091 } 6092 } 6093 6094 6095 void pvplayer_async_test_playpausestop::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 6096 { 6097 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 6098 { 6099 // do nothing 6100 } 6101 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 6102 { 6103 iState = STATE_CLEANUPANDCOMPLETE; 6104 RunIfNotReady(); 6105 } 6106 } 6107 6108 6109 6110 6111 6112 // 6113 // pvplayer_async_test_outsidenodeforvideosink section 6114 // 6115 void pvplayer_async_test_outsidenodeforvideosink::StartTest() 6116 { 6117 AddToScheduler(); 6118 iState = STATE_CREATE; 6119 RunIfNotReady(); 6120 } 6121 6122 6123 void pvplayer_async_test_outsidenodeforvideosink::Run() 6124 { 6125 int error = 0; 6126 6127 switch (iState) 6128 { 6129 case STATE_CREATE: 6130 { 6131 iPlayer = NULL; 6132 6133 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 6134 if (error) 6135 { 6136 PVPATB_TEST_IS_TRUE(false); 6137 iObserver->TestCompleted(*iTestCase); 6138 } 6139 else 6140 { 6141 iState = STATE_ADDDATASOURCE; 6142 RunIfNotReady(); 6143 } 6144 } 6145 break; 6146 6147 case STATE_ADDDATASOURCE: 6148 { 6149 iDataSource = new PVPlayerDataSourceURL; 6150 6151 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 6152 sourcefile += _STRLIT_WCHAR("test.mp4"); 6153 iDataSource->SetDataSourceURL(sourcefile); 6154 6155 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 6156 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 6157 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6158 } 6159 break; 6160 6161 case STATE_INIT: 6162 { 6163 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 6164 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6165 } 6166 break; 6167 6168 6169 case STATE_ADDDATASINK_VIDEO: 6170 { 6171 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 6172 sinkfile += _STRLIT_WCHAR("test_player_outsidevideosink_video.dat"); 6173 6174 iMOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 6175 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMOutVideo); 6176 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 6177 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 6178 6179 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 6180 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6181 } 6182 break; 6183 6184 case STATE_ADDDATASINK_AUDIO: 6185 { 6186 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 6187 sinkfile += _STRLIT_WCHAR("test_player_outsidevideosink_audio.dat"); 6188 6189 iMOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 6190 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMOutAudio); 6191 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 6192 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 6193 6194 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 6195 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6196 } 6197 break; 6198 6199 case STATE_PREPARE: 6200 { 6201 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 6202 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6203 } 6204 break; 6205 6206 case STATE_START: 6207 { 6208 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 6209 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6210 } 6211 break; 6212 6213 case STATE_STOP: 6214 { 6215 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 6216 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6217 } 6218 break; 6219 6220 case STATE_REMOVEDATASINK_VIDEO: 6221 { 6222 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 6223 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6224 } 6225 break; 6226 6227 case STATE_REMOVEDATASINK_AUDIO: 6228 { 6229 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 6230 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6231 } 6232 break; 6233 6234 case STATE_RESET: 6235 { 6236 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 6237 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6238 } 6239 break; 6240 6241 case STATE_REMOVEDATASOURCE: 6242 { 6243 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 6244 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6245 } 6246 break; 6247 6248 case STATE_CLEANUPANDCOMPLETE: 6249 { 6250 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 6251 iPlayer = NULL; 6252 6253 delete iDataSource; 6254 iDataSource = NULL; 6255 6256 delete iDataSinkVideo; 6257 iDataSinkVideo = NULL; 6258 6259 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 6260 iIONodeVideo = NULL; 6261 6262 iMioFactory->DestroyVideoOutput(iMOutVideo); 6263 iMOutVideo = NULL; 6264 6265 delete iDataSinkAudio; 6266 iDataSinkAudio = NULL; 6267 6268 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 6269 iIONodeAudio = NULL; 6270 6271 iMioFactory->DestroyAudioOutput(iMOutAudio); 6272 iMOutAudio = NULL; 6273 6274 iObserver->TestCompleted(*iTestCase); 6275 } 6276 break; 6277 6278 default: 6279 break; 6280 6281 } 6282 } 6283 6284 6285 void pvplayer_async_test_outsidenodeforvideosink::CommandCompleted(const PVCmdResponse& aResponse) 6286 { 6287 if (aResponse.GetCmdId() != iCurrentCmdId) 6288 { 6289 // Wrong command ID. 6290 PVPATB_TEST_IS_TRUE(false); 6291 iState = STATE_CLEANUPANDCOMPLETE; 6292 RunIfNotReady(); 6293 return; 6294 } 6295 6296 if (aResponse.GetContext() != NULL) 6297 { 6298 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 6299 { 6300 if (iContextObject != iContextObjectRefValue) 6301 { 6302 // Context data value was corrupted 6303 PVPATB_TEST_IS_TRUE(false); 6304 iState = STATE_CLEANUPANDCOMPLETE; 6305 RunIfNotReady(); 6306 return; 6307 } 6308 } 6309 else 6310 { 6311 // Context data pointer was corrupted 6312 PVPATB_TEST_IS_TRUE(false); 6313 iState = STATE_CLEANUPANDCOMPLETE; 6314 RunIfNotReady(); 6315 return; 6316 } 6317 } 6318 6319 switch (iState) 6320 { 6321 case STATE_ADDDATASOURCE: 6322 if (aResponse.GetCmdStatus() == PVMFSuccess) 6323 { 6324 iState = STATE_INIT; 6325 RunIfNotReady(); 6326 } 6327 else 6328 { 6329 // AddDataSource failed 6330 PVPATB_TEST_IS_TRUE(false); 6331 iState = STATE_CLEANUPANDCOMPLETE; 6332 RunIfNotReady(); 6333 } 6334 break; 6335 6336 case STATE_INIT: 6337 if (aResponse.GetCmdStatus() == PVMFSuccess) 6338 { 6339 iState = STATE_ADDDATASINK_VIDEO; 6340 RunIfNotReady(); 6341 } 6342 else 6343 { 6344 // Init failed 6345 PVPATB_TEST_IS_TRUE(false); 6346 iState = STATE_CLEANUPANDCOMPLETE; 6347 RunIfNotReady(); 6348 } 6349 break; 6350 6351 case STATE_ADDDATASINK_VIDEO: 6352 if (aResponse.GetCmdStatus() == PVMFSuccess) 6353 { 6354 iState = STATE_ADDDATASINK_AUDIO; 6355 RunIfNotReady(); 6356 } 6357 else 6358 { 6359 // AddDataSink failed 6360 PVPATB_TEST_IS_TRUE(false); 6361 iState = STATE_CLEANUPANDCOMPLETE; 6362 RunIfNotReady(); 6363 } 6364 break; 6365 6366 case STATE_ADDDATASINK_AUDIO: 6367 if (aResponse.GetCmdStatus() == PVMFSuccess) 6368 { 6369 iState = STATE_PREPARE; 6370 RunIfNotReady(); 6371 } 6372 else 6373 { 6374 // AddDataSink failed 6375 PVPATB_TEST_IS_TRUE(false); 6376 iState = STATE_CLEANUPANDCOMPLETE; 6377 RunIfNotReady(); 6378 } 6379 break; 6380 6381 case STATE_PREPARE: 6382 if (aResponse.GetCmdStatus() == PVMFSuccess) 6383 { 6384 iState = STATE_START; 6385 RunIfNotReady(); 6386 } 6387 else 6388 { 6389 // Prepare failed 6390 PVPATB_TEST_IS_TRUE(false); 6391 iState = STATE_CLEANUPANDCOMPLETE; 6392 RunIfNotReady(); 6393 } 6394 break; 6395 6396 case STATE_START: 6397 if (aResponse.GetCmdStatus() == PVMFSuccess) 6398 { 6399 iState = STATE_STOP; 6400 RunIfNotReady(30000000); 6401 } 6402 else 6403 { 6404 // Start failed 6405 PVPATB_TEST_IS_TRUE(false); 6406 iState = STATE_CLEANUPANDCOMPLETE; 6407 RunIfNotReady(); 6408 } 6409 break; 6410 6411 case STATE_STOP: 6412 if (aResponse.GetCmdStatus() == PVMFSuccess) 6413 { 6414 iState = STATE_REMOVEDATASINK_VIDEO; 6415 RunIfNotReady(); 6416 } 6417 else 6418 { 6419 // Stop failed 6420 PVPATB_TEST_IS_TRUE(false); 6421 iState = STATE_CLEANUPANDCOMPLETE; 6422 RunIfNotReady(); 6423 } 6424 break; 6425 6426 case STATE_REMOVEDATASINK_VIDEO: 6427 if (aResponse.GetCmdStatus() == PVMFSuccess) 6428 { 6429 iState = STATE_REMOVEDATASINK_AUDIO; 6430 RunIfNotReady(); 6431 } 6432 else 6433 { 6434 // RemoveDataSink failed 6435 PVPATB_TEST_IS_TRUE(false); 6436 iState = STATE_CLEANUPANDCOMPLETE; 6437 RunIfNotReady(); 6438 } 6439 break; 6440 6441 case STATE_REMOVEDATASINK_AUDIO: 6442 if (aResponse.GetCmdStatus() == PVMFSuccess) 6443 { 6444 iState = STATE_RESET; 6445 RunIfNotReady(); 6446 } 6447 else 6448 { 6449 // RemoveDataSink failed 6450 PVPATB_TEST_IS_TRUE(false); 6451 iState = STATE_CLEANUPANDCOMPLETE; 6452 RunIfNotReady(); 6453 } 6454 break; 6455 6456 case STATE_RESET: 6457 if (aResponse.GetCmdStatus() == PVMFSuccess) 6458 { 6459 iState = STATE_REMOVEDATASOURCE; 6460 RunIfNotReady(); 6461 } 6462 else 6463 { 6464 // Reset failed 6465 PVPATB_TEST_IS_TRUE(false); 6466 iState = STATE_CLEANUPANDCOMPLETE; 6467 RunIfNotReady(); 6468 } 6469 break; 6470 6471 case STATE_REMOVEDATASOURCE: 6472 if (aResponse.GetCmdStatus() == PVMFSuccess) 6473 { 6474 PVPATB_TEST_IS_TRUE(true); 6475 iState = STATE_CLEANUPANDCOMPLETE; 6476 RunIfNotReady(); 6477 } 6478 else 6479 { 6480 // RemoveDataSource failed 6481 PVPATB_TEST_IS_TRUE(false); 6482 iState = STATE_CLEANUPANDCOMPLETE; 6483 RunIfNotReady(); 6484 } 6485 break; 6486 6487 default: 6488 { 6489 // Testing error if this is reached 6490 PVPATB_TEST_IS_TRUE(false); 6491 iState = STATE_CLEANUPANDCOMPLETE; 6492 RunIfNotReady(); 6493 } 6494 break; 6495 } 6496 } 6497 6498 6499 void pvplayer_async_test_outsidenodeforvideosink::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 6500 { 6501 switch (aEvent.GetEventType()) 6502 { 6503 case PVMFErrResourceConfiguration: 6504 // Just log the error 6505 PVPATB_TEST_IS_TRUE(false); 6506 break; 6507 6508 case PVMFErrResource: 6509 // Just log the error 6510 PVPATB_TEST_IS_TRUE(false); 6511 break; 6512 6513 case PVMFErrCorrupt: 6514 // Just log the error 6515 PVPATB_TEST_IS_TRUE(false); 6516 break; 6517 6518 case PVMFErrProcessing: 6519 // Just log the error 6520 PVPATB_TEST_IS_TRUE(false); 6521 break; 6522 6523 default: 6524 // Unknown error and just log the error 6525 PVPATB_TEST_IS_TRUE(false); 6526 break; 6527 } 6528 } 6529 6530 6531 void pvplayer_async_test_outsidenodeforvideosink::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 6532 { 6533 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 6534 { 6535 // do nothing 6536 } 6537 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 6538 { 6539 iState = STATE_CLEANUPANDCOMPLETE; 6540 RunIfNotReady(); 6541 } 6542 } 6543 6544 6545 void pvplayer_async_test_outsidenodeforvideosink::NodeCommandCompleted(const PVMFCmdResp &aResponse) 6546 { 6547 OSCL_UNUSED_ARG(aResponse); 6548 } 6549 6550 6551 // 6552 // pvplayer_async_test_getplayerstate section 6553 // 6554 void pvplayer_async_test_getplayerstate::StartTest() 6555 { 6556 AddToScheduler(); 6557 iState = STATE_CREATE; 6558 RunIfNotReady(); 6559 } 6560 6561 6562 void pvplayer_async_test_getplayerstate::Run() 6563 { 6564 int error = 0; 6565 6566 switch (iState) 6567 { 6568 case STATE_CREATE: 6569 { 6570 iPlayer = NULL; 6571 6572 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 6573 if (error) 6574 { 6575 PVPATB_TEST_IS_TRUE(false); 6576 iObserver->TestCompleted(*iTestCase); 6577 } 6578 else 6579 { 6580 iState = STATE_ADDDATASOURCE; 6581 RunIfNotReady(); 6582 } 6583 } 6584 break; 6585 6586 case STATE_ADDDATASOURCE: 6587 { 6588 iDataSource = new PVPlayerDataSourceURL; 6589 6590 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 6591 sourcefile += _STRLIT_WCHAR("test.mp4"); 6592 iDataSource->SetDataSourceURL(sourcefile); 6593 6594 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 6595 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 6596 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6597 } 6598 break; 6599 6600 case STATE_INIT: 6601 { 6602 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 6603 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6604 } 6605 break; 6606 6607 case STATE_ADDDATASINK_VIDEO: 6608 { 6609 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 6610 sinkfile += _STRLIT_WCHAR("test_player_getplayerstate_video.dat"); 6611 6612 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 6613 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 6614 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 6615 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 6616 6617 6618 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 6619 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6620 } 6621 break; 6622 6623 case STATE_ADDDATASINK_AUDIO: 6624 { 6625 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 6626 sinkfile += _STRLIT_WCHAR("test_player_getplayerstate_audio.dat"); 6627 6628 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 6629 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 6630 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 6631 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 6632 6633 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 6634 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6635 } 6636 break; 6637 6638 case STATE_PREPARE: 6639 { 6640 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 6641 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6642 } 6643 break; 6644 6645 case STATE_START: 6646 { 6647 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 6648 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6649 } 6650 break; 6651 6652 case STATE_STOP: 6653 { 6654 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 6655 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6656 } 6657 break; 6658 6659 case STATE_PLAYER_STATE_FIRST: 6660 { 6661 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetPVPlayerState(aState, (OsclAny*) & iContextObject)); 6662 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6663 } 6664 break; 6665 6666 case STATE_REMOVEDATASINK_VIDEO: 6667 { 6668 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 6669 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6670 } 6671 break; 6672 6673 case STATE_PLAYER_STATE_SECOND: 6674 { 6675 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetPVPlayerState(aState, (OsclAny*) & iContextObject)); 6676 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6677 } 6678 break; 6679 6680 case STATE_REMOVEDATASINK_AUDIO: 6681 { 6682 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 6683 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6684 } 6685 break; 6686 6687 case STATE_PLAYER_STATE_THIRD: 6688 { 6689 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetPVPlayerState(aState, (OsclAny*) & iContextObject)); 6690 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6691 } 6692 break; 6693 6694 case STATE_RESET: 6695 { 6696 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 6697 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6698 } 6699 break; 6700 6701 case STATE_PLAYER_STATE_FOURTH: 6702 { 6703 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetPVPlayerState(aState, (OsclAny*) & iContextObject)); 6704 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6705 } 6706 break; 6707 6708 case STATE_REMOVEDATASOURCE: 6709 { 6710 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 6711 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 6712 } 6713 break; 6714 6715 case STATE_CLEANUPANDCOMPLETE: 6716 { 6717 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 6718 iPlayer = NULL; 6719 6720 delete iDataSource; 6721 iDataSource = NULL; 6722 6723 delete iDataSinkVideo; 6724 iDataSinkVideo = NULL; 6725 6726 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 6727 iIONodeVideo = NULL; 6728 6729 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 6730 iMIOFileOutVideo = NULL; 6731 6732 delete iDataSinkAudio; 6733 iDataSinkAudio = NULL; 6734 6735 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 6736 iIONodeAudio = NULL; 6737 6738 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 6739 iMIOFileOutAudio = NULL; 6740 6741 iObserver->TestCompleted(*iTestCase); 6742 } 6743 break; 6744 6745 default: 6746 break; 6747 6748 } 6749 } 6750 6751 6752 void pvplayer_async_test_getplayerstate::CommandCompleted(const PVCmdResponse& aResponse) 6753 { 6754 if (aResponse.GetCmdId() != iCurrentCmdId) 6755 { 6756 // Wrong command ID. 6757 PVPATB_TEST_IS_TRUE(false); 6758 iState = STATE_CLEANUPANDCOMPLETE; 6759 RunIfNotReady(); 6760 return; 6761 } 6762 6763 if (aResponse.GetContext() != NULL) 6764 { 6765 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 6766 { 6767 if (iContextObject != iContextObjectRefValue) 6768 { 6769 // Context data value was corrupted 6770 PVPATB_TEST_IS_TRUE(false); 6771 iState = STATE_CLEANUPANDCOMPLETE; 6772 RunIfNotReady(); 6773 return; 6774 } 6775 } 6776 else 6777 { 6778 // Context data pointer was corrupted 6779 PVPATB_TEST_IS_TRUE(false); 6780 iState = STATE_CLEANUPANDCOMPLETE; 6781 RunIfNotReady(); 6782 return; 6783 } 6784 } 6785 6786 switch (iState) 6787 { 6788 case STATE_ADDDATASOURCE: 6789 if (iPlayer->GetPVPlayerStateSync(aState) == PVMFSuccess) 6790 { 6791 if (aState == PVP_STATE_IDLE) 6792 { 6793 iState = STATE_INIT; 6794 RunIfNotReady(); 6795 } 6796 else 6797 { 6798 // AddDataSource failed 6799 PVPATB_TEST_IS_TRUE(false); 6800 iState = STATE_CLEANUPANDCOMPLETE; 6801 RunIfNotReady(); 6802 } 6803 } 6804 else 6805 { 6806 // AddDataSource failed 6807 PVPATB_TEST_IS_TRUE(false); 6808 iState = STATE_CLEANUPANDCOMPLETE; 6809 RunIfNotReady(); 6810 } 6811 break; 6812 6813 case STATE_INIT: 6814 if (iPlayer->GetPVPlayerStateSync(aState) == PVMFSuccess) 6815 { 6816 if (aState == PVP_STATE_INITIALIZED) 6817 { 6818 iState = STATE_ADDDATASINK_VIDEO; 6819 RunIfNotReady(); 6820 } 6821 else 6822 { 6823 // AddDataSource failed 6824 PVPATB_TEST_IS_TRUE(false); 6825 iState = STATE_CLEANUPANDCOMPLETE; 6826 RunIfNotReady(); 6827 } 6828 } 6829 else 6830 { 6831 // AddDataSource failed 6832 PVPATB_TEST_IS_TRUE(false); 6833 iState = STATE_CLEANUPANDCOMPLETE; 6834 RunIfNotReady(); 6835 } 6836 break; 6837 6838 case STATE_ADDDATASINK_VIDEO: 6839 if (iPlayer->GetPVPlayerStateSync(aState) == PVMFSuccess) 6840 { 6841 if (aState == PVP_STATE_INITIALIZED) 6842 { 6843 iState = STATE_ADDDATASINK_AUDIO; 6844 RunIfNotReady(); 6845 } 6846 else 6847 { 6848 6849 PVPATB_TEST_IS_TRUE(false); 6850 iState = STATE_CLEANUPANDCOMPLETE; 6851 RunIfNotReady(); 6852 } 6853 } 6854 else 6855 { 6856 6857 PVPATB_TEST_IS_TRUE(false); 6858 iState = STATE_CLEANUPANDCOMPLETE; 6859 RunIfNotReady(); 6860 } 6861 break; 6862 6863 case STATE_ADDDATASINK_AUDIO: 6864 if (iPlayer->GetPVPlayerStateSync(aState) == PVMFSuccess) 6865 { 6866 if (aState == PVP_STATE_INITIALIZED) 6867 { 6868 iState = STATE_PREPARE; 6869 RunIfNotReady(); 6870 } 6871 else 6872 { 6873 6874 PVPATB_TEST_IS_TRUE(false); 6875 iState = STATE_CLEANUPANDCOMPLETE; 6876 RunIfNotReady(); 6877 } 6878 } 6879 else 6880 { 6881 6882 PVPATB_TEST_IS_TRUE(false); 6883 iState = STATE_CLEANUPANDCOMPLETE; 6884 RunIfNotReady(); 6885 } 6886 break; 6887 case STATE_PREPARE: 6888 if (iPlayer->GetPVPlayerStateSync(aState) == PVMFSuccess) 6889 { 6890 if (aState == PVP_STATE_PREPARED) 6891 { 6892 iState = STATE_START; 6893 RunIfNotReady(); 6894 } 6895 else 6896 { 6897 6898 PVPATB_TEST_IS_TRUE(false); 6899 iState = STATE_CLEANUPANDCOMPLETE; 6900 RunIfNotReady(); 6901 } 6902 } 6903 else 6904 { 6905 6906 PVPATB_TEST_IS_TRUE(false); 6907 iState = STATE_CLEANUPANDCOMPLETE; 6908 RunIfNotReady(); 6909 } 6910 break; 6911 case STATE_START: 6912 if (iPlayer->GetPVPlayerStateSync(aState) == PVMFSuccess) 6913 { 6914 if (aState == PVP_STATE_STARTED) 6915 { 6916 iState = STATE_STOP; 6917 RunIfNotReady(20000000); 6918 } 6919 else 6920 { 6921 6922 PVPATB_TEST_IS_TRUE(false); 6923 iState = STATE_CLEANUPANDCOMPLETE; 6924 RunIfNotReady(); 6925 } 6926 } 6927 else 6928 { 6929 6930 PVPATB_TEST_IS_TRUE(false); 6931 iState = STATE_CLEANUPANDCOMPLETE; 6932 RunIfNotReady(); 6933 } 6934 break; 6935 6936 case STATE_STOP: 6937 if (aResponse.GetCmdStatus() == PVMFSuccess) 6938 { 6939 iState = STATE_PLAYER_STATE_FIRST; 6940 RunIfNotReady(); 6941 } 6942 else 6943 { 6944 // RemoveDataSink failed 6945 PVPATB_TEST_IS_TRUE(false); 6946 iState = STATE_CLEANUPANDCOMPLETE; 6947 RunIfNotReady(); 6948 } 6949 break; 6950 6951 case STATE_PLAYER_STATE_FIRST: 6952 if (aResponse.GetCmdStatus() == PVMFSuccess) 6953 { 6954 if (aState == PVP_STATE_INITIALIZED) 6955 { 6956 iState = STATE_REMOVEDATASINK_VIDEO; 6957 RunIfNotReady(); 6958 } 6959 else 6960 { 6961 6962 PVPATB_TEST_IS_TRUE(false); 6963 iState = STATE_CLEANUPANDCOMPLETE; 6964 RunIfNotReady(); 6965 } 6966 } 6967 else 6968 { 6969 6970 PVPATB_TEST_IS_TRUE(false); 6971 iState = STATE_CLEANUPANDCOMPLETE; 6972 RunIfNotReady(); 6973 } 6974 break; 6975 6976 case STATE_REMOVEDATASINK_VIDEO: 6977 if (aResponse.GetCmdStatus() == PVMFSuccess) 6978 { 6979 iState = STATE_PLAYER_STATE_SECOND; 6980 RunIfNotReady(); 6981 } 6982 else 6983 { 6984 // RemoveDataSink failed 6985 PVPATB_TEST_IS_TRUE(false); 6986 iState = STATE_CLEANUPANDCOMPLETE; 6987 RunIfNotReady(); 6988 } 6989 break; 6990 6991 case STATE_PLAYER_STATE_SECOND: 6992 if (aResponse.GetCmdStatus() == PVMFSuccess) 6993 { 6994 if (aState == PVP_STATE_INITIALIZED) 6995 { 6996 iState = STATE_REMOVEDATASINK_AUDIO; 6997 RunIfNotReady(); 6998 } 6999 else 7000 { 7001 7002 PVPATB_TEST_IS_TRUE(false); 7003 iState = STATE_CLEANUPANDCOMPLETE; 7004 RunIfNotReady(); 7005 } 7006 } 7007 else 7008 { 7009 7010 PVPATB_TEST_IS_TRUE(false); 7011 iState = STATE_CLEANUPANDCOMPLETE; 7012 RunIfNotReady(); 7013 } 7014 break; 7015 7016 case STATE_REMOVEDATASINK_AUDIO: 7017 if (aResponse.GetCmdStatus() == PVMFSuccess) 7018 { 7019 iState = STATE_PLAYER_STATE_THIRD; 7020 RunIfNotReady(); 7021 } 7022 else 7023 { 7024 // RemoveDataSink failed 7025 PVPATB_TEST_IS_TRUE(false); 7026 iState = STATE_CLEANUPANDCOMPLETE; 7027 RunIfNotReady(); 7028 } 7029 break; 7030 7031 case STATE_PLAYER_STATE_THIRD: 7032 if (aResponse.GetCmdStatus() == PVMFSuccess) 7033 { 7034 if (aState == PVP_STATE_INITIALIZED) 7035 { 7036 iState = STATE_RESET; 7037 RunIfNotReady(); 7038 } 7039 else 7040 { 7041 7042 PVPATB_TEST_IS_TRUE(false); 7043 iState = STATE_CLEANUPANDCOMPLETE; 7044 RunIfNotReady(); 7045 } 7046 } 7047 else 7048 { 7049 7050 PVPATB_TEST_IS_TRUE(false); 7051 iState = STATE_CLEANUPANDCOMPLETE; 7052 RunIfNotReady(); 7053 } 7054 break; 7055 7056 case STATE_RESET: 7057 if (aResponse.GetCmdStatus() == PVMFSuccess) 7058 { 7059 iState = STATE_PLAYER_STATE_FOURTH; 7060 RunIfNotReady(); 7061 } 7062 else 7063 { 7064 // Reset failed 7065 PVPATB_TEST_IS_TRUE(false); 7066 iState = STATE_CLEANUPANDCOMPLETE; 7067 RunIfNotReady(); 7068 } 7069 break; 7070 7071 case STATE_PLAYER_STATE_FOURTH: 7072 if (aResponse.GetCmdStatus() == PVMFSuccess) 7073 { 7074 if (aState == PVP_STATE_IDLE) 7075 { 7076 iState = STATE_REMOVEDATASOURCE; 7077 RunIfNotReady(); 7078 } 7079 else 7080 { 7081 7082 PVPATB_TEST_IS_TRUE(false); 7083 iState = STATE_CLEANUPANDCOMPLETE; 7084 RunIfNotReady(); 7085 } 7086 } 7087 else 7088 { 7089 7090 PVPATB_TEST_IS_TRUE(false); 7091 iState = STATE_CLEANUPANDCOMPLETE; 7092 RunIfNotReady(); 7093 } 7094 break; 7095 7096 case STATE_REMOVEDATASOURCE: 7097 if (aResponse.GetCmdStatus() == PVMFSuccess) 7098 { 7099 PVPATB_TEST_IS_TRUE(true); 7100 iState = STATE_CLEANUPANDCOMPLETE; 7101 RunIfNotReady(); 7102 } 7103 else 7104 { 7105 // RemoveDataSource failed 7106 PVPATB_TEST_IS_TRUE(false); 7107 iState = STATE_CLEANUPANDCOMPLETE; 7108 RunIfNotReady(); 7109 } 7110 break; 7111 7112 default: 7113 { 7114 // Testing error if this is reached 7115 PVPATB_TEST_IS_TRUE(false); 7116 iState = STATE_CLEANUPANDCOMPLETE; 7117 RunIfNotReady(); 7118 } 7119 break; 7120 } 7121 } 7122 7123 7124 void pvplayer_async_test_getplayerstate::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 7125 { 7126 switch (aEvent.GetEventType()) 7127 { 7128 case PVMFErrResourceConfiguration: 7129 // Just log the error 7130 PVPATB_TEST_IS_TRUE(false); 7131 break; 7132 7133 case PVMFErrResource: 7134 // Just log the error 7135 PVPATB_TEST_IS_TRUE(false); 7136 break; 7137 7138 case PVMFErrCorrupt: 7139 // Just log the error 7140 PVPATB_TEST_IS_TRUE(false); 7141 break; 7142 7143 case PVMFErrProcessing: 7144 // Just log the error 7145 PVPATB_TEST_IS_TRUE(false); 7146 break; 7147 7148 default: 7149 // Unknown error and just log the error 7150 PVPATB_TEST_IS_TRUE(false); 7151 break; 7152 } 7153 } 7154 7155 7156 void pvplayer_async_test_getplayerstate::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 7157 { 7158 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 7159 { 7160 // do nothing 7161 } 7162 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 7163 { 7164 iState = STATE_CLEANUPANDCOMPLETE; 7165 RunIfNotReady(); 7166 } 7167 } 7168 7169 7170 // 7171 // pvplayer_async_test_getcurrentposition section 7172 // 7173 void pvplayer_async_test_getcurrentposition::StartTest() 7174 { 7175 AddToScheduler(); 7176 iState = STATE_CREATE; 7177 RunIfNotReady(); 7178 } 7179 7180 7181 void pvplayer_async_test_getcurrentposition::Run() 7182 { 7183 int error = 0; 7184 7185 switch (iState) 7186 { 7187 case STATE_CREATE: 7188 { 7189 iPlayer = NULL; 7190 7191 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 7192 if (error) 7193 { 7194 PVPATB_TEST_IS_TRUE(false); 7195 iObserver->TestCompleted(*iTestCase); 7196 } 7197 else 7198 { 7199 iState = STATE_ADDDATASOURCE; 7200 RunIfNotReady(); 7201 } 7202 } 7203 break; 7204 7205 case STATE_ADDDATASOURCE: 7206 { 7207 iDataSource = new PVPlayerDataSourceURL; 7208 OSCL_wHeapString<OsclMemAllocator> wFileName; 7209 oscl_wchar output[100] ; 7210 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 100); 7211 wFileName.set(output, oscl_strlen(output)); 7212 iDataSource->SetDataSourceURL(wFileName); 7213 iDataSource->SetDataSourceFormatType(iFileType); 7214 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 7215 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7216 } 7217 break; 7218 7219 case STATE_INIT: 7220 { 7221 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 7222 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7223 } 7224 break; 7225 7226 case STATE_ADDDATASINK_VIDEO: 7227 { 7228 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 7229 sinkfile += _STRLIT_WCHAR("test_player_getcurrentposition_video.dat"); 7230 7231 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 7232 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 7233 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 7234 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 7235 7236 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 7237 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7238 } 7239 break; 7240 7241 case STATE_ADDDATASINK_AUDIO: 7242 { 7243 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 7244 sinkfile += _STRLIT_WCHAR("test_player_getcurrentposition_audio.dat"); 7245 7246 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 7247 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 7248 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 7249 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 7250 7251 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 7252 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7253 } 7254 break; 7255 7256 case STATE_PREPARE: 7257 { 7258 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 7259 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7260 } 7261 break; 7262 7263 case STATE_START: 7264 { 7265 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 7266 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7267 } 7268 break; 7269 7270 case STATE_GETCURRENT_POSITION_SYNC: 7271 { 7272 Position.iPosUnit = PVPPBPOSUNIT_MILLISEC; 7273 Status = iPlayer->GetCurrentPositionSync(Position); 7274 if (Status == PVMFSuccess) 7275 { 7276 if (iCount < 10) 7277 { 7278 iState = STATE_GETCURRENT_POSITION_SYNC; 7279 iCount++; 7280 RunIfNotReady(1000000); 7281 } 7282 else 7283 { 7284 iCount = 0; 7285 iState = STATE_GETCURRENT_POSITION; 7286 RunIfNotReady(); 7287 } 7288 } 7289 else 7290 { 7291 PVPATB_TEST_IS_TRUE(false); 7292 iState = STATE_CLEANUPANDCOMPLETE; 7293 RunIfNotReady(); 7294 } 7295 7296 } 7297 break; 7298 7299 case STATE_GETCURRENT_POSITION: 7300 { 7301 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetCurrentPosition(Position, (OsclAny*) & iContextObject)); 7302 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7303 } 7304 break; 7305 7306 case STATE_STOP: 7307 { 7308 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 7309 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7310 } 7311 break; 7312 7313 case STATE_REMOVEDATASINK_VIDEO: 7314 { 7315 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 7316 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7317 } 7318 break; 7319 7320 case STATE_REMOVEDATASINK_AUDIO: 7321 { 7322 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 7323 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7324 } 7325 break; 7326 7327 case STATE_RESET: 7328 { 7329 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 7330 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7331 } 7332 break; 7333 7334 case STATE_REMOVEDATASOURCE: 7335 { 7336 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 7337 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7338 } 7339 break; 7340 7341 case STATE_CLEANUPANDCOMPLETE: 7342 { 7343 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 7344 iPlayer = NULL; 7345 7346 delete iDataSource; 7347 iDataSource = NULL; 7348 7349 delete iDataSinkVideo; 7350 iDataSinkVideo = NULL; 7351 7352 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 7353 iIONodeVideo = NULL; 7354 7355 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 7356 iMIOFileOutVideo = NULL; 7357 7358 delete iDataSinkAudio; 7359 iDataSinkAudio = NULL; 7360 7361 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 7362 iIONodeAudio = NULL; 7363 7364 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 7365 iMIOFileOutAudio = NULL; 7366 7367 iObserver->TestCompleted(*iTestCase); 7368 } 7369 break; 7370 7371 default: 7372 break; 7373 7374 } 7375 } 7376 7377 7378 void pvplayer_async_test_getcurrentposition::CommandCompleted(const PVCmdResponse& aResponse) 7379 { 7380 if (aResponse.GetCmdId() != iCurrentCmdId) 7381 { 7382 // Wrong command ID. 7383 PVPATB_TEST_IS_TRUE(false); 7384 iState = STATE_CLEANUPANDCOMPLETE; 7385 RunIfNotReady(); 7386 return; 7387 } 7388 7389 if (aResponse.GetContext() != NULL) 7390 { 7391 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 7392 { 7393 if (iContextObject != iContextObjectRefValue) 7394 { 7395 // Context data value was corrupted 7396 PVPATB_TEST_IS_TRUE(false); 7397 iState = STATE_CLEANUPANDCOMPLETE; 7398 RunIfNotReady(); 7399 return; 7400 } 7401 } 7402 else 7403 { 7404 // Context data pointer was corrupted 7405 PVPATB_TEST_IS_TRUE(false); 7406 iState = STATE_CLEANUPANDCOMPLETE; 7407 RunIfNotReady(); 7408 return; 7409 } 7410 } 7411 7412 switch (iState) 7413 { 7414 case STATE_ADDDATASOURCE: 7415 if (aResponse.GetCmdStatus() == PVMFSuccess) 7416 { 7417 iState = STATE_INIT; 7418 RunIfNotReady(); 7419 } 7420 else 7421 { 7422 // AddDataSource failed 7423 PVPATB_TEST_IS_TRUE(false); 7424 iState = STATE_CLEANUPANDCOMPLETE; 7425 RunIfNotReady(); 7426 } 7427 break; 7428 7429 case STATE_INIT: 7430 if (aResponse.GetCmdStatus() == PVMFSuccess) 7431 { 7432 iState = STATE_ADDDATASINK_VIDEO; 7433 RunIfNotReady(); 7434 } 7435 else 7436 { 7437 // Init failed 7438 PVPATB_TEST_IS_TRUE(false); 7439 iState = STATE_CLEANUPANDCOMPLETE; 7440 RunIfNotReady(); 7441 } 7442 break; 7443 7444 case STATE_ADDDATASINK_VIDEO: 7445 if (aResponse.GetCmdStatus() == PVMFSuccess) 7446 { 7447 iState = STATE_ADDDATASINK_AUDIO; 7448 RunIfNotReady(); 7449 } 7450 else 7451 { 7452 // AddDataSink failed 7453 PVPATB_TEST_IS_TRUE(false); 7454 iState = STATE_CLEANUPANDCOMPLETE; 7455 RunIfNotReady(); 7456 } 7457 break; 7458 7459 case STATE_ADDDATASINK_AUDIO: 7460 if (aResponse.GetCmdStatus() == PVMFSuccess) 7461 { 7462 iState = STATE_PREPARE; 7463 RunIfNotReady(); 7464 } 7465 else 7466 { 7467 // AddDataSink failed 7468 PVPATB_TEST_IS_TRUE(false); 7469 iState = STATE_CLEANUPANDCOMPLETE; 7470 RunIfNotReady(); 7471 } 7472 break; 7473 7474 case STATE_PREPARE: 7475 if (aResponse.GetCmdStatus() == PVMFSuccess) 7476 { 7477 iState = STATE_START; 7478 RunIfNotReady(); 7479 } 7480 else 7481 { 7482 // Prepare failed 7483 PVPATB_TEST_IS_TRUE(false); 7484 iState = STATE_CLEANUPANDCOMPLETE; 7485 RunIfNotReady(); 7486 } 7487 break; 7488 7489 case STATE_START: 7490 if (aResponse.GetCmdStatus() == PVMFSuccess) 7491 { 7492 iState = STATE_GETCURRENT_POSITION_SYNC; 7493 RunIfNotReady(); 7494 } 7495 else 7496 { 7497 // Start failed 7498 PVPATB_TEST_IS_TRUE(false); 7499 iState = STATE_CLEANUPANDCOMPLETE; 7500 RunIfNotReady(); 7501 } 7502 break; 7503 7504 case STATE_GETCURRENT_POSITION: 7505 if (aResponse.GetCmdStatus() == PVMFSuccess) 7506 { 7507 if (iCount < 10) 7508 { 7509 iState = STATE_GETCURRENT_POSITION; 7510 iCount++; 7511 RunIfNotReady(1000000); 7512 } 7513 else 7514 { 7515 iState = STATE_STOP; 7516 RunIfNotReady(); 7517 } 7518 7519 } 7520 else 7521 { 7522 // Start failed 7523 PVPATB_TEST_IS_TRUE(false); 7524 iState = STATE_CLEANUPANDCOMPLETE; 7525 RunIfNotReady(); 7526 } 7527 break; 7528 7529 case STATE_STOP: 7530 if (aResponse.GetCmdStatus() == PVMFSuccess) 7531 { 7532 iState = STATE_REMOVEDATASINK_VIDEO; 7533 RunIfNotReady(); 7534 } 7535 else 7536 { 7537 // Stop failed 7538 PVPATB_TEST_IS_TRUE(false); 7539 iState = STATE_CLEANUPANDCOMPLETE; 7540 RunIfNotReady(); 7541 } 7542 break; 7543 7544 case STATE_REMOVEDATASINK_VIDEO: 7545 if (aResponse.GetCmdStatus() == PVMFSuccess) 7546 { 7547 iState = STATE_REMOVEDATASINK_AUDIO; 7548 RunIfNotReady(); 7549 } 7550 else 7551 { 7552 // RemoveDataSink failed 7553 PVPATB_TEST_IS_TRUE(false); 7554 iState = STATE_CLEANUPANDCOMPLETE; 7555 RunIfNotReady(); 7556 } 7557 break; 7558 7559 case STATE_REMOVEDATASINK_AUDIO: 7560 if (aResponse.GetCmdStatus() == PVMFSuccess) 7561 { 7562 iState = STATE_RESET; 7563 RunIfNotReady(); 7564 } 7565 else 7566 { 7567 // RemoveDataSink failed 7568 PVPATB_TEST_IS_TRUE(false); 7569 iState = STATE_CLEANUPANDCOMPLETE; 7570 RunIfNotReady(); 7571 } 7572 break; 7573 7574 case STATE_RESET: 7575 if (aResponse.GetCmdStatus() == PVMFSuccess) 7576 { 7577 iState = STATE_REMOVEDATASOURCE; 7578 RunIfNotReady(); 7579 } 7580 else 7581 { 7582 // Reset failed 7583 PVPATB_TEST_IS_TRUE(false); 7584 iState = STATE_CLEANUPANDCOMPLETE; 7585 RunIfNotReady(); 7586 } 7587 break; 7588 7589 case STATE_REMOVEDATASOURCE: 7590 if (aResponse.GetCmdStatus() == PVMFSuccess) 7591 { 7592 PVPATB_TEST_IS_TRUE(true); 7593 iState = STATE_CLEANUPANDCOMPLETE; 7594 RunIfNotReady(); 7595 } 7596 else 7597 { 7598 // RemoveDataSource failed 7599 PVPATB_TEST_IS_TRUE(false); 7600 iState = STATE_CLEANUPANDCOMPLETE; 7601 RunIfNotReady(); 7602 } 7603 break; 7604 7605 default: 7606 { 7607 // Testing error if this is reached 7608 PVPATB_TEST_IS_TRUE(false); 7609 iState = STATE_CLEANUPANDCOMPLETE; 7610 RunIfNotReady(); 7611 } 7612 break; 7613 } 7614 } 7615 7616 7617 void pvplayer_async_test_getcurrentposition::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 7618 { 7619 switch (aEvent.GetEventType()) 7620 { 7621 case PVMFErrResourceConfiguration: 7622 // Just log the error 7623 PVPATB_TEST_IS_TRUE(false); 7624 break; 7625 7626 case PVMFErrResource: 7627 // Just log the error 7628 PVPATB_TEST_IS_TRUE(false); 7629 break; 7630 7631 case PVMFErrCorrupt: 7632 // Just log the error 7633 PVPATB_TEST_IS_TRUE(false); 7634 break; 7635 7636 case PVMFErrProcessing: 7637 // Just log the error 7638 PVPATB_TEST_IS_TRUE(false); 7639 break; 7640 7641 default: 7642 // Unknown error and just log the error 7643 PVPATB_TEST_IS_TRUE(false); 7644 break; 7645 } 7646 } 7647 7648 7649 void pvplayer_async_test_getcurrentposition::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 7650 { 7651 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 7652 { 7653 // do nothing 7654 } 7655 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 7656 { 7657 iState = STATE_CLEANUPANDCOMPLETE; 7658 RunIfNotReady(); 7659 } 7660 } 7661 7662 7663 // 7664 // pvplayer_async_test_playsetstopposition section 7665 // 7666 void pvplayer_async_test_playsetstopposition::StartTest() 7667 { 7668 AddToScheduler(); 7669 iState = STATE_CREATE; 7670 RunIfNotReady(); 7671 } 7672 7673 7674 void pvplayer_async_test_playsetstopposition::Run() 7675 { 7676 int error = 0; 7677 7678 switch (iState) 7679 { 7680 case STATE_CREATE: 7681 { 7682 iPlayer = NULL; 7683 7684 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 7685 if (error) 7686 { 7687 PVPATB_TEST_IS_TRUE(false); 7688 iObserver->TestCompleted(*iTestCase); 7689 } 7690 else 7691 { 7692 iState = STATE_ADDDATASOURCE; 7693 RunIfNotReady(); 7694 } 7695 } 7696 break; 7697 7698 case STATE_ADDDATASOURCE: 7699 { 7700 iDataSource = new PVPlayerDataSourceURL; 7701 7702 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 7703 sourcefile += _STRLIT_WCHAR("test_reposition.mp4"); 7704 iDataSource->SetDataSourceURL(sourcefile); 7705 7706 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 7707 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 7708 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7709 } 7710 break; 7711 7712 case STATE_INIT: 7713 { 7714 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 7715 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7716 } 7717 break; 7718 7719 case STATE_ADDDATASINK_VIDEO: 7720 { 7721 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 7722 sinkfile += _STRLIT_WCHAR("test_player_playsetstopposition_video.dat"); 7723 7724 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 7725 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 7726 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 7727 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 7728 7729 7730 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 7731 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7732 } 7733 break; 7734 7735 case STATE_ADDDATASINK_AUDIO: 7736 { 7737 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 7738 sinkfile += _STRLIT_WCHAR("test_player_playsetstopposition_audio.dat"); 7739 7740 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 7741 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 7742 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 7743 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 7744 7745 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 7746 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7747 } 7748 break; 7749 7750 case STATE_PREPARE: 7751 { 7752 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 7753 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7754 } 7755 break; 7756 7757 case STATE_START: 7758 { 7759 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 7760 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7761 } 7762 break; 7763 7764 case STATE_SETPLAYBACKRANGE: 7765 { 7766 PVPPlaybackPosition start, end; 7767 start.iIndeterminate = true; 7768 start.iMode = PVPPBPOS_MODE_NOW; 7769 end.iIndeterminate = false; 7770 end.iPosUnit = PVPPBPOSUNIT_MILLISEC; 7771 end.iPosValue.millisec_value = 20000; 7772 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 7773 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7774 } 7775 break; 7776 7777 case STATE_STOPTIMENOTREACHED: 7778 { 7779 // Timeout when player doesn't stop automatically when stop time is reached 7780 PVPATB_TEST_IS_TRUE(false); 7781 iState = STATE_CLEANUPANDCOMPLETE; 7782 RunIfNotReady(); 7783 } 7784 break; 7785 7786 case STATE_STOP: 7787 { 7788 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 7789 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7790 } 7791 break; 7792 7793 case STATE_REMOVEDATASINK_VIDEO: 7794 { 7795 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 7796 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7797 } 7798 break; 7799 7800 case STATE_REMOVEDATASINK_AUDIO: 7801 { 7802 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 7803 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7804 } 7805 break; 7806 7807 case STATE_RESET: 7808 { 7809 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 7810 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7811 } 7812 break; 7813 7814 case STATE_REMOVEDATASOURCE: 7815 { 7816 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 7817 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 7818 } 7819 break; 7820 7821 case STATE_CLEANUPANDCOMPLETE: 7822 { 7823 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 7824 iPlayer = NULL; 7825 7826 delete iDataSource; 7827 iDataSource = NULL; 7828 7829 delete iDataSinkVideo; 7830 iDataSinkVideo = NULL; 7831 7832 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 7833 iIONodeVideo = NULL; 7834 7835 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 7836 iMIOFileOutVideo = NULL; 7837 7838 delete iDataSinkAudio; 7839 iDataSinkAudio = NULL; 7840 7841 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 7842 iIONodeAudio = NULL; 7843 7844 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 7845 iMIOFileOutAudio = NULL; 7846 7847 iObserver->TestCompleted(*iTestCase); 7848 } 7849 break; 7850 7851 default: 7852 break; 7853 7854 } 7855 } 7856 7857 7858 void pvplayer_async_test_playsetstopposition::CommandCompleted(const PVCmdResponse& aResponse) 7859 { 7860 if (aResponse.GetCmdId() != iCurrentCmdId) 7861 { 7862 // Wrong command ID. 7863 PVPATB_TEST_IS_TRUE(false); 7864 iState = STATE_CLEANUPANDCOMPLETE; 7865 RunIfNotReady(); 7866 return; 7867 } 7868 7869 if (aResponse.GetContext() != NULL) 7870 { 7871 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 7872 { 7873 if (iContextObject != iContextObjectRefValue) 7874 { 7875 // Context data value was corrupted 7876 PVPATB_TEST_IS_TRUE(false); 7877 iState = STATE_CLEANUPANDCOMPLETE; 7878 RunIfNotReady(); 7879 return; 7880 } 7881 } 7882 else 7883 { 7884 // Context data pointer was corrupted 7885 PVPATB_TEST_IS_TRUE(false); 7886 iState = STATE_CLEANUPANDCOMPLETE; 7887 RunIfNotReady(); 7888 return; 7889 } 7890 } 7891 7892 switch (iState) 7893 { 7894 case STATE_ADDDATASOURCE: 7895 if (aResponse.GetCmdStatus() == PVMFSuccess) 7896 { 7897 iState = STATE_INIT; 7898 RunIfNotReady(); 7899 } 7900 else 7901 { 7902 // AddDataSource failed 7903 PVPATB_TEST_IS_TRUE(false); 7904 iState = STATE_CLEANUPANDCOMPLETE; 7905 RunIfNotReady(); 7906 } 7907 break; 7908 7909 case STATE_INIT: 7910 if (aResponse.GetCmdStatus() == PVMFSuccess) 7911 { 7912 iState = STATE_ADDDATASINK_VIDEO; 7913 RunIfNotReady(); 7914 } 7915 else 7916 { 7917 // Init failed 7918 PVPATB_TEST_IS_TRUE(false); 7919 iState = STATE_CLEANUPANDCOMPLETE; 7920 RunIfNotReady(); 7921 } 7922 break; 7923 7924 case STATE_ADDDATASINK_VIDEO: 7925 if (aResponse.GetCmdStatus() == PVMFSuccess) 7926 { 7927 iState = STATE_ADDDATASINK_AUDIO; 7928 RunIfNotReady(); 7929 } 7930 else 7931 { 7932 // AddDataSink failed 7933 PVPATB_TEST_IS_TRUE(false); 7934 iState = STATE_CLEANUPANDCOMPLETE; 7935 RunIfNotReady(); 7936 } 7937 break; 7938 7939 case STATE_ADDDATASINK_AUDIO: 7940 if (aResponse.GetCmdStatus() == PVMFSuccess) 7941 { 7942 iState = STATE_PREPARE; 7943 RunIfNotReady(); 7944 } 7945 else 7946 { 7947 // AddDataSink failed 7948 PVPATB_TEST_IS_TRUE(false); 7949 iState = STATE_CLEANUPANDCOMPLETE; 7950 RunIfNotReady(); 7951 } 7952 break; 7953 7954 case STATE_PREPARE: 7955 if (aResponse.GetCmdStatus() == PVMFSuccess) 7956 { 7957 iState = STATE_START; 7958 RunIfNotReady(); 7959 } 7960 else 7961 { 7962 // Prepare failed 7963 PVPATB_TEST_IS_TRUE(false); 7964 iState = STATE_CLEANUPANDCOMPLETE; 7965 RunIfNotReady(); 7966 } 7967 break; 7968 7969 case STATE_START: 7970 if (aResponse.GetCmdStatus() == PVMFSuccess) 7971 { 7972 iState = STATE_SETPLAYBACKRANGE; 7973 RunIfNotReady(); 7974 } 7975 else 7976 { 7977 // Start failed 7978 PVPATB_TEST_IS_TRUE(false); 7979 iState = STATE_CLEANUPANDCOMPLETE; 7980 RunIfNotReady(); 7981 } 7982 break; 7983 7984 case STATE_SETPLAYBACKRANGE: 7985 if (aResponse.GetCmdStatus() == PVMFSuccess) 7986 { 7987 iState = STATE_STOPTIMENOTREACHED; 7988 RunIfNotReady(30000000); 7989 } 7990 else 7991 { 7992 // SetPlaybackRange failed 7993 PVPATB_TEST_IS_TRUE(false); 7994 iState = STATE_CLEANUPANDCOMPLETE; 7995 RunIfNotReady(); 7996 } 7997 break; 7998 7999 case STATE_STOP: 8000 if (aResponse.GetCmdStatus() == PVMFSuccess) 8001 { 8002 iState = STATE_REMOVEDATASINK_VIDEO; 8003 RunIfNotReady(); 8004 } 8005 else 8006 { 8007 // Stop failed 8008 PVPATB_TEST_IS_TRUE(false); 8009 iState = STATE_CLEANUPANDCOMPLETE; 8010 RunIfNotReady(); 8011 } 8012 break; 8013 8014 case STATE_REMOVEDATASINK_VIDEO: 8015 if (aResponse.GetCmdStatus() == PVMFSuccess) 8016 { 8017 iState = STATE_REMOVEDATASINK_AUDIO; 8018 RunIfNotReady(); 8019 } 8020 else 8021 { 8022 // RemoveDataSink failed 8023 PVPATB_TEST_IS_TRUE(false); 8024 iState = STATE_CLEANUPANDCOMPLETE; 8025 RunIfNotReady(); 8026 } 8027 break; 8028 8029 case STATE_REMOVEDATASINK_AUDIO: 8030 if (aResponse.GetCmdStatus() == PVMFSuccess) 8031 { 8032 iState = STATE_RESET; 8033 RunIfNotReady(); 8034 } 8035 else 8036 { 8037 // RemoveDataSink failed 8038 PVPATB_TEST_IS_TRUE(false); 8039 iState = STATE_CLEANUPANDCOMPLETE; 8040 RunIfNotReady(); 8041 } 8042 break; 8043 8044 case STATE_RESET: 8045 if (aResponse.GetCmdStatus() == PVMFSuccess) 8046 { 8047 iState = STATE_REMOVEDATASOURCE; 8048 RunIfNotReady(); 8049 } 8050 else 8051 { 8052 // Reset failed 8053 PVPATB_TEST_IS_TRUE(false); 8054 iState = STATE_CLEANUPANDCOMPLETE; 8055 RunIfNotReady(); 8056 } 8057 break; 8058 8059 case STATE_REMOVEDATASOURCE: 8060 if (aResponse.GetCmdStatus() == PVMFSuccess) 8061 { 8062 PVPATB_TEST_IS_TRUE(true); 8063 iState = STATE_CLEANUPANDCOMPLETE; 8064 RunIfNotReady(); 8065 } 8066 else 8067 { 8068 // RemoveDataSource failed 8069 PVPATB_TEST_IS_TRUE(false); 8070 iState = STATE_CLEANUPANDCOMPLETE; 8071 RunIfNotReady(); 8072 } 8073 break; 8074 8075 default: 8076 { 8077 // Testing error if this is reached 8078 PVPATB_TEST_IS_TRUE(false); 8079 iState = STATE_CLEANUPANDCOMPLETE; 8080 RunIfNotReady(); 8081 } 8082 break; 8083 } 8084 } 8085 8086 8087 void pvplayer_async_test_playsetstopposition::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 8088 { 8089 switch (aEvent.GetEventType()) 8090 { 8091 case PVMFErrResourceConfiguration: 8092 // Just log the error 8093 PVPATB_TEST_IS_TRUE(false); 8094 break; 8095 8096 case PVMFErrResource: 8097 // Just log the error 8098 PVPATB_TEST_IS_TRUE(false); 8099 break; 8100 8101 case PVMFErrCorrupt: 8102 // Just log the error 8103 PVPATB_TEST_IS_TRUE(false); 8104 break; 8105 8106 case PVMFErrProcessing: 8107 // Just log the error 8108 PVPATB_TEST_IS_TRUE(false); 8109 break; 8110 8111 default: 8112 // Unknown error and just log the error 8113 PVPATB_TEST_IS_TRUE(false); 8114 break; 8115 } 8116 } 8117 8118 8119 void pvplayer_async_test_playsetstopposition::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 8120 { 8121 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 8122 { 8123 // do nothing 8124 } 8125 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 8126 { 8127 iState = STATE_CLEANUPANDCOMPLETE; 8128 RunIfNotReady(); 8129 } 8130 // Check for stop time reached event 8131 if (aEvent.GetEventType() == PVMFInfoEndOfData) 8132 { 8133 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 8134 if (iface == NULL) 8135 { 8136 return; 8137 } 8138 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 8139 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 8140 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 8141 { 8142 int32 infocode; 8143 PVUuid infouuid; 8144 infomsgiface->GetCodeUUID(infocode, infouuid); 8145 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoEndTimeReached)) 8146 { 8147 iState = STATE_STOP; 8148 Cancel(); 8149 RunIfNotReady(); 8150 } 8151 } 8152 } 8153 } 8154 8155 8156 // 8157 // pvplayer_async_test_playsetstoppositionvidframenum section 8158 // 8159 void pvplayer_async_test_playsetstoppositionvidframenum::StartTest() 8160 { 8161 AddToScheduler(); 8162 iState = STATE_CREATE; 8163 RunIfNotReady(); 8164 } 8165 8166 8167 void pvplayer_async_test_playsetstoppositionvidframenum::Run() 8168 { 8169 int error = 0; 8170 8171 switch (iState) 8172 { 8173 case STATE_CREATE: 8174 { 8175 iPlayer = NULL; 8176 8177 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 8178 if (error) 8179 { 8180 PVPATB_TEST_IS_TRUE(false); 8181 iObserver->TestCompleted(*iTestCase); 8182 } 8183 else 8184 { 8185 iState = STATE_ADDDATASOURCE; 8186 RunIfNotReady(); 8187 } 8188 } 8189 break; 8190 8191 case STATE_ADDDATASOURCE: 8192 { 8193 iDataSource = new PVPlayerDataSourceURL; 8194 8195 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 8196 sourcefile += _STRLIT_WCHAR("test_reposition.mp4"); 8197 iDataSource->SetDataSourceURL(sourcefile); 8198 8199 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 8200 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 8201 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8202 } 8203 break; 8204 8205 case STATE_INIT: 8206 { 8207 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 8208 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8209 } 8210 break; 8211 8212 case STATE_ADDDATASINK_VIDEO: 8213 { 8214 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 8215 sinkfile += _STRLIT_WCHAR("test_player_playsetstoppositionvidframenum_video.dat"); 8216 8217 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 8218 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 8219 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 8220 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 8221 8222 8223 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 8224 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8225 } 8226 break; 8227 8228 case STATE_ADDDATASINK_AUDIO: 8229 { 8230 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 8231 sinkfile += _STRLIT_WCHAR("test_player_playsetstoppositionvidframenum_audio.dat"); 8232 8233 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 8234 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 8235 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 8236 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 8237 8238 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 8239 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8240 } 8241 break; 8242 8243 case STATE_PREPARE: 8244 { 8245 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 8246 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8247 } 8248 break; 8249 8250 case STATE_START: 8251 { 8252 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 8253 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8254 } 8255 break; 8256 8257 case STATE_SETPLAYBACKRANGE: 8258 { 8259 PVPPlaybackPosition start, end; 8260 start.iIndeterminate = true; 8261 start.iMode = PVPPBPOS_MODE_NOW; 8262 end.iIndeterminate = false; 8263 end.iPosUnit = PVPPBPOSUNIT_SAMPLENUMBER; 8264 end.iPosValue.samplenum_value = 150; 8265 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 8266 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8267 } 8268 break; 8269 8270 case STATE_STOPTIMENOTREACHED: 8271 { 8272 // Timeout when player doesn't stop automatically when stop time is reached 8273 PVPATB_TEST_IS_TRUE(false); 8274 iState = STATE_CLEANUPANDCOMPLETE; 8275 RunIfNotReady(); 8276 } 8277 break; 8278 8279 case STATE_STOP: 8280 { 8281 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 8282 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8283 } 8284 break; 8285 8286 case STATE_REMOVEDATASINK_VIDEO: 8287 { 8288 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 8289 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8290 } 8291 break; 8292 8293 case STATE_REMOVEDATASINK_AUDIO: 8294 { 8295 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 8296 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8297 } 8298 break; 8299 8300 case STATE_RESET: 8301 { 8302 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 8303 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8304 } 8305 break; 8306 8307 case STATE_REMOVEDATASOURCE: 8308 { 8309 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 8310 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8311 } 8312 break; 8313 8314 case STATE_CLEANUPANDCOMPLETE: 8315 { 8316 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 8317 iPlayer = NULL; 8318 8319 delete iDataSource; 8320 iDataSource = NULL; 8321 8322 delete iDataSinkVideo; 8323 iDataSinkVideo = NULL; 8324 8325 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 8326 iIONodeVideo = NULL; 8327 8328 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 8329 iMIOFileOutVideo = NULL; 8330 8331 delete iDataSinkAudio; 8332 iDataSinkAudio = NULL; 8333 8334 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 8335 iIONodeAudio = NULL; 8336 8337 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 8338 iMIOFileOutAudio = NULL; 8339 8340 iObserver->TestCompleted(*iTestCase); 8341 } 8342 break; 8343 8344 default: 8345 break; 8346 8347 } 8348 } 8349 8350 8351 void pvplayer_async_test_playsetstoppositionvidframenum::CommandCompleted(const PVCmdResponse& aResponse) 8352 { 8353 if (aResponse.GetCmdId() != iCurrentCmdId) 8354 { 8355 // Wrong command ID. 8356 PVPATB_TEST_IS_TRUE(false); 8357 iState = STATE_CLEANUPANDCOMPLETE; 8358 RunIfNotReady(); 8359 return; 8360 } 8361 8362 if (aResponse.GetContext() != NULL) 8363 { 8364 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 8365 { 8366 if (iContextObject != iContextObjectRefValue) 8367 { 8368 // Context data value was corrupted 8369 PVPATB_TEST_IS_TRUE(false); 8370 iState = STATE_CLEANUPANDCOMPLETE; 8371 RunIfNotReady(); 8372 return; 8373 } 8374 } 8375 else 8376 { 8377 // Context data pointer was corrupted 8378 PVPATB_TEST_IS_TRUE(false); 8379 iState = STATE_CLEANUPANDCOMPLETE; 8380 RunIfNotReady(); 8381 return; 8382 } 8383 } 8384 8385 switch (iState) 8386 { 8387 case STATE_ADDDATASOURCE: 8388 if (aResponse.GetCmdStatus() == PVMFSuccess) 8389 { 8390 iState = STATE_INIT; 8391 RunIfNotReady(); 8392 } 8393 else 8394 { 8395 // AddDataSource failed 8396 PVPATB_TEST_IS_TRUE(false); 8397 iState = STATE_CLEANUPANDCOMPLETE; 8398 RunIfNotReady(); 8399 } 8400 break; 8401 8402 case STATE_INIT: 8403 if (aResponse.GetCmdStatus() == PVMFSuccess) 8404 { 8405 iState = STATE_ADDDATASINK_VIDEO; 8406 RunIfNotReady(); 8407 } 8408 else 8409 { 8410 // Init failed 8411 PVPATB_TEST_IS_TRUE(false); 8412 iState = STATE_CLEANUPANDCOMPLETE; 8413 RunIfNotReady(); 8414 } 8415 break; 8416 8417 case STATE_ADDDATASINK_VIDEO: 8418 if (aResponse.GetCmdStatus() == PVMFSuccess) 8419 { 8420 iState = STATE_ADDDATASINK_AUDIO; 8421 RunIfNotReady(); 8422 } 8423 else 8424 { 8425 // AddDataSink failed 8426 PVPATB_TEST_IS_TRUE(false); 8427 iState = STATE_CLEANUPANDCOMPLETE; 8428 RunIfNotReady(); 8429 } 8430 break; 8431 8432 case STATE_ADDDATASINK_AUDIO: 8433 if (aResponse.GetCmdStatus() == PVMFSuccess) 8434 { 8435 iState = STATE_PREPARE; 8436 RunIfNotReady(); 8437 } 8438 else 8439 { 8440 // AddDataSink failed 8441 PVPATB_TEST_IS_TRUE(false); 8442 iState = STATE_CLEANUPANDCOMPLETE; 8443 RunIfNotReady(); 8444 } 8445 break; 8446 8447 case STATE_PREPARE: 8448 if (aResponse.GetCmdStatus() == PVMFSuccess) 8449 { 8450 iState = STATE_START; 8451 RunIfNotReady(); 8452 } 8453 else 8454 { 8455 // Prepare failed 8456 PVPATB_TEST_IS_TRUE(false); 8457 iState = STATE_CLEANUPANDCOMPLETE; 8458 RunIfNotReady(); 8459 } 8460 break; 8461 8462 case STATE_START: 8463 if (aResponse.GetCmdStatus() == PVMFSuccess) 8464 { 8465 iState = STATE_SETPLAYBACKRANGE; 8466 RunIfNotReady(); 8467 } 8468 else 8469 { 8470 // Start failed 8471 PVPATB_TEST_IS_TRUE(false); 8472 iState = STATE_CLEANUPANDCOMPLETE; 8473 RunIfNotReady(); 8474 } 8475 break; 8476 8477 case STATE_SETPLAYBACKRANGE: 8478 if (aResponse.GetCmdStatus() == PVMFSuccess) 8479 { 8480 iState = STATE_STOPTIMENOTREACHED; 8481 RunIfNotReady(30000000); 8482 } 8483 else 8484 { 8485 // SetPlaybackRange failed 8486 PVPATB_TEST_IS_TRUE(false); 8487 iState = STATE_CLEANUPANDCOMPLETE; 8488 RunIfNotReady(); 8489 } 8490 break; 8491 8492 case STATE_STOP: 8493 if (aResponse.GetCmdStatus() == PVMFSuccess) 8494 { 8495 iState = STATE_REMOVEDATASINK_VIDEO; 8496 RunIfNotReady(); 8497 } 8498 else 8499 { 8500 // Stop failed 8501 PVPATB_TEST_IS_TRUE(false); 8502 iState = STATE_CLEANUPANDCOMPLETE; 8503 RunIfNotReady(); 8504 } 8505 break; 8506 8507 case STATE_REMOVEDATASINK_VIDEO: 8508 if (aResponse.GetCmdStatus() == PVMFSuccess) 8509 { 8510 iState = STATE_REMOVEDATASINK_AUDIO; 8511 RunIfNotReady(); 8512 } 8513 else 8514 { 8515 // RemoveDataSink failed 8516 PVPATB_TEST_IS_TRUE(false); 8517 iState = STATE_CLEANUPANDCOMPLETE; 8518 RunIfNotReady(); 8519 } 8520 break; 8521 8522 case STATE_REMOVEDATASINK_AUDIO: 8523 if (aResponse.GetCmdStatus() == PVMFSuccess) 8524 { 8525 iState = STATE_RESET; 8526 RunIfNotReady(); 8527 } 8528 else 8529 { 8530 // RemoveDataSink failed 8531 PVPATB_TEST_IS_TRUE(false); 8532 iState = STATE_CLEANUPANDCOMPLETE; 8533 RunIfNotReady(); 8534 } 8535 break; 8536 8537 case STATE_RESET: 8538 if (aResponse.GetCmdStatus() == PVMFSuccess) 8539 { 8540 iState = STATE_REMOVEDATASOURCE; 8541 RunIfNotReady(); 8542 } 8543 else 8544 { 8545 // Reset failed 8546 PVPATB_TEST_IS_TRUE(false); 8547 iState = STATE_CLEANUPANDCOMPLETE; 8548 RunIfNotReady(); 8549 } 8550 break; 8551 8552 case STATE_REMOVEDATASOURCE: 8553 if (aResponse.GetCmdStatus() == PVMFSuccess) 8554 { 8555 PVPATB_TEST_IS_TRUE(true); 8556 iState = STATE_CLEANUPANDCOMPLETE; 8557 RunIfNotReady(); 8558 } 8559 else 8560 { 8561 // RemoveDataSource failed 8562 PVPATB_TEST_IS_TRUE(false); 8563 iState = STATE_CLEANUPANDCOMPLETE; 8564 RunIfNotReady(); 8565 } 8566 break; 8567 8568 default: 8569 { 8570 // Testing error if this is reached 8571 PVPATB_TEST_IS_TRUE(false); 8572 iState = STATE_CLEANUPANDCOMPLETE; 8573 RunIfNotReady(); 8574 } 8575 break; 8576 } 8577 } 8578 8579 8580 void pvplayer_async_test_playsetstoppositionvidframenum::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 8581 { 8582 switch (aEvent.GetEventType()) 8583 { 8584 case PVMFErrResourceConfiguration: 8585 // Just log the error 8586 PVPATB_TEST_IS_TRUE(false); 8587 break; 8588 8589 case PVMFErrResource: 8590 // Just log the error 8591 PVPATB_TEST_IS_TRUE(false); 8592 break; 8593 8594 case PVMFErrCorrupt: 8595 // Just log the error 8596 PVPATB_TEST_IS_TRUE(false); 8597 break; 8598 8599 case PVMFErrProcessing: 8600 // Just log the error 8601 PVPATB_TEST_IS_TRUE(false); 8602 break; 8603 8604 default: 8605 // Unknown error and just log the error 8606 PVPATB_TEST_IS_TRUE(false); 8607 break; 8608 } 8609 } 8610 8611 8612 void pvplayer_async_test_playsetstoppositionvidframenum::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 8613 { 8614 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 8615 { 8616 // do nothing 8617 } 8618 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 8619 { 8620 iState = STATE_CLEANUPANDCOMPLETE; 8621 RunIfNotReady(); 8622 } 8623 // Check for stop time reached event 8624 if (aEvent.GetEventType() == PVMFInfoEndOfData) 8625 { 8626 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 8627 if (iface == NULL) 8628 { 8629 return; 8630 } 8631 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 8632 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 8633 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 8634 { 8635 int32 infocode; 8636 PVUuid infouuid; 8637 infomsgiface->GetCodeUUID(infocode, infouuid); 8638 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoEndTimeReached)) 8639 { 8640 iState = STATE_STOP; 8641 Cancel(); 8642 RunIfNotReady(); 8643 } 8644 } 8645 } 8646 } 8647 8648 8649 // 8650 // pvplayer_async_test_setstartpositionplaystop section 8651 // 8652 void pvplayer_async_test_setstartpositionplaystop::StartTest() 8653 { 8654 AddToScheduler(); 8655 iState = STATE_CREATE; 8656 RunIfNotReady(); 8657 } 8658 8659 8660 void pvplayer_async_test_setstartpositionplaystop::Run() 8661 { 8662 int error = 0; 8663 8664 switch (iState) 8665 { 8666 case STATE_CREATE: 8667 { 8668 iPlayer = NULL; 8669 8670 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 8671 if (error) 8672 { 8673 PVPATB_TEST_IS_TRUE(false); 8674 iObserver->TestCompleted(*iTestCase); 8675 } 8676 else 8677 { 8678 iState = STATE_ADDDATASOURCE; 8679 RunIfNotReady(); 8680 } 8681 } 8682 break; 8683 8684 case STATE_ADDDATASOURCE: 8685 { 8686 PVMFFormatType fileType; 8687 iDataSource = new PVPlayerDataSourceURL; 8688 OSCL_HeapString<OsclMemAllocator> filename; 8689 8690 if (oscl_strstr(iFileName, "test.mp4") != NULL) 8691 { 8692 filename = SOURCENAME_PREPEND_STRING; 8693 filename += _STRLIT_CHAR("test_reposition.mp4"); 8694 fileType = PVMF_MIME_MPEG4FF; 8695 iFileType = PVMF_MIME_MPEG4FF; 8696 } 8697 else 8698 { 8699 filename = iFileName; 8700 fileType = iFileType; 8701 } 8702 fprintf(iTestMsgOutputFile, "***Source URL=%s\n", filename.get_str()); 8703 oscl_UTF8ToUnicode(filename.get_str(), filename.get_size(), output, 256); 8704 wFileName.set(output, oscl_strlen(output)); 8705 8706 if (iFileType == PVMF_MIME_DATA_SOURCE_HTTP_URL) 8707 { 8708 fileType = PVMF_MIME_DATA_SOURCE_HTTP_URL; 8709 iDataSource->SetAlternateSourceFormatType(PVMF_MIME_DATA_SOURCE_MS_HTTP_STREAMING_URL); 8710 iSourceContextData = new PVMFSourceContextData(); 8711 iSourceContextData->EnableCommonSourceContext(); 8712 iSourceContextData->EnableStreamingSourceContext(); 8713 8714 PVInterface* sourceContext = NULL; 8715 PVUuid streamingContextUuid(PVMF_SOURCE_CONTEXT_DATA_STREAMING_UUID); 8716 if (iSourceContextData->queryInterface(streamingContextUuid, sourceContext)) 8717 { 8718 PVMFSourceContextDataStreaming* streamingContext = 8719 OSCL_STATIC_CAST(PVMFSourceContextDataStreaming*, sourceContext); 8720 streamingContext->iStreamStatsLoggingURL = wFileName; 8721 8722 if (iProxyEnabled) 8723 { 8724 streamingContext->iProxyName = _STRLIT_WCHAR("63.215.241.33"); 8725 streamingContext->iProxyPort = 7070; 8726 } 8727 8728 streamingContext->iUserID = _STRLIT_CHAR("abc"); 8729 streamingContext->iUserPasswd = _STRLIT_CHAR("xyz"); 8730 } 8731 iSourceContextData->EnableDownloadHTTPSourceContext(); 8732 sourceContext = NULL; 8733 PVUuid downloadContextUuid(PVMF_SOURCE_CONTEXT_DATA_DOWNLOAD_HTTP_UUID); 8734 if (iSourceContextData->queryInterface(downloadContextUuid, sourceContext)) 8735 { 8736 PVMFSourceContextDataDownloadHTTP* downloadContext = 8737 OSCL_STATIC_CAST(PVMFSourceContextDataDownloadHTTP*, sourceContext); 8738 if (iProxyEnabled) 8739 { 8740 downloadContext->iProxyName = _STRLIT_CHAR("63.215.241.33"); 8741 downloadContext->iProxyPort = 7070; 8742 } 8743 downloadContext->iDownloadFileName += _STRLIT_WCHAR("test_ftdownload.loc"); 8744 downloadContext->iConfigFileName += _STRLIT_WCHAR("mydlconfig"); 8745 downloadContext->iUserID = _STRLIT_CHAR("abc"); 8746 downloadContext->iUserPasswd = _STRLIT_CHAR("xyz"); 8747 downloadContext->bIsNewSession = true; 8748 downloadContext->iMaxFileSize = 0x7FFFFFFF; 8749 downloadContext->iPlaybackControl = PVMFSourceContextDataDownloadHTTP::EAsap; 8750 } 8751 iDataSource->SetDataSourceContextData((OsclAny*)iSourceContextData); 8752 } 8753 iDataSource->SetDataSourceURL(wFileName); 8754 iDataSource->SetDataSourceFormatType(fileType); 8755 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 8756 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8757 } 8758 break; 8759 8760 case STATE_INIT: 8761 { 8762 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 8763 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8764 } 8765 break; 8766 8767 case STATE_ADDDATASINK_VIDEO: 8768 { 8769 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 8770 sinkfile += _STRLIT_WCHAR("test_player_setstartpositionplaystop_video.dat"); 8771 8772 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 8773 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 8774 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 8775 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 8776 8777 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 8778 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8779 } 8780 break; 8781 8782 case STATE_ADDDATASINK_AUDIO: 8783 { 8784 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 8785 sinkfile += _STRLIT_WCHAR("test_player_setstartpositionplaystop_audio.dat"); 8786 8787 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 8788 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 8789 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 8790 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 8791 8792 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 8793 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8794 } 8795 break; 8796 8797 case STATE_SETPLAYBACKRANGE: 8798 { 8799 PVPPlaybackPosition start, end; 8800 start.iIndeterminate = false; 8801 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 8802 start.iMode = PVPPBPOS_MODE_NOW; 8803 start.iPosValue.millisec_value = 10000; 8804 end.iIndeterminate = true; 8805 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 8806 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8807 } 8808 break; 8809 8810 case STATE_PREPARE: 8811 { 8812 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 8813 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8814 } 8815 break; 8816 8817 case STATE_START: 8818 { 8819 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 8820 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8821 } 8822 break; 8823 8824 case STATE_STOP: 8825 { 8826 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 8827 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8828 } 8829 break; 8830 8831 case STATE_REMOVEDATASINK_VIDEO: 8832 { 8833 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 8834 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8835 } 8836 break; 8837 8838 case STATE_REMOVEDATASINK_AUDIO: 8839 { 8840 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 8841 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8842 } 8843 break; 8844 8845 case STATE_RESET: 8846 { 8847 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 8848 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8849 } 8850 break; 8851 8852 case STATE_REMOVEDATASOURCE: 8853 { 8854 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 8855 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 8856 } 8857 break; 8858 8859 case STATE_CLEANUPANDCOMPLETE: 8860 { 8861 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 8862 iPlayer = NULL; 8863 8864 delete iSourceContextData; 8865 iSourceContextData = NULL; 8866 8867 delete iDataSource; 8868 iDataSource = NULL; 8869 8870 delete iDataSinkVideo; 8871 iDataSinkVideo = NULL; 8872 8873 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 8874 iIONodeVideo = NULL; 8875 8876 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 8877 iMIOFileOutVideo = NULL; 8878 8879 delete iDataSinkAudio; 8880 iDataSinkAudio = NULL; 8881 8882 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 8883 iIONodeAudio = NULL; 8884 8885 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 8886 iMIOFileOutAudio = NULL; 8887 8888 iObserver->TestCompleted(*iTestCase); 8889 } 8890 break; 8891 8892 default: 8893 break; 8894 8895 } 8896 } 8897 8898 8899 void pvplayer_async_test_setstartpositionplaystop::CommandCompleted(const PVCmdResponse& aResponse) 8900 { 8901 if (aResponse.GetCmdId() != iCurrentCmdId) 8902 { 8903 // Wrong command ID. 8904 PVPATB_TEST_IS_TRUE(false); 8905 iState = STATE_CLEANUPANDCOMPLETE; 8906 RunIfNotReady(); 8907 return; 8908 } 8909 8910 if (aResponse.GetContext() != NULL) 8911 { 8912 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 8913 { 8914 if (iContextObject != iContextObjectRefValue) 8915 { 8916 // Context data value was corrupted 8917 PVPATB_TEST_IS_TRUE(false); 8918 iState = STATE_CLEANUPANDCOMPLETE; 8919 RunIfNotReady(); 8920 return; 8921 } 8922 } 8923 else 8924 { 8925 // Context data pointer was corrupted 8926 PVPATB_TEST_IS_TRUE(false); 8927 iState = STATE_CLEANUPANDCOMPLETE; 8928 RunIfNotReady(); 8929 return; 8930 } 8931 } 8932 8933 switch (iState) 8934 { 8935 case STATE_ADDDATASOURCE: 8936 if (aResponse.GetCmdStatus() == PVMFSuccess) 8937 { 8938 iState = STATE_INIT; 8939 RunIfNotReady(); 8940 } 8941 else 8942 { 8943 // AddDataSource failed 8944 PVPATB_TEST_IS_TRUE(false); 8945 iState = STATE_CLEANUPANDCOMPLETE; 8946 RunIfNotReady(); 8947 } 8948 break; 8949 8950 case STATE_INIT: 8951 if (aResponse.GetCmdStatus() == PVMFSuccess) 8952 { 8953 iState = STATE_ADDDATASINK_VIDEO; 8954 RunIfNotReady(); 8955 } 8956 else 8957 { 8958 // Init failed 8959 PVPATB_TEST_IS_TRUE(false); 8960 iState = STATE_CLEANUPANDCOMPLETE; 8961 RunIfNotReady(); 8962 } 8963 break; 8964 8965 case STATE_ADDDATASINK_VIDEO: 8966 if (aResponse.GetCmdStatus() == PVMFSuccess) 8967 { 8968 iState = STATE_ADDDATASINK_AUDIO; 8969 RunIfNotReady(); 8970 } 8971 else 8972 { 8973 // AddDataSink failed 8974 PVPATB_TEST_IS_TRUE(false); 8975 iState = STATE_CLEANUPANDCOMPLETE; 8976 RunIfNotReady(); 8977 } 8978 break; 8979 8980 case STATE_ADDDATASINK_AUDIO: 8981 if (aResponse.GetCmdStatus() == PVMFSuccess) 8982 { 8983 iState = STATE_SETPLAYBACKRANGE; 8984 RunIfNotReady(); 8985 } 8986 else 8987 { 8988 // AddDataSink failed 8989 PVPATB_TEST_IS_TRUE(false); 8990 iState = STATE_CLEANUPANDCOMPLETE; 8991 RunIfNotReady(); 8992 } 8993 break; 8994 8995 case STATE_SETPLAYBACKRANGE: 8996 if (aResponse.GetCmdStatus() == PVMFSuccess) 8997 { 8998 iNumSeek++; 8999 iState = STATE_PREPARE; 9000 RunIfNotReady(); 9001 } 9002 else 9003 { 9004 // SetPlaybackRange failed 9005 PVPATB_TEST_IS_TRUE(false); 9006 iState = STATE_CLEANUPANDCOMPLETE; 9007 RunIfNotReady(); 9008 } 9009 break; 9010 9011 case STATE_PREPARE: 9012 if (aResponse.GetCmdStatus() == PVMFSuccess) 9013 { 9014 iState = STATE_START; 9015 RunIfNotReady(); 9016 } 9017 else 9018 { 9019 // Prepare failed 9020 PVPATB_TEST_IS_TRUE(false); 9021 iState = STATE_CLEANUPANDCOMPLETE; 9022 RunIfNotReady(); 9023 } 9024 break; 9025 9026 case STATE_START: 9027 if (aResponse.GetCmdStatus() == PVMFSuccess) 9028 { 9029 iState = STATE_STOP; 9030 RunIfNotReady(20000000); 9031 } 9032 else 9033 { 9034 // Start failed 9035 PVPATB_TEST_IS_TRUE(false); 9036 iState = STATE_CLEANUPANDCOMPLETE; 9037 RunIfNotReady(); 9038 } 9039 break; 9040 9041 case STATE_STOP: 9042 if (aResponse.GetCmdStatus() == PVMFSuccess) 9043 { 9044 if (iTargetNumSeek != iNumSeek) 9045 { 9046 iState = STATE_SETPLAYBACKRANGE; 9047 RunIfNotReady(); 9048 } 9049 else 9050 { 9051 iState = STATE_REMOVEDATASINK_VIDEO; 9052 RunIfNotReady(); 9053 } 9054 } 9055 else 9056 { 9057 // Stop failed 9058 PVPATB_TEST_IS_TRUE(false); 9059 iState = STATE_CLEANUPANDCOMPLETE; 9060 RunIfNotReady(); 9061 } 9062 break; 9063 9064 case STATE_REMOVEDATASINK_VIDEO: 9065 if (aResponse.GetCmdStatus() == PVMFSuccess) 9066 { 9067 iState = STATE_REMOVEDATASINK_AUDIO; 9068 RunIfNotReady(); 9069 } 9070 else 9071 { 9072 // RemoveDataSink failed 9073 PVPATB_TEST_IS_TRUE(false); 9074 iState = STATE_CLEANUPANDCOMPLETE; 9075 RunIfNotReady(); 9076 } 9077 break; 9078 9079 case STATE_REMOVEDATASINK_AUDIO: 9080 if (aResponse.GetCmdStatus() == PVMFSuccess) 9081 { 9082 iState = STATE_RESET; 9083 RunIfNotReady(); 9084 } 9085 else 9086 { 9087 // RemoveDataSink failed 9088 PVPATB_TEST_IS_TRUE(false); 9089 iState = STATE_CLEANUPANDCOMPLETE; 9090 RunIfNotReady(); 9091 } 9092 break; 9093 9094 case STATE_RESET: 9095 if (aResponse.GetCmdStatus() == PVMFSuccess) 9096 { 9097 iState = STATE_REMOVEDATASOURCE; 9098 RunIfNotReady(); 9099 } 9100 else 9101 { 9102 // Reset failed 9103 PVPATB_TEST_IS_TRUE(false); 9104 iState = STATE_CLEANUPANDCOMPLETE; 9105 RunIfNotReady(); 9106 } 9107 break; 9108 9109 case STATE_REMOVEDATASOURCE: 9110 if (aResponse.GetCmdStatus() == PVMFSuccess) 9111 { 9112 PVPATB_TEST_IS_TRUE(true); 9113 iState = STATE_CLEANUPANDCOMPLETE; 9114 RunIfNotReady(); 9115 } 9116 else 9117 { 9118 // RemoveDataSource failed 9119 PVPATB_TEST_IS_TRUE(false); 9120 iState = STATE_CLEANUPANDCOMPLETE; 9121 RunIfNotReady(); 9122 } 9123 break; 9124 9125 default: 9126 { 9127 // Testing error if this is reached 9128 PVPATB_TEST_IS_TRUE(false); 9129 iState = STATE_CLEANUPANDCOMPLETE; 9130 RunIfNotReady(); 9131 } 9132 break; 9133 } 9134 } 9135 9136 9137 void pvplayer_async_test_setstartpositionplaystop::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 9138 { 9139 switch (aEvent.GetEventType()) 9140 { 9141 case PVMFErrResourceConfiguration: 9142 // Just log the error 9143 PVPATB_TEST_IS_TRUE(false); 9144 break; 9145 9146 case PVMFErrResource: 9147 // Just log the error 9148 PVPATB_TEST_IS_TRUE(false); 9149 break; 9150 9151 case PVMFErrCorrupt: 9152 // Just log the error 9153 PVPATB_TEST_IS_TRUE(false); 9154 break; 9155 9156 case PVMFErrProcessing: 9157 // Just log the error 9158 PVPATB_TEST_IS_TRUE(false); 9159 break; 9160 9161 default: 9162 // Unknown error and just log the error 9163 PVPATB_TEST_IS_TRUE(false); 9164 break; 9165 } 9166 } 9167 9168 9169 void pvplayer_async_test_setstartpositionplaystop::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 9170 { 9171 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 9172 { 9173 // do nothing 9174 } 9175 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 9176 { 9177 iState = STATE_CLEANUPANDCOMPLETE; 9178 RunIfNotReady(); 9179 } 9180 // Check for end of clip event 9181 if (aEvent.GetEventType() == PVMFInfoEndOfData) 9182 { 9183 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 9184 if (iface == NULL) 9185 { 9186 return; 9187 } 9188 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 9189 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 9190 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 9191 { 9192 int32 infocode; 9193 PVUuid infouuid; 9194 infomsgiface->GetCodeUUID(infocode, infouuid); 9195 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoEndOfClipReached)) 9196 { 9197 iState = STATE_STOP; 9198 Cancel(); 9199 RunIfNotReady(); 9200 } 9201 } 9202 } 9203 else if (aEvent.GetEventType() == PVMFInfoSourceFormatNotSupported) 9204 { 9205 // source rollover... 9206 fprintf(iTestMsgOutputFile, "###PVMFInfoSourceFormatNotSupported...\n"); 9207 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 9208 if (iface != NULL) 9209 { 9210 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 9211 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 9212 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 9213 { 9214 int32 infocode; 9215 PVUuid infouuid; 9216 infomsgiface->GetCodeUUID(infocode, infouuid); 9217 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && 9218 (infocode == PVPlayerInfoAttemptingSourceRollOver)) 9219 { 9220 uint8* localBuf = aEvent.GetLocalBuffer(); 9221 if (localBuf != NULL) 9222 { 9223 uint32 srcFormat = 0; 9224 oscl_memcpy(&srcFormat, &localBuf[4], sizeof(uint32)); 9225 fprintf(iTestMsgOutputFile, "###Attempting Source RollOver - NewSrcFormat=%d\n", srcFormat); 9226 } 9227 } 9228 } 9229 } 9230 } 9231 } 9232 9233 9234 // 9235 // pvplayer_async_test_setplayrangeplay section 9236 // 9237 void pvplayer_async_test_setplayrangeplay::StartTest() 9238 { 9239 AddToScheduler(); 9240 iState = STATE_CREATE; 9241 RunIfNotReady(); 9242 } 9243 9244 9245 void pvplayer_async_test_setplayrangeplay::Run() 9246 { 9247 int error = 0; 9248 9249 switch (iState) 9250 { 9251 case STATE_CREATE: 9252 { 9253 iPlayer = NULL; 9254 9255 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 9256 if (error) 9257 { 9258 PVPATB_TEST_IS_TRUE(false); 9259 iObserver->TestCompleted(*iTestCase); 9260 } 9261 else 9262 { 9263 iState = STATE_ADDDATASOURCE; 9264 RunIfNotReady(); 9265 } 9266 } 9267 break; 9268 9269 case STATE_ADDDATASOURCE: 9270 { 9271 iDataSource = new PVPlayerDataSourceURL; 9272 9273 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 9274 sourcefile += _STRLIT_WCHAR("test_reposition.mp4"); 9275 iDataSource->SetDataSourceURL(sourcefile); 9276 9277 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 9278 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 9279 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9280 } 9281 break; 9282 9283 case STATE_INIT: 9284 { 9285 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 9286 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9287 } 9288 break; 9289 9290 case STATE_ADDDATASINK_VIDEO: 9291 { 9292 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 9293 sinkfile += _STRLIT_WCHAR("test_player_setplayrangeplay_video.dat"); 9294 9295 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 9296 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 9297 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 9298 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 9299 9300 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 9301 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9302 } 9303 break; 9304 9305 case STATE_ADDDATASINK_AUDIO: 9306 { 9307 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 9308 sinkfile += _STRLIT_WCHAR("test_player_setplayrangeplay_audio.dat"); 9309 9310 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 9311 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 9312 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 9313 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 9314 9315 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 9316 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9317 } 9318 break; 9319 9320 case STATE_SETPLAYBACKRANGE: 9321 { 9322 PVPPlaybackPosition start, end; 9323 start.iIndeterminate = false; 9324 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 9325 start.iMode = PVPPBPOS_MODE_NOW; 9326 start.iPosValue.millisec_value = 10000; 9327 end.iIndeterminate = false; 9328 end.iPosUnit = PVPPBPOSUNIT_MILLISEC; 9329 end.iPosValue.millisec_value = 25000; 9330 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 9331 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9332 } 9333 break; 9334 9335 case STATE_PREPARE: 9336 { 9337 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 9338 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9339 } 9340 break; 9341 9342 case STATE_START: 9343 { 9344 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 9345 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9346 } 9347 break; 9348 9349 case STATE_STOPTIMENOTREACHED: 9350 { 9351 // Timeout when player doesn't stop automatically when stop time is reached 9352 PVPATB_TEST_IS_TRUE(false); 9353 iState = STATE_CLEANUPANDCOMPLETE; 9354 RunIfNotReady(); 9355 } 9356 break; 9357 9358 case STATE_STOP: 9359 { 9360 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 9361 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9362 } 9363 break; 9364 9365 case STATE_REMOVEDATASINK_VIDEO: 9366 { 9367 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 9368 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9369 } 9370 break; 9371 9372 case STATE_REMOVEDATASINK_AUDIO: 9373 { 9374 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 9375 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9376 } 9377 break; 9378 9379 case STATE_RESET: 9380 { 9381 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 9382 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9383 } 9384 break; 9385 9386 case STATE_REMOVEDATASOURCE: 9387 { 9388 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 9389 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9390 } 9391 break; 9392 9393 case STATE_CLEANUPANDCOMPLETE: 9394 { 9395 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 9396 iPlayer = NULL; 9397 9398 delete iDataSource; 9399 iDataSource = NULL; 9400 9401 delete iDataSinkVideo; 9402 iDataSinkVideo = NULL; 9403 9404 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 9405 iIONodeVideo = NULL; 9406 9407 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 9408 iMIOFileOutVideo = NULL; 9409 9410 delete iDataSinkAudio; 9411 iDataSinkAudio = NULL; 9412 9413 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 9414 iIONodeAudio = NULL; 9415 9416 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 9417 iMIOFileOutAudio = NULL; 9418 9419 iObserver->TestCompleted(*iTestCase); 9420 } 9421 break; 9422 9423 default: 9424 break; 9425 9426 } 9427 } 9428 9429 9430 void pvplayer_async_test_setplayrangeplay::CommandCompleted(const PVCmdResponse& aResponse) 9431 { 9432 if (aResponse.GetCmdId() != iCurrentCmdId) 9433 { 9434 // Wrong command ID. 9435 PVPATB_TEST_IS_TRUE(false); 9436 iState = STATE_CLEANUPANDCOMPLETE; 9437 RunIfNotReady(); 9438 return; 9439 } 9440 9441 if (aResponse.GetContext() != NULL) 9442 { 9443 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 9444 { 9445 if (iContextObject != iContextObjectRefValue) 9446 { 9447 // Context data value was corrupted 9448 PVPATB_TEST_IS_TRUE(false); 9449 iState = STATE_CLEANUPANDCOMPLETE; 9450 RunIfNotReady(); 9451 return; 9452 } 9453 } 9454 else 9455 { 9456 // Context data pointer was corrupted 9457 PVPATB_TEST_IS_TRUE(false); 9458 iState = STATE_CLEANUPANDCOMPLETE; 9459 RunIfNotReady(); 9460 return; 9461 } 9462 } 9463 9464 switch (iState) 9465 { 9466 case STATE_ADDDATASOURCE: 9467 if (aResponse.GetCmdStatus() == PVMFSuccess) 9468 { 9469 iState = STATE_INIT; 9470 RunIfNotReady(); 9471 } 9472 else 9473 { 9474 // AddDataSource failed 9475 PVPATB_TEST_IS_TRUE(false); 9476 iState = STATE_CLEANUPANDCOMPLETE; 9477 RunIfNotReady(); 9478 } 9479 break; 9480 9481 case STATE_INIT: 9482 if (aResponse.GetCmdStatus() == PVMFSuccess) 9483 { 9484 iState = STATE_ADDDATASINK_VIDEO; 9485 RunIfNotReady(); 9486 } 9487 else 9488 { 9489 // Init failed 9490 PVPATB_TEST_IS_TRUE(false); 9491 iState = STATE_CLEANUPANDCOMPLETE; 9492 RunIfNotReady(); 9493 } 9494 break; 9495 9496 case STATE_ADDDATASINK_VIDEO: 9497 if (aResponse.GetCmdStatus() == PVMFSuccess) 9498 { 9499 iState = STATE_ADDDATASINK_AUDIO; 9500 RunIfNotReady(); 9501 } 9502 else 9503 { 9504 // AddDataSink failed 9505 PVPATB_TEST_IS_TRUE(false); 9506 iState = STATE_CLEANUPANDCOMPLETE; 9507 RunIfNotReady(); 9508 } 9509 break; 9510 9511 case STATE_ADDDATASINK_AUDIO: 9512 if (aResponse.GetCmdStatus() == PVMFSuccess) 9513 { 9514 iState = STATE_SETPLAYBACKRANGE; 9515 RunIfNotReady(); 9516 } 9517 else 9518 { 9519 // AddDataSink failed 9520 PVPATB_TEST_IS_TRUE(false); 9521 iState = STATE_CLEANUPANDCOMPLETE; 9522 RunIfNotReady(); 9523 } 9524 break; 9525 9526 case STATE_SETPLAYBACKRANGE: 9527 if (aResponse.GetCmdStatus() == PVMFSuccess) 9528 { 9529 iState = STATE_PREPARE; 9530 RunIfNotReady(); 9531 } 9532 else 9533 { 9534 // SetPlaybackRange failed 9535 PVPATB_TEST_IS_TRUE(false); 9536 iState = STATE_CLEANUPANDCOMPLETE; 9537 RunIfNotReady(); 9538 } 9539 break; 9540 9541 case STATE_PREPARE: 9542 if (aResponse.GetCmdStatus() == PVMFSuccess) 9543 { 9544 iState = STATE_START; 9545 RunIfNotReady(); 9546 } 9547 else 9548 { 9549 // Prepare failed 9550 PVPATB_TEST_IS_TRUE(false); 9551 iState = STATE_CLEANUPANDCOMPLETE; 9552 RunIfNotReady(); 9553 } 9554 break; 9555 9556 case STATE_START: 9557 if (aResponse.GetCmdStatus() == PVMFSuccess) 9558 { 9559 iState = STATE_STOPTIMENOTREACHED; 9560 RunIfNotReady(25000000); 9561 } 9562 else 9563 { 9564 // Start failed 9565 PVPATB_TEST_IS_TRUE(false); 9566 iState = STATE_CLEANUPANDCOMPLETE; 9567 RunIfNotReady(); 9568 } 9569 break; 9570 9571 case STATE_STOP: 9572 if (aResponse.GetCmdStatus() == PVMFSuccess) 9573 { 9574 iState = STATE_REMOVEDATASINK_VIDEO; 9575 RunIfNotReady(); 9576 } 9577 else 9578 { 9579 // Stop failed 9580 PVPATB_TEST_IS_TRUE(false); 9581 iState = STATE_CLEANUPANDCOMPLETE; 9582 RunIfNotReady(); 9583 } 9584 break; 9585 9586 case STATE_REMOVEDATASINK_VIDEO: 9587 if (aResponse.GetCmdStatus() == PVMFSuccess) 9588 { 9589 iState = STATE_REMOVEDATASINK_AUDIO; 9590 RunIfNotReady(); 9591 } 9592 else 9593 { 9594 // RemoveDataSink failed 9595 PVPATB_TEST_IS_TRUE(false); 9596 iState = STATE_CLEANUPANDCOMPLETE; 9597 RunIfNotReady(); 9598 } 9599 break; 9600 9601 case STATE_REMOVEDATASINK_AUDIO: 9602 if (aResponse.GetCmdStatus() == PVMFSuccess) 9603 { 9604 iState = STATE_RESET; 9605 RunIfNotReady(); 9606 } 9607 else 9608 { 9609 // RemoveDataSink failed 9610 PVPATB_TEST_IS_TRUE(false); 9611 iState = STATE_CLEANUPANDCOMPLETE; 9612 RunIfNotReady(); 9613 } 9614 break; 9615 9616 case STATE_RESET: 9617 if (aResponse.GetCmdStatus() == PVMFSuccess) 9618 { 9619 iState = STATE_REMOVEDATASOURCE; 9620 RunIfNotReady(); 9621 } 9622 else 9623 { 9624 // Reset failed 9625 PVPATB_TEST_IS_TRUE(false); 9626 iState = STATE_CLEANUPANDCOMPLETE; 9627 RunIfNotReady(); 9628 } 9629 break; 9630 9631 case STATE_REMOVEDATASOURCE: 9632 if (aResponse.GetCmdStatus() == PVMFSuccess) 9633 { 9634 PVPATB_TEST_IS_TRUE(true); 9635 iState = STATE_CLEANUPANDCOMPLETE; 9636 RunIfNotReady(); 9637 } 9638 else 9639 { 9640 // RemoveDataSource failed 9641 PVPATB_TEST_IS_TRUE(false); 9642 iState = STATE_CLEANUPANDCOMPLETE; 9643 RunIfNotReady(); 9644 } 9645 break; 9646 9647 default: 9648 { 9649 // Testing error if this is reached 9650 PVPATB_TEST_IS_TRUE(false); 9651 iState = STATE_CLEANUPANDCOMPLETE; 9652 RunIfNotReady(); 9653 } 9654 break; 9655 } 9656 } 9657 9658 9659 void pvplayer_async_test_setplayrangeplay::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 9660 { 9661 switch (aEvent.GetEventType()) 9662 { 9663 case PVMFErrResourceConfiguration: 9664 // Just log the error 9665 PVPATB_TEST_IS_TRUE(false); 9666 break; 9667 9668 case PVMFErrResource: 9669 // Just log the error 9670 PVPATB_TEST_IS_TRUE(false); 9671 break; 9672 9673 case PVMFErrCorrupt: 9674 // Just log the error 9675 PVPATB_TEST_IS_TRUE(false); 9676 break; 9677 9678 case PVMFErrProcessing: 9679 // Just log the error 9680 PVPATB_TEST_IS_TRUE(false); 9681 break; 9682 9683 default: 9684 // Unknown error and just log the error 9685 PVPATB_TEST_IS_TRUE(false); 9686 break; 9687 } 9688 } 9689 9690 9691 void pvplayer_async_test_setplayrangeplay::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 9692 { 9693 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 9694 { 9695 // do nothing 9696 } 9697 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 9698 { 9699 iState = STATE_CLEANUPANDCOMPLETE; 9700 RunIfNotReady(); 9701 } 9702 // Check for stop time reached event 9703 if (aEvent.GetEventType() == PVMFInfoEndOfData) 9704 { 9705 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 9706 if (iface == NULL) 9707 { 9708 return; 9709 } 9710 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 9711 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 9712 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 9713 { 9714 int32 infocode; 9715 PVUuid infouuid; 9716 infomsgiface->GetCodeUUID(infocode, infouuid); 9717 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoEndTimeReached)) 9718 { 9719 iState = STATE_STOP; 9720 Cancel(); 9721 RunIfNotReady(); 9722 } 9723 } 9724 } 9725 } 9726 9727 9728 // 9729 // pvplayer_async_test_setplayrangevidframenumplay section 9730 // 9731 void pvplayer_async_test_setplayrangevidframenumplay::StartTest() 9732 { 9733 AddToScheduler(); 9734 iState = STATE_CREATE; 9735 RunIfNotReady(); 9736 } 9737 9738 9739 void pvplayer_async_test_setplayrangevidframenumplay::Run() 9740 { 9741 int error = 0; 9742 9743 switch (iState) 9744 { 9745 case STATE_CREATE: 9746 { 9747 iPlayer = NULL; 9748 9749 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 9750 if (error) 9751 { 9752 PVPATB_TEST_IS_TRUE(false); 9753 iObserver->TestCompleted(*iTestCase); 9754 } 9755 else 9756 { 9757 iState = STATE_ADDDATASOURCE; 9758 RunIfNotReady(); 9759 } 9760 } 9761 break; 9762 9763 case STATE_ADDDATASOURCE: 9764 { 9765 iDataSource = new PVPlayerDataSourceURL; 9766 9767 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 9768 sourcefile += _STRLIT_WCHAR("test_reposition.mp4"); 9769 iDataSource->SetDataSourceURL(sourcefile); 9770 9771 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 9772 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 9773 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9774 } 9775 break; 9776 9777 case STATE_INIT: 9778 { 9779 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 9780 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9781 } 9782 break; 9783 9784 case STATE_ADDDATASINK_VIDEO: 9785 { 9786 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 9787 sinkfile += _STRLIT_WCHAR("test_player_setplayrangevidframenumplay_video.dat"); 9788 9789 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 9790 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 9791 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 9792 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 9793 9794 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 9795 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9796 } 9797 break; 9798 9799 case STATE_ADDDATASINK_AUDIO: 9800 { 9801 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 9802 sinkfile += _STRLIT_WCHAR("test_player_setplayrangevidframenumplay_audio.dat"); 9803 9804 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 9805 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 9806 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 9807 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 9808 9809 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 9810 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9811 } 9812 break; 9813 9814 case STATE_SETPLAYBACKRANGE: 9815 { 9816 PVPPlaybackPosition start, end; 9817 start.iIndeterminate = false; 9818 start.iPosUnit = PVPPBPOSUNIT_SAMPLENUMBER; 9819 start.iMode = PVPPBPOS_MODE_NOW; 9820 start.iPosValue.samplenum_value = 100; 9821 end.iIndeterminate = false; 9822 end.iPosUnit = PVPPBPOSUNIT_MILLISEC; 9823 end.iPosValue.millisec_value = 20000; 9824 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 9825 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9826 } 9827 break; 9828 9829 case STATE_PREPARE: 9830 { 9831 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 9832 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9833 } 9834 break; 9835 9836 case STATE_START: 9837 { 9838 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 9839 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9840 } 9841 break; 9842 9843 case STATE_STOPTIMENOTREACHED: 9844 { 9845 // Timeout when player doesn't stop automatically when stop time is reached 9846 PVPATB_TEST_IS_TRUE(false); 9847 iState = STATE_CLEANUPANDCOMPLETE; 9848 RunIfNotReady(); 9849 } 9850 break; 9851 9852 case STATE_STOP: 9853 { 9854 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 9855 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9856 } 9857 break; 9858 9859 case STATE_REMOVEDATASINK_VIDEO: 9860 { 9861 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 9862 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9863 } 9864 break; 9865 9866 case STATE_REMOVEDATASINK_AUDIO: 9867 { 9868 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 9869 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9870 } 9871 break; 9872 9873 case STATE_RESET: 9874 { 9875 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 9876 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9877 } 9878 break; 9879 9880 case STATE_REMOVEDATASOURCE: 9881 { 9882 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 9883 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 9884 } 9885 break; 9886 9887 case STATE_CLEANUPANDCOMPLETE: 9888 { 9889 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 9890 iPlayer = NULL; 9891 9892 delete iDataSource; 9893 iDataSource = NULL; 9894 9895 delete iDataSinkVideo; 9896 iDataSinkVideo = NULL; 9897 9898 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 9899 iIONodeVideo = NULL; 9900 9901 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 9902 iMIOFileOutVideo = NULL; 9903 9904 delete iDataSinkAudio; 9905 iDataSinkAudio = NULL; 9906 9907 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 9908 iIONodeAudio = NULL; 9909 9910 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 9911 iMIOFileOutAudio = NULL; 9912 9913 iObserver->TestCompleted(*iTestCase); 9914 } 9915 break; 9916 9917 default: 9918 break; 9919 9920 } 9921 } 9922 9923 9924 void pvplayer_async_test_setplayrangevidframenumplay::CommandCompleted(const PVCmdResponse& aResponse) 9925 { 9926 if (aResponse.GetCmdId() != iCurrentCmdId) 9927 { 9928 // Wrong command ID. 9929 PVPATB_TEST_IS_TRUE(false); 9930 iState = STATE_CLEANUPANDCOMPLETE; 9931 RunIfNotReady(); 9932 return; 9933 } 9934 9935 if (aResponse.GetContext() != NULL) 9936 { 9937 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 9938 { 9939 if (iContextObject != iContextObjectRefValue) 9940 { 9941 // Context data value was corrupted 9942 PVPATB_TEST_IS_TRUE(false); 9943 iState = STATE_CLEANUPANDCOMPLETE; 9944 RunIfNotReady(); 9945 return; 9946 } 9947 } 9948 else 9949 { 9950 // Context data pointer was corrupted 9951 PVPATB_TEST_IS_TRUE(false); 9952 iState = STATE_CLEANUPANDCOMPLETE; 9953 RunIfNotReady(); 9954 return; 9955 } 9956 } 9957 9958 switch (iState) 9959 { 9960 case STATE_ADDDATASOURCE: 9961 if (aResponse.GetCmdStatus() == PVMFSuccess) 9962 { 9963 iState = STATE_INIT; 9964 RunIfNotReady(); 9965 } 9966 else 9967 { 9968 // AddDataSource failed 9969 PVPATB_TEST_IS_TRUE(false); 9970 iState = STATE_CLEANUPANDCOMPLETE; 9971 RunIfNotReady(); 9972 } 9973 break; 9974 9975 case STATE_INIT: 9976 if (aResponse.GetCmdStatus() == PVMFSuccess) 9977 { 9978 iState = STATE_ADDDATASINK_VIDEO; 9979 RunIfNotReady(); 9980 } 9981 else 9982 { 9983 // Init failed 9984 PVPATB_TEST_IS_TRUE(false); 9985 iState = STATE_CLEANUPANDCOMPLETE; 9986 RunIfNotReady(); 9987 } 9988 break; 9989 9990 case STATE_ADDDATASINK_VIDEO: 9991 if (aResponse.GetCmdStatus() == PVMFSuccess) 9992 { 9993 iState = STATE_ADDDATASINK_AUDIO; 9994 RunIfNotReady(); 9995 } 9996 else 9997 { 9998 // AddDataSink failed 9999 PVPATB_TEST_IS_TRUE(false); 10000 iState = STATE_CLEANUPANDCOMPLETE; 10001 RunIfNotReady(); 10002 } 10003 break; 10004 10005 case STATE_ADDDATASINK_AUDIO: 10006 if (aResponse.GetCmdStatus() == PVMFSuccess) 10007 { 10008 iState = STATE_SETPLAYBACKRANGE; 10009 RunIfNotReady(); 10010 } 10011 else 10012 { 10013 // AddDataSink failed 10014 PVPATB_TEST_IS_TRUE(false); 10015 iState = STATE_CLEANUPANDCOMPLETE; 10016 RunIfNotReady(); 10017 } 10018 break; 10019 10020 case STATE_SETPLAYBACKRANGE: 10021 if (aResponse.GetCmdStatus() == PVMFSuccess) 10022 { 10023 iState = STATE_PREPARE; 10024 RunIfNotReady(); 10025 } 10026 else 10027 { 10028 // SetPlaybackRange failed 10029 PVPATB_TEST_IS_TRUE(false); 10030 iState = STATE_CLEANUPANDCOMPLETE; 10031 RunIfNotReady(); 10032 } 10033 break; 10034 10035 case STATE_PREPARE: 10036 if (aResponse.GetCmdStatus() == PVMFSuccess) 10037 { 10038 iState = STATE_START; 10039 RunIfNotReady(); 10040 } 10041 else 10042 { 10043 // Prepare failed 10044 PVPATB_TEST_IS_TRUE(false); 10045 iState = STATE_CLEANUPANDCOMPLETE; 10046 RunIfNotReady(); 10047 } 10048 break; 10049 10050 case STATE_START: 10051 if (aResponse.GetCmdStatus() == PVMFSuccess) 10052 { 10053 iState = STATE_STOPTIMENOTREACHED; 10054 RunIfNotReady(25000000); 10055 } 10056 else 10057 { 10058 // Start failed 10059 PVPATB_TEST_IS_TRUE(false); 10060 iState = STATE_CLEANUPANDCOMPLETE; 10061 RunIfNotReady(); 10062 } 10063 break; 10064 10065 case STATE_STOP: 10066 if (aResponse.GetCmdStatus() == PVMFSuccess) 10067 { 10068 iState = STATE_REMOVEDATASINK_VIDEO; 10069 RunIfNotReady(); 10070 } 10071 else 10072 { 10073 // Stop failed 10074 PVPATB_TEST_IS_TRUE(false); 10075 iState = STATE_CLEANUPANDCOMPLETE; 10076 RunIfNotReady(); 10077 } 10078 break; 10079 10080 case STATE_REMOVEDATASINK_VIDEO: 10081 if (aResponse.GetCmdStatus() == PVMFSuccess) 10082 { 10083 iState = STATE_REMOVEDATASINK_AUDIO; 10084 RunIfNotReady(); 10085 } 10086 else 10087 { 10088 // RemoveDataSink failed 10089 PVPATB_TEST_IS_TRUE(false); 10090 iState = STATE_CLEANUPANDCOMPLETE; 10091 RunIfNotReady(); 10092 } 10093 break; 10094 10095 case STATE_REMOVEDATASINK_AUDIO: 10096 if (aResponse.GetCmdStatus() == PVMFSuccess) 10097 { 10098 iState = STATE_RESET; 10099 RunIfNotReady(); 10100 } 10101 else 10102 { 10103 // RemoveDataSink failed 10104 PVPATB_TEST_IS_TRUE(false); 10105 iState = STATE_CLEANUPANDCOMPLETE; 10106 RunIfNotReady(); 10107 } 10108 break; 10109 10110 case STATE_RESET: 10111 if (aResponse.GetCmdStatus() == PVMFSuccess) 10112 { 10113 iState = STATE_REMOVEDATASOURCE; 10114 RunIfNotReady(); 10115 } 10116 else 10117 { 10118 // Reset failed 10119 PVPATB_TEST_IS_TRUE(false); 10120 iState = STATE_CLEANUPANDCOMPLETE; 10121 RunIfNotReady(); 10122 } 10123 break; 10124 10125 case STATE_REMOVEDATASOURCE: 10126 if (aResponse.GetCmdStatus() == PVMFSuccess) 10127 { 10128 PVPATB_TEST_IS_TRUE(true); 10129 iState = STATE_CLEANUPANDCOMPLETE; 10130 RunIfNotReady(); 10131 } 10132 else 10133 { 10134 // RemoveDataSource failed 10135 PVPATB_TEST_IS_TRUE(false); 10136 iState = STATE_CLEANUPANDCOMPLETE; 10137 RunIfNotReady(); 10138 } 10139 break; 10140 10141 default: 10142 { 10143 // Testing error if this is reached 10144 PVPATB_TEST_IS_TRUE(false); 10145 iState = STATE_CLEANUPANDCOMPLETE; 10146 RunIfNotReady(); 10147 } 10148 break; 10149 } 10150 } 10151 10152 10153 void pvplayer_async_test_setplayrangevidframenumplay::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 10154 { 10155 switch (aEvent.GetEventType()) 10156 { 10157 case PVMFErrResourceConfiguration: 10158 // Just log the error 10159 PVPATB_TEST_IS_TRUE(false); 10160 break; 10161 10162 case PVMFErrResource: 10163 // Just log the error 10164 PVPATB_TEST_IS_TRUE(false); 10165 break; 10166 10167 case PVMFErrCorrupt: 10168 // Just log the error 10169 PVPATB_TEST_IS_TRUE(false); 10170 break; 10171 10172 case PVMFErrProcessing: 10173 // Just log the error 10174 PVPATB_TEST_IS_TRUE(false); 10175 break; 10176 10177 default: 10178 // Unknown error and just log the error 10179 PVPATB_TEST_IS_TRUE(false); 10180 break; 10181 } 10182 } 10183 10184 10185 void pvplayer_async_test_setplayrangevidframenumplay::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 10186 { 10187 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 10188 { 10189 // do nothing 10190 } 10191 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 10192 { 10193 iState = STATE_CLEANUPANDCOMPLETE; 10194 RunIfNotReady(); 10195 } 10196 // Check for stop time reached event 10197 if (aEvent.GetEventType() == PVMFInfoEndOfData) 10198 { 10199 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 10200 if (iface == NULL) 10201 { 10202 return; 10203 } 10204 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 10205 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 10206 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 10207 { 10208 int32 infocode; 10209 PVUuid infouuid; 10210 infomsgiface->GetCodeUUID(infocode, infouuid); 10211 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoEndTimeReached)) 10212 { 10213 iState = STATE_STOP; 10214 Cancel(); 10215 RunIfNotReady(); 10216 } 10217 } 10218 } 10219 } 10220 10221 10222 // 10223 // pvplayer_async_test_playsetplayrangestop section 10224 // 10225 void pvplayer_async_test_playsetplayrangestop::StartTest() 10226 { 10227 AddToScheduler(); 10228 iState = STATE_CREATE; 10229 RunIfNotReady(); 10230 } 10231 10232 10233 void pvplayer_async_test_playsetplayrangestop::Run() 10234 { 10235 int error = 0; 10236 10237 switch (iState) 10238 { 10239 case STATE_CREATE: 10240 { 10241 iPlayer = NULL; 10242 10243 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 10244 if (error) 10245 { 10246 PVPATB_TEST_IS_TRUE(false); 10247 iObserver->TestCompleted(*iTestCase); 10248 } 10249 else 10250 { 10251 iState = STATE_ADDDATASOURCE; 10252 RunIfNotReady(); 10253 } 10254 } 10255 break; 10256 10257 case STATE_ADDDATASOURCE: 10258 { 10259 iDataSource = new PVPlayerDataSourceURL; 10260 10261 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 10262 sourcefile += _STRLIT_WCHAR("test_reposition.mp4"); 10263 iDataSource->SetDataSourceURL(sourcefile); 10264 10265 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 10266 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 10267 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10268 } 10269 break; 10270 10271 case STATE_INIT: 10272 { 10273 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 10274 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10275 } 10276 break; 10277 10278 case STATE_ADDDATASINK_VIDEO: 10279 { 10280 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 10281 sinkfile += _STRLIT_WCHAR("test_player_playsetplayrangestop_video.dat"); 10282 10283 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 10284 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 10285 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 10286 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 10287 10288 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 10289 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10290 } 10291 break; 10292 10293 case STATE_ADDDATASINK_AUDIO: 10294 { 10295 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 10296 sinkfile += _STRLIT_WCHAR("test_player_playsetplayrangestop_audio.dat"); 10297 10298 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 10299 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 10300 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 10301 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 10302 10303 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 10304 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10305 } 10306 break; 10307 10308 case STATE_PREPARE: 10309 { 10310 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 10311 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10312 } 10313 break; 10314 10315 case STATE_START: 10316 { 10317 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 10318 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10319 } 10320 break; 10321 10322 case STATE_SETPLAYBACKRANGE: 10323 { 10324 PVPPlaybackPosition start, end; 10325 start.iIndeterminate = false; 10326 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 10327 start.iMode = PVPPBPOS_MODE_NOW; 10328 start.iPosValue.millisec_value = 20000; 10329 end.iIndeterminate = true; 10330 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 10331 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10332 } 10333 break; 10334 10335 case STATE_STOP: 10336 { 10337 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 10338 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10339 } 10340 break; 10341 10342 case STATE_REMOVEDATASINK_VIDEO: 10343 { 10344 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 10345 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10346 } 10347 break; 10348 10349 case STATE_REMOVEDATASINK_AUDIO: 10350 { 10351 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 10352 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10353 } 10354 break; 10355 10356 case STATE_RESET: 10357 { 10358 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 10359 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10360 } 10361 break; 10362 10363 case STATE_REMOVEDATASOURCE: 10364 { 10365 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 10366 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10367 } 10368 break; 10369 10370 case STATE_CLEANUPANDCOMPLETE: 10371 { 10372 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 10373 iPlayer = NULL; 10374 10375 delete iDataSource; 10376 iDataSource = NULL; 10377 10378 delete iDataSinkVideo; 10379 iDataSinkVideo = NULL; 10380 10381 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 10382 iIONodeVideo = NULL; 10383 10384 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 10385 iMIOFileOutVideo = NULL; 10386 10387 delete iDataSinkAudio; 10388 iDataSinkAudio = NULL; 10389 10390 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 10391 iIONodeAudio = NULL; 10392 10393 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 10394 iMIOFileOutAudio = NULL; 10395 10396 iObserver->TestCompleted(*iTestCase); 10397 } 10398 break; 10399 10400 default: 10401 break; 10402 10403 } 10404 } 10405 10406 10407 void pvplayer_async_test_playsetplayrangestop::CommandCompleted(const PVCmdResponse& aResponse) 10408 { 10409 if (aResponse.GetCmdId() != iCurrentCmdId) 10410 { 10411 // Wrong command ID. 10412 PVPATB_TEST_IS_TRUE(false); 10413 iState = STATE_CLEANUPANDCOMPLETE; 10414 RunIfNotReady(); 10415 return; 10416 } 10417 10418 if (aResponse.GetContext() != NULL) 10419 { 10420 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 10421 { 10422 if (iContextObject != iContextObjectRefValue) 10423 { 10424 // Context data value was corrupted 10425 PVPATB_TEST_IS_TRUE(false); 10426 iState = STATE_CLEANUPANDCOMPLETE; 10427 RunIfNotReady(); 10428 return; 10429 } 10430 } 10431 else 10432 { 10433 // Context data pointer was corrupted 10434 PVPATB_TEST_IS_TRUE(false); 10435 iState = STATE_CLEANUPANDCOMPLETE; 10436 RunIfNotReady(); 10437 return; 10438 } 10439 } 10440 10441 switch (iState) 10442 { 10443 case STATE_ADDDATASOURCE: 10444 if (aResponse.GetCmdStatus() == PVMFSuccess) 10445 { 10446 iState = STATE_INIT; 10447 RunIfNotReady(); 10448 } 10449 else 10450 { 10451 // AddDataSource failed 10452 PVPATB_TEST_IS_TRUE(false); 10453 iState = STATE_CLEANUPANDCOMPLETE; 10454 RunIfNotReady(); 10455 } 10456 break; 10457 10458 case STATE_INIT: 10459 if (aResponse.GetCmdStatus() == PVMFSuccess) 10460 { 10461 iState = STATE_ADDDATASINK_VIDEO; 10462 RunIfNotReady(); 10463 } 10464 else 10465 { 10466 // Init failed 10467 PVPATB_TEST_IS_TRUE(false); 10468 iState = STATE_CLEANUPANDCOMPLETE; 10469 RunIfNotReady(); 10470 } 10471 break; 10472 10473 case STATE_ADDDATASINK_VIDEO: 10474 if (aResponse.GetCmdStatus() == PVMFSuccess) 10475 { 10476 iState = STATE_ADDDATASINK_AUDIO; 10477 RunIfNotReady(); 10478 } 10479 else 10480 { 10481 // AddDataSink failed 10482 PVPATB_TEST_IS_TRUE(false); 10483 iState = STATE_CLEANUPANDCOMPLETE; 10484 RunIfNotReady(); 10485 } 10486 break; 10487 10488 case STATE_ADDDATASINK_AUDIO: 10489 if (aResponse.GetCmdStatus() == PVMFSuccess) 10490 { 10491 iState = STATE_PREPARE; 10492 RunIfNotReady(); 10493 } 10494 else 10495 { 10496 // AddDataSink failed 10497 PVPATB_TEST_IS_TRUE(false); 10498 iState = STATE_CLEANUPANDCOMPLETE; 10499 RunIfNotReady(); 10500 } 10501 break; 10502 10503 case STATE_PREPARE: 10504 if (aResponse.GetCmdStatus() == PVMFSuccess) 10505 { 10506 iState = STATE_START; 10507 RunIfNotReady(); 10508 } 10509 else 10510 { 10511 // Prepare failed 10512 PVPATB_TEST_IS_TRUE(false); 10513 iState = STATE_CLEANUPANDCOMPLETE; 10514 RunIfNotReady(); 10515 } 10516 break; 10517 10518 case STATE_START: 10519 if (aResponse.GetCmdStatus() == PVMFSuccess) 10520 { 10521 iState = STATE_SETPLAYBACKRANGE; 10522 RunIfNotReady(10000000); 10523 } 10524 else 10525 { 10526 // Start failed 10527 PVPATB_TEST_IS_TRUE(false); 10528 iState = STATE_CLEANUPANDCOMPLETE; 10529 RunIfNotReady(); 10530 } 10531 break; 10532 10533 case STATE_SETPLAYBACKRANGE: 10534 if (aResponse.GetCmdStatus() == PVMFSuccess) 10535 { 10536 iState = STATE_STOP; 10537 RunIfNotReady(10000000); 10538 } 10539 else 10540 { 10541 // SetPlaybackRange failed 10542 PVPATB_TEST_IS_TRUE(false); 10543 iState = STATE_CLEANUPANDCOMPLETE; 10544 RunIfNotReady(); 10545 } 10546 break; 10547 10548 case STATE_STOP: 10549 if (aResponse.GetCmdStatus() == PVMFSuccess) 10550 { 10551 iState = STATE_REMOVEDATASINK_VIDEO; 10552 RunIfNotReady(); 10553 } 10554 else 10555 { 10556 // Stop failed 10557 PVPATB_TEST_IS_TRUE(false); 10558 iState = STATE_CLEANUPANDCOMPLETE; 10559 RunIfNotReady(); 10560 } 10561 break; 10562 break; 10563 10564 case STATE_REMOVEDATASINK_VIDEO: 10565 if (aResponse.GetCmdStatus() == PVMFSuccess) 10566 { 10567 iState = STATE_REMOVEDATASINK_AUDIO; 10568 RunIfNotReady(); 10569 } 10570 else 10571 { 10572 // RemoveDataSink failed 10573 PVPATB_TEST_IS_TRUE(false); 10574 iState = STATE_CLEANUPANDCOMPLETE; 10575 RunIfNotReady(); 10576 } 10577 break; 10578 10579 case STATE_REMOVEDATASINK_AUDIO: 10580 if (aResponse.GetCmdStatus() == PVMFSuccess) 10581 { 10582 iState = STATE_RESET; 10583 RunIfNotReady(); 10584 } 10585 else 10586 { 10587 // RemoveDataSink failed 10588 PVPATB_TEST_IS_TRUE(false); 10589 iState = STATE_CLEANUPANDCOMPLETE; 10590 RunIfNotReady(); 10591 } 10592 break; 10593 10594 case STATE_RESET: 10595 if (aResponse.GetCmdStatus() == PVMFSuccess) 10596 { 10597 iState = STATE_REMOVEDATASOURCE; 10598 RunIfNotReady(); 10599 } 10600 else 10601 { 10602 // Reset failed 10603 PVPATB_TEST_IS_TRUE(false); 10604 iState = STATE_CLEANUPANDCOMPLETE; 10605 RunIfNotReady(); 10606 } 10607 break; 10608 10609 case STATE_REMOVEDATASOURCE: 10610 if (aResponse.GetCmdStatus() == PVMFSuccess) 10611 { 10612 PVPATB_TEST_IS_TRUE(true); 10613 iState = STATE_CLEANUPANDCOMPLETE; 10614 RunIfNotReady(); 10615 } 10616 else 10617 { 10618 // RemoveDataSource failed 10619 PVPATB_TEST_IS_TRUE(false); 10620 iState = STATE_CLEANUPANDCOMPLETE; 10621 RunIfNotReady(); 10622 } 10623 break; 10624 10625 default: 10626 { 10627 // Testing error if this is reached 10628 PVPATB_TEST_IS_TRUE(false); 10629 iState = STATE_CLEANUPANDCOMPLETE; 10630 RunIfNotReady(); 10631 } 10632 break; 10633 } 10634 } 10635 10636 10637 void pvplayer_async_test_playsetplayrangestop::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 10638 { 10639 switch (aEvent.GetEventType()) 10640 { 10641 case PVMFErrResourceConfiguration: 10642 // Just log the error 10643 PVPATB_TEST_IS_TRUE(false); 10644 break; 10645 10646 case PVMFErrResource: 10647 // Just log the error 10648 PVPATB_TEST_IS_TRUE(false); 10649 break; 10650 10651 case PVMFErrCorrupt: 10652 // Just log the error 10653 PVPATB_TEST_IS_TRUE(false); 10654 break; 10655 10656 case PVMFErrProcessing: 10657 // Just log the error 10658 PVPATB_TEST_IS_TRUE(false); 10659 break; 10660 10661 default: 10662 // Unknown error and just log the error 10663 PVPATB_TEST_IS_TRUE(false); 10664 break; 10665 } 10666 } 10667 10668 10669 void pvplayer_async_test_playsetplayrangestop::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 10670 { 10671 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 10672 { 10673 // do nothing 10674 } 10675 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 10676 { 10677 iState = STATE_CLEANUPANDCOMPLETE; 10678 RunIfNotReady(); 10679 } 10680 } 10681 10682 10683 10684 // 10685 // pvplayer_async_test_playsetplayrangevidframenumstop section 10686 // 10687 void pvplayer_async_test_playsetplayrangevidframenumstop::StartTest() 10688 { 10689 AddToScheduler(); 10690 iState = STATE_CREATE; 10691 RunIfNotReady(); 10692 } 10693 10694 10695 void pvplayer_async_test_playsetplayrangevidframenumstop::Run() 10696 { 10697 int error = 0; 10698 10699 switch (iState) 10700 { 10701 case STATE_CREATE: 10702 { 10703 iPlayer = NULL; 10704 10705 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 10706 if (error) 10707 { 10708 PVPATB_TEST_IS_TRUE(false); 10709 iObserver->TestCompleted(*iTestCase); 10710 } 10711 else 10712 { 10713 iState = STATE_ADDDATASOURCE; 10714 RunIfNotReady(); 10715 } 10716 } 10717 break; 10718 10719 case STATE_ADDDATASOURCE: 10720 { 10721 iDataSource = new PVPlayerDataSourceURL; 10722 10723 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 10724 sourcefile += _STRLIT_WCHAR("test_reposition.mp4"); 10725 iDataSource->SetDataSourceURL(sourcefile); 10726 10727 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 10728 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 10729 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10730 } 10731 break; 10732 10733 case STATE_INIT: 10734 { 10735 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 10736 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10737 } 10738 break; 10739 10740 case STATE_ADDDATASINK_VIDEO: 10741 { 10742 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 10743 sinkfile += _STRLIT_WCHAR("test_player_playsetplayrangevidframenumstop_video.dat"); 10744 10745 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 10746 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 10747 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 10748 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 10749 10750 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 10751 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10752 } 10753 break; 10754 10755 case STATE_ADDDATASINK_AUDIO: 10756 { 10757 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 10758 sinkfile += _STRLIT_WCHAR("test_player_playsetplayrangevidframenumstop_audio.dat"); 10759 10760 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 10761 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 10762 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 10763 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 10764 10765 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 10766 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10767 } 10768 break; 10769 10770 case STATE_PREPARE: 10771 { 10772 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 10773 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10774 } 10775 break; 10776 10777 case STATE_START: 10778 { 10779 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 10780 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10781 } 10782 break; 10783 10784 case STATE_SETPLAYBACKRANGE: 10785 { 10786 PVPPlaybackPosition start, end; 10787 start.iIndeterminate = false; 10788 start.iPosUnit = PVPPBPOSUNIT_SAMPLENUMBER; 10789 start.iMode = PVPPBPOS_MODE_NOW; 10790 start.iPosValue.samplenum_value = 100; 10791 end.iIndeterminate = true; 10792 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 10793 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10794 } 10795 break; 10796 10797 case STATE_STOP: 10798 { 10799 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 10800 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10801 } 10802 break; 10803 10804 case STATE_REMOVEDATASINK_VIDEO: 10805 { 10806 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 10807 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10808 } 10809 break; 10810 10811 case STATE_REMOVEDATASINK_AUDIO: 10812 { 10813 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 10814 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10815 } 10816 break; 10817 10818 case STATE_RESET: 10819 { 10820 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 10821 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10822 } 10823 break; 10824 10825 case STATE_REMOVEDATASOURCE: 10826 { 10827 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 10828 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 10829 } 10830 break; 10831 10832 case STATE_CLEANUPANDCOMPLETE: 10833 { 10834 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 10835 iPlayer = NULL; 10836 10837 delete iDataSource; 10838 iDataSource = NULL; 10839 10840 delete iDataSinkVideo; 10841 iDataSinkVideo = NULL; 10842 10843 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 10844 iIONodeVideo = NULL; 10845 10846 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 10847 iMIOFileOutVideo = NULL; 10848 10849 delete iDataSinkAudio; 10850 iDataSinkAudio = NULL; 10851 10852 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 10853 iIONodeAudio = NULL; 10854 10855 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 10856 iMIOFileOutAudio = NULL; 10857 10858 iObserver->TestCompleted(*iTestCase); 10859 } 10860 break; 10861 10862 default: 10863 break; 10864 10865 } 10866 } 10867 10868 10869 void pvplayer_async_test_playsetplayrangevidframenumstop::CommandCompleted(const PVCmdResponse& aResponse) 10870 { 10871 if (aResponse.GetCmdId() != iCurrentCmdId) 10872 { 10873 // Wrong command ID. 10874 PVPATB_TEST_IS_TRUE(false); 10875 iState = STATE_CLEANUPANDCOMPLETE; 10876 RunIfNotReady(); 10877 return; 10878 } 10879 10880 if (aResponse.GetContext() != NULL) 10881 { 10882 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 10883 { 10884 if (iContextObject != iContextObjectRefValue) 10885 { 10886 // Context data value was corrupted 10887 PVPATB_TEST_IS_TRUE(false); 10888 iState = STATE_CLEANUPANDCOMPLETE; 10889 RunIfNotReady(); 10890 return; 10891 } 10892 } 10893 else 10894 { 10895 // Context data pointer was corrupted 10896 PVPATB_TEST_IS_TRUE(false); 10897 iState = STATE_CLEANUPANDCOMPLETE; 10898 RunIfNotReady(); 10899 return; 10900 } 10901 } 10902 10903 switch (iState) 10904 { 10905 case STATE_ADDDATASOURCE: 10906 if (aResponse.GetCmdStatus() == PVMFSuccess) 10907 { 10908 iState = STATE_INIT; 10909 RunIfNotReady(); 10910 } 10911 else 10912 { 10913 // AddDataSource failed 10914 PVPATB_TEST_IS_TRUE(false); 10915 iState = STATE_CLEANUPANDCOMPLETE; 10916 RunIfNotReady(); 10917 } 10918 break; 10919 10920 case STATE_INIT: 10921 if (aResponse.GetCmdStatus() == PVMFSuccess) 10922 { 10923 iState = STATE_ADDDATASINK_VIDEO; 10924 RunIfNotReady(); 10925 } 10926 else 10927 { 10928 // Init failed 10929 PVPATB_TEST_IS_TRUE(false); 10930 iState = STATE_CLEANUPANDCOMPLETE; 10931 RunIfNotReady(); 10932 } 10933 break; 10934 10935 case STATE_ADDDATASINK_VIDEO: 10936 if (aResponse.GetCmdStatus() == PVMFSuccess) 10937 { 10938 iState = STATE_ADDDATASINK_AUDIO; 10939 RunIfNotReady(); 10940 } 10941 else 10942 { 10943 // AddDataSink failed 10944 PVPATB_TEST_IS_TRUE(false); 10945 iState = STATE_CLEANUPANDCOMPLETE; 10946 RunIfNotReady(); 10947 } 10948 break; 10949 10950 case STATE_ADDDATASINK_AUDIO: 10951 if (aResponse.GetCmdStatus() == PVMFSuccess) 10952 { 10953 iState = STATE_PREPARE; 10954 RunIfNotReady(); 10955 } 10956 else 10957 { 10958 // AddDataSink failed 10959 PVPATB_TEST_IS_TRUE(false); 10960 iState = STATE_CLEANUPANDCOMPLETE; 10961 RunIfNotReady(); 10962 } 10963 break; 10964 10965 case STATE_PREPARE: 10966 if (aResponse.GetCmdStatus() == PVMFSuccess) 10967 { 10968 iState = STATE_START; 10969 RunIfNotReady(); 10970 } 10971 else 10972 { 10973 // Prepare failed 10974 PVPATB_TEST_IS_TRUE(false); 10975 iState = STATE_CLEANUPANDCOMPLETE; 10976 RunIfNotReady(); 10977 } 10978 break; 10979 10980 case STATE_START: 10981 if (aResponse.GetCmdStatus() == PVMFSuccess) 10982 { 10983 iState = STATE_SETPLAYBACKRANGE; 10984 RunIfNotReady(10000000); 10985 } 10986 else 10987 { 10988 // Start failed 10989 PVPATB_TEST_IS_TRUE(false); 10990 iState = STATE_CLEANUPANDCOMPLETE; 10991 RunIfNotReady(); 10992 } 10993 break; 10994 10995 case STATE_SETPLAYBACKRANGE: 10996 if (aResponse.GetCmdStatus() == PVMFSuccess) 10997 { 10998 iState = STATE_STOP; 10999 RunIfNotReady(10000000); 11000 } 11001 else 11002 { 11003 // SetPlaybackRange failed 11004 PVPATB_TEST_IS_TRUE(false); 11005 iState = STATE_CLEANUPANDCOMPLETE; 11006 RunIfNotReady(); 11007 } 11008 break; 11009 11010 case STATE_STOP: 11011 if (aResponse.GetCmdStatus() == PVMFSuccess) 11012 { 11013 iState = STATE_REMOVEDATASINK_VIDEO; 11014 RunIfNotReady(); 11015 } 11016 else 11017 { 11018 // Stop failed 11019 PVPATB_TEST_IS_TRUE(false); 11020 iState = STATE_CLEANUPANDCOMPLETE; 11021 RunIfNotReady(); 11022 } 11023 break; 11024 break; 11025 11026 case STATE_REMOVEDATASINK_VIDEO: 11027 if (aResponse.GetCmdStatus() == PVMFSuccess) 11028 { 11029 iState = STATE_REMOVEDATASINK_AUDIO; 11030 RunIfNotReady(); 11031 } 11032 else 11033 { 11034 // RemoveDataSink failed 11035 PVPATB_TEST_IS_TRUE(false); 11036 iState = STATE_CLEANUPANDCOMPLETE; 11037 RunIfNotReady(); 11038 } 11039 break; 11040 11041 case STATE_REMOVEDATASINK_AUDIO: 11042 if (aResponse.GetCmdStatus() == PVMFSuccess) 11043 { 11044 iState = STATE_RESET; 11045 RunIfNotReady(); 11046 } 11047 else 11048 { 11049 // RemoveDataSink failed 11050 PVPATB_TEST_IS_TRUE(false); 11051 iState = STATE_CLEANUPANDCOMPLETE; 11052 RunIfNotReady(); 11053 } 11054 break; 11055 11056 case STATE_RESET: 11057 if (aResponse.GetCmdStatus() == PVMFSuccess) 11058 { 11059 iState = STATE_REMOVEDATASOURCE; 11060 RunIfNotReady(); 11061 } 11062 else 11063 { 11064 // Reset failed 11065 PVPATB_TEST_IS_TRUE(false); 11066 iState = STATE_CLEANUPANDCOMPLETE; 11067 RunIfNotReady(); 11068 } 11069 break; 11070 11071 case STATE_REMOVEDATASOURCE: 11072 if (aResponse.GetCmdStatus() == PVMFSuccess) 11073 { 11074 PVPATB_TEST_IS_TRUE(true); 11075 iState = STATE_CLEANUPANDCOMPLETE; 11076 RunIfNotReady(); 11077 } 11078 else 11079 { 11080 // RemoveDataSource failed 11081 PVPATB_TEST_IS_TRUE(false); 11082 iState = STATE_CLEANUPANDCOMPLETE; 11083 RunIfNotReady(); 11084 } 11085 break; 11086 11087 default: 11088 { 11089 // Testing error if this is reached 11090 PVPATB_TEST_IS_TRUE(false); 11091 iState = STATE_CLEANUPANDCOMPLETE; 11092 RunIfNotReady(); 11093 } 11094 break; 11095 } 11096 } 11097 11098 11099 void pvplayer_async_test_playsetplayrangevidframenumstop::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 11100 { 11101 switch (aEvent.GetEventType()) 11102 { 11103 case PVMFErrResourceConfiguration: 11104 // Just log the error 11105 PVPATB_TEST_IS_TRUE(false); 11106 break; 11107 11108 case PVMFErrResource: 11109 // Just log the error 11110 PVPATB_TEST_IS_TRUE(false); 11111 break; 11112 11113 case PVMFErrCorrupt: 11114 // Just log the error 11115 PVPATB_TEST_IS_TRUE(false); 11116 break; 11117 11118 case PVMFErrProcessing: 11119 // Just log the error 11120 PVPATB_TEST_IS_TRUE(false); 11121 break; 11122 11123 default: 11124 // Unknown error and just log the error 11125 PVPATB_TEST_IS_TRUE(false); 11126 break; 11127 } 11128 } 11129 11130 11131 void pvplayer_async_test_playsetplayrangevidframenumstop::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 11132 { 11133 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 11134 { 11135 // do nothing 11136 } 11137 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 11138 { 11139 iState = STATE_CLEANUPANDCOMPLETE; 11140 RunIfNotReady(); 11141 } 11142 } 11143 11144 11145 // 11146 // pvplayer_async_test_tracklevelinfo section 11147 // 11148 void pvplayer_async_test_tracklevelinfo::StartTest() 11149 { 11150 AddToScheduler(); 11151 iState = STATE_CREATE; 11152 RunIfNotReady(); 11153 } 11154 11155 11156 void pvplayer_async_test_tracklevelinfo::Run() 11157 { 11158 int error = 0; 11159 11160 switch (iState) 11161 { 11162 case STATE_CREATE: 11163 { 11164 iPlayer = NULL; 11165 11166 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 11167 if (error) 11168 { 11169 PVPATB_TEST_IS_TRUE(false); 11170 iObserver->TestCompleted(*iTestCase); 11171 } 11172 else 11173 { 11174 iState = STATE_INVALIDQUERYINTERFACE1; 11175 RunIfNotReady(); 11176 } 11177 } 11178 break; 11179 11180 case STATE_INVALIDQUERYINTERFACE1: 11181 { 11182 PVUuid tracklevelinfouuid = PVMF_TRACK_LEVEL_INFO_INTERFACE_UUID; 11183 OSCL_TRY(error, iCurrentCmdId = iPlayer->QueryInterface(tracklevelinfouuid, (PVInterface*&)iTrackLevelInfoIF, (OsclAny*) & iContextObject)); 11184 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11185 } 11186 break; 11187 11188 case STATE_ADDDATASOURCE: 11189 { 11190 iDataSource = new PVPlayerDataSourceURL; 11191 11192 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 512); 11193 wFileName.set(output, oscl_strlen(output)); 11194 iDataSource->SetDataSourceURL(wFileName); 11195 11196 iDataSource->SetDataSourceFormatType(iFileType); 11197 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 11198 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11199 } 11200 11201 break; 11202 11203 case STATE_INIT: 11204 { 11205 11206 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 11207 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11208 } 11209 break; 11210 11211 case STATE_ADDDATASINK_VIDEO: 11212 { 11213 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 11214 sinkfile += _STRLIT_WCHAR("test_player_tracklevelinfo_video.dat"); 11215 11216 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 11217 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 11218 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 11219 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 11220 11221 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 11222 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11223 } 11224 break; 11225 11226 case STATE_ADDDATASINK_AUDIO: 11227 { 11228 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 11229 sinkfile += _STRLIT_WCHAR("test_player_tracklevelinfo_audio.dat"); 11230 11231 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 11232 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 11233 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 11234 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 11235 11236 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 11237 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11238 } 11239 break; 11240 11241 case STATE_PREPARE: 11242 { 11243 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 11244 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11245 } 11246 break; 11247 11248 case STATE_START: 11249 { 11250 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 11251 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11252 } 11253 break; 11254 11255 case STATE_QUERYINTERFACE: 11256 { 11257 PVUuid tracklevelinfouuid = PVMF_TRACK_LEVEL_INFO_INTERFACE_UUID; 11258 OSCL_TRY(error, iCurrentCmdId = iPlayer->QueryInterface(tracklevelinfouuid, (PVInterface*&)iTrackLevelInfoIF, (OsclAny*) & iContextObject)); 11259 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11260 } 11261 break; 11262 11263 case STATE_TRACKLEVELINFOTEST: 11264 { 11265 Oscl_Vector<PVMFTrackInfo, OsclMemAllocator> availabletracks; 11266 if (iTrackLevelInfoIF->GetAvailableTracks(availabletracks) != PVMFSuccess) 11267 { 11268 PVPATB_TEST_IS_TRUE(false); 11269 iState = STATE_CLEANUPANDCOMPLETE; 11270 RunIfNotReady(); 11271 break; 11272 } 11273 11274 uint32 audioTrackID[MAX_AUDIO_TRACKS]; 11275 uint32 videoTrackID[MAX_VIDEO_TRACKS]; 11276 11277 oscl_memset(audioTrackID, '\0', MAX_AUDIO_TRACKS); 11278 oscl_memset(videoTrackID, '\0', MAX_VIDEO_TRACKS); 11279 11280 uint32 audioTrackCnt = 0; 11281 uint32 videoTrackCnt = 0; 11282 11283 for (uint32 i = 0; i < availabletracks.size(); ++i) 11284 { 11285 PVMFFormatType Format = availabletracks[i].getTrackMimeType().get_str(); 11286 if (Format.isAudio()) 11287 { 11288 audioTrackID[audioTrackCnt++] = i; 11289 } 11290 else if (Format.isVideo() || Format.isImage()) 11291 { 11292 videoTrackID[videoTrackCnt++] = i; 11293 } 11294 } 11295 11296 // Check the video track info 11297 PVMFTimestamp samplets = 0; 11298 uint32 samplenum = 0; 11299 int32 numsyncsamples = 0; 11300 PVMFSampleNumTSList syncnumtslist; 11301 11302 // There is reason to fail the test case just 'cos a clip doesnt have audio or video. 11303 // Below loops of getting audio or video sample info will not be executed anyways if videoTrackCnt or audioTrackCnt are 0. 11304 11305 for (uint32 j = 0; j < videoTrackCnt; j++) 11306 { 11307 uint32 tempID = videoTrackID[j]; 11308 if (iTrackLevelInfoIF->GetNumberOfSyncSamples(availabletracks[tempID], numsyncsamples) != PVMFSuccess) 11309 { 11310 PVPATB_TEST_IS_TRUE(false); 11311 } 11312 else 11313 { 11314 // Check the number of sync samples 11315 if (!(oscl_strcmp(iFileName, "test_tracklevelinfo.mp4"))) 11316 PVPATB_TEST_IS_TRUE(numsyncsamples == 6); 11317 } 11318 11319 int32 aTargetTimeInMS = 35000; 11320 int32 EndIdx = 2; 11321 uint32 howManySamples = 2, startIdx = 3; 11322 if (iTrackLevelInfoIF->GetSyncSampleInfo(syncnumtslist, availabletracks[tempID], aTargetTimeInMS, howManySamples) != PVMFSuccess) 11323 { 11324 PVPATB_TEST_IS_TRUE(false); 11325 } 11326 11327 if (iTrackLevelInfoIF->GetSyncSampleInfo(availabletracks[tempID], syncnumtslist, startIdx, EndIdx) != PVMFSuccess) 11328 { 11329 PVPATB_TEST_IS_TRUE(false); 11330 } 11331 else 11332 { 11333 // Check the returned info on sync samples 11334 if (!(oscl_strcmp(iFileName, "test_tracklevelinfo.mp4"))) 11335 { 11336 PVPATB_TEST_IS_TRUE(syncnumtslist[0].iSampleNumber == 256); 11337 PVPATB_TEST_IS_TRUE(syncnumtslist[0].iTimestamp == 22250); 11338 PVPATB_TEST_IS_TRUE(syncnumtslist[1].iSampleNumber == 331); 11339 PVPATB_TEST_IS_TRUE(syncnumtslist[1].iTimestamp == 32333); 11340 } 11341 } 11342 11343 if (!(oscl_strcmp(iFileName, "test_tracklevelinfo.mp4"))) 11344 { 11345 PVMFTimestamp samplets = 0; 11346 if (iTrackLevelInfoIF->GetTimestampForSampleNumber(availabletracks[tempID], 100, samplets) != PVMFSuccess) 11347 { 11348 PVPATB_TEST_IS_TRUE(false); 11349 } 11350 else 11351 { 11352 PVPATB_TEST_IS_TRUE(samplets == 8416); 11353 } 11354 11355 samplets = 0; 11356 if (iTrackLevelInfoIF->GetTimestampForSampleNumber(availabletracks[tempID], 361, samplets) != PVMFSuccess) 11357 { 11358 PVPATB_TEST_IS_TRUE(false); 11359 } 11360 else 11361 { 11362 PVPATB_TEST_IS_TRUE(samplets == 36166); 11363 } 11364 11365 samplets = 0; 11366 if (iTrackLevelInfoIF->GetTimestampForSampleNumber(availabletracks[tempID], 600, samplets) != PVMFSuccess) 11367 { 11368 PVPATB_TEST_IS_TRUE(true); 11369 } 11370 else 11371 { 11372 // Beyond the last sample so the call should fail 11373 PVPATB_TEST_IS_TRUE(false); 11374 } 11375 11376 uint32 samplenum = 0; 11377 if (iTrackLevelInfoIF->GetSampleNumberForTimestamp(availabletracks[tempID], 5700, samplenum) != PVMFSuccess) 11378 { 11379 PVPATB_TEST_IS_TRUE(false); 11380 } 11381 else 11382 { 11383 PVPATB_TEST_IS_TRUE(samplenum == 67); 11384 } 11385 11386 samplenum = 0; 11387 if (iTrackLevelInfoIF->GetSampleNumberForTimestamp(availabletracks[tempID], 12000, samplenum) != PVMFSuccess) 11388 { 11389 PVPATB_TEST_IS_TRUE(false); 11390 } 11391 else 11392 { 11393 PVPATB_TEST_IS_TRUE(samplenum == 143); 11394 } 11395 11396 samplenum = 0; 11397 if (iTrackLevelInfoIF->GetSampleNumberForTimestamp(availabletracks[tempID], 45000, samplenum) != PVMFSuccess) 11398 { 11399 PVPATB_TEST_IS_TRUE(false); 11400 } 11401 else 11402 { 11403 // Beyond the duration of track so sample number should be the (last sample+1) 11404 PVPATB_TEST_IS_TRUE(samplenum == 409); 11405 } 11406 } 11407 } 11408 11409 for (uint32 k = 0; k < audioTrackCnt; k++) 11410 { 11411 // Check the audio track info 11412 numsyncsamples = 0; 11413 uint32 tempID = audioTrackID[k]; 11414 11415 if (!(oscl_strcmp(iFileName, "test_tracklevelinfo.mp4"))) 11416 { 11417 samplets = 0; 11418 if (iTrackLevelInfoIF->GetTimestampForSampleNumber(availabletracks[tempID], 33, samplets) != PVMFSuccess) 11419 { 11420 PVPATB_TEST_IS_TRUE(false); 11421 } 11422 else 11423 { 11424 PVPATB_TEST_IS_TRUE(samplets == 660); 11425 } 11426 11427 samplets = 0; 11428 if (iTrackLevelInfoIF->GetTimestampForSampleNumber(availabletracks[tempID], 1483, samplets) != PVMFSuccess) 11429 { 11430 PVPATB_TEST_IS_TRUE(false); 11431 } 11432 else 11433 { 11434 PVPATB_TEST_IS_TRUE(samplets == 29660); 11435 } 11436 11437 samplets = 0; 11438 if (iTrackLevelInfoIF->GetTimestampForSampleNumber(availabletracks[tempID], 2500, samplets) != PVMFSuccess) 11439 { 11440 PVPATB_TEST_IS_TRUE(true); 11441 } 11442 else 11443 { 11444 // Beyond the last sample so query should fail 11445 PVPATB_TEST_IS_TRUE(false); 11446 } 11447 11448 samplenum = 0; 11449 if (iTrackLevelInfoIF->GetSampleNumberForTimestamp(availabletracks[tempID], 844, samplenum) != PVMFSuccess) 11450 { 11451 PVPATB_TEST_IS_TRUE(false); 11452 } 11453 else 11454 { 11455 PVPATB_TEST_IS_TRUE(samplenum == 42); 11456 } 11457 11458 samplenum = 0; 11459 if (iTrackLevelInfoIF->GetSampleNumberForTimestamp(availabletracks[tempID], 12100, samplenum) != PVMFSuccess) 11460 { 11461 PVPATB_TEST_IS_TRUE(false); 11462 } 11463 else 11464 { 11465 PVPATB_TEST_IS_TRUE(samplenum == 605); 11466 } 11467 11468 samplenum = 0; 11469 if (iTrackLevelInfoIF->GetSampleNumberForTimestamp(availabletracks[tempID], 45000, samplenum) != PVMFSuccess) 11470 { 11471 PVPATB_TEST_IS_TRUE(false); 11472 } 11473 else 11474 { 11475 PVPATB_TEST_IS_TRUE(samplenum == 2120); 11476 } 11477 } 11478 } 11479 iTrackLevelInfoIF->removeRef(); 11480 iTrackLevelInfoIF = NULL; 11481 11482 iState = STATE_STOP; 11483 RunIfNotReady(); 11484 } 11485 break; 11486 11487 case STATE_STOP: 11488 { 11489 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 11490 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11491 } 11492 break; 11493 11494 case STATE_REMOVEDATASINK_VIDEO: 11495 { 11496 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 11497 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11498 } 11499 break; 11500 11501 case STATE_REMOVEDATASINK_AUDIO: 11502 { 11503 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 11504 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11505 } 11506 break; 11507 11508 case STATE_RESET: 11509 { 11510 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 11511 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11512 } 11513 break; 11514 11515 case STATE_REMOVEDATASOURCE: 11516 { 11517 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 11518 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11519 } 11520 break; 11521 11522 case STATE_INVALIDQUERYINTERFACE2: 11523 { 11524 PVUuid tracklevelinfouuid = PVMF_TRACK_LEVEL_INFO_INTERFACE_UUID; 11525 OSCL_TRY(error, iCurrentCmdId = iPlayer->QueryInterface(tracklevelinfouuid, (PVInterface*&)iTrackLevelInfoIF, (OsclAny*) & iContextObject)); 11526 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11527 } 11528 break; 11529 11530 case STATE_CLEANUPANDCOMPLETE: 11531 { 11532 if (iTrackLevelInfoIF) 11533 { 11534 iTrackLevelInfoIF->removeRef(); 11535 iTrackLevelInfoIF = NULL; 11536 } 11537 11538 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 11539 iPlayer = NULL; 11540 11541 delete iDataSource; 11542 iDataSource = NULL; 11543 11544 delete iDataSinkVideo; 11545 iDataSinkVideo = NULL; 11546 11547 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 11548 iIONodeVideo = NULL; 11549 11550 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 11551 iMIOFileOutVideo = NULL; 11552 11553 delete iDataSinkAudio; 11554 iDataSinkAudio = NULL; 11555 11556 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 11557 iIONodeAudio = NULL; 11558 11559 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 11560 iMIOFileOutAudio = NULL; 11561 11562 iObserver->TestCompleted(*iTestCase); 11563 } 11564 break; 11565 11566 default: 11567 break; 11568 11569 } 11570 } 11571 11572 11573 void pvplayer_async_test_tracklevelinfo::CommandCompleted(const PVCmdResponse& aResponse) 11574 { 11575 if (aResponse.GetCmdId() != iCurrentCmdId) 11576 { 11577 // Wrong command ID. 11578 PVPATB_TEST_IS_TRUE(false); 11579 iState = STATE_CLEANUPANDCOMPLETE; 11580 RunIfNotReady(); 11581 return; 11582 } 11583 11584 if (aResponse.GetContext() != NULL) 11585 { 11586 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 11587 { 11588 if (iContextObject != iContextObjectRefValue) 11589 { 11590 // Context data value was corrupted 11591 PVPATB_TEST_IS_TRUE(false); 11592 iState = STATE_CLEANUPANDCOMPLETE; 11593 RunIfNotReady(); 11594 return; 11595 } 11596 } 11597 else 11598 { 11599 // Context data pointer was corrupted 11600 PVPATB_TEST_IS_TRUE(false); 11601 iState = STATE_CLEANUPANDCOMPLETE; 11602 RunIfNotReady(); 11603 return; 11604 } 11605 } 11606 11607 switch (iState) 11608 { 11609 case STATE_INVALIDQUERYINTERFACE1: 11610 if (aResponse.GetCmdStatus() != PVMFSuccess) 11611 { 11612 iState = STATE_ADDDATASOURCE; 11613 RunIfNotReady(); 11614 } 11615 else 11616 { 11617 // QueryInterface() should not succeed at this state 11618 PVPATB_TEST_IS_TRUE(false); 11619 iState = STATE_CLEANUPANDCOMPLETE; 11620 RunIfNotReady(); 11621 } 11622 break; 11623 11624 case STATE_ADDDATASOURCE: 11625 if (aResponse.GetCmdStatus() == PVMFSuccess) 11626 { 11627 iState = STATE_INIT; 11628 RunIfNotReady(); 11629 } 11630 else 11631 { 11632 // AddDataSource failed 11633 PVPATB_TEST_IS_TRUE(false); 11634 iState = STATE_CLEANUPANDCOMPLETE; 11635 RunIfNotReady(); 11636 } 11637 break; 11638 11639 11640 11641 case STATE_INIT: 11642 if (aResponse.GetCmdStatus() == PVMFSuccess) 11643 { 11644 iState = STATE_ADDDATASINK_VIDEO; 11645 RunIfNotReady(); 11646 } 11647 else 11648 { 11649 // Init failed 11650 PVPATB_TEST_IS_TRUE(false); 11651 iState = STATE_CLEANUPANDCOMPLETE; 11652 RunIfNotReady(); 11653 } 11654 break; 11655 11656 case STATE_ADDDATASINK_VIDEO: 11657 if (aResponse.GetCmdStatus() == PVMFSuccess) 11658 { 11659 iState = STATE_ADDDATASINK_AUDIO; 11660 RunIfNotReady(); 11661 } 11662 else 11663 { 11664 // AddDataSink failed 11665 PVPATB_TEST_IS_TRUE(false); 11666 iState = STATE_CLEANUPANDCOMPLETE; 11667 RunIfNotReady(); 11668 } 11669 break; 11670 11671 case STATE_ADDDATASINK_AUDIO: 11672 if (aResponse.GetCmdStatus() == PVMFSuccess) 11673 { 11674 iState = STATE_PREPARE; 11675 RunIfNotReady(); 11676 } 11677 else 11678 { 11679 // AddDataSink failed 11680 PVPATB_TEST_IS_TRUE(false); 11681 iState = STATE_CLEANUPANDCOMPLETE; 11682 RunIfNotReady(); 11683 } 11684 break; 11685 11686 case STATE_PREPARE: 11687 if (aResponse.GetCmdStatus() == PVMFSuccess) 11688 { 11689 iState = STATE_START; 11690 RunIfNotReady(); 11691 } 11692 else 11693 { 11694 // Prepare failed 11695 PVPATB_TEST_IS_TRUE(false); 11696 iState = STATE_CLEANUPANDCOMPLETE; 11697 RunIfNotReady(); 11698 } 11699 break; 11700 11701 case STATE_START: 11702 if (aResponse.GetCmdStatus() == PVMFSuccess) 11703 { 11704 iState = STATE_QUERYINTERFACE; 11705 RunIfNotReady(); 11706 } 11707 else 11708 { 11709 // Start failed 11710 PVPATB_TEST_IS_TRUE(false); 11711 iState = STATE_CLEANUPANDCOMPLETE; 11712 RunIfNotReady(); 11713 } 11714 break; 11715 11716 case STATE_QUERYINTERFACE: 11717 if (aResponse.GetCmdStatus() == PVMFSuccess) 11718 { 11719 iState = STATE_TRACKLEVELINFOTEST; 11720 RunIfNotReady(); 11721 } 11722 else 11723 { 11724 // QueryInterface failed 11725 PVPATB_TEST_IS_TRUE(false); 11726 iState = STATE_CLEANUPANDCOMPLETE; 11727 RunIfNotReady(); 11728 } 11729 break; 11730 11731 case STATE_STOP: 11732 if (aResponse.GetCmdStatus() == PVMFSuccess) 11733 { 11734 iState = STATE_REMOVEDATASINK_VIDEO; 11735 RunIfNotReady(); 11736 } 11737 else 11738 { 11739 // Stop failed 11740 PVPATB_TEST_IS_TRUE(false); 11741 iState = STATE_CLEANUPANDCOMPLETE; 11742 RunIfNotReady(); 11743 } 11744 break; 11745 11746 case STATE_REMOVEDATASINK_VIDEO: 11747 if (aResponse.GetCmdStatus() == PVMFSuccess) 11748 { 11749 iState = STATE_REMOVEDATASINK_AUDIO; 11750 RunIfNotReady(); 11751 } 11752 else 11753 { 11754 // RemoveDataSink failed 11755 PVPATB_TEST_IS_TRUE(false); 11756 iState = STATE_CLEANUPANDCOMPLETE; 11757 RunIfNotReady(); 11758 } 11759 break; 11760 11761 case STATE_REMOVEDATASINK_AUDIO: 11762 if (aResponse.GetCmdStatus() == PVMFSuccess) 11763 { 11764 iState = STATE_RESET; 11765 RunIfNotReady(); 11766 } 11767 else 11768 { 11769 // RemoveDataSink failed 11770 PVPATB_TEST_IS_TRUE(false); 11771 iState = STATE_CLEANUPANDCOMPLETE; 11772 RunIfNotReady(); 11773 } 11774 break; 11775 11776 case STATE_RESET: 11777 if (aResponse.GetCmdStatus() == PVMFSuccess) 11778 { 11779 iState = STATE_REMOVEDATASOURCE; 11780 RunIfNotReady(); 11781 } 11782 else 11783 { 11784 // Reset failed 11785 PVPATB_TEST_IS_TRUE(false); 11786 iState = STATE_CLEANUPANDCOMPLETE; 11787 RunIfNotReady(); 11788 } 11789 break; 11790 11791 case STATE_REMOVEDATASOURCE: 11792 if (aResponse.GetCmdStatus() == PVMFSuccess) 11793 { 11794 iState = STATE_INVALIDQUERYINTERFACE2; 11795 RunIfNotReady(); 11796 } 11797 else 11798 { 11799 // RemoveDataSource failed 11800 PVPATB_TEST_IS_TRUE(false); 11801 iState = STATE_CLEANUPANDCOMPLETE; 11802 RunIfNotReady(); 11803 } 11804 break; 11805 11806 case STATE_INVALIDQUERYINTERFACE2: 11807 if (aResponse.GetCmdStatus() != PVMFSuccess) 11808 { 11809 PVPATB_TEST_IS_TRUE(true); 11810 iState = STATE_CLEANUPANDCOMPLETE; 11811 RunIfNotReady(); 11812 } 11813 else 11814 { 11815 // QueryInterface() should not succeed at this state 11816 PVPATB_TEST_IS_TRUE(false); 11817 iState = STATE_CLEANUPANDCOMPLETE; 11818 RunIfNotReady(); 11819 } 11820 break; 11821 11822 default: 11823 { 11824 // Testing error if this is reached 11825 PVPATB_TEST_IS_TRUE(false); 11826 iState = STATE_CLEANUPANDCOMPLETE; 11827 RunIfNotReady(); 11828 } 11829 break; 11830 } 11831 } 11832 11833 11834 void pvplayer_async_test_tracklevelinfo::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 11835 { 11836 switch (aEvent.GetEventType()) 11837 { 11838 case PVMFErrResourceConfiguration: 11839 // Just log the error 11840 PVPATB_TEST_IS_TRUE(false); 11841 break; 11842 11843 case PVMFErrResource: 11844 // Just log the error 11845 PVPATB_TEST_IS_TRUE(false); 11846 break; 11847 11848 case PVMFErrCorrupt: 11849 // Just log the error 11850 PVPATB_TEST_IS_TRUE(false); 11851 break; 11852 11853 case PVMFErrProcessing: 11854 // Just log the error 11855 PVPATB_TEST_IS_TRUE(false); 11856 break; 11857 11858 default: 11859 // Unknown error and just log the error 11860 PVPATB_TEST_IS_TRUE(false); 11861 break; 11862 } 11863 } 11864 11865 11866 void pvplayer_async_test_tracklevelinfo::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 11867 { 11868 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 11869 { 11870 // do nothing 11871 } 11872 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 11873 { 11874 iState = STATE_CLEANUPANDCOMPLETE; 11875 RunIfNotReady(); 11876 } 11877 } 11878 11879 11880 11881 // 11882 // pvplayer_async_test_setplaybackrate2X section 11883 // 11884 void pvplayer_async_test_setplaybackrate2X::StartTest() 11885 { 11886 AddToScheduler(); 11887 iState = STATE_CREATE; 11888 RunIfNotReady(); 11889 } 11890 11891 11892 void pvplayer_async_test_setplaybackrate2X::Run() 11893 { 11894 int error = 0; 11895 11896 switch (iState) 11897 { 11898 case STATE_CREATE: 11899 { 11900 iPlayer = NULL; 11901 11902 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 11903 if (error) 11904 { 11905 PVPATB_TEST_IS_TRUE(false); 11906 iObserver->TestCompleted(*iTestCase); 11907 } 11908 else 11909 { 11910 iState = STATE_ADDDATASOURCE; 11911 RunIfNotReady(); 11912 } 11913 } 11914 break; 11915 11916 case STATE_ADDDATASOURCE: 11917 { 11918 iDataSource = new PVPlayerDataSourceURL; 11919 11920 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 11921 sourcefile += _STRLIT_WCHAR("test_reposition.mp4"); 11922 iDataSource->SetDataSourceURL(sourcefile); 11923 11924 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 11925 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 11926 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11927 } 11928 break; 11929 11930 case STATE_INIT: 11931 { 11932 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 11933 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11934 } 11935 break; 11936 11937 case STATE_ADDDATASINK_VIDEO: 11938 { 11939 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 11940 sinkfile += _STRLIT_WCHAR("test_player_setplaybackrate2x_video.dat"); 11941 11942 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 11943 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 11944 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 11945 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 11946 11947 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 11948 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11949 } 11950 break; 11951 11952 case STATE_ADDDATASINK_AUDIO: 11953 { 11954 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 11955 sinkfile += _STRLIT_WCHAR("test_player_setplaybackrate2x_audio.dat"); 11956 11957 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 11958 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 11959 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 11960 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 11961 11962 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 11963 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11964 } 11965 break; 11966 11967 case STATE_PREPARE: 11968 { 11969 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 11970 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11971 } 11972 break; 11973 11974 case STATE_SETPLAYBACKRATE: 11975 { 11976 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRate(200000, NULL, (OsclAny*) & iContextObject)); 11977 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11978 } 11979 break; 11980 11981 case STATE_START: 11982 { 11983 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 11984 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11985 } 11986 break; 11987 11988 case STATE_STOP: 11989 { 11990 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 11991 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11992 } 11993 break; 11994 11995 case STATE_REMOVEDATASINK_VIDEO: 11996 { 11997 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 11998 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 11999 } 12000 break; 12001 12002 case STATE_REMOVEDATASINK_AUDIO: 12003 { 12004 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 12005 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12006 } 12007 break; 12008 12009 case STATE_RESET: 12010 { 12011 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 12012 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12013 } 12014 break; 12015 12016 case STATE_REMOVEDATASOURCE: 12017 { 12018 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 12019 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12020 } 12021 break; 12022 12023 case STATE_CLEANUPANDCOMPLETE: 12024 { 12025 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 12026 iPlayer = NULL; 12027 12028 delete iDataSource; 12029 iDataSource = NULL; 12030 12031 delete iDataSinkVideo; 12032 iDataSinkVideo = NULL; 12033 12034 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 12035 iIONodeVideo = NULL; 12036 12037 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 12038 iMIOFileOutVideo = NULL; 12039 12040 delete iDataSinkAudio; 12041 iDataSinkAudio = NULL; 12042 12043 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 12044 iIONodeAudio = NULL; 12045 12046 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 12047 iMIOFileOutAudio = NULL; 12048 12049 iObserver->TestCompleted(*iTestCase); 12050 } 12051 break; 12052 12053 default: 12054 break; 12055 12056 } 12057 } 12058 12059 12060 void pvplayer_async_test_setplaybackrate2X::CommandCompleted(const PVCmdResponse& aResponse) 12061 { 12062 if (aResponse.GetCmdId() != iCurrentCmdId) 12063 { 12064 // Wrong command ID. 12065 PVPATB_TEST_IS_TRUE(false); 12066 iState = STATE_CLEANUPANDCOMPLETE; 12067 RunIfNotReady(); 12068 return; 12069 } 12070 12071 if (aResponse.GetContext() != NULL) 12072 { 12073 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 12074 { 12075 if (iContextObject != iContextObjectRefValue) 12076 { 12077 // Context data value was corrupted 12078 PVPATB_TEST_IS_TRUE(false); 12079 iState = STATE_CLEANUPANDCOMPLETE; 12080 RunIfNotReady(); 12081 return; 12082 } 12083 } 12084 else 12085 { 12086 // Context data pointer was corrupted 12087 PVPATB_TEST_IS_TRUE(false); 12088 iState = STATE_CLEANUPANDCOMPLETE; 12089 RunIfNotReady(); 12090 return; 12091 } 12092 } 12093 12094 switch (iState) 12095 { 12096 case STATE_ADDDATASOURCE: 12097 if (aResponse.GetCmdStatus() == PVMFSuccess) 12098 { 12099 iState = STATE_INIT; 12100 RunIfNotReady(); 12101 } 12102 else 12103 { 12104 // AddDataSource failed 12105 PVPATB_TEST_IS_TRUE(false); 12106 iState = STATE_CLEANUPANDCOMPLETE; 12107 RunIfNotReady(); 12108 } 12109 break; 12110 12111 case STATE_INIT: 12112 if (aResponse.GetCmdStatus() == PVMFSuccess) 12113 { 12114 iState = STATE_ADDDATASINK_VIDEO; 12115 RunIfNotReady(); 12116 } 12117 else 12118 { 12119 // Init failed 12120 PVPATB_TEST_IS_TRUE(false); 12121 iState = STATE_CLEANUPANDCOMPLETE; 12122 RunIfNotReady(); 12123 } 12124 break; 12125 12126 case STATE_ADDDATASINK_VIDEO: 12127 if (aResponse.GetCmdStatus() == PVMFSuccess) 12128 { 12129 iState = STATE_ADDDATASINK_AUDIO; 12130 RunIfNotReady(); 12131 } 12132 else 12133 { 12134 // AddDataSink failed 12135 PVPATB_TEST_IS_TRUE(false); 12136 iState = STATE_CLEANUPANDCOMPLETE; 12137 RunIfNotReady(); 12138 } 12139 break; 12140 12141 case STATE_ADDDATASINK_AUDIO: 12142 if (aResponse.GetCmdStatus() == PVMFSuccess) 12143 { 12144 iState = STATE_PREPARE; 12145 RunIfNotReady(); 12146 } 12147 else 12148 { 12149 // AddDataSink failed 12150 PVPATB_TEST_IS_TRUE(false); 12151 iState = STATE_CLEANUPANDCOMPLETE; 12152 RunIfNotReady(); 12153 } 12154 break; 12155 12156 case STATE_PREPARE: 12157 if (aResponse.GetCmdStatus() == PVMFSuccess) 12158 { 12159 iState = STATE_SETPLAYBACKRATE; 12160 RunIfNotReady(); 12161 } 12162 else 12163 { 12164 // Prepare failed 12165 PVPATB_TEST_IS_TRUE(false); 12166 iState = STATE_CLEANUPANDCOMPLETE; 12167 RunIfNotReady(); 12168 } 12169 break; 12170 12171 case STATE_SETPLAYBACKRATE: 12172 if (aResponse.GetCmdStatus() == PVMFSuccess) 12173 { 12174 iState = STATE_START; 12175 RunIfNotReady(); 12176 } 12177 else 12178 { 12179 // SetPlaybackRate failed 12180 PVPATB_TEST_IS_TRUE(false); 12181 iState = STATE_STOP; 12182 RunIfNotReady(); 12183 } 12184 break; 12185 12186 case STATE_START: 12187 if (aResponse.GetCmdStatus() == PVMFSuccess) 12188 { 12189 iState = STATE_STOP; 12190 RunIfNotReady(15000000); 12191 } 12192 else 12193 { 12194 // Start failed 12195 PVPATB_TEST_IS_TRUE(false); 12196 iState = STATE_CLEANUPANDCOMPLETE; 12197 RunIfNotReady(); 12198 } 12199 break; 12200 12201 case STATE_STOP: 12202 if (aResponse.GetCmdStatus() == PVMFSuccess) 12203 { 12204 iState = STATE_REMOVEDATASINK_VIDEO; 12205 RunIfNotReady(); 12206 } 12207 else 12208 { 12209 // Start failed 12210 PVPATB_TEST_IS_TRUE(false); 12211 iState = STATE_CLEANUPANDCOMPLETE; 12212 RunIfNotReady(); 12213 } 12214 break; 12215 12216 case STATE_REMOVEDATASINK_VIDEO: 12217 if (aResponse.GetCmdStatus() == PVMFSuccess) 12218 { 12219 iState = STATE_REMOVEDATASINK_AUDIO; 12220 RunIfNotReady(); 12221 } 12222 else 12223 { 12224 // RemoveDataSink failed 12225 PVPATB_TEST_IS_TRUE(false); 12226 iState = STATE_CLEANUPANDCOMPLETE; 12227 RunIfNotReady(); 12228 } 12229 break; 12230 12231 case STATE_REMOVEDATASINK_AUDIO: 12232 if (aResponse.GetCmdStatus() == PVMFSuccess) 12233 { 12234 iState = STATE_RESET; 12235 RunIfNotReady(); 12236 } 12237 else 12238 { 12239 // RemoveDataSink failed 12240 PVPATB_TEST_IS_TRUE(false); 12241 iState = STATE_CLEANUPANDCOMPLETE; 12242 RunIfNotReady(); 12243 } 12244 break; 12245 12246 case STATE_RESET: 12247 if (aResponse.GetCmdStatus() == PVMFSuccess) 12248 { 12249 iState = STATE_REMOVEDATASOURCE; 12250 RunIfNotReady(); 12251 } 12252 else 12253 { 12254 // Reset failed 12255 PVPATB_TEST_IS_TRUE(false); 12256 iState = STATE_CLEANUPANDCOMPLETE; 12257 RunIfNotReady(); 12258 } 12259 break; 12260 12261 case STATE_REMOVEDATASOURCE: 12262 if (aResponse.GetCmdStatus() == PVMFSuccess) 12263 { 12264 PVPATB_TEST_IS_TRUE(true); 12265 iState = STATE_CLEANUPANDCOMPLETE; 12266 RunIfNotReady(); 12267 } 12268 else 12269 { 12270 // RemoveDataSource failed 12271 PVPATB_TEST_IS_TRUE(false); 12272 iState = STATE_CLEANUPANDCOMPLETE; 12273 RunIfNotReady(); 12274 } 12275 break; 12276 12277 default: 12278 { 12279 // Testing error if this is reached 12280 PVPATB_TEST_IS_TRUE(false); 12281 iState = STATE_CLEANUPANDCOMPLETE; 12282 RunIfNotReady(); 12283 } 12284 break; 12285 } 12286 } 12287 12288 12289 void pvplayer_async_test_setplaybackrate2X::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 12290 { 12291 switch (aEvent.GetEventType()) 12292 { 12293 case PVMFErrResourceConfiguration: 12294 // Just log the error 12295 PVPATB_TEST_IS_TRUE(false); 12296 break; 12297 12298 case PVMFErrResource: 12299 // Just log the error 12300 PVPATB_TEST_IS_TRUE(false); 12301 break; 12302 12303 case PVMFErrCorrupt: 12304 // Just log the error 12305 PVPATB_TEST_IS_TRUE(false); 12306 break; 12307 12308 case PVMFErrProcessing: 12309 // Just log the error 12310 PVPATB_TEST_IS_TRUE(false); 12311 break; 12312 12313 default: 12314 // Unknown error and just log the error 12315 PVPATB_TEST_IS_TRUE(false); 12316 break; 12317 } 12318 } 12319 12320 12321 void pvplayer_async_test_setplaybackrate2X::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 12322 { 12323 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 12324 { 12325 // do nothing 12326 } 12327 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 12328 { 12329 iState = STATE_CLEANUPANDCOMPLETE; 12330 RunIfNotReady(); 12331 } 12332 } 12333 12334 12335 // 12336 // pvplayer_async_test_setplaybackratefifth section 12337 // 12338 void pvplayer_async_test_setplaybackratefifth::StartTest() 12339 { 12340 AddToScheduler(); 12341 iState = STATE_CREATE; 12342 RunIfNotReady(); 12343 } 12344 12345 12346 void pvplayer_async_test_setplaybackratefifth::Run() 12347 { 12348 int error = 0; 12349 12350 switch (iState) 12351 { 12352 case STATE_CREATE: 12353 { 12354 iPlayer = NULL; 12355 12356 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 12357 if (error) 12358 { 12359 PVPATB_TEST_IS_TRUE(false); 12360 iObserver->TestCompleted(*iTestCase); 12361 } 12362 else 12363 { 12364 iState = STATE_ADDDATASOURCE; 12365 RunIfNotReady(); 12366 } 12367 } 12368 break; 12369 12370 case STATE_ADDDATASOURCE: 12371 { 12372 iDataSource = new PVPlayerDataSourceURL; 12373 12374 OSCL_wHeapString<OsclMemAllocator> sourcefile = SOURCENAME_PREPEND_WSTRING; 12375 sourcefile += _STRLIT_WCHAR("test_reposition.mp4"); 12376 iDataSource->SetDataSourceURL(sourcefile); 12377 12378 iDataSource->SetDataSourceFormatType(PVMF_MIME_MPEG4FF); 12379 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 12380 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12381 } 12382 break; 12383 12384 case STATE_INIT: 12385 { 12386 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 12387 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12388 } 12389 break; 12390 12391 case STATE_ADDDATASINK_VIDEO: 12392 { 12393 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 12394 sinkfile += _STRLIT_WCHAR("test_player_setplaybackratefifth_video.dat"); 12395 12396 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 12397 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 12398 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 12399 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 12400 12401 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 12402 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12403 } 12404 break; 12405 12406 case STATE_ADDDATASINK_AUDIO: 12407 { 12408 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 12409 sinkfile += _STRLIT_WCHAR("test_player_setplaybackratefifth_audio.dat"); 12410 12411 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 12412 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 12413 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 12414 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 12415 12416 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 12417 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12418 } 12419 break; 12420 12421 case STATE_PREPARE: 12422 { 12423 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 12424 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12425 } 12426 break; 12427 12428 case STATE_SETPLAYBACKRATE: 12429 { 12430 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRate(20000, NULL, (OsclAny*) & iContextObject)); 12431 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12432 } 12433 break; 12434 12435 case STATE_START: 12436 { 12437 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 12438 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12439 } 12440 break; 12441 12442 case STATE_STOP: 12443 { 12444 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 12445 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12446 } 12447 break; 12448 12449 case STATE_REMOVEDATASINK_VIDEO: 12450 { 12451 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 12452 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12453 } 12454 break; 12455 12456 case STATE_REMOVEDATASINK_AUDIO: 12457 { 12458 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 12459 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12460 } 12461 break; 12462 12463 case STATE_RESET: 12464 { 12465 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 12466 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12467 } 12468 break; 12469 12470 case STATE_REMOVEDATASOURCE: 12471 { 12472 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 12473 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12474 } 12475 break; 12476 12477 case STATE_CLEANUPANDCOMPLETE: 12478 { 12479 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 12480 iPlayer = NULL; 12481 12482 delete iDataSource; 12483 iDataSource = NULL; 12484 12485 delete iDataSinkVideo; 12486 iDataSinkVideo = NULL; 12487 12488 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 12489 iIONodeVideo = NULL; 12490 12491 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 12492 iMIOFileOutVideo = NULL; 12493 12494 delete iDataSinkAudio; 12495 iDataSinkAudio = NULL; 12496 12497 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 12498 iIONodeAudio = NULL; 12499 12500 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 12501 iMIOFileOutAudio = NULL; 12502 12503 iObserver->TestCompleted(*iTestCase); 12504 } 12505 break; 12506 12507 default: 12508 break; 12509 12510 } 12511 } 12512 12513 12514 void pvplayer_async_test_setplaybackratefifth::CommandCompleted(const PVCmdResponse& aResponse) 12515 { 12516 if (aResponse.GetCmdId() != iCurrentCmdId) 12517 { 12518 // Wrong command ID. 12519 PVPATB_TEST_IS_TRUE(false); 12520 iState = STATE_CLEANUPANDCOMPLETE; 12521 RunIfNotReady(); 12522 return; 12523 } 12524 12525 if (aResponse.GetContext() != NULL) 12526 { 12527 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 12528 { 12529 if (iContextObject != iContextObjectRefValue) 12530 { 12531 // Context data value was corrupted 12532 PVPATB_TEST_IS_TRUE(false); 12533 iState = STATE_CLEANUPANDCOMPLETE; 12534 RunIfNotReady(); 12535 return; 12536 } 12537 } 12538 else 12539 { 12540 // Context data pointer was corrupted 12541 PVPATB_TEST_IS_TRUE(false); 12542 iState = STATE_CLEANUPANDCOMPLETE; 12543 RunIfNotReady(); 12544 return; 12545 } 12546 } 12547 12548 switch (iState) 12549 { 12550 case STATE_ADDDATASOURCE: 12551 if (aResponse.GetCmdStatus() == PVMFSuccess) 12552 { 12553 iState = STATE_INIT; 12554 RunIfNotReady(); 12555 } 12556 else 12557 { 12558 // AddDataSource failed 12559 PVPATB_TEST_IS_TRUE(false); 12560 iState = STATE_CLEANUPANDCOMPLETE; 12561 RunIfNotReady(); 12562 } 12563 break; 12564 12565 case STATE_INIT: 12566 if (aResponse.GetCmdStatus() == PVMFSuccess) 12567 { 12568 iState = STATE_ADDDATASINK_VIDEO; 12569 RunIfNotReady(); 12570 } 12571 else 12572 { 12573 // Init failed 12574 PVPATB_TEST_IS_TRUE(false); 12575 iState = STATE_CLEANUPANDCOMPLETE; 12576 RunIfNotReady(); 12577 } 12578 break; 12579 12580 case STATE_ADDDATASINK_VIDEO: 12581 if (aResponse.GetCmdStatus() == PVMFSuccess) 12582 { 12583 iState = STATE_ADDDATASINK_AUDIO; 12584 RunIfNotReady(); 12585 } 12586 else 12587 { 12588 // AddDataSink failed 12589 PVPATB_TEST_IS_TRUE(false); 12590 iState = STATE_CLEANUPANDCOMPLETE; 12591 RunIfNotReady(); 12592 } 12593 break; 12594 12595 case STATE_ADDDATASINK_AUDIO: 12596 if (aResponse.GetCmdStatus() == PVMFSuccess) 12597 { 12598 iState = STATE_PREPARE; 12599 RunIfNotReady(); 12600 } 12601 else 12602 { 12603 // AddDataSink failed 12604 PVPATB_TEST_IS_TRUE(false); 12605 iState = STATE_CLEANUPANDCOMPLETE; 12606 RunIfNotReady(); 12607 } 12608 break; 12609 12610 case STATE_PREPARE: 12611 if (aResponse.GetCmdStatus() == PVMFSuccess) 12612 { 12613 iState = STATE_SETPLAYBACKRATE; 12614 RunIfNotReady(); 12615 } 12616 else 12617 { 12618 // Prepare failed 12619 PVPATB_TEST_IS_TRUE(false); 12620 iState = STATE_CLEANUPANDCOMPLETE; 12621 RunIfNotReady(); 12622 } 12623 break; 12624 12625 case STATE_SETPLAYBACKRATE: 12626 if (aResponse.GetCmdStatus() == PVMFSuccess) 12627 { 12628 iState = STATE_START; 12629 RunIfNotReady(); 12630 } 12631 else 12632 { 12633 // SetPlaybackRate failed 12634 PVPATB_TEST_IS_TRUE(false); 12635 iState = STATE_STOP; 12636 RunIfNotReady(); 12637 } 12638 break; 12639 12640 case STATE_START: 12641 if (aResponse.GetCmdStatus() == PVMFSuccess) 12642 { 12643 iState = STATE_STOP; 12644 RunIfNotReady(15000000); 12645 } 12646 else 12647 { 12648 // Start failed 12649 PVPATB_TEST_IS_TRUE(false); 12650 iState = STATE_CLEANUPANDCOMPLETE; 12651 RunIfNotReady(); 12652 } 12653 break; 12654 12655 case STATE_STOP: 12656 if (aResponse.GetCmdStatus() == PVMFSuccess) 12657 { 12658 iState = STATE_REMOVEDATASINK_VIDEO; 12659 RunIfNotReady(); 12660 } 12661 else 12662 { 12663 // Start failed 12664 PVPATB_TEST_IS_TRUE(false); 12665 iState = STATE_CLEANUPANDCOMPLETE; 12666 RunIfNotReady(); 12667 } 12668 break; 12669 12670 case STATE_REMOVEDATASINK_VIDEO: 12671 if (aResponse.GetCmdStatus() == PVMFSuccess) 12672 { 12673 iState = STATE_REMOVEDATASINK_AUDIO; 12674 RunIfNotReady(); 12675 } 12676 else 12677 { 12678 // RemoveDataSink failed 12679 PVPATB_TEST_IS_TRUE(false); 12680 iState = STATE_CLEANUPANDCOMPLETE; 12681 RunIfNotReady(); 12682 } 12683 break; 12684 12685 case STATE_REMOVEDATASINK_AUDIO: 12686 if (aResponse.GetCmdStatus() == PVMFSuccess) 12687 { 12688 iState = STATE_RESET; 12689 RunIfNotReady(); 12690 } 12691 else 12692 { 12693 // RemoveDataSink failed 12694 PVPATB_TEST_IS_TRUE(false); 12695 iState = STATE_CLEANUPANDCOMPLETE; 12696 RunIfNotReady(); 12697 } 12698 break; 12699 12700 case STATE_RESET: 12701 if (aResponse.GetCmdStatus() == PVMFSuccess) 12702 { 12703 iState = STATE_REMOVEDATASOURCE; 12704 RunIfNotReady(); 12705 } 12706 else 12707 { 12708 // Reset failed 12709 PVPATB_TEST_IS_TRUE(false); 12710 iState = STATE_CLEANUPANDCOMPLETE; 12711 RunIfNotReady(); 12712 } 12713 break; 12714 12715 case STATE_REMOVEDATASOURCE: 12716 if (aResponse.GetCmdStatus() == PVMFSuccess) 12717 { 12718 PVPATB_TEST_IS_TRUE(true); 12719 iState = STATE_CLEANUPANDCOMPLETE; 12720 RunIfNotReady(); 12721 } 12722 else 12723 { 12724 // RemoveDataSource failed 12725 PVPATB_TEST_IS_TRUE(false); 12726 iState = STATE_CLEANUPANDCOMPLETE; 12727 RunIfNotReady(); 12728 } 12729 break; 12730 12731 default: 12732 { 12733 // Testing error if this is reached 12734 PVPATB_TEST_IS_TRUE(false); 12735 iState = STATE_CLEANUPANDCOMPLETE; 12736 RunIfNotReady(); 12737 } 12738 break; 12739 } 12740 } 12741 12742 12743 void pvplayer_async_test_setplaybackratefifth::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 12744 { 12745 switch (aEvent.GetEventType()) 12746 { 12747 case PVMFErrResourceConfiguration: 12748 // Just log the error 12749 PVPATB_TEST_IS_TRUE(false); 12750 break; 12751 12752 case PVMFErrResource: 12753 // Just log the error 12754 PVPATB_TEST_IS_TRUE(false); 12755 break; 12756 12757 case PVMFErrCorrupt: 12758 // Just log the error 12759 PVPATB_TEST_IS_TRUE(false); 12760 break; 12761 12762 case PVMFErrProcessing: 12763 // Just log the error 12764 PVPATB_TEST_IS_TRUE(false); 12765 break; 12766 12767 default: 12768 // Unknown error and just log the error 12769 PVPATB_TEST_IS_TRUE(false); 12770 break; 12771 } 12772 } 12773 12774 12775 void pvplayer_async_test_setplaybackratefifth::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 12776 { 12777 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 12778 { 12779 // do nothing 12780 } 12781 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 12782 { 12783 iState = STATE_CLEANUPANDCOMPLETE; 12784 RunIfNotReady(); 12785 } 12786 } 12787 12788 12789 // 12790 // pvplayer_async_test_queuedcommands section 12791 // 12792 void pvplayer_async_test_queuedcommands::StartTest() 12793 { 12794 AddToScheduler(); 12795 iState = STATE_CREATE; 12796 RunIfNotReady(); 12797 } 12798 12799 12800 void pvplayer_async_test_queuedcommands::Run() 12801 { 12802 int error = 0; 12803 12804 switch (iState) 12805 { 12806 case STATE_CREATE: 12807 { 12808 iPlayer = NULL; 12809 12810 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 12811 if (error) 12812 { 12813 PVPATB_TEST_IS_TRUE(false); 12814 iObserver->TestCompleted(*iTestCase); 12815 } 12816 else 12817 { 12818 iState = STATE_QUEUEDCMD1; 12819 RunIfNotReady(); 12820 } 12821 } 12822 break; 12823 12824 case STATE_QUEUEDCMD1: 12825 { 12826 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 12827 // Add the data source 12828 iDataSource = new PVPlayerDataSourceURL; 12829 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 512); 12830 wFileName.set(output, oscl_strlen(output)); 12831 iDataSource->SetDataSourceURL(wFileName); 12832 iDataSource->SetDataSourceFormatType(iFileType); 12833 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 12834 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12835 iCmdIds.push_back(iCurrentCmdId); 12836 // Initialize 12837 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 12838 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12839 iCmdIds.push_back(iCurrentCmdId); 12840 12841 // Add video data sink 12842 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 12843 SinkFileName += _STRLIT_WCHAR("test_player_queuedcmd_"); 12844 OSCL_wHeapString<OsclMemAllocator> inputfilename; 12845 RetrieveFilename(wFileName.get_str(), inputfilename); 12846 SinkFileName += inputfilename; 12847 SinkFileName += _STRLIT_WCHAR("_video.dat"); 12848 12849 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & SinkFileName, MEDIATYPE_VIDEO, iCompressedVideo); 12850 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 12851 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 12852 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 12853 12854 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 12855 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12856 iCmdIds.push_back(iCurrentCmdId); 12857 12858 12859 // Add audio data sink 12860 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 12861 SinkFileName += _STRLIT_WCHAR("test_player_queuedcmd_"); 12862 SinkFileName += inputfilename; 12863 SinkFileName += _STRLIT_WCHAR("_audio.dat"); 12864 12865 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & SinkFileName, MEDIATYPE_AUDIO, iCompressedAudio); 12866 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 12867 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 12868 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 12869 12870 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 12871 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12872 iCmdIds.push_back(iCurrentCmdId); 12873 } 12874 break; 12875 12876 case STATE_QUEUEDCMD2: 12877 { 12878 // Prepare 12879 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 12880 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12881 iCmdIds.push_back(iCurrentCmdId); 12882 // Start 12883 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 12884 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12885 iCmdIds.push_back(iCurrentCmdId); 12886 } 12887 break; 12888 12889 case STATE_QUEUEDCMD3: 12890 { 12891 // Stop 12892 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 12893 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12894 iCmdIds.push_back(iCurrentCmdId); 12895 // Remove video data sink 12896 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 12897 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12898 iCmdIds.push_back(iCurrentCmdId); 12899 } 12900 break; 12901 12902 case STATE_QUEUEDCMD4: 12903 { 12904 // Remove audio data sink 12905 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 12906 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12907 iCmdIds.push_back(iCurrentCmdId); 12908 // Reset 12909 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 12910 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12911 iCmdIds.push_back(iCurrentCmdId); 12912 // Remove data source 12913 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 12914 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 12915 iCmdIds.push_back(iCurrentCmdId); 12916 } 12917 break; 12918 12919 case STATE_CLEANUPANDCOMPLETE: 12920 { 12921 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 12922 iPlayer = NULL; 12923 12924 delete iDataSource; 12925 iDataSource = NULL; 12926 12927 delete iDataSinkVideo; 12928 iDataSinkVideo = NULL; 12929 12930 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 12931 iIONodeVideo = NULL; 12932 12933 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 12934 iMIOFileOutVideo = NULL; 12935 12936 delete iDataSinkAudio; 12937 iDataSinkAudio = NULL; 12938 12939 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 12940 iIONodeAudio = NULL; 12941 12942 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 12943 iMIOFileOutAudio = NULL; 12944 12945 iObserver->TestCompleted(*iTestCase); 12946 } 12947 break; 12948 12949 default: 12950 break; 12951 12952 } 12953 } 12954 12955 12956 void pvplayer_async_test_queuedcommands::CommandCompleted(const PVCmdResponse& aResponse) 12957 { 12958 // Assumes the engine commands are completed in the order they are requested 12959 if (aResponse.GetCmdId() != iCmdIds[0]) 12960 { 12961 // Wrong command ID. 12962 PVPATB_TEST_IS_TRUE(false); 12963 iState = STATE_CLEANUPANDCOMPLETE; 12964 RunIfNotReady(); 12965 return; 12966 } 12967 12968 if (aResponse.GetContext() != NULL) 12969 { 12970 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 12971 { 12972 if (iContextObject != iContextObjectRefValue) 12973 { 12974 // Context data value was corrupted 12975 PVPATB_TEST_IS_TRUE(false); 12976 iState = STATE_CLEANUPANDCOMPLETE; 12977 RunIfNotReady(); 12978 return; 12979 } 12980 } 12981 else 12982 { 12983 // Context data pointer was corrupted 12984 PVPATB_TEST_IS_TRUE(false); 12985 iState = STATE_CLEANUPANDCOMPLETE; 12986 RunIfNotReady(); 12987 return; 12988 } 12989 } 12990 12991 switch (iState) 12992 { 12993 case STATE_QUEUEDCMD1: 12994 if (aResponse.GetCmdStatus() == PVMFSuccess) 12995 { 12996 iCmdIds.erase(iCmdIds.begin()); 12997 if (iCmdIds.empty()) 12998 { 12999 // All requested commands have completed 13000 iState = STATE_QUEUEDCMD2; 13001 RunIfNotReady(); 13002 } 13003 } 13004 else 13005 { 13006 // One of queued commands failed 13007 PVPATB_TEST_IS_TRUE(false); 13008 iState = STATE_CLEANUPANDCOMPLETE; 13009 RunIfNotReady(); 13010 } 13011 break; 13012 13013 case STATE_QUEUEDCMD2: 13014 if (aResponse.GetCmdStatus() == PVMFSuccess) 13015 { 13016 iCmdIds.erase(iCmdIds.begin()); 13017 if (iCmdIds.empty()) 13018 { 13019 // All requested commands have completed 13020 iState = STATE_QUEUEDCMD3; 13021 RunIfNotReady(10000000); 13022 } 13023 } 13024 else 13025 { 13026 // One of queued commands failed 13027 PVPATB_TEST_IS_TRUE(false); 13028 iState = STATE_CLEANUPANDCOMPLETE; 13029 RunIfNotReady(); 13030 } 13031 break; 13032 13033 case STATE_QUEUEDCMD3: 13034 if (aResponse.GetCmdStatus() == PVMFSuccess) 13035 { 13036 iCmdIds.erase(iCmdIds.begin()); 13037 if (iCmdIds.empty()) 13038 { 13039 // All requested commands have completed 13040 iState = STATE_QUEUEDCMD4; 13041 RunIfNotReady(); 13042 } 13043 } 13044 else 13045 { 13046 // One of queued commands failed 13047 PVPATB_TEST_IS_TRUE(false); 13048 iState = STATE_CLEANUPANDCOMPLETE; 13049 RunIfNotReady(); 13050 } 13051 break; 13052 13053 case STATE_QUEUEDCMD4: 13054 if (aResponse.GetCmdStatus() == PVMFSuccess) 13055 { 13056 iCmdIds.erase(iCmdIds.begin()); 13057 if (iCmdIds.empty()) 13058 { 13059 // All requested commands have completed 13060 PVPATB_TEST_IS_TRUE(true); 13061 iState = STATE_CLEANUPANDCOMPLETE; 13062 RunIfNotReady(); 13063 } 13064 } 13065 else 13066 { 13067 // One of queued commands failed 13068 PVPATB_TEST_IS_TRUE(false); 13069 iState = STATE_CLEANUPANDCOMPLETE; 13070 RunIfNotReady(); 13071 } 13072 break; 13073 13074 default: 13075 { 13076 // Testing error if this is reached 13077 PVPATB_TEST_IS_TRUE(false); 13078 iState = STATE_CLEANUPANDCOMPLETE; 13079 RunIfNotReady(); 13080 } 13081 break; 13082 } 13083 } 13084 13085 13086 void pvplayer_async_test_queuedcommands::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 13087 { 13088 switch (aEvent.GetEventType()) 13089 { 13090 case PVMFErrResourceConfiguration: 13091 // Just log the error 13092 PVPATB_TEST_IS_TRUE(false); 13093 break; 13094 13095 case PVMFErrResource: 13096 // Just log the error 13097 PVPATB_TEST_IS_TRUE(false); 13098 break; 13099 13100 case PVMFErrCorrupt: 13101 // Just log the error 13102 PVPATB_TEST_IS_TRUE(false); 13103 break; 13104 13105 case PVMFErrProcessing: 13106 // Just log the error 13107 PVPATB_TEST_IS_TRUE(false); 13108 break; 13109 13110 default: 13111 // Unknown error and just log the error 13112 PVPATB_TEST_IS_TRUE(false); 13113 break; 13114 } 13115 } 13116 13117 13118 void pvplayer_async_test_queuedcommands::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 13119 { 13120 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 13121 { 13122 // do nothing 13123 } 13124 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 13125 { 13126 iState = STATE_CLEANUPANDCOMPLETE; 13127 RunIfNotReady(); 13128 } 13129 } 13130 13131 13132 13133 // 13134 // pvplayer_async_test_looping section 13135 // 13136 void pvplayer_async_test_looping::StartTest() 13137 { 13138 AddToScheduler(); 13139 iState = STATE_CREATE; 13140 RunIfNotReady(); 13141 } 13142 13143 13144 void pvplayer_async_test_looping::Run() 13145 { 13146 int error = 0; 13147 13148 switch (iState) 13149 { 13150 case STATE_CREATE: 13151 { 13152 iPlayer = NULL; 13153 13154 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 13155 if (error) 13156 { 13157 PVPATB_TEST_IS_TRUE(false); 13158 iObserver->TestCompleted(*iTestCase); 13159 } 13160 else 13161 { 13162 iState = STATE_STARTPLAYBACK; 13163 RunIfNotReady(); 13164 } 13165 } 13166 break; 13167 13168 case STATE_STARTPLAYBACK: 13169 { 13170 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 13171 OSCL_wHeapString<OsclMemAllocator> inputfilename; 13172 RetrieveFilename(wFileName.get_str(), inputfilename); 13173 13174 // Add the data source 13175 iDataSource = new PVPlayerDataSourceURL; 13176 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 512); 13177 wFileName.set(output, oscl_strlen(output)); 13178 iDataSource->SetDataSourceURL(wFileName); 13179 iDataSource->SetDataSourceFormatType(iFileType); 13180 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 13181 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13182 iCmdIds.push_back(iCurrentCmdId); 13183 // Initialize 13184 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 13185 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13186 iCmdIds.push_back(iCurrentCmdId); 13187 13188 // Add video data sink 13189 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 13190 SinkFileName += _STRLIT_WCHAR("test_player_looping_"); 13191 SinkFileName += inputfilename; 13192 SinkFileName += _STRLIT_WCHAR("_video.dat"); 13193 13194 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & SinkFileName, MEDIATYPE_VIDEO, iCompressedVideo); 13195 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 13196 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 13197 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 13198 13199 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 13200 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13201 iCmdIds.push_back(iCurrentCmdId); 13202 13203 // Add audio data sink 13204 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 13205 SinkFileName += _STRLIT_WCHAR("test_player_looping_"); 13206 SinkFileName += inputfilename; 13207 SinkFileName += _STRLIT_WCHAR("_audio.dat"); 13208 13209 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & SinkFileName, MEDIATYPE_AUDIO, iCompressedAudio); 13210 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 13211 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 13212 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 13213 13214 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 13215 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13216 iCmdIds.push_back(iCurrentCmdId); 13217 13218 // Add text data sink 13219 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 13220 SinkFileName += _STRLIT_WCHAR("test_player_looping_"); 13221 SinkFileName += inputfilename; 13222 SinkFileName += _STRLIT_WCHAR("_text.dat"); 13223 13224 iMIOFileOutText = iMioFactory->CreateTextOutput((OsclAny*) & SinkFileName, MEDIATYPE_TEXT); 13225 iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutText); 13226 iDataSinkText = new PVPlayerDataSinkPVMFNode; 13227 ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText); 13228 13229 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 13230 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13231 iCmdIds.push_back(iCurrentCmdId); 13232 13233 // Prepare 13234 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 13235 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13236 iCmdIds.push_back(iCurrentCmdId); 13237 // Start 13238 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 13239 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13240 iCmdIds.push_back(iCurrentCmdId); 13241 } 13242 break; 13243 13244 case STATE_SETPLAYBACKRANGE1: 13245 { 13246 PVPPlaybackPosition start, end; 13247 start.iIndeterminate = true; 13248 start.iMode = PVPPBPOS_MODE_NOW; 13249 end.iIndeterminate = false; 13250 end.iPosUnit = PVPPBPOSUNIT_MILLISEC; 13251 end.iPosValue.millisec_value = 10000; 13252 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 13253 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13254 iCmdIds.push_back(iCurrentCmdId); 13255 } 13256 break; 13257 13258 case STATE_ENDTIMENOTREACHED1: 13259 { 13260 // Timeout when player doesn't stop automatically when stop time is reached 13261 PVPATB_TEST_IS_TRUE(false); 13262 iState = STATE_CLEANUPANDCOMPLETE; 13263 RunIfNotReady(); 13264 } 13265 break; 13266 13267 case STATE_SETPLAYBACKRANGE2: 13268 { 13269 PVPPlaybackPosition start, end; 13270 start.iIndeterminate = false; 13271 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 13272 start.iMode = PVPPBPOS_MODE_NOW; 13273 start.iPosValue.millisec_value = 0; 13274 end.iIndeterminate = false; 13275 end.iPosUnit = PVPPBPOSUNIT_MILLISEC; 13276 end.iPosValue.millisec_value = 10000; 13277 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 13278 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13279 iCmdIds.push_back(iCurrentCmdId); 13280 } 13281 break; 13282 13283 case STATE_RESUME: 13284 { 13285 // Resume 13286 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 13287 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13288 iCmdIds.push_back(iCurrentCmdId); 13289 } 13290 break; 13291 13292 case STATE_ENDTIMENOTREACHED2: 13293 { 13294 // Timeout when player doesn't stop automatically when stop time is reached 13295 PVPATB_TEST_IS_TRUE(false); 13296 iState = STATE_CLEANUPANDCOMPLETE; 13297 RunIfNotReady(); 13298 } 13299 break; 13300 13301 case STATE_SHUTDOWN: 13302 { 13303 // Stop 13304 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 13305 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13306 iCmdIds.push_back(iCurrentCmdId); 13307 // Remove video data sink 13308 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 13309 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13310 iCmdIds.push_back(iCurrentCmdId); 13311 // Remove audio data sink 13312 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 13313 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13314 iCmdIds.push_back(iCurrentCmdId); 13315 // Remove text data sink 13316 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 13317 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13318 iCmdIds.push_back(iCurrentCmdId); 13319 // Reset 13320 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 13321 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13322 iCmdIds.push_back(iCurrentCmdId); 13323 // Remove data source 13324 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 13325 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13326 iCmdIds.push_back(iCurrentCmdId); 13327 } 13328 break; 13329 13330 case STATE_CLEANUPANDCOMPLETE: 13331 { 13332 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 13333 iPlayer = NULL; 13334 13335 delete iDataSource; 13336 iDataSource = NULL; 13337 13338 delete iDataSinkVideo; 13339 iDataSinkVideo = NULL; 13340 13341 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 13342 iIONodeVideo = NULL; 13343 13344 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 13345 iMIOFileOutVideo = NULL; 13346 13347 delete iDataSinkAudio; 13348 iDataSinkAudio = NULL; 13349 13350 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 13351 iIONodeAudio = NULL; 13352 13353 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 13354 iMIOFileOutAudio = NULL; 13355 13356 delete iDataSinkText; 13357 iDataSinkText = NULL; 13358 13359 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText); 13360 iIONodeText = NULL; 13361 13362 iMioFactory->DestroyTextOutput(iMIOFileOutText); 13363 iMIOFileOutText = NULL; 13364 13365 iObserver->TestCompleted(*iTestCase); 13366 } 13367 break; 13368 13369 default: 13370 break; 13371 13372 } 13373 } 13374 13375 13376 void pvplayer_async_test_looping::CommandCompleted(const PVCmdResponse& aResponse) 13377 { 13378 // Assumes the engine commands are completed in the order they are requested 13379 if (aResponse.GetCmdId() != iCmdIds[0]) 13380 { 13381 // Wrong command ID. 13382 PVPATB_TEST_IS_TRUE(false); 13383 iState = STATE_CLEANUPANDCOMPLETE; 13384 RunIfNotReady(); 13385 return; 13386 } 13387 13388 if (aResponse.GetContext() != NULL) 13389 { 13390 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 13391 { 13392 if (iContextObject != iContextObjectRefValue) 13393 { 13394 // Context data value was corrupted 13395 PVPATB_TEST_IS_TRUE(false); 13396 iState = STATE_CLEANUPANDCOMPLETE; 13397 RunIfNotReady(); 13398 return; 13399 } 13400 } 13401 else 13402 { 13403 // Context data pointer was corrupted 13404 PVPATB_TEST_IS_TRUE(false); 13405 iState = STATE_CLEANUPANDCOMPLETE; 13406 RunIfNotReady(); 13407 return; 13408 } 13409 } 13410 13411 switch (iState) 13412 { 13413 case STATE_STARTPLAYBACK: 13414 if (aResponse.GetCmdStatus() == PVMFSuccess) 13415 { 13416 iCmdIds.erase(iCmdIds.begin()); 13417 if (iCmdIds.empty()) 13418 { 13419 // All requested commands have completed 13420 iState = STATE_SETPLAYBACKRANGE1; 13421 RunIfNotReady(); 13422 } 13423 } 13424 else 13425 { 13426 // One of queued commands failed 13427 PVPATB_TEST_IS_TRUE(false); 13428 iState = STATE_CLEANUPANDCOMPLETE; 13429 RunIfNotReady(); 13430 } 13431 break; 13432 13433 case STATE_SETPLAYBACKRANGE1: 13434 if (aResponse.GetCmdStatus() == PVMFSuccess) 13435 { 13436 iCmdIds.erase(iCmdIds.begin()); 13437 if (iCmdIds.empty()) 13438 { 13439 // All requested commands have completed 13440 iState = STATE_ENDTIMENOTREACHED1; 13441 RunIfNotReady(18000000); 13442 } 13443 } 13444 else 13445 { 13446 // One of queued commands failed 13447 PVPATB_TEST_IS_TRUE(false); 13448 iState = STATE_CLEANUPANDCOMPLETE; 13449 RunIfNotReady(); 13450 } 13451 break; 13452 13453 case STATE_SETPLAYBACKRANGE2: 13454 if (aResponse.GetCmdStatus() == PVMFSuccess) 13455 { 13456 iCmdIds.erase(iCmdIds.begin()); 13457 if (iCmdIds.empty()) 13458 { 13459 // All requested commands have completed 13460 iState = STATE_RESUME; 13461 RunIfNotReady(); 13462 } 13463 } 13464 else 13465 { 13466 // One of queued commands failed 13467 PVPATB_TEST_IS_TRUE(false); 13468 iState = STATE_CLEANUPANDCOMPLETE; 13469 RunIfNotReady(); 13470 } 13471 break; 13472 13473 case STATE_RESUME: 13474 if (aResponse.GetCmdStatus() == PVMFSuccess) 13475 { 13476 iCmdIds.erase(iCmdIds.begin()); 13477 if (iCmdIds.empty()) 13478 { 13479 // All requested commands have completed 13480 iState = STATE_ENDTIMENOTREACHED2; 13481 RunIfNotReady(20000000); 13482 } 13483 } 13484 else 13485 { 13486 // One of queued commands failed 13487 PVPATB_TEST_IS_TRUE(false); 13488 iState = STATE_CLEANUPANDCOMPLETE; 13489 RunIfNotReady(); 13490 } 13491 break; 13492 13493 case STATE_SHUTDOWN: 13494 if (aResponse.GetCmdStatus() == PVMFSuccess) 13495 { 13496 iCmdIds.erase(iCmdIds.begin()); 13497 if (iCmdIds.empty()) 13498 { 13499 // All requested commands have completed 13500 PVPATB_TEST_IS_TRUE(true); 13501 iState = STATE_CLEANUPANDCOMPLETE; 13502 RunIfNotReady(); 13503 } 13504 } 13505 else 13506 { 13507 // One of queued commands failed 13508 PVPATB_TEST_IS_TRUE(false); 13509 iState = STATE_CLEANUPANDCOMPLETE; 13510 RunIfNotReady(); 13511 } 13512 break; 13513 13514 default: 13515 { 13516 // Testing error if this is reached 13517 PVPATB_TEST_IS_TRUE(false); 13518 iState = STATE_CLEANUPANDCOMPLETE; 13519 RunIfNotReady(); 13520 } 13521 break; 13522 } 13523 } 13524 13525 13526 void pvplayer_async_test_looping::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 13527 { 13528 switch (aEvent.GetEventType()) 13529 { 13530 case PVMFErrResourceConfiguration: 13531 // Just log the error 13532 PVPATB_TEST_IS_TRUE(false); 13533 break; 13534 13535 case PVMFErrResource: 13536 // Just log the error 13537 PVPATB_TEST_IS_TRUE(false); 13538 break; 13539 13540 case PVMFErrCorrupt: 13541 // Just log the error 13542 PVPATB_TEST_IS_TRUE(false); 13543 break; 13544 13545 case PVMFErrProcessing: 13546 // Just log the error 13547 PVPATB_TEST_IS_TRUE(false); 13548 break; 13549 13550 default: 13551 // Unknown error and just log the error 13552 PVPATB_TEST_IS_TRUE(false); 13553 break; 13554 } 13555 } 13556 13557 13558 void pvplayer_async_test_looping::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 13559 { 13560 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 13561 { 13562 // do nothing 13563 } 13564 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 13565 { 13566 iState = STATE_CLEANUPANDCOMPLETE; 13567 RunIfNotReady(); 13568 } 13569 // Check for stop time reached event 13570 if (aEvent.GetEventType() == PVMFInfoEndOfData) 13571 { 13572 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 13573 if (iface == NULL) 13574 { 13575 return; 13576 } 13577 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 13578 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 13579 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 13580 { 13581 int32 infocode; 13582 PVUuid infouuid; 13583 infomsgiface->GetCodeUUID(infocode, infouuid); 13584 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoEndTimeReached)) 13585 { 13586 if (iState == STATE_ENDTIMENOTREACHED1) 13587 { 13588 iState = STATE_SETPLAYBACKRANGE2; 13589 } 13590 else if (iState == STATE_ENDTIMENOTREACHED2) 13591 { 13592 iState = STATE_SHUTDOWN; 13593 } 13594 else 13595 { 13596 // Wrong test case state to get this event 13597 PVPATB_TEST_IS_TRUE(false); 13598 iState = STATE_CLEANUPANDCOMPLETE; 13599 } 13600 Cancel(); 13601 RunIfNotReady(); 13602 } 13603 } 13604 } 13605 } 13606 13607 13608 // 13609 // pvplayer_async_test_waitforeos section 13610 // 13611 void pvplayer_async_test_waitforeos::StartTest() 13612 { 13613 AddToScheduler(); 13614 iState = STATE_CREATE; 13615 RunIfNotReady(); 13616 } 13617 13618 13619 void pvplayer_async_test_waitforeos::Run() 13620 { 13621 int error = 0; 13622 13623 switch (iState) 13624 { 13625 case STATE_CREATE: 13626 { 13627 iPlayer = NULL; 13628 13629 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 13630 if (error) 13631 { 13632 PVPATB_TEST_IS_TRUE(false); 13633 iObserver->TestCompleted(*iTestCase); 13634 } 13635 else 13636 { 13637 iState = STATE_ADDDATASOURCE; 13638 RunIfNotReady(); 13639 } 13640 } 13641 break; 13642 13643 case STATE_ADDDATASOURCE: 13644 { 13645 iDataSource = new PVPlayerDataSourceURL; 13646 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 512); 13647 wFileName.set(output, oscl_strlen(output)); 13648 iDataSource->SetDataSourceURL(wFileName); 13649 iDataSource->SetDataSourceFormatType(iFileType); 13650 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 13651 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13652 } 13653 13654 break; 13655 13656 case STATE_INIT: 13657 { 13658 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 13659 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13660 } 13661 break; 13662 13663 case STATE_ADDDATASINK_VIDEO: 13664 { 13665 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 13666 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 13667 SinkFileName += _STRLIT_WCHAR("test_player_waitforeos_"); 13668 OSCL_wHeapString<OsclMemAllocator> inputfilename; 13669 RetrieveFilename(wFileName.get_str(), inputfilename); 13670 SinkFileName += inputfilename; 13671 SinkFileName += _STRLIT_WCHAR("_video.dat"); 13672 13673 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & SinkFileName, MEDIATYPE_VIDEO, iCompressedVideo); 13674 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 13675 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 13676 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 13677 13678 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 13679 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13680 } 13681 break; 13682 13683 case STATE_ADDDATASINK_AUDIO: 13684 { 13685 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 13686 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 13687 SinkFileName += _STRLIT_WCHAR("test_player_waitforeos_"); 13688 OSCL_wHeapString<OsclMemAllocator> inputfilename; 13689 RetrieveFilename(wFileName.get_str(), inputfilename); 13690 SinkFileName += inputfilename; 13691 SinkFileName += _STRLIT_WCHAR("_audio.dat"); 13692 13693 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & SinkFileName, MEDIATYPE_AUDIO, iCompressedAudio); 13694 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 13695 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 13696 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 13697 13698 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 13699 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13700 } 13701 break; 13702 13703 case STATE_ADDDATASINK_TEXT: 13704 { 13705 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 13706 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 13707 SinkFileName += _STRLIT_WCHAR("test_player_waitforeos_"); 13708 OSCL_wHeapString<OsclMemAllocator> inputfilename; 13709 RetrieveFilename(wFileName.get_str(), inputfilename); 13710 SinkFileName += inputfilename; 13711 SinkFileName += _STRLIT_WCHAR("_text.dat"); 13712 13713 iMIOFileOutText = iMioFactory->CreateTextOutput((OsclAny*) & SinkFileName, MEDIATYPE_TEXT); 13714 iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutText); 13715 iDataSinkText = new PVPlayerDataSinkPVMFNode; 13716 ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText); 13717 13718 13719 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 13720 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13721 } 13722 break; 13723 13724 case STATE_PREPARE: 13725 { 13726 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 13727 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13728 } 13729 break; 13730 13731 case STATE_START: 13732 { 13733 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 13734 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13735 } 13736 break; 13737 13738 case STATE_EOSNOTREACHED: 13739 { 13740 // EOS event not received so initiate stop 13741 PVPATB_TEST_IS_TRUE(false); 13742 iState = STATE_STOP; 13743 RunIfNotReady(); 13744 } 13745 break; 13746 13747 case STATE_STOP: 13748 { 13749 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 13750 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13751 } 13752 break; 13753 13754 case STATE_REMOVEDATASINK_VIDEO: 13755 { 13756 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 13757 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13758 } 13759 break; 13760 13761 case STATE_REMOVEDATASINK_AUDIO: 13762 { 13763 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 13764 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13765 } 13766 break; 13767 13768 case STATE_REMOVEDATASINK_TEXT: 13769 { 13770 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 13771 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13772 } 13773 break; 13774 13775 case STATE_RESET: 13776 { 13777 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 13778 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13779 } 13780 break; 13781 13782 case STATE_REMOVEDATASOURCE: 13783 { 13784 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 13785 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 13786 } 13787 break; 13788 13789 case STATE_CLEANUPANDCOMPLETE: 13790 { 13791 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 13792 iPlayer = NULL; 13793 13794 delete iDataSource; 13795 iDataSource = NULL; 13796 13797 delete iDataSinkVideo; 13798 iDataSinkVideo = NULL; 13799 13800 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 13801 iIONodeVideo = NULL; 13802 13803 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 13804 iMIOFileOutVideo = NULL; 13805 13806 delete iDataSinkAudio; 13807 iDataSinkAudio = NULL; 13808 13809 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 13810 iIONodeAudio = NULL; 13811 13812 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 13813 iMIOFileOutAudio = NULL; 13814 13815 delete iDataSinkText; 13816 iDataSinkText = NULL; 13817 13818 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText); 13819 iIONodeText = NULL; 13820 13821 iMioFactory->DestroyTextOutput(iMIOFileOutText); 13822 iMIOFileOutText = NULL; 13823 13824 iObserver->TestCompleted(*iTestCase); 13825 } 13826 break; 13827 13828 default: 13829 break; 13830 13831 } 13832 } 13833 13834 13835 void pvplayer_async_test_waitforeos::CommandCompleted(const PVCmdResponse& aResponse) 13836 { 13837 if (aResponse.GetCmdId() != iCurrentCmdId) 13838 { 13839 // Wrong command ID. 13840 PVPATB_TEST_IS_TRUE(false); 13841 iState = STATE_CLEANUPANDCOMPLETE; 13842 RunIfNotReady(); 13843 return; 13844 } 13845 13846 if (aResponse.GetContext() != NULL) 13847 { 13848 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 13849 { 13850 if (iContextObject != iContextObjectRefValue) 13851 { 13852 // Context data value was corrupted 13853 PVPATB_TEST_IS_TRUE(false); 13854 iState = STATE_CLEANUPANDCOMPLETE; 13855 RunIfNotReady(); 13856 return; 13857 } 13858 } 13859 else 13860 { 13861 // Context data pointer was corrupted 13862 PVPATB_TEST_IS_TRUE(false); 13863 iState = STATE_CLEANUPANDCOMPLETE; 13864 RunIfNotReady(); 13865 return; 13866 } 13867 } 13868 13869 switch (iState) 13870 { 13871 case STATE_ADDDATASOURCE: 13872 if (aResponse.GetCmdStatus() == PVMFSuccess) 13873 { 13874 iState = STATE_INIT; 13875 RunIfNotReady(); 13876 } 13877 else 13878 { 13879 // AddDataSource failed 13880 PVPATB_TEST_IS_TRUE(false); 13881 iState = STATE_CLEANUPANDCOMPLETE; 13882 RunIfNotReady(); 13883 } 13884 break; 13885 13886 case STATE_INIT: 13887 if (aResponse.GetCmdStatus() == PVMFSuccess) 13888 { 13889 iState = STATE_ADDDATASINK_VIDEO; 13890 RunIfNotReady(); 13891 } 13892 else 13893 { 13894 // Init failed 13895 PVPATB_TEST_IS_TRUE(false); 13896 iState = STATE_CLEANUPANDCOMPLETE; 13897 RunIfNotReady(); 13898 } 13899 break; 13900 13901 case STATE_ADDDATASINK_VIDEO: 13902 if (aResponse.GetCmdStatus() == PVMFSuccess) 13903 { 13904 iState = STATE_ADDDATASINK_AUDIO; 13905 RunIfNotReady(); 13906 } 13907 else 13908 { 13909 // AddDataSink failed 13910 PVPATB_TEST_IS_TRUE(false); 13911 iState = STATE_CLEANUPANDCOMPLETE; 13912 RunIfNotReady(); 13913 } 13914 break; 13915 13916 case STATE_ADDDATASINK_AUDIO: 13917 if (aResponse.GetCmdStatus() == PVMFSuccess) 13918 { 13919 iState = STATE_ADDDATASINK_TEXT; 13920 RunIfNotReady(); 13921 } 13922 else 13923 { 13924 // AddDataSink failed 13925 PVPATB_TEST_IS_TRUE(false); 13926 iState = STATE_CLEANUPANDCOMPLETE; 13927 RunIfNotReady(); 13928 } 13929 break; 13930 13931 case STATE_ADDDATASINK_TEXT: 13932 if (aResponse.GetCmdStatus() == PVMFSuccess) 13933 { 13934 iState = STATE_PREPARE; 13935 RunIfNotReady(); 13936 } 13937 else 13938 { 13939 // AddDataSink failed 13940 PVPATB_TEST_IS_TRUE(false); 13941 iState = STATE_CLEANUPANDCOMPLETE; 13942 RunIfNotReady(); 13943 } 13944 break; 13945 13946 case STATE_PREPARE: 13947 if (aResponse.GetCmdStatus() == PVMFSuccess) 13948 { 13949 iState = STATE_START; 13950 RunIfNotReady(); 13951 } 13952 else 13953 { 13954 // Prepare failed 13955 PVPATB_TEST_IS_TRUE(false); 13956 iState = STATE_CLEANUPANDCOMPLETE; 13957 RunIfNotReady(); 13958 } 13959 break; 13960 13961 case STATE_START: 13962 if (aResponse.GetCmdStatus() == PVMFSuccess) 13963 { 13964 iState = STATE_EOSNOTREACHED; 13965 RunIfNotReady(500000000); 13966 } 13967 else 13968 { 13969 // Start failed 13970 PVPATB_TEST_IS_TRUE(false); 13971 iState = STATE_CLEANUPANDCOMPLETE; 13972 RunIfNotReady(); 13973 } 13974 break; 13975 13976 case STATE_STOP: 13977 if (aResponse.GetCmdStatus() == PVMFSuccess) 13978 { 13979 iState = STATE_REMOVEDATASINK_VIDEO; 13980 RunIfNotReady(); 13981 } 13982 else 13983 { 13984 // Stop failed 13985 PVPATB_TEST_IS_TRUE(false); 13986 iState = STATE_CLEANUPANDCOMPLETE; 13987 RunIfNotReady(); 13988 } 13989 break; 13990 13991 case STATE_REMOVEDATASINK_VIDEO: 13992 if (aResponse.GetCmdStatus() == PVMFSuccess) 13993 { 13994 iState = STATE_REMOVEDATASINK_AUDIO; 13995 RunIfNotReady(); 13996 } 13997 else 13998 { 13999 // RemoveDataSink failed 14000 PVPATB_TEST_IS_TRUE(false); 14001 iState = STATE_CLEANUPANDCOMPLETE; 14002 RunIfNotReady(); 14003 } 14004 break; 14005 14006 case STATE_REMOVEDATASINK_AUDIO: 14007 if (aResponse.GetCmdStatus() == PVMFSuccess) 14008 { 14009 iState = STATE_REMOVEDATASINK_TEXT; 14010 RunIfNotReady(); 14011 } 14012 else 14013 { 14014 // RemoveDataSink failed 14015 PVPATB_TEST_IS_TRUE(false); 14016 iState = STATE_CLEANUPANDCOMPLETE; 14017 RunIfNotReady(); 14018 } 14019 break; 14020 14021 case STATE_REMOVEDATASINK_TEXT: 14022 if (aResponse.GetCmdStatus() == PVMFSuccess) 14023 { 14024 iState = STATE_RESET; 14025 RunIfNotReady(); 14026 } 14027 else 14028 { 14029 // RemoveDataSink failed 14030 PVPATB_TEST_IS_TRUE(false); 14031 iState = STATE_CLEANUPANDCOMPLETE; 14032 RunIfNotReady(); 14033 } 14034 break; 14035 14036 case STATE_RESET: 14037 if (aResponse.GetCmdStatus() == PVMFSuccess) 14038 { 14039 iState = STATE_REMOVEDATASOURCE; 14040 RunIfNotReady(); 14041 } 14042 else 14043 { 14044 // Reset failed 14045 PVPATB_TEST_IS_TRUE(false); 14046 iState = STATE_CLEANUPANDCOMPLETE; 14047 RunIfNotReady(); 14048 } 14049 break; 14050 14051 case STATE_REMOVEDATASOURCE: 14052 if (aResponse.GetCmdStatus() == PVMFSuccess) 14053 { 14054 PVPATB_TEST_IS_TRUE(true); 14055 iState = STATE_CLEANUPANDCOMPLETE; 14056 RunIfNotReady(); 14057 } 14058 else 14059 { 14060 // RemoveDataSource failed 14061 PVPATB_TEST_IS_TRUE(false); 14062 iState = STATE_CLEANUPANDCOMPLETE; 14063 RunIfNotReady(); 14064 } 14065 break; 14066 14067 default: 14068 { 14069 // Testing error if this is reached 14070 PVPATB_TEST_IS_TRUE(false); 14071 iState = STATE_CLEANUPANDCOMPLETE; 14072 RunIfNotReady(); 14073 } 14074 break; 14075 } 14076 } 14077 14078 14079 void pvplayer_async_test_waitforeos::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 14080 { 14081 switch (aEvent.GetEventType()) 14082 { 14083 case PVMFErrResourceConfiguration: 14084 // Just log the error 14085 PVPATB_TEST_IS_TRUE(false); 14086 break; 14087 14088 case PVMFErrResource: 14089 // Just log the error 14090 PVPATB_TEST_IS_TRUE(false); 14091 break; 14092 14093 case PVMFErrCorrupt: 14094 // Just log the error 14095 PVPATB_TEST_IS_TRUE(false); 14096 break; 14097 14098 case PVMFErrProcessing: 14099 // Just log the error 14100 PVPATB_TEST_IS_TRUE(false); 14101 break; 14102 14103 default: 14104 // Unknown error and just log the error 14105 PVPATB_TEST_IS_TRUE(false); 14106 break; 14107 } 14108 } 14109 14110 14111 void pvplayer_async_test_waitforeos::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 14112 { 14113 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 14114 { 14115 // do nothing 14116 } 14117 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 14118 { 14119 iState = STATE_CLEANUPANDCOMPLETE; 14120 RunIfNotReady(); 14121 } 14122 // Check for stop time reached event 14123 if (aEvent.GetEventType() == PVMFInfoEndOfData) 14124 { 14125 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 14126 if (iface == NULL) 14127 { 14128 return; 14129 } 14130 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 14131 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 14132 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 14133 { 14134 int32 infocode; 14135 PVUuid infouuid; 14136 infomsgiface->GetCodeUUID(infocode, infouuid); 14137 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoEndOfClipReached)) 14138 { 14139 iState = STATE_STOP; 14140 Cancel(); 14141 RunIfNotReady(); 14142 } 14143 } 14144 } 14145 } 14146 14147 14148 14149 // 14150 // pvplayer_async_test_multipauseresume section 14151 // 14152 void pvplayer_async_test_multipauseresume::StartTest() 14153 { 14154 AddToScheduler(); 14155 iState = STATE_CREATE; 14156 RunIfNotReady(); 14157 } 14158 14159 14160 void pvplayer_async_test_multipauseresume::Run() 14161 { 14162 int error = 0; 14163 14164 switch (iState) 14165 { 14166 case STATE_CREATE: 14167 { 14168 iPlayer = NULL; 14169 14170 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 14171 if (error) 14172 { 14173 PVPATB_TEST_IS_TRUE(false); 14174 iObserver->TestCompleted(*iTestCase); 14175 } 14176 else 14177 { 14178 iState = STATE_STARTPLAYBACK; 14179 RunIfNotReady(); 14180 } 14181 } 14182 break; 14183 14184 case STATE_STARTPLAYBACK: 14185 { 14186 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 14187 OSCL_wHeapString<OsclMemAllocator> inputfilename; 14188 14189 // Add the data source 14190 iDataSource = new PVPlayerDataSourceURL; 14191 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 512); 14192 wFileName.set(output, oscl_strlen(output)); 14193 RetrieveFilename(wFileName.get_str(), inputfilename); 14194 iDataSource->SetDataSourceURL(wFileName); 14195 iDataSource->SetDataSourceFormatType(iFileType); 14196 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 14197 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14198 iCmdIds.push_back(iCurrentCmdId); 14199 // Initialize 14200 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 14201 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14202 iCmdIds.push_back(iCurrentCmdId); 14203 14204 // Add video data sink 14205 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 14206 SinkFileName += _STRLIT_WCHAR("test_player_multipauseresume_"); 14207 SinkFileName += inputfilename; 14208 SinkFileName += _STRLIT_WCHAR("_video.dat"); 14209 14210 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & SinkFileName, MEDIATYPE_VIDEO, iCompressedVideo); 14211 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 14212 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 14213 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 14214 14215 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 14216 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14217 iCmdIds.push_back(iCurrentCmdId); 14218 14219 // Add audio data sink 14220 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 14221 SinkFileName += _STRLIT_WCHAR("test_player_multipauseresume_"); 14222 SinkFileName += inputfilename; 14223 SinkFileName += _STRLIT_WCHAR("_audio.dat"); 14224 14225 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & SinkFileName, MEDIATYPE_AUDIO, iCompressedAudio); 14226 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 14227 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 14228 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 14229 14230 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 14231 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14232 iCmdIds.push_back(iCurrentCmdId); 14233 14234 // Add text data sink 14235 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 14236 SinkFileName += _STRLIT_WCHAR("test_player_multipauseresume_"); 14237 SinkFileName += inputfilename; 14238 SinkFileName += _STRLIT_WCHAR("_text.dat"); 14239 14240 iMIOFileOutText = iMioFactory->CreateTextOutput((OsclAny*) & SinkFileName, MEDIATYPE_TEXT); 14241 iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutText); 14242 iDataSinkText = new PVPlayerDataSinkPVMFNode; 14243 ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText); 14244 14245 14246 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 14247 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14248 iCmdIds.push_back(iCurrentCmdId); 14249 14250 // Prepare 14251 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 14252 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14253 iCmdIds.push_back(iCurrentCmdId); 14254 // Start 14255 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 14256 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14257 iCmdIds.push_back(iCurrentCmdId); 14258 } 14259 break; 14260 14261 case STATE_PAUSERESUME1: 14262 { 14263 // Pause 14264 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 14265 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14266 iCmdIds.push_back(iCurrentCmdId); 14267 // Resume 14268 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 14269 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14270 iCmdIds.push_back(iCurrentCmdId); 14271 // Pause 14272 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 14273 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14274 iCmdIds.push_back(iCurrentCmdId); 14275 // Resume 14276 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 14277 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14278 iCmdIds.push_back(iCurrentCmdId); 14279 // Pause 14280 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 14281 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14282 iCmdIds.push_back(iCurrentCmdId); 14283 // Resume 14284 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 14285 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14286 iCmdIds.push_back(iCurrentCmdId); 14287 // Pause 14288 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 14289 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14290 iCmdIds.push_back(iCurrentCmdId); 14291 // Resume 14292 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 14293 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14294 iCmdIds.push_back(iCurrentCmdId); 14295 // Pause 14296 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 14297 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14298 iCmdIds.push_back(iCurrentCmdId); 14299 // Resume 14300 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 14301 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14302 iCmdIds.push_back(iCurrentCmdId); 14303 } 14304 break; 14305 14306 case STATE_PAUSE: 14307 { 14308 // Pause 14309 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 14310 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 14311 iCmdIds.push_back(iCurrentCmdId); 14312 } 14313 break; 14314 14315 case STATE_RESUME: 14316 { 14317 // Resume 14318 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 14319 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 14320 iCmdIds.push_back(iCurrentCmdId); 14321 } 14322 break; 14323 14324 case STATE_PAUSERESUME2: 14325 { 14326 // Pause 14327 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 14328 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14329 iCmdIds.push_back(iCurrentCmdId); 14330 // Resume 14331 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 14332 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14333 iCmdIds.push_back(iCurrentCmdId); 14334 // Pause 14335 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 14336 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14337 iCmdIds.push_back(iCurrentCmdId); 14338 // Resume 14339 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 14340 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14341 iCmdIds.push_back(iCurrentCmdId); 14342 // Pause 14343 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 14344 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14345 iCmdIds.push_back(iCurrentCmdId); 14346 // Resume 14347 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 14348 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14349 iCmdIds.push_back(iCurrentCmdId); 14350 } 14351 break; 14352 14353 case STATE_SHUTDOWN: 14354 { 14355 // Stop 14356 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 14357 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14358 iCmdIds.push_back(iCurrentCmdId); 14359 // Remove video data sink 14360 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 14361 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14362 iCmdIds.push_back(iCurrentCmdId); 14363 // Remove audio data sink 14364 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 14365 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14366 iCmdIds.push_back(iCurrentCmdId); 14367 // Remove text data sink 14368 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 14369 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14370 iCmdIds.push_back(iCurrentCmdId); 14371 // Reset 14372 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 14373 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14374 iCmdIds.push_back(iCurrentCmdId); 14375 // Remove data source 14376 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 14377 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14378 iCmdIds.push_back(iCurrentCmdId); 14379 } 14380 break; 14381 14382 case STATE_CLEANUPANDCOMPLETE: 14383 { 14384 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 14385 iPlayer = NULL; 14386 14387 delete iDataSource; 14388 iDataSource = NULL; 14389 14390 delete iDataSinkVideo; 14391 iDataSinkVideo = NULL; 14392 14393 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 14394 iIONodeVideo = NULL; 14395 14396 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 14397 iMIOFileOutVideo = NULL; 14398 14399 delete iDataSinkAudio; 14400 iDataSinkAudio = NULL; 14401 14402 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 14403 iIONodeAudio = NULL; 14404 14405 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 14406 iMIOFileOutAudio = NULL; 14407 14408 delete iDataSinkText; 14409 iDataSinkText = NULL; 14410 14411 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText); 14412 iIONodeText = NULL; 14413 14414 iMioFactory->DestroyTextOutput(iMIOFileOutText); 14415 iMIOFileOutText = NULL; 14416 14417 iObserver->TestCompleted(*iTestCase); 14418 } 14419 break; 14420 14421 default: 14422 break; 14423 14424 } 14425 } 14426 14427 14428 void pvplayer_async_test_multipauseresume::CommandCompleted(const PVCmdResponse& aResponse) 14429 { 14430 // Assumes the engine commands are completed in the order they are requested 14431 if (aResponse.GetCmdId() != iCmdIds[0]) 14432 { 14433 // Wrong command ID. 14434 PVPATB_TEST_IS_TRUE(false); 14435 iState = STATE_CLEANUPANDCOMPLETE; 14436 RunIfNotReady(); 14437 return; 14438 } 14439 14440 if (aResponse.GetContext() != NULL) 14441 { 14442 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 14443 { 14444 if (iContextObject != iContextObjectRefValue) 14445 { 14446 // Context data value was corrupted 14447 PVPATB_TEST_IS_TRUE(false); 14448 iState = STATE_CLEANUPANDCOMPLETE; 14449 RunIfNotReady(); 14450 return; 14451 } 14452 } 14453 else 14454 { 14455 // Context data pointer was corrupted 14456 PVPATB_TEST_IS_TRUE(false); 14457 iState = STATE_CLEANUPANDCOMPLETE; 14458 RunIfNotReady(); 14459 return; 14460 } 14461 } 14462 14463 switch (iState) 14464 { 14465 case STATE_STARTPLAYBACK: 14466 if (aResponse.GetCmdStatus() == PVMFSuccess) 14467 { 14468 iCmdIds.erase(iCmdIds.begin()); 14469 if (iCmdIds.empty()) 14470 { 14471 // All requested commands have completed 14472 iState = STATE_PAUSERESUME1; 14473 RunIfNotReady(5000000); 14474 } 14475 } 14476 else 14477 { 14478 // One of queued commands failed 14479 PVPATB_TEST_IS_TRUE(false); 14480 iState = STATE_CLEANUPANDCOMPLETE; 14481 RunIfNotReady(); 14482 } 14483 break; 14484 14485 case STATE_PAUSERESUME1: 14486 if (aResponse.GetCmdStatus() == PVMFSuccess) 14487 { 14488 iCmdIds.erase(iCmdIds.begin()); 14489 if (iCmdIds.empty()) 14490 { 14491 // All requested commands have completed 14492 iState = STATE_PAUSE; 14493 RunIfNotReady(2000000); 14494 } 14495 } 14496 else 14497 { 14498 // One of queued commands failed 14499 PVPATB_TEST_IS_TRUE(false); 14500 iState = STATE_CLEANUPANDCOMPLETE; 14501 RunIfNotReady(); 14502 } 14503 break; 14504 14505 case STATE_PAUSE: 14506 if (aResponse.GetCmdStatus() == PVMFSuccess) 14507 { 14508 iCmdIds.erase(iCmdIds.begin()); 14509 if (iCmdIds.empty()) 14510 { 14511 // All requested commands have completed 14512 iState = STATE_RESUME; 14513 RunIfNotReady(5000000); 14514 } 14515 } 14516 else 14517 { 14518 // One of queued commands failed 14519 PVPATB_TEST_IS_TRUE(false); 14520 iState = STATE_CLEANUPANDCOMPLETE; 14521 RunIfNotReady(); 14522 } 14523 break; 14524 14525 case STATE_RESUME: 14526 if (aResponse.GetCmdStatus() == PVMFSuccess) 14527 { 14528 iCmdIds.erase(iCmdIds.begin()); 14529 if (iCmdIds.empty()) 14530 { 14531 // All requested commands have completed 14532 iState = STATE_PAUSERESUME2; 14533 RunIfNotReady(3000000); 14534 } 14535 } 14536 else 14537 { 14538 // One of queued commands failed 14539 PVPATB_TEST_IS_TRUE(false); 14540 iState = STATE_CLEANUPANDCOMPLETE; 14541 RunIfNotReady(); 14542 } 14543 break; 14544 14545 case STATE_PAUSERESUME2: 14546 if (aResponse.GetCmdStatus() == PVMFSuccess) 14547 { 14548 iCmdIds.erase(iCmdIds.begin()); 14549 if (iCmdIds.empty()) 14550 { 14551 // All requested commands have completed 14552 iState = STATE_SHUTDOWN; 14553 RunIfNotReady(5000000); 14554 } 14555 } 14556 else 14557 { 14558 // One of queued commands failed 14559 PVPATB_TEST_IS_TRUE(false); 14560 iState = STATE_CLEANUPANDCOMPLETE; 14561 RunIfNotReady(); 14562 } 14563 break; 14564 14565 case STATE_SHUTDOWN: 14566 if (aResponse.GetCmdStatus() == PVMFSuccess) 14567 { 14568 iCmdIds.erase(iCmdIds.begin()); 14569 if (iCmdIds.empty()) 14570 { 14571 // All requested commands have completed 14572 PVPATB_TEST_IS_TRUE(true); 14573 iState = STATE_CLEANUPANDCOMPLETE; 14574 RunIfNotReady(); 14575 } 14576 } 14577 else 14578 { 14579 // One of queued commands failed 14580 PVPATB_TEST_IS_TRUE(false); 14581 iState = STATE_CLEANUPANDCOMPLETE; 14582 RunIfNotReady(); 14583 } 14584 break; 14585 14586 default: 14587 { 14588 // Testing error if this is reached 14589 PVPATB_TEST_IS_TRUE(false); 14590 iState = STATE_CLEANUPANDCOMPLETE; 14591 RunIfNotReady(); 14592 } 14593 break; 14594 } 14595 } 14596 14597 14598 void pvplayer_async_test_multipauseresume::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 14599 { 14600 switch (aEvent.GetEventType()) 14601 { 14602 case PVMFErrResourceConfiguration: 14603 // Just log the error 14604 PVPATB_TEST_IS_TRUE(false); 14605 break; 14606 14607 case PVMFErrResource: 14608 // Just log the error 14609 PVPATB_TEST_IS_TRUE(false); 14610 break; 14611 14612 case PVMFErrCorrupt: 14613 // Just log the error 14614 PVPATB_TEST_IS_TRUE(false); 14615 break; 14616 14617 case PVMFErrProcessing: 14618 // Just log the error 14619 PVPATB_TEST_IS_TRUE(false); 14620 break; 14621 14622 default: 14623 // Unknown error and just log the error 14624 PVPATB_TEST_IS_TRUE(false); 14625 break; 14626 } 14627 14628 // Wait for engine to handle the error 14629 Cancel(); 14630 } 14631 14632 14633 void pvplayer_async_test_multipauseresume::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 14634 { 14635 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 14636 { 14637 // do nothing 14638 } 14639 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 14640 { 14641 iState = STATE_CLEANUPANDCOMPLETE; 14642 RunIfNotReady(); 14643 } 14644 } 14645 14646 14647 // 14648 // pvplayer_async_test_multireposition section 14649 // 14650 void pvplayer_async_test_multireposition::StartTest() 14651 { 14652 AddToScheduler(); 14653 iState = STATE_CREATE; 14654 RunIfNotReady(); 14655 } 14656 14657 14658 void pvplayer_async_test_multireposition::Run() 14659 { 14660 int error = 0; 14661 14662 switch (iState) 14663 { 14664 case STATE_CREATE: 14665 { 14666 iPlayer = NULL; 14667 14668 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 14669 if (error) 14670 { 14671 PVPATB_TEST_IS_TRUE(false); 14672 iObserver->TestCompleted(*iTestCase); 14673 } 14674 else 14675 { 14676 iState = STATE_STARTPLAYBACK; 14677 RunIfNotReady(); 14678 } 14679 } 14680 break; 14681 14682 case STATE_STARTPLAYBACK: 14683 { 14684 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 14685 OSCL_wHeapString<OsclMemAllocator> inputfilename; 14686 14687 // Add the data source 14688 iDataSource = new PVPlayerDataSourceURL; 14689 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 512); 14690 wFileName.set(output, oscl_strlen(output)); 14691 RetrieveFilename(wFileName.get_str(), inputfilename); 14692 iDataSource->SetDataSourceURL(wFileName); 14693 iDataSource->SetDataSourceFormatType(iFileType); 14694 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 14695 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14696 iCmdIds.push_back(iCurrentCmdId); 14697 14698 // Open file to log reposition times 14699 iFS.Connect(); 14700 14701 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 14702 SinkFileName += _STRLIT_WCHAR("test_player_multireposition_"); 14703 SinkFileName += inputfilename; 14704 SinkFileName += _STRLIT_WCHAR("_repositiontime.dat"); 14705 14706 if (iTimeLogFile.Open(SinkFileName.get_str(), Oscl_File::MODE_READWRITE | Oscl_File::MODE_TEXT, iFS)) 14707 { 14708 PVPATB_TEST_IS_TRUE(false); 14709 iState = STATE_CLEANUPANDCOMPLETE; 14710 RunIfNotReady(); 14711 break; 14712 } 14713 // Initialize 14714 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 14715 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14716 iCmdIds.push_back(iCurrentCmdId); 14717 14718 // Add video data sink 14719 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 14720 SinkFileName += _STRLIT_WCHAR("test_player_multireposition_"); 14721 SinkFileName += inputfilename; 14722 SinkFileName += _STRLIT_WCHAR("_video.dat"); 14723 14724 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & SinkFileName, MEDIATYPE_VIDEO, iCompressedVideo); 14725 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 14726 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 14727 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 14728 14729 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 14730 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14731 iCmdIds.push_back(iCurrentCmdId); 14732 14733 // Add audio data sink 14734 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 14735 SinkFileName += _STRLIT_WCHAR("test_player_multireposition_"); 14736 SinkFileName += inputfilename; 14737 SinkFileName += _STRLIT_WCHAR("_audio.dat"); 14738 14739 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & SinkFileName, MEDIATYPE_AUDIO, iCompressedAudio); 14740 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 14741 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 14742 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 14743 14744 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 14745 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14746 iCmdIds.push_back(iCurrentCmdId); 14747 14748 // Add text data sink 14749 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 14750 SinkFileName += _STRLIT_WCHAR("test_player_multireposition_"); 14751 SinkFileName += inputfilename; 14752 SinkFileName += _STRLIT_WCHAR("_text.dat"); 14753 14754 iMIOFileOutText = iMioFactory->CreateTextOutput((OsclAny*) & SinkFileName, MEDIATYPE_TEXT); 14755 iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutText); 14756 iDataSinkText = new PVPlayerDataSinkPVMFNode; 14757 ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText); 14758 14759 14760 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 14761 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14762 iCmdIds.push_back(iCurrentCmdId); 14763 14764 // Prepare 14765 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 14766 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14767 iCmdIds.push_back(iCurrentCmdId); 14768 14769 // Start 14770 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 14771 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14772 iCmdIds.push_back(iCurrentCmdId); 14773 } 14774 break; 14775 14776 case STATE_SETPLAYBACKRANGE1: 14777 { 14778 // Reposition 14779 PVPPlaybackPosition start, end; 14780 start.iIndeterminate = false; 14781 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 14782 start.iMode = PVPPBPOS_MODE_NOW; 14783 start.iPosValue.millisec_value = 20000; 14784 end.iIndeterminate = true; 14785 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 14786 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 14787 iCmdIds.push_back(iCurrentCmdId); 14788 14789 char outstr[128]; 14790 oscl_snprintf(outstr, 128, "SetPlaybackRange() called; Start time 20 sec; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 14791 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 14792 iTimeLogFile.Flush(); 14793 } 14794 break; 14795 14796 case STATE_SETPLAYBACKRANGE2: 14797 { 14798 // Reposition 14799 PVPPlaybackPosition start, end; 14800 start.iIndeterminate = false; 14801 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 14802 start.iMode = PVPPBPOS_MODE_NOW; 14803 start.iPosValue.millisec_value = 5000; 14804 end.iIndeterminate = true; 14805 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 14806 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 14807 iCmdIds.push_back(iCurrentCmdId); 14808 14809 char outstr[128]; 14810 oscl_snprintf(outstr, 128, "SetPlaybackRange() called; Start time 5 sec; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 14811 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 14812 iTimeLogFile.Flush(); 14813 } 14814 break; 14815 14816 case STATE_SETPLAYBACKRANGE3: 14817 { 14818 // Reposition 14819 PVPPlaybackPosition start, end; 14820 start.iIndeterminate = false; 14821 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 14822 start.iMode = PVPPBPOS_MODE_NOW; 14823 start.iPosValue.millisec_value = 25000; 14824 end.iIndeterminate = true; 14825 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 14826 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 14827 iCmdIds.push_back(iCurrentCmdId); 14828 14829 char outstr[128]; 14830 oscl_snprintf(outstr, 128, "SetPlaybackRange() called; Start time 25 sec; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 14831 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 14832 iTimeLogFile.Flush(); 14833 } 14834 break; 14835 14836 case STATE_SETPLAYBACKRANGE4: 14837 { 14838 // Reposition 14839 PVPPlaybackPosition start, end; 14840 start.iIndeterminate = false; 14841 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 14842 start.iMode = PVPPBPOS_MODE_NOW; 14843 start.iPosValue.millisec_value = 10000; 14844 end.iIndeterminate = true; 14845 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 14846 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 14847 iCmdIds.push_back(iCurrentCmdId); 14848 14849 char outstr[128]; 14850 oscl_snprintf(outstr, 128, "SetPlaybackRange() called; Start time 10 sec; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 14851 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 14852 iTimeLogFile.Flush(); 14853 } 14854 break; 14855 14856 case STATE_SETPLAYBACKRANGE5: 14857 { 14858 // Reposition 14859 PVPPlaybackPosition start, end; 14860 start.iIndeterminate = false; 14861 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 14862 start.iMode = PVPPBPOS_MODE_NOW; 14863 start.iPosValue.millisec_value = 20000; 14864 end.iIndeterminate = true; 14865 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 14866 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 14867 iCmdIds.push_back(iCurrentCmdId); 14868 14869 char outstr[128]; 14870 oscl_snprintf(outstr, 128, "SetPlaybackRange() called; Start time 20 sec; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 14871 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 14872 iTimeLogFile.Flush(); 14873 } 14874 break; 14875 14876 case STATE_SETPLAYBACKRANGE6: 14877 { 14878 // Reposition 14879 PVPPlaybackPosition start, end; 14880 start.iIndeterminate = false; 14881 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 14882 start.iMode = PVPPBPOS_MODE_NOW; 14883 start.iPosValue.millisec_value = 0; 14884 end.iIndeterminate = true; 14885 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 14886 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 14887 iCmdIds.push_back(iCurrentCmdId); 14888 14889 char outstr[128]; 14890 oscl_snprintf(outstr, 128, "SetPlaybackRange() called; Start time 0 sec; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 14891 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 14892 iTimeLogFile.Flush(); 14893 } 14894 break; 14895 14896 case STATE_SHUTDOWN: 14897 { 14898 // Close the reposition log time file 14899 iTimeLogFile.Close(); 14900 iFS.Close(); 14901 // Stop 14902 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 14903 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14904 iCmdIds.push_back(iCurrentCmdId); 14905 // Remove video data sink 14906 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 14907 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14908 iCmdIds.push_back(iCurrentCmdId); 14909 // Remove audio data sink 14910 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 14911 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14912 iCmdIds.push_back(iCurrentCmdId); 14913 // Remove text data sink 14914 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 14915 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14916 iCmdIds.push_back(iCurrentCmdId); 14917 // Reset 14918 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 14919 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14920 iCmdIds.push_back(iCurrentCmdId); 14921 // Remove data source 14922 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 14923 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady(); break); 14924 iCmdIds.push_back(iCurrentCmdId); 14925 } 14926 break; 14927 14928 case STATE_CLEANUPANDCOMPLETE: 14929 { 14930 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 14931 iPlayer = NULL; 14932 14933 delete iDataSource; 14934 iDataSource = NULL; 14935 14936 delete iDataSinkVideo; 14937 iDataSinkVideo = NULL; 14938 14939 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 14940 iIONodeVideo = NULL; 14941 14942 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 14943 iMIOFileOutVideo = NULL; 14944 14945 delete iDataSinkAudio; 14946 iDataSinkAudio = NULL; 14947 14948 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 14949 iIONodeAudio = NULL; 14950 14951 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 14952 iMIOFileOutAudio = NULL; 14953 14954 delete iDataSinkText; 14955 iDataSinkText = NULL; 14956 14957 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText); 14958 iIONodeText = NULL; 14959 14960 iMioFactory->DestroyTextOutput(iMIOFileOutText); 14961 iMIOFileOutText = NULL; 14962 14963 iObserver->TestCompleted(*iTestCase); 14964 } 14965 break; 14966 14967 default: 14968 break; 14969 14970 } 14971 } 14972 14973 14974 void pvplayer_async_test_multireposition::CommandCompleted(const PVCmdResponse& aResponse) 14975 { 14976 // Assumes the engine commands are completed in the order they are requested 14977 if (aResponse.GetCmdId() != iCmdIds[0]) 14978 { 14979 // Wrong command ID. 14980 PVPATB_TEST_IS_TRUE(false); 14981 iState = STATE_CLEANUPANDCOMPLETE; 14982 RunIfNotReady(); 14983 return; 14984 } 14985 14986 if (aResponse.GetContext() != NULL) 14987 { 14988 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 14989 { 14990 if (iContextObject != iContextObjectRefValue) 14991 { 14992 // Context data value was corrupted 14993 PVPATB_TEST_IS_TRUE(false); 14994 iState = STATE_CLEANUPANDCOMPLETE; 14995 RunIfNotReady(); 14996 return; 14997 } 14998 } 14999 else 15000 { 15001 // Context data pointer was corrupted 15002 PVPATB_TEST_IS_TRUE(false); 15003 iState = STATE_CLEANUPANDCOMPLETE; 15004 RunIfNotReady(); 15005 return; 15006 } 15007 } 15008 15009 switch (iState) 15010 { 15011 case STATE_STARTPLAYBACK: 15012 if (aResponse.GetCmdStatus() == PVMFSuccess) 15013 { 15014 iCmdIds.erase(iCmdIds.begin()); 15015 if (iCmdIds.empty()) 15016 { 15017 // All requested commands have completed 15018 iState = STATE_SETPLAYBACKRANGE1; 15019 RunIfNotReady(5000000); 15020 } 15021 } 15022 else 15023 { 15024 // One of queued commands failed 15025 PVPATB_TEST_IS_TRUE(false); 15026 iState = STATE_CLEANUPANDCOMPLETE; 15027 RunIfNotReady(); 15028 } 15029 break; 15030 15031 case STATE_SETPLAYBACKRANGE1: 15032 if (aResponse.GetCmdStatus() == PVMFSuccess) 15033 { 15034 iCmdIds.erase(iCmdIds.begin()); 15035 if (iCmdIds.empty()) 15036 { 15037 // All requested commands have completed 15038 iState = STATE_SETPLAYBACKRANGE2; 15039 RunIfNotReady(5000000); 15040 15041 char outstr[128]; 15042 oscl_snprintf(outstr, 128, "SetPlaybackRange() Complete; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 15043 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 15044 iTimeLogFile.Flush(); 15045 } 15046 } 15047 else 15048 { 15049 // One of queued commands failed 15050 PVPATB_TEST_IS_TRUE(false); 15051 iState = STATE_CLEANUPANDCOMPLETE; 15052 RunIfNotReady(); 15053 } 15054 break; 15055 15056 case STATE_SETPLAYBACKRANGE2: 15057 if (aResponse.GetCmdStatus() == PVMFSuccess) 15058 { 15059 iCmdIds.erase(iCmdIds.begin()); 15060 if (iCmdIds.empty()) 15061 { 15062 // All requested commands have completed 15063 iState = STATE_SETPLAYBACKRANGE3; 15064 RunIfNotReady(5000000); 15065 15066 char outstr[128]; 15067 oscl_snprintf(outstr, 128, "SetPlaybackRange() Complete; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 15068 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 15069 iTimeLogFile.Flush(); 15070 } 15071 } 15072 else 15073 { 15074 // One of queued commands failed 15075 PVPATB_TEST_IS_TRUE(false); 15076 iState = STATE_CLEANUPANDCOMPLETE; 15077 RunIfNotReady(); 15078 } 15079 break; 15080 15081 case STATE_SETPLAYBACKRANGE3: 15082 if (aResponse.GetCmdStatus() == PVMFSuccess) 15083 { 15084 iCmdIds.erase(iCmdIds.begin()); 15085 if (iCmdIds.empty()) 15086 { 15087 // All requested commands have completed 15088 iState = STATE_SETPLAYBACKRANGE4; 15089 RunIfNotReady(5000000); 15090 15091 char outstr[128]; 15092 oscl_snprintf(outstr, 128, "SetPlaybackRange() Complete; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 15093 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 15094 iTimeLogFile.Flush(); 15095 } 15096 } 15097 else 15098 { 15099 // One of queued commands failed 15100 PVPATB_TEST_IS_TRUE(false); 15101 iState = STATE_CLEANUPANDCOMPLETE; 15102 RunIfNotReady(); 15103 } 15104 break; 15105 15106 case STATE_SETPLAYBACKRANGE4: 15107 if (aResponse.GetCmdStatus() == PVMFSuccess) 15108 { 15109 iCmdIds.erase(iCmdIds.begin()); 15110 if (iCmdIds.empty()) 15111 { 15112 // All requested commands have completed 15113 iState = STATE_SETPLAYBACKRANGE5; 15114 RunIfNotReady(5000000); 15115 15116 char outstr[128]; 15117 oscl_snprintf(outstr, 128, "SetPlaybackRange() Complete; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 15118 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 15119 iTimeLogFile.Flush(); 15120 } 15121 } 15122 else 15123 { 15124 // One of queued commands failed 15125 PVPATB_TEST_IS_TRUE(false); 15126 iState = STATE_CLEANUPANDCOMPLETE; 15127 RunIfNotReady(); 15128 } 15129 break; 15130 15131 case STATE_SETPLAYBACKRANGE5: 15132 if (aResponse.GetCmdStatus() == PVMFSuccess) 15133 { 15134 iCmdIds.erase(iCmdIds.begin()); 15135 if (iCmdIds.empty()) 15136 { 15137 // All requested commands have completed 15138 iState = STATE_SETPLAYBACKRANGE6; 15139 RunIfNotReady(); 15140 15141 char outstr[128]; 15142 oscl_snprintf(outstr, 128, "SetPlaybackRange() Complete; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 15143 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 15144 iTimeLogFile.Flush(); 15145 } 15146 } 15147 else 15148 { 15149 // One of queued commands failed 15150 PVPATB_TEST_IS_TRUE(false); 15151 iState = STATE_CLEANUPANDCOMPLETE; 15152 RunIfNotReady(); 15153 } 15154 break; 15155 15156 case STATE_SETPLAYBACKRANGE6: 15157 if (aResponse.GetCmdStatus() == PVMFSuccess) 15158 { 15159 iCmdIds.erase(iCmdIds.begin()); 15160 if (iCmdIds.empty()) 15161 { 15162 // All requested commands have completed 15163 iState = STATE_SHUTDOWN; 15164 RunIfNotReady(5000000); 15165 } 15166 } 15167 else 15168 { 15169 // One of queued commands failed 15170 PVPATB_TEST_IS_TRUE(false); 15171 iState = STATE_CLEANUPANDCOMPLETE; 15172 RunIfNotReady(); 15173 } 15174 break; 15175 15176 case STATE_SHUTDOWN: 15177 if (aResponse.GetCmdStatus() == PVMFSuccess) 15178 { 15179 iCmdIds.erase(iCmdIds.begin()); 15180 if (iCmdIds.empty()) 15181 { 15182 // All requested commands have completed 15183 PVPATB_TEST_IS_TRUE(true); 15184 iState = STATE_CLEANUPANDCOMPLETE; 15185 RunIfNotReady(); 15186 } 15187 } 15188 else 15189 { 15190 // One of queued commands failed 15191 PVPATB_TEST_IS_TRUE(false); 15192 iState = STATE_CLEANUPANDCOMPLETE; 15193 RunIfNotReady(); 15194 } 15195 break; 15196 15197 default: 15198 { 15199 // Testing error if this is reached 15200 PVPATB_TEST_IS_TRUE(false); 15201 iState = STATE_CLEANUPANDCOMPLETE; 15202 RunIfNotReady(); 15203 } 15204 break; 15205 } 15206 } 15207 15208 15209 void pvplayer_async_test_multireposition::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 15210 { 15211 switch (aEvent.GetEventType()) 15212 { 15213 case PVMFErrResourceConfiguration: 15214 // Just log the error 15215 PVPATB_TEST_IS_TRUE(false); 15216 break; 15217 15218 case PVMFErrResource: 15219 // Just log the error 15220 PVPATB_TEST_IS_TRUE(false); 15221 break; 15222 15223 case PVMFErrCorrupt: 15224 // Just log the error 15225 PVPATB_TEST_IS_TRUE(false); 15226 break; 15227 15228 case PVMFErrProcessing: 15229 // Just log the error 15230 PVPATB_TEST_IS_TRUE(false); 15231 break; 15232 15233 default: 15234 // Unknown error and just log the error 15235 PVPATB_TEST_IS_TRUE(false); 15236 break; 15237 } 15238 } 15239 15240 15241 void pvplayer_async_test_multireposition::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 15242 { 15243 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 15244 { 15245 // do nothing 15246 } 15247 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 15248 { 15249 iState = STATE_CLEANUPANDCOMPLETE; 15250 RunIfNotReady(); 15251 } 15252 // Check reposition time here 15253 if (aEvent.GetEventType() == PVMFInfoPositionStatus) 15254 { 15255 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 15256 if (iface == NULL) 15257 { 15258 return; 15259 } 15260 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 15261 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 15262 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 15263 { 15264 int32 infocode; 15265 PVUuid infouuid; 15266 infomsgiface->GetCodeUUID(infocode, infouuid); 15267 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoPlaybackFromBeginTime)) 15268 { 15269 char outstr[128]; 15270 oscl_snprintf(outstr, 128, "Begin playback position reached; Time %d\n", OsclTickCount::TicksToMsec(OsclTickCount::TickCount())); 15271 iTimeLogFile.Write(outstr, sizeof(char), oscl_strlen(outstr)); 15272 iTimeLogFile.Flush(); 15273 } 15274 } 15275 } 15276 } 15277 15278 15279 // 15280 // pvplayer_async_test_capconfigiftest section 15281 // 15282 void pvplayer_async_test_capconfigiftest::StartTest() 15283 { 15284 AddToScheduler(); 15285 iState = STATE_CREATE; 15286 RunIfNotReady(); 15287 } 15288 15289 15290 void pvplayer_async_test_capconfigiftest::Run() 15291 { 15292 int error = 0; 15293 15294 switch (iState) 15295 { 15296 case STATE_CREATE: 15297 { 15298 iPlayer = NULL; 15299 15300 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 15301 if (error) 15302 { 15303 PVPATB_TEST_IS_TRUE(false); 15304 iObserver->TestCompleted(*iTestCase); 15305 } 15306 else 15307 { 15308 iState = STATE_QUERYINTERFACE; 15309 RunIfNotReady(); 15310 } 15311 } 15312 break; 15313 15314 case STATE_QUERYINTERFACE: 15315 { 15316 PVUuid capconfigifuuid = PVMI_CAPABILITY_AND_CONFIG_PVUUID; 15317 OSCL_TRY(error, iCurrentCmdId = iPlayer->QueryInterface(capconfigifuuid, (PVInterface*&)iPlayerCapConfigIF, (OsclAny*) & iContextObject)); 15318 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15319 } 15320 break; 15321 15322 case STATE_CAPCONFIG1: 15323 { 15324 PvmiKvp* retparam = NULL; 15325 int retnumparam = 0; 15326 15327 // Set the observer 15328 iPlayerCapConfigIF->setObserver(this); 15329 15330 // Check that capability metric is 0 15331 PVPATB_TEST_IS_TRUE(iPlayerCapConfigIF->getCapabilityMetric(NULL) == 0); 15332 15333 // Query using get 15334 OSCL_StackString<64> querykey; 15335 15336 retparam = NULL; 15337 retnumparam = 0; 15338 querykey = _STRLIT_CHAR("x-pvmf/player;attr=cap"); 15339 iPlayerCapConfigIF->getParametersSync(NULL, querykey.get_str(), retparam, retnumparam, NULL); 15340 // Just check the number of returned entries 15341 if (retparam != NULL && retnumparam == 13) 15342 { 15343 PVPATB_TEST_IS_TRUE(true); 15344 15345 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15346 { 15347 PVPATB_TEST_IS_TRUE(false); 15348 } 15349 } 15350 else 15351 { 15352 PVPATB_TEST_IS_TRUE(false); 15353 } 15354 15355 retparam = NULL; 15356 retnumparam = 0; 15357 querykey = _STRLIT_CHAR("x-pvmf/player/productinfo;attr=cap"); 15358 iPlayerCapConfigIF->getParametersSync(NULL, querykey.get_str(), retparam, retnumparam, NULL); 15359 // Just check the number of returned entries 15360 if (retparam != NULL && retnumparam == 5) 15361 { 15362 PVPATB_TEST_IS_TRUE(true); 15363 15364 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15365 { 15366 PVPATB_TEST_IS_TRUE(false); 15367 } 15368 } 15369 else 15370 { 15371 PVPATB_TEST_IS_TRUE(false); 15372 } 15373 15374 // Set up KVPs for verify, set, and get 15375 PvmiKvp paramkvp[2]; 15376 OSCL_StackString<64> paramkey1(_STRLIT_CHAR("x-pvmf/player/endtimecheck_interval;valtype=uint32")); 15377 OSCL_StackString<64> paramkey2(_STRLIT_CHAR("x-pvmf/player/nodecmd_timeout;valtype=uint32")); 15378 paramkvp[0].key = paramkey1.get_str(); 15379 paramkvp[0].value.uint32_value = 2000; 15380 paramkvp[1].key = paramkey2.get_str(); 15381 paramkvp[1].value.uint32_value = 4421; 15382 15383 // Verify the new settings 15384 if (iPlayerCapConfigIF->verifyParametersSync(NULL, paramkvp, 2) == PVMFSuccess) 15385 { 15386 // Set the new settings 15387 iErrorKVP = NULL; 15388 iPlayerCapConfigIF->setParametersSync(NULL, paramkvp, 2, iErrorKVP); 15389 if (iErrorKVP == NULL) 15390 { 15391 // Check by calling get 15392 retparam = NULL; 15393 retnumparam = 0; 15394 paramkey1 += _STRLIT_CHAR(";attr=cur"); 15395 iPlayerCapConfigIF->getParametersSync(NULL, paramkey1.get_str(), retparam, retnumparam, NULL); 15396 if (retparam != NULL && retnumparam == 1) 15397 { 15398 PVPATB_TEST_IS_TRUE(retparam->value.uint32_value == paramkvp[0].value.uint32_value); 15399 15400 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15401 { 15402 PVPATB_TEST_IS_TRUE(false); 15403 } 15404 } 15405 else 15406 { 15407 PVPATB_TEST_IS_TRUE(false); 15408 } 15409 15410 retparam = NULL; 15411 retnumparam = 0; 15412 paramkey2 += _STRLIT_CHAR(";attr=cur"); 15413 iPlayerCapConfigIF->getParametersSync(NULL, paramkey2.get_str(), retparam, retnumparam, NULL); 15414 if (retparam != NULL && retnumparam == 1) 15415 { 15416 PVPATB_TEST_IS_TRUE(retparam->value.uint32_value == paramkvp[1].value.uint32_value); 15417 15418 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15419 { 15420 PVPATB_TEST_IS_TRUE(false); 15421 } 15422 } 15423 else 15424 { 15425 PVPATB_TEST_IS_TRUE(false); 15426 } 15427 } 15428 else 15429 { 15430 // Set failed 15431 PVPATB_TEST_IS_TRUE(false); 15432 } 15433 } 15434 else 15435 { 15436 // Verify failed 15437 PVPATB_TEST_IS_TRUE(false); 15438 } 15439 15440 // Try the set asynchronously 15441 iKeyStringSetAsync = _STRLIT_CHAR("x-pvmf/player/syncpointseekwindow;valtype=uint32"); 15442 iKVPSetAsync.key = iKeyStringSetAsync.get_str(); 15443 iKVPSetAsync.value.uint32_value = 2134; 15444 15445 iErrorKVP = NULL; 15446 OSCL_TRY(error, iCurrentCmdId = iPlayerCapConfigIF->setParametersAsync(NULL, &iKVPSetAsync, 1, iErrorKVP)); 15447 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15448 } 15449 break; 15450 15451 case STATE_CAPCONFIG2: 15452 { 15453 // Check by calling get 15454 PvmiKvp* retparam = NULL; 15455 int retnumparam = 0; 15456 iKeyStringSetAsync += _STRLIT_CHAR(";attr=cur"); 15457 iPlayerCapConfigIF->getParametersSync(NULL, iKeyStringSetAsync.get_str(), retparam, retnumparam, NULL); 15458 if (retparam != NULL && retnumparam == 1) 15459 { 15460 PVPATB_TEST_IS_TRUE(retparam->value.uint32_value == iKVPSetAsync.value.uint32_value); 15461 15462 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15463 { 15464 PVPATB_TEST_IS_TRUE(false); 15465 } 15466 } 15467 else 15468 { 15469 PVPATB_TEST_IS_TRUE(false); 15470 } 15471 15472 iState = STATE_ADDDATASOURCE; 15473 RunIfNotReady(); 15474 } 15475 break; 15476 15477 case STATE_ADDDATASOURCE: 15478 { 15479 iDataSource = new PVPlayerDataSourceURL; 15480 oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), output, 512); 15481 wFileName.set(output, oscl_strlen(output)); 15482 iDataSource->SetDataSourceURL(wFileName); 15483 iDataSource->SetDataSourceFormatType(iFileType); 15484 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 15485 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15486 } 15487 15488 break; 15489 15490 case STATE_INIT: 15491 { 15492 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 15493 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15494 } 15495 break; 15496 15497 case STATE_CAPCONFIG3: 15498 { 15499 // Set up KVPs for verify, set, and get 15500 PvmiKvp paramkvp[2]; 15501 OSCL_StackString<64> paramkey1(_STRLIT_CHAR("x-pvmf/player/endtimecheck_interval;valtype=uint32")); 15502 OSCL_StackString<64> paramkey2(_STRLIT_CHAR("x-pvmf/player/nodecmd_timeout;valtype=uint32")); 15503 paramkvp[0].key = paramkey1.get_str(); 15504 paramkvp[0].value.uint32_value = 2000; 15505 paramkvp[1].key = paramkey2.get_str(); 15506 paramkvp[1].value.uint32_value = 4421; 15507 15508 // Verify the new settings 15509 if (iPlayerCapConfigIF->verifyParametersSync(NULL, paramkvp, 2) == PVMFSuccess) 15510 { 15511 // Set the new settings 15512 iErrorKVP = NULL; 15513 iPlayerCapConfigIF->setParametersSync(NULL, paramkvp, 2, iErrorKVP); 15514 if (iErrorKVP == NULL) 15515 { 15516 // Check by calling get 15517 PvmiKvp* retparam = NULL; 15518 int retnumparam = 0; 15519 paramkey1 += _STRLIT_CHAR(";attr=cur"); 15520 iPlayerCapConfigIF->getParametersSync(NULL, paramkey1.get_str(), retparam, retnumparam, NULL); 15521 if (retparam != NULL && retnumparam == 1) 15522 { 15523 PVPATB_TEST_IS_TRUE(retparam->value.uint32_value == paramkvp[0].value.uint32_value); 15524 15525 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15526 { 15527 PVPATB_TEST_IS_TRUE(false); 15528 } 15529 } 15530 else 15531 { 15532 PVPATB_TEST_IS_TRUE(false); 15533 } 15534 15535 retparam = NULL; 15536 retnumparam = 0; 15537 paramkey2 += _STRLIT_CHAR(";attr=cur"); 15538 iPlayerCapConfigIF->getParametersSync(NULL, paramkey2.get_str(), retparam, retnumparam, NULL); 15539 if (retparam != NULL && retnumparam == 1) 15540 { 15541 PVPATB_TEST_IS_TRUE(retparam->value.uint32_value == paramkvp[1].value.uint32_value); 15542 15543 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15544 { 15545 PVPATB_TEST_IS_TRUE(false); 15546 } 15547 } 15548 else 15549 { 15550 PVPATB_TEST_IS_TRUE(false); 15551 } 15552 } 15553 else 15554 { 15555 // Set failed 15556 PVPATB_TEST_IS_TRUE(false); 15557 } 15558 } 15559 else 15560 { 15561 // Verify failed 15562 PVPATB_TEST_IS_TRUE(false); 15563 } 15564 15565 iState = STATE_ADDDATASINK_VIDEO; 15566 RunIfNotReady(); 15567 } 15568 break; 15569 15570 case STATE_ADDDATASINK_VIDEO: 15571 { 15572 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 15573 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 15574 SinkFileName += _STRLIT_WCHAR("test_player_capconfigif_"); 15575 OSCL_wHeapString<OsclMemAllocator> inputfilename; 15576 RetrieveFilename(wFileName.get_str(), inputfilename); 15577 SinkFileName += inputfilename; 15578 SinkFileName += _STRLIT_WCHAR("_video.dat"); 15579 15580 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & SinkFileName, MEDIATYPE_VIDEO, iCompressedVideo); 15581 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 15582 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 15583 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 15584 15585 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 15586 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15587 } 15588 break; 15589 15590 case STATE_ADDDATASINK_AUDIO: 15591 { 15592 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 15593 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 15594 SinkFileName += _STRLIT_WCHAR("test_player_capconfigif_"); 15595 OSCL_wHeapString<OsclMemAllocator> inputfilename; 15596 RetrieveFilename(wFileName.get_str(), inputfilename); 15597 SinkFileName += inputfilename; 15598 SinkFileName += _STRLIT_WCHAR("_audio.dat"); 15599 15600 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & SinkFileName, MEDIATYPE_AUDIO, iCompressedAudio); 15601 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 15602 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 15603 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 15604 15605 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 15606 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15607 } 15608 break; 15609 15610 case STATE_PREPARE: 15611 { 15612 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 15613 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15614 } 15615 break; 15616 15617 case STATE_START: 15618 { 15619 // Set up KVPs to enable video dec node postproc 15620 PvmiKvp paramkvp[2]; 15621 OSCL_StackString<64> paramkey1(_STRLIT_CHAR("x-pvmf/video/decoder/postproc_enable;valtype=bool")); 15622 OSCL_StackString<64> paramkey2(_STRLIT_CHAR("x-pvmf/video/decoder/postproc_type;valtype=bitarray32")); 15623 paramkvp[0].key = paramkey1.get_str(); 15624 paramkvp[0].value.bool_value = true; 15625 paramkvp[1].key = paramkey2.get_str(); 15626 paramkvp[1].value.uint32_value = 1; 15627 15628 // Set the new settings 15629 iErrorKVP = NULL; 15630 iPlayerCapConfigIF->setParametersSync(NULL, paramkvp, 2, iErrorKVP); 15631 // Don't check if set works 15632 15633 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 15634 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15635 } 15636 break; 15637 15638 case STATE_CAPCONFIG4: 15639 { 15640 // Set up KVPs for verify, set, and get 15641 PvmiKvp paramkvp[2]; 15642 OSCL_StackString<64> paramkey1(_STRLIT_CHAR("x-pvmf/player/pbpos_interval;valtype=uint32")); 15643 OSCL_StackString<64> paramkey2(_STRLIT_CHAR("x-pvmf/player/seektosyncpoint;valtype=bool")); 15644 paramkvp[0].key = paramkey1.get_str(); 15645 paramkvp[0].value.uint32_value = 2000; 15646 paramkvp[1].key = paramkey2.get_str(); 15647 paramkvp[1].value.bool_value = false; 15648 15649 // Verify the new settings 15650 if (iPlayerCapConfigIF->verifyParametersSync(NULL, paramkvp, 2) == PVMFSuccess) 15651 { 15652 // Set the new settings 15653 iErrorKVP = NULL; 15654 iPlayerCapConfigIF->setParametersSync(NULL, paramkvp, 2, iErrorKVP); 15655 if (iErrorKVP == NULL) 15656 { 15657 // Check by calling get 15658 PvmiKvp* retparam = NULL; 15659 int retnumparam = 0; 15660 paramkey1 += _STRLIT_CHAR(";attr=cur"); 15661 iPlayerCapConfigIF->getParametersSync(NULL, paramkey1.get_str(), retparam, retnumparam, NULL); 15662 if (retparam != NULL && retnumparam == 1) 15663 { 15664 PVPATB_TEST_IS_TRUE(retparam->value.uint32_value == paramkvp[0].value.uint32_value); 15665 15666 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15667 { 15668 PVPATB_TEST_IS_TRUE(false); 15669 } 15670 } 15671 else 15672 { 15673 PVPATB_TEST_IS_TRUE(false); 15674 } 15675 15676 retparam = NULL; 15677 retnumparam = 0; 15678 paramkey2 += _STRLIT_CHAR(";attr=cur"); 15679 iPlayerCapConfigIF->getParametersSync(NULL, paramkey2.get_str(), retparam, retnumparam, NULL); 15680 if (retparam != NULL && retnumparam == 1) 15681 { 15682 PVPATB_TEST_IS_TRUE(retparam->value.bool_value == paramkvp[1].value.bool_value); 15683 15684 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15685 { 15686 PVPATB_TEST_IS_TRUE(false); 15687 } 15688 } 15689 else 15690 { 15691 PVPATB_TEST_IS_TRUE(false); 15692 } 15693 } 15694 else 15695 { 15696 // Set failed 15697 PVPATB_TEST_IS_TRUE(false); 15698 } 15699 } 15700 else 15701 { 15702 // Verify failed 15703 PVPATB_TEST_IS_TRUE(false); 15704 } 15705 15706 // Check if video decoder cap-config is available 15707 { 15708 PvmiKvp* retparam = NULL; 15709 int retnumparam = 0; 15710 OSCL_StackString<64> querykey(_STRLIT_CHAR("x-pvmf/video/decoder;attr=cap")); 15711 iPlayerCapConfigIF->getParametersSync(NULL, querykey.get_str(), retparam, retnumparam, NULL); 15712 // Just check the number of returned entries 15713 if (retparam != NULL && retnumparam == 6) 15714 { 15715 PVPATB_TEST_IS_TRUE(true); 15716 15717 if (iPlayerCapConfigIF->releaseParameters(NULL, retparam, retnumparam) != PVMFSuccess) 15718 { 15719 PVPATB_TEST_IS_TRUE(false); 15720 } 15721 } 15722 else 15723 { 15724 // Depending on configuration video dec node might be available 15725 // so don't flag this as error in test case 15726 } 15727 } 15728 15729 15730 // Done with cap-config testing 15731 iPlayerCapConfigIF = NULL; 15732 15733 iState = STATE_STOP; 15734 RunIfNotReady(); 15735 } 15736 break; 15737 15738 case STATE_STOP: 15739 { 15740 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 15741 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15742 } 15743 break; 15744 15745 case STATE_REMOVEDATASINK_VIDEO: 15746 { 15747 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 15748 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15749 } 15750 break; 15751 15752 case STATE_REMOVEDATASINK_AUDIO: 15753 { 15754 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 15755 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15756 } 15757 break; 15758 15759 case STATE_RESET: 15760 { 15761 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 15762 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15763 } 15764 break; 15765 15766 case STATE_REMOVEDATASOURCE: 15767 { 15768 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 15769 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 15770 } 15771 break; 15772 15773 case STATE_CLEANUPANDCOMPLETE: 15774 { 15775 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 15776 iPlayer = NULL; 15777 15778 delete iDataSource; 15779 iDataSource = NULL; 15780 15781 delete iDataSinkVideo; 15782 iDataSinkVideo = NULL; 15783 15784 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 15785 iIONodeVideo = NULL; 15786 15787 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 15788 iMIOFileOutVideo = NULL; 15789 15790 delete iDataSinkAudio; 15791 iDataSinkAudio = NULL; 15792 15793 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 15794 iIONodeAudio = NULL; 15795 15796 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 15797 iMIOFileOutAudio = NULL; 15798 15799 iObserver->TestCompleted(*iTestCase); 15800 } 15801 break; 15802 15803 default: 15804 break; 15805 15806 } 15807 } 15808 15809 15810 void pvplayer_async_test_capconfigiftest::CommandCompleted(const PVCmdResponse& aResponse) 15811 { 15812 if (aResponse.GetCmdId() != iCurrentCmdId) 15813 { 15814 // Wrong command ID. 15815 PVPATB_TEST_IS_TRUE(false); 15816 iState = STATE_CLEANUPANDCOMPLETE; 15817 RunIfNotReady(); 15818 return; 15819 } 15820 15821 if (aResponse.GetContext() != NULL) 15822 { 15823 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 15824 { 15825 if (iContextObject != iContextObjectRefValue) 15826 { 15827 // Context data value was corrupted 15828 PVPATB_TEST_IS_TRUE(false); 15829 iState = STATE_CLEANUPANDCOMPLETE; 15830 RunIfNotReady(); 15831 return; 15832 } 15833 } 15834 else 15835 { 15836 // Context data pointer was corrupted 15837 PVPATB_TEST_IS_TRUE(false); 15838 iState = STATE_CLEANUPANDCOMPLETE; 15839 RunIfNotReady(); 15840 return; 15841 } 15842 } 15843 15844 switch (iState) 15845 { 15846 case STATE_QUERYINTERFACE: 15847 if (aResponse.GetCmdStatus() == PVMFSuccess) 15848 { 15849 iState = STATE_CAPCONFIG1; 15850 RunIfNotReady(); 15851 } 15852 else 15853 { 15854 // QueryInterface failed 15855 PVPATB_TEST_IS_TRUE(false); 15856 iState = STATE_CLEANUPANDCOMPLETE; 15857 RunIfNotReady(); 15858 } 15859 break; 15860 15861 case STATE_ADDDATASOURCE: 15862 if (aResponse.GetCmdStatus() == PVMFSuccess) 15863 { 15864 iState = STATE_INIT; 15865 RunIfNotReady(); 15866 } 15867 else 15868 { 15869 // AddDataSource failed 15870 PVPATB_TEST_IS_TRUE(false); 15871 iState = STATE_CLEANUPANDCOMPLETE; 15872 RunIfNotReady(); 15873 } 15874 break; 15875 15876 case STATE_INIT: 15877 if (aResponse.GetCmdStatus() == PVMFSuccess) 15878 { 15879 iState = STATE_CAPCONFIG3; 15880 RunIfNotReady(); 15881 } 15882 else 15883 { 15884 // Init failed 15885 PVPATB_TEST_IS_TRUE(false); 15886 iState = STATE_CLEANUPANDCOMPLETE; 15887 RunIfNotReady(); 15888 } 15889 break; 15890 15891 case STATE_ADDDATASINK_VIDEO: 15892 if (aResponse.GetCmdStatus() == PVMFSuccess) 15893 { 15894 iState = STATE_ADDDATASINK_AUDIO; 15895 RunIfNotReady(); 15896 } 15897 else 15898 { 15899 // AddDataSink failed 15900 PVPATB_TEST_IS_TRUE(false); 15901 iState = STATE_CLEANUPANDCOMPLETE; 15902 RunIfNotReady(); 15903 } 15904 break; 15905 15906 case STATE_ADDDATASINK_AUDIO: 15907 if (aResponse.GetCmdStatus() == PVMFSuccess) 15908 { 15909 iState = STATE_PREPARE; 15910 RunIfNotReady(); 15911 } 15912 else 15913 { 15914 // AddDataSink failed 15915 PVPATB_TEST_IS_TRUE(false); 15916 iState = STATE_CLEANUPANDCOMPLETE; 15917 RunIfNotReady(); 15918 } 15919 break; 15920 15921 case STATE_PREPARE: 15922 if (aResponse.GetCmdStatus() == PVMFSuccess) 15923 { 15924 iState = STATE_START; 15925 RunIfNotReady(); 15926 } 15927 else 15928 { 15929 // Prepare failed 15930 PVPATB_TEST_IS_TRUE(false); 15931 iState = STATE_CLEANUPANDCOMPLETE; 15932 RunIfNotReady(); 15933 } 15934 break; 15935 15936 case STATE_START: 15937 if (aResponse.GetCmdStatus() == PVMFSuccess) 15938 { 15939 iState = STATE_CAPCONFIG4; 15940 RunIfNotReady(); 15941 } 15942 else 15943 { 15944 // Start failed 15945 PVPATB_TEST_IS_TRUE(false); 15946 iState = STATE_CLEANUPANDCOMPLETE; 15947 RunIfNotReady(); 15948 } 15949 break; 15950 15951 case STATE_STOP: 15952 if (aResponse.GetCmdStatus() == PVMFSuccess) 15953 { 15954 iState = STATE_REMOVEDATASINK_VIDEO; 15955 RunIfNotReady(); 15956 } 15957 else 15958 { 15959 // Stop failed 15960 PVPATB_TEST_IS_TRUE(false); 15961 iState = STATE_CLEANUPANDCOMPLETE; 15962 RunIfNotReady(); 15963 } 15964 break; 15965 15966 case STATE_REMOVEDATASINK_VIDEO: 15967 if (aResponse.GetCmdStatus() == PVMFSuccess) 15968 { 15969 iState = STATE_REMOVEDATASINK_AUDIO; 15970 RunIfNotReady(); 15971 } 15972 else 15973 { 15974 // RemoveDataSink failed 15975 PVPATB_TEST_IS_TRUE(false); 15976 iState = STATE_CLEANUPANDCOMPLETE; 15977 RunIfNotReady(); 15978 } 15979 break; 15980 15981 case STATE_REMOVEDATASINK_AUDIO: 15982 if (aResponse.GetCmdStatus() == PVMFSuccess) 15983 { 15984 iState = STATE_RESET; 15985 RunIfNotReady(); 15986 } 15987 else 15988 { 15989 // RemoveDataSink failed 15990 PVPATB_TEST_IS_TRUE(false); 15991 iState = STATE_CLEANUPANDCOMPLETE; 15992 RunIfNotReady(); 15993 } 15994 break; 15995 15996 case STATE_RESET: 15997 if (aResponse.GetCmdStatus() == PVMFSuccess) 15998 { 15999 iState = STATE_REMOVEDATASOURCE; 16000 RunIfNotReady(); 16001 } 16002 else 16003 { 16004 // Reset failed 16005 PVPATB_TEST_IS_TRUE(false); 16006 iState = STATE_CLEANUPANDCOMPLETE; 16007 RunIfNotReady(); 16008 } 16009 break; 16010 16011 case STATE_REMOVEDATASOURCE: 16012 if (aResponse.GetCmdStatus() == PVMFSuccess) 16013 { 16014 PVPATB_TEST_IS_TRUE(true); 16015 iState = STATE_CLEANUPANDCOMPLETE; 16016 RunIfNotReady(); 16017 } 16018 else 16019 { 16020 // RemoveDataSource failed 16021 PVPATB_TEST_IS_TRUE(false); 16022 iState = STATE_CLEANUPANDCOMPLETE; 16023 RunIfNotReady(); 16024 } 16025 break; 16026 16027 default: 16028 { 16029 // Testing error if this is reached 16030 PVPATB_TEST_IS_TRUE(false); 16031 iState = STATE_CLEANUPANDCOMPLETE; 16032 RunIfNotReady(); 16033 } 16034 break; 16035 } 16036 } 16037 16038 16039 void pvplayer_async_test_capconfigiftest::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 16040 { 16041 switch (aEvent.GetEventType()) 16042 { 16043 case PVMFErrResourceConfiguration: 16044 // Just log the error 16045 PVPATB_TEST_IS_TRUE(false); 16046 break; 16047 16048 case PVMFErrResource: 16049 // Just log the error 16050 PVPATB_TEST_IS_TRUE(false); 16051 break; 16052 16053 case PVMFErrCorrupt: 16054 // Just log the error 16055 PVPATB_TEST_IS_TRUE(false); 16056 break; 16057 16058 case PVMFErrProcessing: 16059 // Just log the error 16060 PVPATB_TEST_IS_TRUE(false); 16061 break; 16062 16063 default: 16064 // Unknown error and just log the error 16065 PVPATB_TEST_IS_TRUE(false); 16066 break; 16067 } 16068 16069 // Wait for engine to handle the error 16070 Cancel(); 16071 } 16072 16073 16074 void pvplayer_async_test_capconfigiftest::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 16075 { 16076 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 16077 { 16078 // do nothing 16079 } 16080 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 16081 { 16082 iState = STATE_CLEANUPANDCOMPLETE; 16083 RunIfNotReady(); 16084 } 16085 } 16086 16087 void pvplayer_async_test_capconfigiftest::SignalEvent(int32 req_id) 16088 { 16089 if (req_id != iCurrentCmdId) 16090 { 16091 // Wrong command ID. 16092 PVPATB_TEST_IS_TRUE(false); 16093 iState = STATE_CLEANUPANDCOMPLETE; 16094 RunIfNotReady(); 16095 return; 16096 } 16097 16098 if (iState == STATE_CAPCONFIG1) 16099 { 16100 if (iErrorKVP != NULL) 16101 { 16102 // There was an error in setParameterAsync() 16103 PVPATB_TEST_IS_TRUE(false); 16104 iState = STATE_ADDDATASOURCE; 16105 } 16106 else 16107 { 16108 iState = STATE_CAPCONFIG2; 16109 } 16110 RunIfNotReady(); 16111 } 16112 } 16113 16114 void pvplayer_async_test_setplaybackafterprepare::StartTest() 16115 { 16116 AddToScheduler(); 16117 iState = STATE_CREATE; 16118 RunIfNotReady(); 16119 } 16120 16121 16122 void pvplayer_async_test_setplaybackafterprepare::Run() 16123 { 16124 int error = 0; 16125 16126 switch (iState) 16127 { 16128 case STATE_CREATE: 16129 { 16130 iPlayer = NULL; 16131 16132 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 16133 if (error) 16134 { 16135 PVPATB_TEST_IS_TRUE(false); 16136 iObserver->TestCompleted(*iTestCase); 16137 } 16138 else 16139 { 16140 iState = STATE_ADDDATASOURCE; 16141 RunIfNotReady(); 16142 } 16143 } 16144 break; 16145 16146 case STATE_ADDDATASOURCE: 16147 { 16148 PVMFFormatType fileType; 16149 iDataSource = new PVPlayerDataSourceURL; 16150 OSCL_HeapString<OsclMemAllocator> filename; 16151 16152 if (oscl_strstr(iFileName, "test.mp4") != NULL) 16153 { 16154 filename = SOURCENAME_PREPEND_STRING; 16155 filename += _STRLIT_CHAR("test_reposition.mp4"); 16156 fileType = PVMF_MIME_MPEG4FF; 16157 iFileType = PVMF_MIME_MPEG4FF; 16158 } 16159 else 16160 { 16161 filename = iFileName; 16162 fileType = iFileType; 16163 } 16164 fprintf(iTestMsgOutputFile, "***Source URL=%s\n", filename.get_str()); 16165 oscl_UTF8ToUnicode(filename.get_str(), filename.get_size(), output, 256); 16166 wFileName.set(output, oscl_strlen(output)); 16167 16168 if (iFileType == PVMF_MIME_DATA_SOURCE_HTTP_URL) 16169 { 16170 fileType = PVMF_MIME_DATA_SOURCE_HTTP_URL; 16171 iDataSource->SetAlternateSourceFormatType(PVMF_MIME_DATA_SOURCE_MS_HTTP_STREAMING_URL); 16172 iSourceContextData = new PVMFSourceContextData(); 16173 iSourceContextData->EnableCommonSourceContext(); 16174 iSourceContextData->EnableStreamingSourceContext(); 16175 16176 PVInterface* sourceContext = NULL; 16177 PVUuid streamingContextUuid(PVMF_SOURCE_CONTEXT_DATA_STREAMING_UUID); 16178 if (iSourceContextData->queryInterface(streamingContextUuid, sourceContext)) 16179 { 16180 PVMFSourceContextDataStreaming* streamingContext = 16181 OSCL_STATIC_CAST(PVMFSourceContextDataStreaming*, sourceContext); 16182 streamingContext->iStreamStatsLoggingURL = wFileName; 16183 16184 if (iProxyEnabled) 16185 { 16186 streamingContext->iProxyName = _STRLIT_WCHAR("63.215.241.33"); 16187 streamingContext->iProxyPort = 7070; 16188 } 16189 16190 streamingContext->iUserID = _STRLIT_CHAR("abc"); 16191 streamingContext->iUserPasswd = _STRLIT_CHAR("xyz"); 16192 } 16193 iSourceContextData->EnableDownloadHTTPSourceContext(); 16194 sourceContext = NULL; 16195 PVUuid downloadContextUuid(PVMF_SOURCE_CONTEXT_DATA_DOWNLOAD_HTTP_UUID); 16196 if (iSourceContextData->queryInterface(downloadContextUuid, sourceContext)) 16197 { 16198 PVMFSourceContextDataDownloadHTTP* downloadContext = 16199 OSCL_STATIC_CAST(PVMFSourceContextDataDownloadHTTP*, sourceContext); 16200 if (iProxyEnabled) 16201 { 16202 downloadContext->iProxyName = _STRLIT_CHAR("63.215.241.33"); 16203 downloadContext->iProxyPort = 7070; 16204 } 16205 downloadContext->iDownloadFileName += _STRLIT_WCHAR("test_ftdownload.loc"); 16206 downloadContext->iConfigFileName += _STRLIT_WCHAR("mydlconfig"); 16207 downloadContext->iUserID = _STRLIT_CHAR("abc"); 16208 downloadContext->iUserPasswd = _STRLIT_CHAR("xyz"); 16209 downloadContext->bIsNewSession = true; 16210 downloadContext->iMaxFileSize = 0x7FFFFFFF; 16211 downloadContext->iPlaybackControl = PVMFSourceContextDataDownloadHTTP::EAsap; 16212 } 16213 iDataSource->SetDataSourceContextData((OsclAny*)iSourceContextData); 16214 } 16215 iDataSource->SetDataSourceURL(wFileName); 16216 iDataSource->SetDataSourceFormatType(fileType); 16217 16218 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 16219 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16220 } 16221 16222 break; 16223 16224 case STATE_INIT: 16225 { 16226 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 16227 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16228 } 16229 break; 16230 16231 case STATE_ADDDATASINK_VIDEO: 16232 { 16233 OSCL_wHeapString<OsclMemAllocator> SinkFileName; 16234 SinkFileName = OUTPUTNAME_PREPEND_WSTRING; 16235 SinkFileName += _STRLIT_WCHAR("test_player_setplaybackafterprepare_"); 16236 OSCL_wHeapString<OsclMemAllocator> inputfilename; 16237 RetrieveFilename(wFileName.get_str(), inputfilename); 16238 SinkFileName += inputfilename; 16239 SinkFileName += _STRLIT_WCHAR("_video.dat"); 16240 16241 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & SinkFileName, MEDIATYPE_VIDEO, iCompressedVideo); 16242 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 16243 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 16244 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 16245 16246 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 16247 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16248 16249 } 16250 break; 16251 16252 case STATE_ADDDATASINK_AUDIO: 16253 { 16254 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 16255 sinkfile += _STRLIT_WCHAR("test_player_setplaybackafterprepare_audio.dat"); 16256 OSCL_wHeapString<OsclMemAllocator> inputfilename; 16257 RetrieveFilename(wFileName.get_str(), inputfilename); 16258 sinkfile += inputfilename; 16259 sinkfile += _STRLIT_WCHAR("_audio.dat"); 16260 16261 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 16262 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 16263 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 16264 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 16265 16266 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 16267 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16268 } 16269 break; 16270 16271 case STATE_ADDDATASINK_TEXT: 16272 { 16273 OSCL_wHeapString<OsclMemAllocator> sinkfilename; 16274 sinkfilename = OUTPUTNAME_PREPEND_WSTRING; 16275 sinkfilename += _STRLIT_WCHAR("test_player_setplaybackafterprepare_"); 16276 OSCL_wHeapString<OsclMemAllocator> inputfilename; 16277 RetrieveFilename(wFileName.get_str(), inputfilename); 16278 sinkfilename += inputfilename; 16279 sinkfilename += _STRLIT_WCHAR("_text.dat"); 16280 16281 iMIOFileOutText = iMioFactory->CreateTextOutput((OsclAny*) & sinkfilename, MEDIATYPE_TEXT); 16282 iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutText); 16283 iDataSinkText = new PVPlayerDataSinkPVMFNode; 16284 ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText); 16285 16286 16287 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 16288 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16289 } 16290 break; 16291 16292 case STATE_PREPARE: 16293 { 16294 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 16295 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16296 } 16297 break; 16298 16299 case STATE_SETPLAYBACKRANGE: 16300 { 16301 PVPPlaybackPosition start, end; 16302 start.iIndeterminate = false; 16303 end.iIndeterminate = true; 16304 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 16305 start.iMode = PVPPBPOS_MODE_NOW; 16306 start.iPosValue.millisec_value = 10000; 16307 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 16308 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16309 } 16310 break; 16311 16312 case STATE_START: 16313 { 16314 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 16315 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16316 } 16317 break; 16318 16319 case STATE_STOP: 16320 { 16321 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 16322 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16323 } 16324 break; 16325 16326 case STATE_REMOVEDATASINK_VIDEO: 16327 { 16328 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 16329 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16330 } 16331 break; 16332 16333 case STATE_REMOVEDATASINK_AUDIO: 16334 { 16335 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 16336 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16337 } 16338 break; 16339 16340 case STATE_REMOVEDATASINK_TEXT: 16341 { 16342 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 16343 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16344 } 16345 break; 16346 16347 case STATE_RESET: 16348 { 16349 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 16350 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16351 } 16352 break; 16353 16354 case STATE_REMOVEDATASOURCE: 16355 { 16356 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 16357 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16358 } 16359 break; 16360 16361 case STATE_CLEANUPANDCOMPLETE: 16362 { 16363 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 16364 iPlayer = NULL; 16365 16366 delete iSourceContextData; 16367 iSourceContextData = NULL; 16368 16369 delete iDataSource; 16370 iDataSource = NULL; 16371 16372 delete iDataSinkVideo; 16373 iDataSinkVideo = NULL; 16374 16375 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 16376 iIONodeVideo = NULL; 16377 16378 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 16379 iMIOFileOutVideo = NULL; 16380 16381 delete iDataSinkAudio; 16382 iDataSinkAudio = NULL; 16383 16384 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 16385 iIONodeAudio = NULL; 16386 16387 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 16388 iMIOFileOutAudio = NULL; 16389 16390 delete iDataSinkText; 16391 iDataSinkText = NULL; 16392 16393 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText); 16394 iIONodeText = NULL; 16395 16396 iMioFactory->DestroyTextOutput(iMIOFileOutText); 16397 iMIOFileOutText = NULL; 16398 16399 iObserver->TestCompleted(*iTestCase); 16400 } 16401 break; 16402 16403 default: 16404 break; 16405 16406 } 16407 } 16408 16409 16410 void pvplayer_async_test_setplaybackafterprepare::CommandCompleted(const PVCmdResponse& aResponse) 16411 { 16412 if (aResponse.GetCmdId() != iCurrentCmdId) 16413 { 16414 // Wrong command ID. 16415 PVPATB_TEST_IS_TRUE(false); 16416 iState = STATE_CLEANUPANDCOMPLETE; 16417 RunIfNotReady(); 16418 return; 16419 } 16420 16421 if (aResponse.GetContext() != NULL) 16422 { 16423 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 16424 { 16425 if (iContextObject != iContextObjectRefValue) 16426 { 16427 // Context data value was corrupted 16428 PVPATB_TEST_IS_TRUE(false); 16429 iState = STATE_CLEANUPANDCOMPLETE; 16430 RunIfNotReady(); 16431 return; 16432 } 16433 } 16434 else 16435 { 16436 // Context data pointer was corrupted 16437 PVPATB_TEST_IS_TRUE(false); 16438 iState = STATE_CLEANUPANDCOMPLETE; 16439 RunIfNotReady(); 16440 return; 16441 } 16442 } 16443 16444 switch (iState) 16445 { 16446 case STATE_ADDDATASOURCE: 16447 if (aResponse.GetCmdStatus() == PVMFSuccess) 16448 { 16449 iState = STATE_INIT; 16450 RunIfNotReady(); 16451 } 16452 else 16453 { 16454 // AddDataSource failed 16455 PVPATB_TEST_IS_TRUE(false); 16456 iState = STATE_CLEANUPANDCOMPLETE; 16457 RunIfNotReady(); 16458 } 16459 break; 16460 16461 case STATE_INIT: 16462 if (aResponse.GetCmdStatus() == PVMFSuccess) 16463 { 16464 iState = STATE_ADDDATASINK_VIDEO; 16465 RunIfNotReady(); 16466 } 16467 else 16468 { 16469 // Init failed 16470 16471 16472 iState = STATE_CLEANUPANDCOMPLETE; 16473 RunIfNotReady(); 16474 } 16475 break; 16476 16477 case STATE_ADDDATASINK_VIDEO: 16478 if (aResponse.GetCmdStatus() == PVMFSuccess) 16479 { 16480 iState = STATE_ADDDATASINK_AUDIO; 16481 RunIfNotReady(); 16482 } 16483 else 16484 { 16485 // AddDataSink failed 16486 PVPATB_TEST_IS_TRUE(false); 16487 iState = STATE_CLEANUPANDCOMPLETE; 16488 RunIfNotReady(); 16489 } 16490 break; 16491 16492 case STATE_ADDDATASINK_AUDIO: 16493 if (aResponse.GetCmdStatus() == PVMFSuccess) 16494 { 16495 iState = STATE_ADDDATASINK_TEXT; 16496 RunIfNotReady(); 16497 } 16498 else 16499 { 16500 // AddDataSink failed 16501 PVPATB_TEST_IS_TRUE(false); 16502 iState = STATE_CLEANUPANDCOMPLETE; 16503 RunIfNotReady(); 16504 } 16505 break; 16506 16507 case STATE_ADDDATASINK_TEXT: 16508 if (aResponse.GetCmdStatus() == PVMFSuccess) 16509 { 16510 iState = STATE_PREPARE; 16511 RunIfNotReady(); 16512 } 16513 else 16514 { 16515 // AddDataSink failed 16516 PVPATB_TEST_IS_TRUE(false); 16517 iState = STATE_CLEANUPANDCOMPLETE; 16518 RunIfNotReady(); 16519 } 16520 break; 16521 16522 case STATE_PREPARE: 16523 if (aResponse.GetCmdStatus() == PVMFSuccess) 16524 { 16525 iState = STATE_SETPLAYBACKRANGE; 16526 RunIfNotReady(); 16527 } 16528 else 16529 { 16530 // Prepare failed 16531 PVPATB_TEST_IS_TRUE(false); 16532 iState = STATE_CLEANUPANDCOMPLETE; 16533 RunIfNotReady(); 16534 } 16535 break; 16536 16537 case STATE_SETPLAYBACKRANGE: 16538 if (aResponse.GetCmdStatus() == PVMFSuccess) 16539 { 16540 iState = STATE_START; 16541 RunIfNotReady(); 16542 } 16543 else if (aResponse.GetCmdStatus() == PVMFErrNotSupported) 16544 { 16545 fprintf(file, " SetPlaybackRange not supported \n"); 16546 iState = STATE_START; 16547 RunIfNotReady(); 16548 } 16549 else 16550 { 16551 // Stop failed 16552 PVPATB_TEST_IS_TRUE(false); 16553 iState = STATE_CLEANUPANDCOMPLETE; 16554 RunIfNotReady(); 16555 } 16556 break; 16557 16558 case STATE_START: 16559 if (aResponse.GetCmdStatus() == PVMFSuccess) 16560 { 16561 iState = STATE_STOP; 16562 RunIfNotReady(5000000); 16563 } 16564 else 16565 { 16566 // Start failed 16567 PVPATB_TEST_IS_TRUE(false); 16568 iState = STATE_CLEANUPANDCOMPLETE; 16569 RunIfNotReady(); 16570 } 16571 break; 16572 16573 case STATE_STOP: 16574 if (aResponse.GetCmdStatus() == PVMFSuccess) 16575 { 16576 iState = STATE_REMOVEDATASINK_VIDEO; 16577 RunIfNotReady(3000000); 16578 } 16579 else 16580 { 16581 // Stop failed 16582 PVPATB_TEST_IS_TRUE(false); 16583 iState = STATE_CLEANUPANDCOMPLETE; 16584 RunIfNotReady(); 16585 } 16586 break; 16587 16588 case STATE_REMOVEDATASINK_VIDEO: 16589 if (aResponse.GetCmdStatus() == PVMFSuccess) 16590 { 16591 iState = STATE_REMOVEDATASINK_AUDIO; 16592 RunIfNotReady(); 16593 } 16594 else 16595 { 16596 // RemoveDataSink failed 16597 PVPATB_TEST_IS_TRUE(false); 16598 iState = STATE_CLEANUPANDCOMPLETE; 16599 RunIfNotReady(); 16600 } 16601 break; 16602 16603 case STATE_REMOVEDATASINK_AUDIO: 16604 if (aResponse.GetCmdStatus() == PVMFSuccess) 16605 { 16606 iState = STATE_REMOVEDATASINK_TEXT; 16607 // iState=STATE_RESET; 16608 RunIfNotReady(); 16609 } 16610 else 16611 { 16612 // RemoveDataSink failed 16613 PVPATB_TEST_IS_TRUE(false); 16614 iState = STATE_CLEANUPANDCOMPLETE; 16615 RunIfNotReady(); 16616 } 16617 break; 16618 16619 case STATE_REMOVEDATASINK_TEXT: 16620 if (aResponse.GetCmdStatus() == PVMFSuccess) 16621 { 16622 iState = STATE_RESET; 16623 RunIfNotReady(); 16624 } 16625 else 16626 { 16627 // RemoveDataSink failed 16628 PVPATB_TEST_IS_TRUE(false); 16629 iState = STATE_CLEANUPANDCOMPLETE; 16630 RunIfNotReady(); 16631 } 16632 break; 16633 16634 case STATE_RESET: 16635 if (aResponse.GetCmdStatus() == PVMFSuccess) 16636 { 16637 iState = STATE_REMOVEDATASOURCE; 16638 RunIfNotReady(); 16639 } 16640 else 16641 { 16642 // Reset failed 16643 PVPATB_TEST_IS_TRUE(false); 16644 iState = STATE_CLEANUPANDCOMPLETE; 16645 RunIfNotReady(); 16646 } 16647 break; 16648 16649 case STATE_REMOVEDATASOURCE: 16650 if (aResponse.GetCmdStatus() == PVMFSuccess) 16651 { 16652 PVPATB_TEST_IS_TRUE(true); 16653 iState = STATE_CLEANUPANDCOMPLETE; 16654 RunIfNotReady(); 16655 } 16656 else 16657 { 16658 // RemoveDataSource failed 16659 PVPATB_TEST_IS_TRUE(false); 16660 iState = STATE_CLEANUPANDCOMPLETE; 16661 RunIfNotReady(); 16662 } 16663 break; 16664 16665 default: 16666 { 16667 // Testing error if this is reached 16668 PVPATB_TEST_IS_TRUE(false); 16669 iState = STATE_CLEANUPANDCOMPLETE; 16670 RunIfNotReady(); 16671 } 16672 break; 16673 } 16674 } 16675 16676 16677 void pvplayer_async_test_setplaybackafterprepare::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 16678 { 16679 switch (aEvent.GetEventType()) 16680 { 16681 case PVMFErrResourceConfiguration: 16682 // Just log the error 16683 PVPATB_TEST_IS_TRUE(false); 16684 break; 16685 16686 case PVMFErrResource: 16687 // Just log the error 16688 PVPATB_TEST_IS_TRUE(false); 16689 break; 16690 16691 case PVMFErrCorrupt: 16692 // Just log the error 16693 PVPATB_TEST_IS_TRUE(false); 16694 break; 16695 16696 case PVMFErrProcessing: 16697 // Just log the error 16698 PVPATB_TEST_IS_TRUE(false); 16699 break; 16700 16701 default: 16702 // Unknown error and just log the error 16703 PVPATB_TEST_IS_TRUE(false); 16704 break; 16705 } 16706 } 16707 16708 16709 void pvplayer_async_test_setplaybackafterprepare::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 16710 { 16711 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 16712 { 16713 // do nothing 16714 } 16715 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 16716 { 16717 iState = STATE_CLEANUPANDCOMPLETE; 16718 RunIfNotReady(); 16719 } 16720 if (aEvent.GetEventType() == PVMFInfoPositionStatus) 16721 { 16722 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 16723 if (iface == NULL) 16724 { 16725 return; 16726 } 16727 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 16728 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 16729 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 16730 { 16731 int32 infocode; 16732 PVUuid infouuid; 16733 infomsgiface->GetCodeUUID(infocode, infouuid); 16734 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoPlaybackPositionStatus)) 16735 { 16736 PVPPlaybackPosition aPos1; 16737 uint32 aPos2; 16738 16739 aPos1.iPosUnit = PVPPBPOSUNIT_MILLISEC; 16740 iPlayer->GetCurrentPositionSync(aPos1); 16741 16742 uint8* localbuf = aEvent.GetLocalBuffer(); 16743 if (aEvent.GetLocalBufferSize() == 8 && localbuf[0] == 1) 16744 { 16745 oscl_memcpy(&aPos2, &localbuf[4], sizeof(uint32)); 16746 } 16747 else 16748 { 16749 aPos2 = 0; 16750 } 16751 fprintf(file, " PVMFInfoPositionStatus: %d\n", aPos2); 16752 16753 /* 16754 if ( !(aPos1.iPosValue.millisec_value <= aPos2 + 50) ) 16755 { 16756 PVPATB_TEST_IS_TRUE(false); 16757 } 16758 */ 16759 } 16760 } 16761 } 16762 } 16763 16764 // 16765 // pvplayer_async_test_multipauseseekresume section 16766 // 16767 void pvplayer_async_test_multipauseseekresume::StartTest() 16768 { 16769 AddToScheduler(); 16770 iState = STATE_CREATE; 16771 RunIfNotReady(); 16772 } 16773 16774 16775 void pvplayer_async_test_multipauseseekresume::Run() 16776 { 16777 int error = 0; 16778 16779 switch (iState) 16780 { 16781 case STATE_CREATE: 16782 { 16783 iPlayer = NULL; 16784 16785 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 16786 if (error) 16787 { 16788 PVPATB_TEST_IS_TRUE(false); 16789 iObserver->TestCompleted(*iTestCase); 16790 } 16791 else 16792 { 16793 iState = STATE_ADDDATASOURCE; 16794 RunIfNotReady(); 16795 } 16796 } 16797 break; 16798 16799 case STATE_ADDDATASOURCE: 16800 { 16801 PVMFFormatType fileType; 16802 iDataSource = new PVPlayerDataSourceURL; 16803 OSCL_HeapString<OsclMemAllocator> filename; 16804 16805 if (oscl_strstr(iFileName, "test.mp4") != NULL) 16806 { 16807 filename = SOURCENAME_PREPEND_STRING; 16808 filename += _STRLIT_CHAR("test_reposition.mp4"); 16809 fileType = PVMF_MIME_MPEG4FF; 16810 iFileType = PVMF_MIME_MPEG4FF; 16811 } 16812 else 16813 { 16814 filename = iFileName; 16815 fileType = iFileType; 16816 } 16817 fprintf(iTestMsgOutputFile, "***Source URL=%s\n", filename.get_str()); 16818 oscl_UTF8ToUnicode(filename.get_str(), filename.get_size(), output, 256); 16819 wFileName.set(output, oscl_strlen(output)); 16820 16821 if (iFileType == PVMF_MIME_DATA_SOURCE_HTTP_URL) 16822 { 16823 fileType = PVMF_MIME_DATA_SOURCE_HTTP_URL; 16824 iDataSource->SetAlternateSourceFormatType(PVMF_MIME_DATA_SOURCE_MS_HTTP_STREAMING_URL); 16825 iSourceContextData = new PVMFSourceContextData(); 16826 iSourceContextData->EnableCommonSourceContext(); 16827 iSourceContextData->EnableStreamingSourceContext(); 16828 16829 PVInterface* sourceContext = NULL; 16830 PVUuid streamingContextUuid(PVMF_SOURCE_CONTEXT_DATA_STREAMING_UUID); 16831 if (iSourceContextData->queryInterface(streamingContextUuid, sourceContext)) 16832 { 16833 PVMFSourceContextDataStreaming* streamingContext = 16834 OSCL_STATIC_CAST(PVMFSourceContextDataStreaming*, sourceContext); 16835 streamingContext->iStreamStatsLoggingURL = wFileName; 16836 16837 if (iProxyEnabled) 16838 { 16839 streamingContext->iProxyName = _STRLIT_WCHAR("63.215.241.33"); 16840 streamingContext->iProxyPort = 7070; 16841 } 16842 16843 streamingContext->iUserID = _STRLIT_CHAR("abc"); 16844 streamingContext->iUserPasswd = _STRLIT_CHAR("xyz"); 16845 } 16846 iSourceContextData->EnableDownloadHTTPSourceContext(); 16847 sourceContext = NULL; 16848 PVUuid downloadContextUuid(PVMF_SOURCE_CONTEXT_DATA_DOWNLOAD_HTTP_UUID); 16849 if (iSourceContextData->queryInterface(downloadContextUuid, sourceContext)) 16850 { 16851 PVMFSourceContextDataDownloadHTTP* downloadContext = 16852 OSCL_STATIC_CAST(PVMFSourceContextDataDownloadHTTP*, sourceContext); 16853 if (iProxyEnabled) 16854 { 16855 downloadContext->iProxyName = _STRLIT_CHAR("63.215.241.33"); 16856 downloadContext->iProxyPort = 7070; 16857 } 16858 downloadContext->iDownloadFileName += _STRLIT_WCHAR("test_ftdownload.loc"); 16859 downloadContext->iConfigFileName += _STRLIT_WCHAR("mydlconfig"); 16860 downloadContext->iUserID = _STRLIT_CHAR("abc"); 16861 downloadContext->iUserPasswd = _STRLIT_CHAR("xyz"); 16862 downloadContext->bIsNewSession = true; 16863 downloadContext->iMaxFileSize = 0x7FFFFFFF; 16864 downloadContext->iPlaybackControl = PVMFSourceContextDataDownloadHTTP::EAsap; 16865 } 16866 iDataSource->SetDataSourceContextData((OsclAny*)iSourceContextData); 16867 } 16868 iDataSource->SetDataSourceURL(wFileName); 16869 iDataSource->SetDataSourceFormatType(fileType); 16870 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 16871 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16872 } 16873 break; 16874 16875 case STATE_INIT: 16876 { 16877 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 16878 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16879 } 16880 break; 16881 16882 case STATE_GETMETADATAKEYLIST: 16883 { 16884 iMetadataKeyList.clear(); 16885 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataKeys(iMetadataKeyList, 0, -1, NULL, (OsclAny*) & iContextObject)); 16886 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16887 } 16888 break; 16889 16890 case STATE_GETMETADATAVALUELIST: 16891 { 16892 iMetadataValueList.clear(); 16893 iNumValues = 0; 16894 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iMetadataKeyList, 0, -1, iNumValues, iMetadataValueList, (OsclAny*) & iContextObject)); 16895 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16896 } 16897 break; 16898 16899 case STATE_ADDDATASINK_VIDEO: 16900 { 16901 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 16902 sinkfile += _STRLIT_WCHAR("test_player_setstartpositionplaystop_video.dat"); 16903 16904 iMIOFileOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfile, MEDIATYPE_VIDEO, iCompressedVideo); 16905 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutVideo); 16906 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 16907 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 16908 16909 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 16910 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16911 } 16912 break; 16913 16914 case STATE_ADDDATASINK_AUDIO: 16915 { 16916 OSCL_wHeapString<OsclMemAllocator> sinkfile = OUTPUTNAME_PREPEND_WSTRING; 16917 sinkfile += _STRLIT_WCHAR("test_player_setstartpositionplaystop_audio.dat"); 16918 16919 iMIOFileOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfile, MEDIATYPE_AUDIO, iCompressedAudio); 16920 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMIOFileOutAudio); 16921 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 16922 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 16923 16924 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 16925 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16926 } 16927 break; 16928 16929 case STATE_PREPARE: 16930 { 16931 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 16932 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16933 } 16934 break; 16935 16936 case STATE_START: 16937 { 16938 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 16939 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16940 } 16941 break; 16942 16943 case STATE_PAUSE: 16944 { 16945 OSCL_TRY(error, iCurrentCmdId = iPlayer->Pause((OsclAny*) & iContextObject)); 16946 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16947 iCmdIds.push_back(iCurrentCmdId); 16948 } 16949 break; 16950 16951 case STATE_SETPLAYBACKRANGE: 16952 { 16953 PVPPlaybackPosition start, end; 16954 start.iIndeterminate = false; 16955 start.iPosUnit = PVPPBPOSUNIT_MILLISEC; 16956 start.iMode = PVPPBPOS_MODE_NOW; 16957 start.iPosValue.millisec_value = iSessionDuration / 4; 16958 end.iIndeterminate = true; 16959 OSCL_TRY(error, iCurrentCmdId = iPlayer->SetPlaybackRange(start, end, false, (OsclAny*) & iContextObject)); 16960 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16961 } 16962 break; 16963 16964 case STATE_RESUME: 16965 { 16966 OSCL_TRY(error, iCurrentCmdId = iPlayer->Resume((OsclAny*) & iContextObject)); 16967 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16968 iCmdIds.push_back(iCurrentCmdId); 16969 } 16970 break; 16971 16972 case STATE_STOP: 16973 { 16974 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 16975 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16976 } 16977 break; 16978 16979 case STATE_REMOVEDATASINK_VIDEO: 16980 { 16981 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 16982 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16983 } 16984 break; 16985 16986 case STATE_REMOVEDATASINK_AUDIO: 16987 { 16988 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 16989 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16990 } 16991 break; 16992 16993 case STATE_RESET: 16994 { 16995 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 16996 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 16997 } 16998 break; 16999 17000 case STATE_REMOVEDATASOURCE: 17001 { 17002 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 17003 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17004 } 17005 break; 17006 17007 case STATE_CLEANUPANDCOMPLETE: 17008 { 17009 PVPATB_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 17010 iPlayer = NULL; 17011 17012 delete iSourceContextData; 17013 iSourceContextData = NULL; 17014 17015 delete iDataSource; 17016 iDataSource = NULL; 17017 17018 delete iDataSinkVideo; 17019 iDataSinkVideo = NULL; 17020 17021 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 17022 iIONodeVideo = NULL; 17023 17024 iMioFactory->DestroyVideoOutput(iMIOFileOutVideo); 17025 iMIOFileOutVideo = NULL; 17026 17027 delete iDataSinkAudio; 17028 iDataSinkAudio = NULL; 17029 17030 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 17031 iIONodeAudio = NULL; 17032 17033 iMioFactory->DestroyAudioOutput(iMIOFileOutAudio); 17034 iMIOFileOutAudio = NULL; 17035 17036 iObserver->TestCompleted(*iTestCase); 17037 } 17038 break; 17039 17040 default: 17041 break; 17042 17043 } 17044 } 17045 17046 17047 void pvplayer_async_test_multipauseseekresume::CommandCompleted(const PVCmdResponse& aResponse) 17048 { 17049 if (aResponse.GetCmdId() != iCurrentCmdId) 17050 { 17051 // Wrong command ID. 17052 PVPATB_TEST_IS_TRUE(false); 17053 iState = STATE_CLEANUPANDCOMPLETE; 17054 RunIfNotReady(); 17055 return; 17056 } 17057 17058 if (aResponse.GetContext() != NULL) 17059 { 17060 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 17061 { 17062 if (iContextObject != iContextObjectRefValue) 17063 { 17064 // Context data value was corrupted 17065 PVPATB_TEST_IS_TRUE(false); 17066 iState = STATE_CLEANUPANDCOMPLETE; 17067 RunIfNotReady(); 17068 return; 17069 } 17070 } 17071 else 17072 { 17073 // Context data pointer was corrupted 17074 PVPATB_TEST_IS_TRUE(false); 17075 iState = STATE_CLEANUPANDCOMPLETE; 17076 RunIfNotReady(); 17077 return; 17078 } 17079 } 17080 17081 switch (iState) 17082 { 17083 case STATE_ADDDATASOURCE: 17084 if (aResponse.GetCmdStatus() == PVMFSuccess) 17085 { 17086 iState = STATE_INIT; 17087 RunIfNotReady(); 17088 } 17089 else 17090 { 17091 // AddDataSource failed 17092 PVPATB_TEST_IS_TRUE(false); 17093 iState = STATE_CLEANUPANDCOMPLETE; 17094 RunIfNotReady(); 17095 } 17096 break; 17097 17098 case STATE_INIT: 17099 if (aResponse.GetCmdStatus() == PVMFSuccess) 17100 { 17101 iState = STATE_GETMETADATAKEYLIST; 17102 RunIfNotReady(); 17103 } 17104 else 17105 { 17106 // Init failed 17107 PVPATB_TEST_IS_TRUE(false); 17108 iState = STATE_CLEANUPANDCOMPLETE; 17109 RunIfNotReady(); 17110 } 17111 break; 17112 17113 case STATE_GETMETADATAKEYLIST: 17114 if (aResponse.GetCmdStatus() == PVMFSuccess) 17115 { 17116 iState = STATE_GETMETADATAVALUELIST; 17117 RunIfNotReady(); 17118 } 17119 else 17120 { 17121 // GetMetadataKeys failed 17122 PVPATB_TEST_IS_TRUE(false); 17123 iState = STATE_CLEANUPANDCOMPLETE; 17124 RunIfNotReady(); 17125 } 17126 break; 17127 17128 case STATE_GETMETADATAVALUELIST: 17129 if (aResponse.GetCmdStatus() == PVMFSuccess) 17130 { 17131 for (uint32 i = 0; i < iMetadataValueList.size(); ++i) 17132 { 17133 if ((oscl_strstr(iMetadataValueList[i].key, "duration")) && iSessionDuration == 0) 17134 { 17135 iSessionDuration = iMetadataValueList[i].value.uint32_value; 17136 17137 // Check the timescale. If not available, assume millisecond (1000) 17138 const char *retTSstr; 17139 retTSstr = oscl_strstr(iMetadataValueList[i].key, "timescale="); 17140 uint32 retTSstrLen = 0; 17141 uint32 tsstrlen = oscl_strlen(_STRLIT_CHAR("timescale=")); 17142 if (retTSstr != NULL) 17143 { 17144 retTSstrLen = oscl_strlen(retTSstr); 17145 if (retTSstrLen > tsstrlen) 17146 { 17147 uint32 timescale = 0; 17148 PV_atoi((char*)(retTSstr + tsstrlen), 'd', (retTSstrLen - tsstrlen), timescale); 17149 if (timescale > 0 && timescale != 1000) 17150 { 17151 // Convert to milliseconds 17152 MediaClockConverter mcc(timescale); 17153 mcc.update_clock(iSessionDuration); 17154 iSessionDuration = mcc.get_converted_ts(1000); 17155 } 17156 } 17157 } 17158 } 17159 } 17160 iState = STATE_ADDDATASINK_VIDEO; 17161 RunIfNotReady(); 17162 } 17163 else 17164 { 17165 // GetMetadataValue failed 17166 PVPATB_TEST_IS_TRUE(false); 17167 iState = STATE_CLEANUPANDCOMPLETE; 17168 RunIfNotReady(); 17169 } 17170 break; 17171 17172 case STATE_ADDDATASINK_VIDEO: 17173 if (aResponse.GetCmdStatus() == PVMFSuccess) 17174 { 17175 iState = STATE_ADDDATASINK_AUDIO; 17176 RunIfNotReady(); 17177 } 17178 else 17179 { 17180 // AddDataSink failed 17181 PVPATB_TEST_IS_TRUE(false); 17182 iState = STATE_CLEANUPANDCOMPLETE; 17183 RunIfNotReady(); 17184 } 17185 break; 17186 17187 case STATE_ADDDATASINK_AUDIO: 17188 if (aResponse.GetCmdStatus() == PVMFSuccess) 17189 { 17190 iState = STATE_PREPARE; 17191 RunIfNotReady(); 17192 } 17193 else 17194 { 17195 // AddDataSink failed 17196 PVPATB_TEST_IS_TRUE(false); 17197 iState = STATE_CLEANUPANDCOMPLETE; 17198 RunIfNotReady(); 17199 } 17200 break; 17201 17202 case STATE_PREPARE: 17203 if (aResponse.GetCmdStatus() == PVMFSuccess) 17204 { 17205 iState = STATE_START; 17206 RunIfNotReady(); 17207 } 17208 else 17209 { 17210 // Prepare failed 17211 PVPATB_TEST_IS_TRUE(false); 17212 iState = STATE_CLEANUPANDCOMPLETE; 17213 RunIfNotReady(); 17214 } 17215 break; 17216 17217 case STATE_START: 17218 if (aResponse.GetCmdStatus() == PVMFSuccess) 17219 { 17220 iState = STATE_PAUSE; 17221 uint32 iPauseDurationMS = iSessionDuration / 10; 17222 RunIfNotReady(iPauseDurationMS*1000); 17223 } 17224 else 17225 { 17226 // Start failed 17227 PVPATB_TEST_IS_TRUE(false); 17228 iState = STATE_CLEANUPANDCOMPLETE; 17229 RunIfNotReady(); 17230 } 17231 break; 17232 17233 case STATE_PAUSE: 17234 if (aResponse.GetCmdStatus() == PVMFSuccess) 17235 { 17236 iNumPause++; 17237 iState = STATE_SETPLAYBACKRANGE; 17238 RunIfNotReady(1000000); 17239 } 17240 else 17241 { 17242 // One of queued commands failed 17243 PVPATB_TEST_IS_TRUE(false); 17244 iState = STATE_CLEANUPANDCOMPLETE; 17245 RunIfNotReady(); 17246 } 17247 break; 17248 17249 case STATE_SETPLAYBACKRANGE: 17250 if (aResponse.GetCmdStatus() == PVMFSuccess) 17251 { 17252 iState = STATE_RESUME; 17253 RunIfNotReady(1000000); 17254 } 17255 else 17256 { 17257 // SetPlaybackRange failed 17258 PVPATB_TEST_IS_TRUE(false); 17259 iState = STATE_CLEANUPANDCOMPLETE; 17260 RunIfNotReady(); 17261 } 17262 break; 17263 17264 case STATE_RESUME: 17265 if (aResponse.GetCmdStatus() == PVMFSuccess) 17266 { 17267 if (iTargetNumPause != iNumPause) 17268 { 17269 iState = STATE_PAUSE; 17270 uint32 iPauseDurationMS = iSessionDuration / 10; 17271 RunIfNotReady(iPauseDurationMS*1000); 17272 } 17273 } 17274 else 17275 { 17276 // One of queued commands failed 17277 PVPATB_TEST_IS_TRUE(false); 17278 iState = STATE_CLEANUPANDCOMPLETE; 17279 RunIfNotReady(); 17280 } 17281 break; 17282 17283 case STATE_STOP: 17284 if (aResponse.GetCmdStatus() == PVMFSuccess) 17285 { 17286 iState = STATE_REMOVEDATASINK_VIDEO; 17287 RunIfNotReady(); 17288 } 17289 else 17290 { 17291 // Stop failed 17292 PVPATB_TEST_IS_TRUE(false); 17293 iState = STATE_CLEANUPANDCOMPLETE; 17294 RunIfNotReady(); 17295 } 17296 break; 17297 17298 case STATE_REMOVEDATASINK_VIDEO: 17299 if (aResponse.GetCmdStatus() == PVMFSuccess) 17300 { 17301 iState = STATE_REMOVEDATASINK_AUDIO; 17302 RunIfNotReady(); 17303 } 17304 else 17305 { 17306 // RemoveDataSink failed 17307 PVPATB_TEST_IS_TRUE(false); 17308 iState = STATE_CLEANUPANDCOMPLETE; 17309 RunIfNotReady(); 17310 } 17311 break; 17312 17313 case STATE_REMOVEDATASINK_AUDIO: 17314 if (aResponse.GetCmdStatus() == PVMFSuccess) 17315 { 17316 iState = STATE_RESET; 17317 RunIfNotReady(); 17318 } 17319 else 17320 { 17321 // RemoveDataSink failed 17322 PVPATB_TEST_IS_TRUE(false); 17323 iState = STATE_CLEANUPANDCOMPLETE; 17324 RunIfNotReady(); 17325 } 17326 break; 17327 17328 case STATE_RESET: 17329 if (aResponse.GetCmdStatus() == PVMFSuccess) 17330 { 17331 iState = STATE_REMOVEDATASOURCE; 17332 RunIfNotReady(); 17333 } 17334 else 17335 { 17336 // Reset failed 17337 PVPATB_TEST_IS_TRUE(false); 17338 iState = STATE_CLEANUPANDCOMPLETE; 17339 RunIfNotReady(); 17340 } 17341 break; 17342 17343 case STATE_REMOVEDATASOURCE: 17344 if (aResponse.GetCmdStatus() == PVMFSuccess) 17345 { 17346 PVPATB_TEST_IS_TRUE(true); 17347 iState = STATE_CLEANUPANDCOMPLETE; 17348 RunIfNotReady(); 17349 } 17350 else 17351 { 17352 // RemoveDataSource failed 17353 PVPATB_TEST_IS_TRUE(false); 17354 iState = STATE_CLEANUPANDCOMPLETE; 17355 RunIfNotReady(); 17356 } 17357 break; 17358 17359 default: 17360 { 17361 // Testing error if this is reached 17362 PVPATB_TEST_IS_TRUE(false); 17363 iState = STATE_CLEANUPANDCOMPLETE; 17364 RunIfNotReady(); 17365 } 17366 break; 17367 } 17368 } 17369 17370 17371 void pvplayer_async_test_multipauseseekresume::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 17372 { 17373 switch (aEvent.GetEventType()) 17374 { 17375 case PVMFErrResourceConfiguration: 17376 // Just log the error 17377 PVPATB_TEST_IS_TRUE(false); 17378 break; 17379 17380 case PVMFErrResource: 17381 // Just log the error 17382 PVPATB_TEST_IS_TRUE(false); 17383 break; 17384 17385 case PVMFErrCorrupt: 17386 // Just log the error 17387 PVPATB_TEST_IS_TRUE(false); 17388 break; 17389 17390 case PVMFErrProcessing: 17391 // Just log the error 17392 PVPATB_TEST_IS_TRUE(false); 17393 break; 17394 17395 default: 17396 // Unknown error and just log the error 17397 PVPATB_TEST_IS_TRUE(false); 17398 break; 17399 } 17400 17401 // Wait for engine to handle the error 17402 Cancel(); 17403 } 17404 17405 17406 void pvplayer_async_test_multipauseseekresume::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 17407 { 17408 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 17409 { 17410 // do nothing 17411 } 17412 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 17413 { 17414 iState = STATE_CLEANUPANDCOMPLETE; 17415 RunIfNotReady(); 17416 } 17417 // Check for end of clip event 17418 if (aEvent.GetEventType() == PVMFInfoEndOfData) 17419 { 17420 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 17421 if (iface == NULL) 17422 { 17423 return; 17424 } 17425 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 17426 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 17427 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 17428 { 17429 int32 infocode; 17430 PVUuid infouuid; 17431 infomsgiface->GetCodeUUID(infocode, infouuid); 17432 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && (infocode == PVPlayerInfoEndOfClipReached)) 17433 { 17434 iState = STATE_STOP; 17435 Cancel(); 17436 RunIfNotReady(); 17437 } 17438 } 17439 } 17440 else if (aEvent.GetEventType() == PVMFInfoSourceFormatNotSupported) 17441 { 17442 // source rollover... 17443 fprintf(iTestMsgOutputFile, "###PVMFInfoSourceFormatNotSupported...\n"); 17444 PVInterface* iface = (PVInterface*)(aEvent.GetEventExtensionInterface()); 17445 if (iface != NULL) 17446 { 17447 PVUuid infomsguuid = PVMFErrorInfoMessageInterfaceUUID; 17448 PVMFErrorInfoMessageInterface* infomsgiface = NULL; 17449 if (iface->queryInterface(infomsguuid, (PVInterface*&)infomsgiface) == true) 17450 { 17451 int32 infocode; 17452 PVUuid infouuid; 17453 infomsgiface->GetCodeUUID(infocode, infouuid); 17454 if ((infouuid == PVPlayerErrorInfoEventTypesUUID) && 17455 (infocode == PVPlayerInfoAttemptingSourceRollOver)) 17456 { 17457 uint8* localBuf = aEvent.GetLocalBuffer(); 17458 if (localBuf != NULL) 17459 { 17460 uint32 srcFormat = 0; 17461 oscl_memcpy(&srcFormat, &localBuf[4], sizeof(uint32)); 17462 fprintf(iTestMsgOutputFile, "###Attempting Source RollOver - NewSrcFormat=%d\n", srcFormat); 17463 } 17464 } 17465 } 17466 } 17467 } 17468 } 17469 17470 // 17471 // pvplayer_async_test_multiple_instance section 17472 // 17473 #include "pvmf_local_data_source.h" 17474 #include "oscl_scheduler.h" 17475 #include "OMX_Core.h" 17476 #include "pv_omxcore.h" 17477 #include "oscl_mem_audit.h" 17478 17479 //test observer function for the 2nd instance. 17480 void pvplayer_async_test_multiple_instance::ChildObserver::TestCompleted(test_case &tc) 17481 { 17482 OSCL_UNUSED_ARG(tc); 17483 OsclExecScheduler* sched = OsclExecScheduler::Current(); 17484 if (sched) 17485 sched->StopScheduler(); 17486 } 17487 17488 void pvplayer_async_test_multiple_instance::ChildTestIsTrue(bool aCondition) 17489 //add failures from child to the parent error count. 17490 { 17491 OSCL_ASSERT(iParentInstance); 17492 if (!aCondition) 17493 iParentInstance->iChildThreadFailures++; 17494 } 17495 17496 //To avoid thread contention for the test result, only the parent thread can register 17497 //test failures directly in the test case. The child thread increments a counter that 17498 //will get added to test case results after the child thread exits. 17499 #define MULTI_TEST_IS_TRUE(x) (iParentInstance)?ChildTestIsTrue(x):PVPATB_TEST_IS_TRUE(x); 17500 17501 void pvplayer_async_test_multiple_instance::InThread(pvplayer_async_test_multiple_instance* parent) 17502 { 17503 //Init Oscl 17504 OsclMem::Init(); 17505 OMX_MasterInit(); 17506 PVLogger::Init(); 17507 OsclScheduler::Init("pvplayer_async_test_multiple_instance"); 17508 17509 { 17510 //create a 2nd test instance. 17511 pvplayer_async_test_multiple_instance* test = new pvplayer_async_test_multiple_instance(*parent->iParam); 17512 17513 //replace the observer with one appropriate for this thread. 17514 ChildObserver* obs = new ChildObserver; 17515 test->iObserver = obs; 17516 17517 //replace sink name with a unique name for this thread. 17518 test->iSinkName = _STRLIT_WCHAR("pvplayer_async_test_multiple_instance_2nd_"); 17519 17520 //save parent instance pointer 17521 test->iParentInstance = parent; 17522 17523 //add to scheduler and go 17524 test->StartTest(); 17525 OsclExecScheduler* sched = OsclExecScheduler::Current(); 17526 sched->StartScheduler(); 17527 17528 //cleanup. 17529 delete(obs); 17530 delete(test); 17531 } 17532 17533 //Cleanup Oscl. 17534 OsclScheduler::Cleanup(); 17535 PVLogger::Cleanup(); 17536 OMX_MasterDeinit(); 17537 //note: there's no memory leak check here since 17538 //this thread exits before the main thread. 17539 OsclMem::Cleanup(); 17540 } 17541 17542 static TOsclThreadFuncRet OSCL_THREAD_DECL pvplayer_async_test_multiple_instance_thread(TOsclThreadFuncArg arg) 17543 { 17544 //parent test is passed in as arg 17545 pvplayer_async_test_multiple_instance* parent = (pvplayer_async_test_multiple_instance*)arg; 17546 17547 //Init Oscl 17548 OsclBase::Init(); 17549 OsclErrorTrap::Init(); 17550 17551 //Run remainder of the thread under a trap. 17552 OSCL_TRY(parent->iChildThreadLeave, 17553 pvplayer_async_test_multiple_instance::InThread(parent);); 17554 17555 //Cleanup Oscl 17556 OsclErrorTrap::Cleanup(); 17557 OsclBase::Cleanup(); 17558 17559 //parent thread waits on this signal to know this thread exited. 17560 parent->iChildThreadExit = true; 17561 17562 return 0; 17563 } 17564 17565 void pvplayer_async_test_multiple_instance::StartTest() 17566 { 17567 AddToScheduler(); 17568 iState = STATE_CREATE; 17569 RunIfNotReady(); 17570 } 17571 17572 void pvplayer_async_test_multiple_instance::Run() 17573 { 17574 int error = 0; 17575 17576 switch (iState) 17577 { 17578 case STATE_CREATE: 17579 { 17580 //If this is the original instance, then launch a 2nd thread. 17581 if (!iParentInstance) 17582 { 17583 OsclThread thread; 17584 OsclProcStatus::eOsclProcError result = thread.Create(pvplayer_async_test_multiple_instance_thread, 0, this); 17585 if (result != OsclProcStatus::SUCCESS_ERROR) 17586 { 17587 PVPATB_TEST_IS_TRUE(false); 17588 iObserver->TestCompleted(*iTestCase); 17589 break; 17590 } 17591 } 17592 17593 OSCL_TRY(error, iPlayer = PVPlayerFactory::CreatePlayer(this, this, this)); 17594 if (error) 17595 { 17596 MULTI_TEST_IS_TRUE(false); 17597 iObserver->TestCompleted(*iTestCase); 17598 } 17599 else 17600 { 17601 iState = STATE_ADDDATASOURCE; 17602 RunIfNotReady(); 17603 } 17604 } 17605 break; 17606 17607 case STATE_ADDDATASOURCE: 17608 { 17609 iDataSource = new PVPlayerDataSourceURL; 17610 17611 OSCL_HeapString<OsclMemAllocator> fname(iFileName); 17612 oscl_UTF8ToUnicode(fname.get_cstr(), fname.get_size(), iTmpWCharBuffer, 512); 17613 iFileNameWStr.set(iTmpWCharBuffer, oscl_strlen(iTmpWCharBuffer)); 17614 iDataSource->SetDataSourceURL(iFileNameWStr); 17615 iDataSource->SetDataSourceFormatType(iFileType); 17616 iLocalDataSource = new PVMFLocalDataSource(); 17617 iDataSource->SetDataSourceContextData((OsclAny*)iLocalDataSource); 17618 17619 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 17620 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17621 } 17622 17623 break; 17624 17625 case STATE_INIT: 17626 { 17627 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 17628 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17629 } 17630 break; 17631 17632 case STATE_GETMETADATAKEYLIST: 17633 { 17634 iMetadataKeyList.clear(); 17635 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataKeys(iMetadataKeyList, 0, 100, NULL, (OsclAny*) & iContextObject)); 17636 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17637 } 17638 break; 17639 17640 case STATE_GETMETADATAVALUELIST: 17641 { 17642 iMetadataValueList.clear(); 17643 iNumValues = 0; 17644 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iMetadataKeyList, 0, 100, iNumValues, iMetadataValueList, (OsclAny*) & iContextObject)); 17645 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17646 } 17647 break; 17648 17649 case STATE_ADDDATASINK_VIDEO: 17650 { 17651 17652 OSCL_wHeapString<OsclMemAllocator> sinkfilename; 17653 sinkfilename = OUTPUTNAME_PREPEND_WSTRING; 17654 sinkfilename += iSinkName; 17655 if (iCompressedVideo) 17656 { 17657 sinkfilename += _STRLIT_WCHAR("compressed_"); 17658 } 17659 OSCL_wHeapString<OsclMemAllocator> inputfilename; 17660 RetrieveFilename(iFileNameWStr.get_str(), inputfilename); 17661 sinkfilename += inputfilename; 17662 sinkfilename += _STRLIT_WCHAR("_video.dat"); 17663 17664 iMOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfilename, MEDIATYPE_VIDEO, iCompressedVideo); 17665 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMOutVideo); 17666 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 17667 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 17668 17669 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 17670 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17671 } 17672 break; 17673 17674 case STATE_ADDDATASINK_AUDIO: 17675 { 17676 OSCL_wHeapString<OsclMemAllocator> sinkfilename; 17677 sinkfilename = OUTPUTNAME_PREPEND_WSTRING; 17678 sinkfilename += iSinkName; 17679 if (iCompressedAudio) 17680 { 17681 sinkfilename += _STRLIT_WCHAR("compressed_"); 17682 } 17683 OSCL_wHeapString<OsclMemAllocator> inputfilename; 17684 RetrieveFilename(iFileNameWStr.get_str(), inputfilename); 17685 sinkfilename += inputfilename; 17686 sinkfilename += _STRLIT_WCHAR("_audio.dat"); 17687 17688 iMOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfilename, MEDIATYPE_AUDIO, iCompressedAudio); 17689 17690 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMOutAudio); 17691 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 17692 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 17693 17694 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 17695 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17696 } 17697 break; 17698 17699 case STATE_ADDDATASINK_TEXT: 17700 { 17701 OSCL_wHeapString<OsclMemAllocator> sinkfilename; 17702 sinkfilename = OUTPUTNAME_PREPEND_WSTRING; 17703 sinkfilename += iSinkName; 17704 OSCL_wHeapString<OsclMemAllocator> inputfilename; 17705 RetrieveFilename(iFileNameWStr.get_str(), inputfilename); 17706 sinkfilename += inputfilename; 17707 sinkfilename += _STRLIT_WCHAR("_text.dat"); 17708 17709 iMOutText = iMioFactory->CreateTextOutput((OsclAny*) & sinkfilename, MEDIATYPE_TEXT); 17710 iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMOutText); 17711 iDataSinkText = new PVPlayerDataSinkPVMFNode; 17712 ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText); 17713 17714 17715 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 17716 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17717 } 17718 break; 17719 17720 case STATE_PREPARE: 17721 { 17722 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 17723 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17724 } 17725 break; 17726 17727 case STATE_START: 17728 { 17729 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 17730 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17731 } 17732 break; 17733 17734 case STATE_STOP: 17735 { 17736 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 17737 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17738 } 17739 break; 17740 17741 case STATE_REMOVEDATASINK_VIDEO: 17742 { 17743 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 17744 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17745 } 17746 break; 17747 17748 case STATE_REMOVEDATASINK_AUDIO: 17749 { 17750 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 17751 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17752 } 17753 break; 17754 17755 case STATE_REMOVEDATASINK_TEXT: 17756 { 17757 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 17758 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17759 } 17760 break; 17761 17762 case STATE_RESET: 17763 { 17764 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 17765 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17766 } 17767 break; 17768 17769 case STATE_REMOVEDATASOURCE: 17770 { 17771 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 17772 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 17773 } 17774 break; 17775 17776 case STATE_CLEANUPANDCOMPLETE: 17777 { 17778 MULTI_TEST_IS_TRUE(PVPlayerFactory::DeletePlayer(iPlayer)); 17779 iPlayer = NULL; 17780 17781 delete iDataSource; 17782 iDataSource = NULL; 17783 17784 delete iDataSinkVideo; 17785 iDataSinkVideo = NULL; 17786 17787 delete iDataSinkAudio; 17788 iDataSinkAudio = NULL; 17789 17790 delete iDataSinkText; 17791 iDataSinkText = NULL; 17792 17793 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 17794 iIONodeVideo = NULL; 17795 17796 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 17797 iIONodeAudio = NULL; 17798 17799 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText); 17800 iIONodeText = NULL; 17801 17802 iMioFactory->DestroyVideoOutput(iMOutVideo); 17803 iMOutVideo = NULL; 17804 17805 iMioFactory->DestroyAudioOutput(iMOutAudio); 17806 iMOutAudio = NULL; 17807 17808 iMioFactory->DestroyTextOutput(iMOutText); 17809 iMOutText = NULL; 17810 17811 delete iLocalDataSource; 17812 iLocalDataSource = NULL; 17813 17814 //If this is the original instance, then wait on the 2nd instance to finish 17815 //so we can check its error results and add to this test case results. 17816 if (!iParentInstance) 17817 { 17818 if (!iChildThreadExit) 17819 { 17820 fprintf(file, "Waiting on 2nd instance to exit...\n"); 17821 for (uint32 i = 0; !iChildThreadExit && i < 20; i++) 17822 OsclThread::SleepMillisec(1000); 17823 } 17824 //make sure child thread exited within the allowed time 17825 //and didn't report any test failures, exceptions, or memory leaks. 17826 PVPATB_TEST_IS_TRUE(iChildThreadExit); 17827 if (iChildThreadFailures > 0) 17828 PVPATB_TEST_IS_TRUE(false); 17829 if (iChildThreadLeave != OsclErrNone) 17830 PVPATB_TEST_IS_TRUE(false); 17831 } 17832 17833 iObserver->TestCompleted(*iTestCase); 17834 } 17835 break; 17836 17837 default: 17838 break; 17839 17840 } 17841 } 17842 17843 17844 void pvplayer_async_test_multiple_instance::CommandCompleted(const PVCmdResponse& aResponse) 17845 { 17846 if (aResponse.GetCmdId() != iCurrentCmdId) 17847 { 17848 // Wrong command ID. 17849 MULTI_TEST_IS_TRUE(false); 17850 iState = STATE_CLEANUPANDCOMPLETE; 17851 RunIfNotReady(); 17852 return; 17853 } 17854 17855 if (aResponse.GetContext() != NULL) 17856 { 17857 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 17858 { 17859 if (iContextObject != iContextObjectRefValue) 17860 { 17861 // Context data value was corrupted 17862 MULTI_TEST_IS_TRUE(false); 17863 iState = STATE_CLEANUPANDCOMPLETE; 17864 RunIfNotReady(); 17865 return; 17866 } 17867 } 17868 else 17869 { 17870 // Context data pointer was corrupted 17871 MULTI_TEST_IS_TRUE(false); 17872 iState = STATE_CLEANUPANDCOMPLETE; 17873 RunIfNotReady(); 17874 return; 17875 } 17876 } 17877 17878 switch (iState) 17879 { 17880 case STATE_ADDDATASOURCE: 17881 if (aResponse.GetCmdStatus() == PVMFSuccess) 17882 { 17883 iState = STATE_INIT; 17884 RunIfNotReady(); 17885 } 17886 else 17887 { 17888 // AddDataSource failed 17889 MULTI_TEST_IS_TRUE(false); 17890 iState = STATE_CLEANUPANDCOMPLETE; 17891 RunIfNotReady(); 17892 } 17893 break; 17894 17895 case STATE_INIT: 17896 if (aResponse.GetCmdStatus() == PVMFSuccess) 17897 { 17898 iState = STATE_GETMETADATAKEYLIST; 17899 RunIfNotReady(); 17900 } 17901 else 17902 { 17903 // Init failed 17904 MULTI_TEST_IS_TRUE(false); 17905 iState = STATE_CLEANUPANDCOMPLETE; 17906 RunIfNotReady(); 17907 } 17908 break; 17909 17910 case STATE_GETMETADATAKEYLIST: 17911 if (aResponse.GetCmdStatus() == PVMFSuccess || aResponse.GetCmdStatus() == PVMFErrArgument) 17912 { 17913 iState = STATE_GETMETADATAVALUELIST; 17914 RunIfNotReady(); 17915 } 17916 else 17917 { 17918 // GetMetadataKeys failed 17919 MULTI_TEST_IS_TRUE(false); 17920 iState = STATE_CLEANUPANDCOMPLETE; 17921 RunIfNotReady(); 17922 } 17923 break; 17924 17925 case STATE_GETMETADATAVALUELIST: 17926 if (aResponse.GetCmdStatus() == PVMFSuccess || aResponse.GetCmdStatus() == PVMFErrArgument) 17927 { 17928 //Display the resulting metadata. 17929 PrintMetadata(); 17930 iState = STATE_ADDDATASINK_VIDEO; 17931 RunIfNotReady(); 17932 } 17933 else 17934 { 17935 // GetMetadataValue failed 17936 MULTI_TEST_IS_TRUE(false); 17937 iState = STATE_CLEANUPANDCOMPLETE; 17938 RunIfNotReady(); 17939 } 17940 break; 17941 17942 case STATE_ADDDATASINK_VIDEO: 17943 if (aResponse.GetCmdStatus() == PVMFSuccess) 17944 { 17945 iState = STATE_ADDDATASINK_AUDIO; 17946 RunIfNotReady(); 17947 } 17948 else 17949 { 17950 // AddDataSink failed 17951 MULTI_TEST_IS_TRUE(false); 17952 iState = STATE_CLEANUPANDCOMPLETE; 17953 RunIfNotReady(); 17954 } 17955 break; 17956 17957 case STATE_ADDDATASINK_AUDIO: 17958 if (aResponse.GetCmdStatus() == PVMFSuccess) 17959 { 17960 iState = STATE_ADDDATASINK_TEXT; 17961 RunIfNotReady(); 17962 } 17963 else 17964 { 17965 // AddDataSink failed 17966 MULTI_TEST_IS_TRUE(false); 17967 iState = STATE_CLEANUPANDCOMPLETE; 17968 RunIfNotReady(); 17969 } 17970 break; 17971 17972 case STATE_ADDDATASINK_TEXT: 17973 if (aResponse.GetCmdStatus() == PVMFSuccess) 17974 { 17975 iState = STATE_PREPARE; 17976 RunIfNotReady(); 17977 } 17978 else 17979 { 17980 // AddDataSink failed 17981 MULTI_TEST_IS_TRUE(false); 17982 iState = STATE_CLEANUPANDCOMPLETE; 17983 RunIfNotReady(); 17984 } 17985 break; 17986 17987 case STATE_PREPARE: 17988 if (aResponse.GetCmdStatus() == PVMFSuccess) 17989 { 17990 iState = STATE_START; 17991 RunIfNotReady(); 17992 } 17993 else 17994 { 17995 // Prepare failed 17996 MULTI_TEST_IS_TRUE(false); 17997 iState = STATE_CLEANUPANDCOMPLETE; 17998 RunIfNotReady(); 17999 } 18000 break; 18001 18002 case STATE_START: 18003 if (aResponse.GetCmdStatus() == PVMFSuccess) 18004 { 18005 //stop in 20 seconds. 18006 iState = STATE_STOP; 18007 RunIfNotReady(20000000); 18008 } 18009 else 18010 { 18011 // Start failed 18012 MULTI_TEST_IS_TRUE(false); 18013 iState = STATE_CLEANUPANDCOMPLETE; 18014 RunIfNotReady(); 18015 } 18016 break; 18017 18018 case STATE_STOP: 18019 if (aResponse.GetCmdStatus() == PVMFSuccess) 18020 { 18021 iState = STATE_REMOVEDATASINK_VIDEO; 18022 RunIfNotReady(); 18023 } 18024 else 18025 { 18026 // Stop failed 18027 MULTI_TEST_IS_TRUE(false); 18028 iState = STATE_CLEANUPANDCOMPLETE; 18029 RunIfNotReady(); 18030 } 18031 break; 18032 18033 case STATE_REMOVEDATASINK_VIDEO: 18034 if (aResponse.GetCmdStatus() == PVMFSuccess) 18035 { 18036 iState = STATE_REMOVEDATASINK_AUDIO; 18037 RunIfNotReady(); 18038 } 18039 else 18040 { 18041 // RemoveDataSink failed 18042 MULTI_TEST_IS_TRUE(false); 18043 iState = STATE_CLEANUPANDCOMPLETE; 18044 RunIfNotReady(); 18045 } 18046 break; 18047 18048 case STATE_REMOVEDATASINK_AUDIO: 18049 if (aResponse.GetCmdStatus() == PVMFSuccess) 18050 { 18051 iState = STATE_REMOVEDATASINK_TEXT; 18052 RunIfNotReady(); 18053 } 18054 else 18055 { 18056 // RemoveDataSink failed 18057 MULTI_TEST_IS_TRUE(false); 18058 iState = STATE_CLEANUPANDCOMPLETE; 18059 RunIfNotReady(); 18060 } 18061 break; 18062 18063 case STATE_REMOVEDATASINK_TEXT: 18064 if (aResponse.GetCmdStatus() == PVMFSuccess) 18065 { 18066 iState = STATE_RESET; 18067 RunIfNotReady(); 18068 } 18069 else 18070 { 18071 // RemoveDataSink failed 18072 MULTI_TEST_IS_TRUE(false); 18073 iState = STATE_CLEANUPANDCOMPLETE; 18074 RunIfNotReady(); 18075 } 18076 break; 18077 18078 case STATE_RESET: 18079 if (aResponse.GetCmdStatus() == PVMFSuccess) 18080 { 18081 iState = STATE_REMOVEDATASOURCE; 18082 RunIfNotReady(); 18083 } 18084 else 18085 { 18086 // Reset failed 18087 MULTI_TEST_IS_TRUE(false); 18088 iState = STATE_CLEANUPANDCOMPLETE; 18089 RunIfNotReady(); 18090 } 18091 break; 18092 18093 case STATE_REMOVEDATASOURCE: 18094 if (aResponse.GetCmdStatus() == PVMFSuccess) 18095 { 18096 MULTI_TEST_IS_TRUE(true); 18097 iState = STATE_CLEANUPANDCOMPLETE; 18098 RunIfNotReady(); 18099 } 18100 else 18101 { 18102 // RemoveDataSource failed 18103 MULTI_TEST_IS_TRUE(false); 18104 iState = STATE_CLEANUPANDCOMPLETE; 18105 RunIfNotReady(); 18106 } 18107 break; 18108 18109 default: 18110 { 18111 // Testing error if this is reached 18112 MULTI_TEST_IS_TRUE(false); 18113 iState = STATE_CLEANUPANDCOMPLETE; 18114 RunIfNotReady(); 18115 } 18116 break; 18117 } 18118 } 18119 18120 18121 void pvplayer_async_test_multiple_instance::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 18122 { 18123 switch (aEvent.GetEventType()) 18124 { 18125 case PVMFErrResourceConfiguration: 18126 // Just log the error 18127 MULTI_TEST_IS_TRUE(false); 18128 break; 18129 18130 case PVMFErrResource: 18131 // Just log the error 18132 MULTI_TEST_IS_TRUE(false); 18133 break; 18134 18135 case PVMFErrCorrupt: 18136 // Just log the error 18137 MULTI_TEST_IS_TRUE(false); 18138 break; 18139 18140 case PVMFErrProcessing: 18141 // Just log the error 18142 MULTI_TEST_IS_TRUE(false); 18143 break; 18144 18145 default: 18146 // Unknown error and just log the error 18147 MULTI_TEST_IS_TRUE(false); 18148 break; 18149 } 18150 18151 // Wait for engine to handle the error 18152 Cancel(); 18153 } 18154 18155 18156 void pvplayer_async_test_multiple_instance::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 18157 { 18158 if (aEvent.GetEventType() == PVMFInfoErrorHandlingStart) 18159 { 18160 // do nothing 18161 } 18162 if (aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 18163 { 18164 iState = STATE_CLEANUPANDCOMPLETE; 18165 RunIfNotReady(); 18166 } 18167 } 18168 18169 void pvplayer_async_test_multiple_instance::PrintMetadata() 18170 { 18171 //to avoid thread contention for the output file, only print metadata 18172 //from the original instance (with NULL parent). 18173 if (iParentInstance) 18174 return; 18175 18176 for (uint32 i = 0; i < iMetadataValueList.size(); i++) 18177 { 18178 if (!iMetadataValueList[i].key) 18179 { 18180 fprintf(file, " Metadata Key Missing!, value ?\n"); 18181 } 18182 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=char*")) 18183 { 18184 fprintf(file, " Metadata Key '%s', value '%s'\n", iMetadataValueList[i].key, iMetadataValueList[i].value.pChar_value); 18185 } 18186 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=wchar*")) 18187 { 18188 OSCL_HeapString<OsclMemAllocator> ostr; 18189 char buf[2]; 18190 buf[1] = '\0'; 18191 for (uint32 j = 0;; j++) 18192 { 18193 if (iMetadataValueList[i].value.pWChar_value[j] == '\0') 18194 break; 18195 buf[0] = (char)iMetadataValueList[i].value.pWChar_value[j]; 18196 ostr += buf; 18197 } 18198 fprintf(file, " Metadata Key '%s', value '%s'\n", iMetadataValueList[i].key, ostr.get_str()); 18199 } 18200 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=uint32")) 18201 { 18202 fprintf(file, " Metadata Key '%s', value %d\n", iMetadataValueList[i].key, iMetadataValueList[i].value.uint32_value); 18203 } 18204 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=bool")) 18205 { 18206 fprintf(file, " Metadata Key '%s', value %d\n", iMetadataValueList[i].key, iMetadataValueList[i].value.bool_value); 18207 } 18208 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=uint8*")) 18209 { 18210 fprintf(file, " Metadata Key '%s', len %d\n", iMetadataValueList[i].key, iMetadataValueList[i].length); 18211 } 18212 else 18213 { 18214 fprintf(file, " Metadata Key '%s', value ?\n", iMetadataValueList[i].key); 18215 } 18216 } 18217 fprintf(file, "\n\n"); 18218 } 18219 18220 // 18221 // pvplayer_async_test_multiple_thread section 18222 // 18223 #include "pvmf_local_data_source.h" 18224 #include "oscl_scheduler.h" 18225 #include "OMX_Core.h" 18226 #include "oscl_mem_audit.h" 18227 18228 18229 18230 // 18231 #undef MULTI_TEST_IS_TRUE 18232 #define MULTI_TEST_IS_TRUE(x) PVPATB_TEST_IS_TRUE(x); 18233 18234 18235 void pvplayer_async_test_multiple_thread::StartTest() 18236 { 18237 AddToScheduler(); 18238 iState = STATE_CREATE; 18239 RunIfNotReady(); 18240 } 18241 18242 #include "oscl_init.h" 18243 #include "oscl_mem.h" 18244 18245 static TOsclThreadFuncRet OSCL_THREAD_DECL pvplayer_async_test_multiple_thread_thread(TOsclThreadFuncArg arg) 18246 { 18247 //parent test is passed in as arg 18248 pvplayer_async_test_multiple_thread* parent = (pvplayer_async_test_multiple_thread*)arg; 18249 18250 //Init Oscl. 18251 OsclSelect select; 18252 select.iOutputFile = file;//for memory leak output. 18253 int32 err; 18254 OsclInit::Init(err, &select); 18255 if (err) 18256 { 18257 parent->iThreadErrors++; 18258 parent->iThreadReadySem.Signal(); 18259 return 0; 18260 } 18261 18262 OSCL_TRY(err, 18263 18264 //get scheduler 18265 parent->iThreadScheduler = OsclExecScheduler::Current(); 18266 18267 //create player 18268 parent->iPlayer = PVPlayerFactory::CreatePlayer(parent, parent, parent); 18269 18270 //signal parent thread that player is ready to accept commands. 18271 parent->iThreadReadySem.Signal(); 18272 18273 //launch scheduler. this call blocks. 18274 parent->iThreadScheduler->StartScheduler(); 18275 18276 //delete player 18277 PVPlayerFactory::DeletePlayer(parent->iPlayer); 18278 parent->iPlayer = NULL; 18279 18280 ); //OSCL_TRY 18281 if (err) 18282 parent->iThreadErrors++; 18283 18284 //Cleanup Oscl 18285 OsclInit::Cleanup(err, &select); 18286 if (err) 18287 parent->iThreadErrors++; 18288 18289 parent->iThreadScheduler = NULL; 18290 18291 //Signal that this thread is cleaned up. 18292 parent->iThreadExitSem.Signal(); 18293 18294 return 0; 18295 } 18296 18297 void pvplayer_async_test_multiple_thread::Run() 18298 { 18299 int error = 0; 18300 18301 switch (iState) 18302 { 18303 case STATE_CREATE: 18304 { 18305 //Configure the threadsafe queues that are used for engine 18306 //thread callbacks. 18307 iThreadSafeCommandQueue.Configure(this); 18308 iThreadSafeErrorQueue.Configure(this); 18309 iThreadSafeInfoQueue.Configure(this); 18310 18311 //Create engine thread 18312 { 18313 iThreadReadySem.Create(); 18314 iThreadExitSem.Create(); 18315 iThreadErrors = 0; 18316 iPlayer = NULL; 18317 iThreadScheduler = NULL; 18318 18319 OsclThread thread; 18320 OsclProcStatus::eOsclProcError result = thread.Create(pvplayer_async_test_multiple_thread_thread, 0, this); 18321 if (result != OsclProcStatus::SUCCESS_ERROR) 18322 { 18323 PVPATB_TEST_IS_TRUE(false); 18324 iObserver->TestCompleted(*iTestCase); 18325 break; 18326 } 18327 //wait on engine to be ready to use. 18328 iThreadReadySem.Wait(); 18329 } 18330 18331 //player should have been created in the other thread 18332 if (!iPlayer) 18333 { 18334 MULTI_TEST_IS_TRUE(false); 18335 iObserver->TestCompleted(*iTestCase); 18336 } 18337 else 18338 { 18339 iState = STATE_ADDDATASOURCE; 18340 RunIfNotReady(); 18341 } 18342 } 18343 break; 18344 18345 case STATE_ADDDATASOURCE: 18346 { 18347 iDataSource = new PVPlayerDataSourceURL; 18348 18349 OSCL_HeapString<OsclMemAllocator> fname(iFileName); 18350 oscl_UTF8ToUnicode(fname.get_cstr(), fname.get_size(), iTmpWCharBuffer, 512); 18351 iFileNameWStr.set(iTmpWCharBuffer, oscl_strlen(iTmpWCharBuffer)); 18352 iDataSource->SetDataSourceURL(iFileNameWStr); 18353 iDataSource->SetDataSourceFormatType(iFileType); 18354 iLocalDataSource = new PVMFLocalDataSource(); 18355 iDataSource->SetDataSourceContextData((OsclAny*)iLocalDataSource); 18356 18357 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSource(*iDataSource, (OsclAny*) & iContextObject)); 18358 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18359 } 18360 18361 break; 18362 18363 case STATE_INIT: 18364 { 18365 OSCL_TRY(error, iCurrentCmdId = iPlayer->Init((OsclAny*) & iContextObject)); 18366 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18367 } 18368 break; 18369 18370 case STATE_GETMETADATAKEYLIST: 18371 { 18372 iMetadataKeyList.clear(); 18373 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataKeys(iMetadataKeyList, 0, 100, NULL, (OsclAny*) & iContextObject)); 18374 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18375 } 18376 break; 18377 18378 case STATE_GETMETADATAVALUELIST: 18379 { 18380 iMetadataValueList.clear(); 18381 iNumValues = 0; 18382 OSCL_TRY(error, iCurrentCmdId = iPlayer->GetMetadataValues(iMetadataKeyList, 0, 100, iNumValues, iMetadataValueList, (OsclAny*) & iContextObject, false)); 18383 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18384 } 18385 break; 18386 18387 case STATE_RELEASEMETADATAVALUES: 18388 { 18389 PrintMetadata(); 18390 OSCL_TRY(error, iCurrentCmdId = iPlayer->ReleaseMetadataValues(iMetadataValueList, (OsclAny*) & iContextObject)); 18391 OSCL_FIRST_CATCH_ANY(error, PVPATB_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18392 } 18393 break; 18394 18395 case STATE_ADDDATASINK_VIDEO: 18396 { 18397 //Synchronous API test 18398 { 18399 PVPlayerState state; 18400 PVMFStatus status = PVMFFailure; 18401 OSCL_TRY(error, status = iPlayer->GetPVPlayerStateSync(state);); 18402 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18403 MULTI_TEST_IS_TRUE(status == PVMFSuccess && state == PVP_STATE_INITIALIZED); 18404 } 18405 18406 OSCL_wHeapString<OsclMemAllocator> sinkfilename; 18407 sinkfilename = OUTPUTNAME_PREPEND_WSTRING; 18408 sinkfilename += iSinkName; 18409 if (iCompressedVideo) 18410 { 18411 sinkfilename += _STRLIT_WCHAR("compressed_"); 18412 } 18413 OSCL_wHeapString<OsclMemAllocator> inputfilename; 18414 RetrieveFilename(iFileNameWStr.get_str(), inputfilename); 18415 sinkfilename += inputfilename; 18416 sinkfilename += _STRLIT_WCHAR("_video.dat"); 18417 18418 iMOutVideo = iMioFactory->CreateVideoOutput((OsclAny*) & sinkfilename, MEDIATYPE_VIDEO, iCompressedVideo); 18419 iIONodeVideo = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMOutVideo); 18420 iDataSinkVideo = new PVPlayerDataSinkPVMFNode; 18421 ((PVPlayerDataSinkPVMFNode*)iDataSinkVideo)->SetDataSinkNode(iIONodeVideo); 18422 18423 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 18424 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18425 } 18426 break; 18427 18428 case STATE_ADDDATASINK_AUDIO: 18429 { 18430 OSCL_wHeapString<OsclMemAllocator> sinkfilename; 18431 sinkfilename = OUTPUTNAME_PREPEND_WSTRING; 18432 sinkfilename += iSinkName; 18433 if (iCompressedAudio) 18434 { 18435 sinkfilename += _STRLIT_WCHAR("compressed_"); 18436 } 18437 OSCL_wHeapString<OsclMemAllocator> inputfilename; 18438 RetrieveFilename(iFileNameWStr.get_str(), inputfilename); 18439 sinkfilename += inputfilename; 18440 sinkfilename += _STRLIT_WCHAR("_audio.dat"); 18441 18442 iMOutAudio = iMioFactory->CreateAudioOutput((OsclAny*) & sinkfilename, MEDIATYPE_AUDIO, iCompressedAudio); 18443 18444 iIONodeAudio = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMOutAudio); 18445 iDataSinkAudio = new PVPlayerDataSinkPVMFNode; 18446 ((PVPlayerDataSinkPVMFNode*)iDataSinkAudio)->SetDataSinkNode(iIONodeAudio); 18447 18448 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 18449 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18450 } 18451 break; 18452 18453 case STATE_ADDDATASINK_TEXT: 18454 { 18455 OSCL_wHeapString<OsclMemAllocator> sinkfilename; 18456 sinkfilename = OUTPUTNAME_PREPEND_WSTRING; 18457 sinkfilename += iSinkName; 18458 OSCL_wHeapString<OsclMemAllocator> inputfilename; 18459 RetrieveFilename(iFileNameWStr.get_str(), inputfilename); 18460 sinkfilename += inputfilename; 18461 sinkfilename += _STRLIT_WCHAR("_text.dat"); 18462 18463 iMOutText = iMioFactory->CreateTextOutput((OsclAny*) & sinkfilename, MEDIATYPE_TEXT); 18464 iIONodeText = PVMediaOutputNodeFactory::CreateMediaOutputNode(iMOutText); 18465 iDataSinkText = new PVPlayerDataSinkPVMFNode; 18466 ((PVPlayerDataSinkPVMFNode*)iDataSinkText)->SetDataSinkNode(iIONodeText); 18467 18468 18469 OSCL_TRY(error, iCurrentCmdId = iPlayer->AddDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 18470 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18471 } 18472 break; 18473 18474 case STATE_PREPARE: 18475 { 18476 OSCL_TRY(error, iCurrentCmdId = iPlayer->Prepare((OsclAny*) & iContextObject)); 18477 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18478 } 18479 break; 18480 18481 case STATE_START: 18482 { 18483 OSCL_TRY(error, iCurrentCmdId = iPlayer->Start((OsclAny*) & iContextObject)); 18484 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18485 } 18486 break; 18487 18488 case STATE_STOP: 18489 { 18490 OSCL_TRY(error, iCurrentCmdId = iPlayer->Stop((OsclAny*) & iContextObject)); 18491 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18492 } 18493 break; 18494 18495 case STATE_REMOVEDATASINK_VIDEO: 18496 { 18497 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkVideo, (OsclAny*) & iContextObject)); 18498 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18499 } 18500 break; 18501 18502 case STATE_REMOVEDATASINK_AUDIO: 18503 { 18504 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkAudio, (OsclAny*) & iContextObject)); 18505 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18506 } 18507 break; 18508 18509 case STATE_REMOVEDATASINK_TEXT: 18510 { 18511 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSink(*iDataSinkText, (OsclAny*) & iContextObject)); 18512 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18513 } 18514 break; 18515 18516 case STATE_RESET: 18517 { 18518 OSCL_TRY(error, iCurrentCmdId = iPlayer->Reset((OsclAny*) & iContextObject)); 18519 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18520 } 18521 break; 18522 18523 case STATE_REMOVEDATASOURCE: 18524 { 18525 OSCL_TRY(error, iCurrentCmdId = iPlayer->RemoveDataSource(*iDataSource, (OsclAny*) & iContextObject)); 18526 OSCL_FIRST_CATCH_ANY(error, MULTI_TEST_IS_TRUE(false); iState = STATE_CLEANUPANDCOMPLETE; RunIfNotReady()); 18527 } 18528 break; 18529 18530 case STATE_WAIT_FOR_ERROR_HANDLING: 18531 { 18532 // Timed out waiting for error handling to complete 18533 MULTI_TEST_IS_TRUE(false); 18534 // Forcibly terminate the test 18535 iState = STATE_CLEANUPANDCOMPLETE; 18536 RunIfNotReady(); 18537 } 18538 break; 18539 18540 case STATE_CLEANUPANDCOMPLETE: 18541 { 18542 //Engine thread cleanup 18543 { 18544 if (iPlayer) 18545 { 18546 //Stop scheduler 18547 iThreadScheduler->StopScheduler(); 18548 18549 //Wait on engine cleanup 18550 iThreadExitSem.Wait(); 18551 18552 //Check for errors. 18553 if (iThreadErrors > 0) 18554 PVPATB_TEST_IS_TRUE(false); 18555 18556 iThreadReadySem.Close(); 18557 iThreadExitSem.Close(); 18558 } 18559 } 18560 18561 delete iDataSource; 18562 iDataSource = NULL; 18563 18564 delete iDataSinkVideo; 18565 iDataSinkVideo = NULL; 18566 18567 delete iDataSinkAudio; 18568 iDataSinkAudio = NULL; 18569 18570 delete iDataSinkText; 18571 iDataSinkText = NULL; 18572 18573 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeVideo); 18574 iIONodeVideo = NULL; 18575 18576 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeAudio); 18577 iIONodeAudio = NULL; 18578 18579 PVMediaOutputNodeFactory::DeleteMediaOutputNode(iIONodeText); 18580 iIONodeText = NULL; 18581 18582 iMioFactory->DestroyVideoOutput(iMOutVideo); 18583 iMOutVideo = NULL; 18584 18585 iMioFactory->DestroyAudioOutput(iMOutAudio); 18586 iMOutAudio = NULL; 18587 18588 iMioFactory->DestroyTextOutput(iMOutText); 18589 iMOutText = NULL; 18590 18591 delete iLocalDataSource; 18592 iLocalDataSource = NULL; 18593 18594 iObserver->TestCompleted(*iTestCase); 18595 } 18596 break; 18597 18598 default: 18599 break; 18600 18601 } 18602 } 18603 18604 //data is available on one of the thread-safe queues. 18605 void pvplayer_async_test_multiple_thread::ThreadSafeQueueDataAvailable(ThreadSafeQueue* aQueue) 18606 { 18607 if (aQueue == &iThreadSafeCommandQueue) 18608 { 18609 for (uint32 ndata = 1; ndata;) 18610 { 18611 ThreadSafeQueueId id; 18612 OsclAny* data; 18613 ndata = iThreadSafeCommandQueue.DeQueue(id, data); 18614 if (ndata) 18615 { 18616 PVCmdResponse* cmd = (PVCmdResponse*)data; 18617 CommandCompleted(*cmd); 18618 OSCL_DELETE(cmd); 18619 } 18620 } 18621 } 18622 if (aQueue == &iThreadSafeErrorQueue) 18623 { 18624 for (uint32 ndata = 1; ndata;) 18625 { 18626 ThreadSafeQueueId id; 18627 OsclAny* data; 18628 ndata = iThreadSafeErrorQueue.DeQueue(id, data); 18629 if (ndata) 18630 { 18631 int32 eventType = (PVMFEventType)data; 18632 PVAsyncErrorEvent event(eventType); 18633 HandleErrorEvent(event); 18634 } 18635 } 18636 } 18637 if (aQueue == &iThreadSafeInfoQueue) 18638 { 18639 for (uint32 ndata = 1; ndata;) 18640 { 18641 ThreadSafeQueueId id; 18642 OsclAny* data; 18643 ndata = iThreadSafeInfoQueue.DeQueue(id, data); 18644 if (ndata) 18645 { 18646 int32 eventType = (PVMFEventType)data; 18647 PVAsyncInformationalEvent event(eventType); 18648 HandleInformationalEvent(event); 18649 } 18650 } 18651 } 18652 } 18653 18654 void pvplayer_async_test_multiple_thread::CommandCompleted(const PVCmdResponse& aResponse) 18655 { 18656 //if this callback is from engine thread, then push it across the thread 18657 //boundary. 18658 if (!iThreadSafeCommandQueue.IsInThread()) 18659 { 18660 PVCmdResponse* cmd = OSCL_NEW(PVCmdResponse, (aResponse)); 18661 iThreadSafeCommandQueue.AddToQueue(cmd); 18662 return; 18663 } 18664 18665 if (aResponse.GetCmdId() != iCurrentCmdId) 18666 { 18667 // Wrong command ID. 18668 MULTI_TEST_IS_TRUE(false); 18669 iState = STATE_CLEANUPANDCOMPLETE; 18670 RunIfNotReady(); 18671 return; 18672 } 18673 18674 if (aResponse.GetContext() != NULL) 18675 { 18676 if (aResponse.GetContext() == (OsclAny*)&iContextObject) 18677 { 18678 if (iContextObject != iContextObjectRefValue) 18679 { 18680 // Context data value was corrupted 18681 MULTI_TEST_IS_TRUE(false); 18682 iState = STATE_CLEANUPANDCOMPLETE; 18683 RunIfNotReady(); 18684 return; 18685 } 18686 } 18687 else 18688 { 18689 // Context data pointer was corrupted 18690 MULTI_TEST_IS_TRUE(false); 18691 iState = STATE_CLEANUPANDCOMPLETE; 18692 RunIfNotReady(); 18693 return; 18694 } 18695 } 18696 18697 switch (iState) 18698 { 18699 case STATE_ADDDATASOURCE: 18700 if (aResponse.GetCmdStatus() == PVMFSuccess) 18701 { 18702 iState = STATE_INIT; 18703 RunIfNotReady(); 18704 } 18705 else 18706 { 18707 // AddDataSource failed 18708 MULTI_TEST_IS_TRUE(false); 18709 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18710 RunIfNotReady(5000000); 18711 } 18712 break; 18713 18714 case STATE_INIT: 18715 if (aResponse.GetCmdStatus() == PVMFSuccess) 18716 { 18717 iState = STATE_GETMETADATAKEYLIST; 18718 RunIfNotReady(); 18719 } 18720 else 18721 { 18722 // Init failed 18723 MULTI_TEST_IS_TRUE(false); 18724 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18725 RunIfNotReady(5000000); 18726 } 18727 break; 18728 18729 case STATE_GETMETADATAKEYLIST: 18730 if (aResponse.GetCmdStatus() == PVMFSuccess || aResponse.GetCmdStatus() == PVMFErrArgument) 18731 { 18732 iState = STATE_GETMETADATAVALUELIST; 18733 RunIfNotReady(); 18734 } 18735 else 18736 { 18737 // GetMetadataKeys failed 18738 MULTI_TEST_IS_TRUE(false); 18739 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18740 RunIfNotReady(5000000); 18741 } 18742 break; 18743 18744 case STATE_GETMETADATAVALUELIST: 18745 if (aResponse.GetCmdStatus() == PVMFSuccess || aResponse.GetCmdStatus() == PVMFErrArgument) 18746 { 18747 iState = STATE_RELEASEMETADATAVALUES; 18748 RunIfNotReady(); 18749 } 18750 else 18751 { 18752 // GetMetadataValue failed 18753 MULTI_TEST_IS_TRUE(false); 18754 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18755 RunIfNotReady(5000000); 18756 } 18757 break; 18758 18759 case STATE_RELEASEMETADATAVALUES: 18760 if (aResponse.GetCmdStatus() == PVMFSuccess) 18761 { 18762 iState = STATE_ADDDATASINK_VIDEO; 18763 RunIfNotReady(); 18764 } 18765 else 18766 { 18767 // ReleaseMetadataValue failed 18768 MULTI_TEST_IS_TRUE(false); 18769 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18770 RunIfNotReady(5000000); 18771 } 18772 break; 18773 18774 case STATE_ADDDATASINK_VIDEO: 18775 if (aResponse.GetCmdStatus() == PVMFSuccess) 18776 { 18777 iState = STATE_ADDDATASINK_AUDIO; 18778 RunIfNotReady(); 18779 } 18780 else 18781 { 18782 // AddDataSink failed 18783 MULTI_TEST_IS_TRUE(false); 18784 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18785 RunIfNotReady(5000000); 18786 } 18787 break; 18788 18789 case STATE_ADDDATASINK_AUDIO: 18790 if (aResponse.GetCmdStatus() == PVMFSuccess) 18791 { 18792 iState = STATE_ADDDATASINK_TEXT; 18793 RunIfNotReady(); 18794 } 18795 else 18796 { 18797 // AddDataSink failed 18798 MULTI_TEST_IS_TRUE(false); 18799 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18800 RunIfNotReady(5000000); 18801 } 18802 break; 18803 18804 case STATE_ADDDATASINK_TEXT: 18805 if (aResponse.GetCmdStatus() == PVMFSuccess) 18806 { 18807 iState = STATE_PREPARE; 18808 RunIfNotReady(); 18809 } 18810 else 18811 { 18812 // AddDataSink failed 18813 MULTI_TEST_IS_TRUE(false); 18814 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18815 RunIfNotReady(5000000); 18816 } 18817 break; 18818 18819 case STATE_PREPARE: 18820 if (aResponse.GetCmdStatus() == PVMFSuccess) 18821 { 18822 iState = STATE_START; 18823 RunIfNotReady(); 18824 } 18825 else 18826 { 18827 // Prepare failed 18828 MULTI_TEST_IS_TRUE(false); 18829 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18830 RunIfNotReady(5000000); 18831 } 18832 break; 18833 18834 case STATE_START: 18835 if (aResponse.GetCmdStatus() == PVMFSuccess) 18836 { 18837 //stop in 20 seconds. 18838 iState = STATE_STOP; 18839 RunIfNotReady(20000000); 18840 } 18841 else 18842 { 18843 // Start failed 18844 MULTI_TEST_IS_TRUE(false); 18845 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18846 RunIfNotReady(5000000); 18847 } 18848 break; 18849 18850 case STATE_STOP: 18851 if (aResponse.GetCmdStatus() == PVMFSuccess) 18852 { 18853 iState = STATE_REMOVEDATASINK_VIDEO; 18854 RunIfNotReady(); 18855 } 18856 else 18857 { 18858 // Stop failed 18859 MULTI_TEST_IS_TRUE(false); 18860 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18861 RunIfNotReady(5000000); 18862 } 18863 break; 18864 18865 case STATE_REMOVEDATASINK_VIDEO: 18866 if (aResponse.GetCmdStatus() == PVMFSuccess) 18867 { 18868 iState = STATE_REMOVEDATASINK_AUDIO; 18869 RunIfNotReady(); 18870 } 18871 else 18872 { 18873 // RemoveDataSink failed 18874 MULTI_TEST_IS_TRUE(false); 18875 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18876 RunIfNotReady(5000000); 18877 } 18878 break; 18879 18880 case STATE_REMOVEDATASINK_AUDIO: 18881 if (aResponse.GetCmdStatus() == PVMFSuccess) 18882 { 18883 iState = STATE_REMOVEDATASINK_TEXT; 18884 RunIfNotReady(); 18885 } 18886 else 18887 { 18888 // RemoveDataSink failed 18889 MULTI_TEST_IS_TRUE(false); 18890 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18891 RunIfNotReady(5000000); 18892 } 18893 break; 18894 18895 case STATE_REMOVEDATASINK_TEXT: 18896 if (aResponse.GetCmdStatus() == PVMFSuccess) 18897 { 18898 iState = STATE_RESET; 18899 RunIfNotReady(); 18900 } 18901 else 18902 { 18903 // RemoveDataSink failed 18904 MULTI_TEST_IS_TRUE(false); 18905 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18906 RunIfNotReady(5000000); 18907 } 18908 break; 18909 18910 case STATE_RESET: 18911 if (aResponse.GetCmdStatus() == PVMFSuccess) 18912 { 18913 iState = STATE_REMOVEDATASOURCE; 18914 RunIfNotReady(); 18915 } 18916 else 18917 { 18918 // Reset failed 18919 MULTI_TEST_IS_TRUE(false); 18920 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18921 RunIfNotReady(5000000); 18922 } 18923 break; 18924 18925 case STATE_REMOVEDATASOURCE: 18926 if (aResponse.GetCmdStatus() == PVMFSuccess) 18927 { 18928 MULTI_TEST_IS_TRUE(true); 18929 iState = STATE_CLEANUPANDCOMPLETE; 18930 RunIfNotReady(); 18931 } 18932 else 18933 { 18934 // RemoveDataSource failed 18935 MULTI_TEST_IS_TRUE(false); 18936 iState = STATE_CLEANUPANDCOMPLETE; 18937 RunIfNotReady(); 18938 } 18939 break; 18940 18941 default: 18942 { 18943 // Testing error if this is reached 18944 MULTI_TEST_IS_TRUE(false); 18945 iState = STATE_CLEANUPANDCOMPLETE; 18946 RunIfNotReady(); 18947 } 18948 break; 18949 } 18950 } 18951 18952 18953 void pvplayer_async_test_multiple_thread::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) 18954 { 18955 //if this callback is from engine thread, then push it across the thread 18956 //boundary. 18957 if (!iThreadSafeErrorQueue.IsInThread()) 18958 { 18959 //note: we discard all data except the event type here. 18960 //if we need more data, memory has to be copied. 18961 iThreadSafeErrorQueue.AddToQueue((OsclAny*)aEvent.GetEventType()); 18962 return; 18963 } 18964 18965 switch (aEvent.GetEventType()) 18966 { 18967 case PVMFErrResourceConfiguration: 18968 // Just log the error 18969 MULTI_TEST_IS_TRUE(false); 18970 break; 18971 18972 case PVMFErrResource: 18973 // Just log the error 18974 MULTI_TEST_IS_TRUE(false); 18975 break; 18976 18977 case PVMFErrCorrupt: 18978 // Just log the error 18979 MULTI_TEST_IS_TRUE(false); 18980 break; 18981 18982 case PVMFErrProcessing: 18983 // Just log the error 18984 MULTI_TEST_IS_TRUE(false); 18985 break; 18986 18987 default: 18988 // Unknown error and just log the error 18989 MULTI_TEST_IS_TRUE(false); 18990 break; 18991 } 18992 18993 // Wait for engine to handle the error 18994 Cancel(); 18995 iState = STATE_WAIT_FOR_ERROR_HANDLING; 18996 RunIfNotReady(5000000); 18997 } 18998 18999 19000 void pvplayer_async_test_multiple_thread::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) 19001 { 19002 //if this callback is from engine thread, then push it across the thread 19003 //boundary. 19004 if (!iThreadSafeInfoQueue.IsInThread()) 19005 { 19006 //note: we discard all data except the event type here. 19007 //if we need more data, memory has to be copied. 19008 iThreadSafeInfoQueue.AddToQueue((OsclAny*)aEvent.GetEventType()); 19009 return; 19010 } 19011 19012 // Wait for error handling to complete 19013 if (iState == STATE_WAIT_FOR_ERROR_HANDLING && aEvent.GetEventType() == PVMFInfoErrorHandlingComplete) 19014 { 19015 PVPlayerState pstate; 19016 iPlayer->GetPVPlayerStateSync(pstate); 19017 switch (pstate) 19018 { 19019 case PVP_STATE_INITIALIZED: 19020 Cancel(); 19021 iState = STATE_REMOVEDATASINK_VIDEO; 19022 RunIfNotReady(); 19023 break; 19024 19025 case PVP_STATE_IDLE: 19026 Cancel(); 19027 iState = STATE_REMOVEDATASOURCE; 19028 RunIfNotReady(); 19029 break; 19030 19031 default: 19032 // Engine should not be in any other state when 19033 // error handling completes 19034 MULTI_TEST_IS_TRUE(false); 19035 Cancel(); 19036 iState = STATE_CLEANUPANDCOMPLETE; 19037 RunIfNotReady(); 19038 break; 19039 } 19040 } 19041 } 19042 19043 void pvplayer_async_test_multiple_thread::PrintMetadata() 19044 { 19045 for (uint32 i = 0; i < iMetadataValueList.size(); i++) 19046 { 19047 if (!iMetadataValueList[i].key) 19048 { 19049 fprintf(file, " Metadata Key Missing!, value ?\n"); 19050 } 19051 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=char*")) 19052 { 19053 fprintf(file, " Metadata Key '%s', value '%s'\n", iMetadataValueList[i].key, iMetadataValueList[i].value.pChar_value); 19054 } 19055 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=wchar*")) 19056 { 19057 OSCL_HeapString<OsclMemAllocator> ostr; 19058 char buf[2]; 19059 buf[1] = '\0'; 19060 for (uint32 j = 0;; j++) 19061 { 19062 if (iMetadataValueList[i].value.pWChar_value[j] == '\0') 19063 break; 19064 buf[0] = (char)iMetadataValueList[i].value.pWChar_value[j]; 19065 ostr += buf; 19066 } 19067 fprintf(file, " Metadata Key '%s', value '%s'\n", iMetadataValueList[i].key, ostr.get_str()); 19068 } 19069 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=uint32")) 19070 { 19071 fprintf(file, " Metadata Key '%s', value %d\n", iMetadataValueList[i].key, iMetadataValueList[i].value.uint32_value); 19072 } 19073 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=bool")) 19074 { 19075 fprintf(file, " Metadata Key '%s', value %d\n", iMetadataValueList[i].key, iMetadataValueList[i].value.bool_value); 19076 } 19077 else if (oscl_strstr(iMetadataValueList[i].key, "valtype=uint8*")) 19078 { 19079 fprintf(file, " Metadata Key '%s', len %d\n", iMetadataValueList[i].key, iMetadataValueList[i].length); 19080 } 19081 else 19082 { 19083 fprintf(file, " Metadata Key '%s', value ?\n", iMetadataValueList[i].key); 19084 } 19085 } 19086 fprintf(file, "\n\n"); 19087 } 19088