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_BASE_H_INCLUDED 19 #define TEST_BASE_H_INCLUDED 20 21 #include "test_engine.h" 22 23 #define TEST_DURATION 10000 24 25 class test_base : public engine_test, 26 public H324MConfigObserver 27 { 28 public: 29 30 test_base(PVMFFormatType aAudSrcFormatType, 31 PVMFFormatType aAudSinkFormatType, 32 PVMFFormatType aVidSrcFormatType, 33 PVMFFormatType aVidSinkFormatType, 34 bool aUseProxy = false, 35 int aMaxRuns = 1, 36 bool isSIP = false) : 37 engine_test(aUseProxy, aMaxRuns), 38 iH324MConfig(NULL), 39 iEncoderIFCommandId(-1), 40 i324mIFCommandId(-1), 41 iCancelCmdId(-1), 42 iQueryInterfaceCmdId(-1), 43 iStackIFSet(false), 44 iEncoderIFSet(false), 45 iSIP(isSIP), 46 iAudSrcFormatType(aAudSrcFormatType), 47 iAudSinkFormatType(aAudSinkFormatType), 48 iVidSrcFormatType(aVidSrcFormatType), 49 iVidSinkFormatType(aVidSinkFormatType), 50 iTempH324MConfigIterface(NULL) 51 { 52 } 53 54 virtual ~test_base() 55 { 56 } 57 58 template<class DestructClass> 59 class AppenderDestructDealloc : public OsclDestructDealloc 60 { 61 public: 62 virtual void destruct_and_dealloc(OsclAny *ptr) 63 { 64 delete((DestructClass*)ptr); 65 } 66 }; 67 68 protected: 69 void InitializeLogs(); 70 71 virtual bool Init(); 72 virtual void CommandCompleted(const PVCmdResponse& aResponse); 73 74 void CreateH324Component(bool aCreateH324 = true); 75 76 void H324MConfigCommandCompletedL(PVMFCmdResp& aResponse); 77 void H324MConfigHandleInformationalEventL(PVMFAsyncEvent& aNotification); 78 79 virtual void QueryInterfaceSucceeded(); 80 81 //------------------- Functions overridden in test classes for specific behavior------ 82 virtual bool start_async_test(); 83 84 virtual void InitSucceeded(); 85 virtual void InitFailed(); 86 virtual void InitCancelled(); 87 88 virtual void ConnectSucceeded(); 89 virtual void ConnectFailed(); 90 virtual void ConnectCancelled(); 91 92 virtual void CancelCmdCompleted(); 93 94 95 virtual void RstCmdCompleted(); 96 virtual void DisCmdSucceeded(); 97 virtual void DisCmdFailed(); 98 99 virtual void EncoderIFSucceeded(); 100 virtual void EncoderIFFailed(); 101 102 103 // audio 104 virtual void AudioAddSinkCompleted(); 105 virtual void AudioAddSourceCompleted(); 106 virtual void AudioRemoveSourceCompleted(); 107 virtual void AudioRemoveSinkCompleted(); 108 109 // video 110 virtual void VideoAddSinkSucceeded(); 111 virtual void VideoAddSinkFailed(); 112 virtual void VideoAddSourceSucceeded(); 113 virtual void VideoAddSourceFailed(); 114 virtual void VideoRemoveSourceCompleted(); 115 virtual void VideoRemoveSinkCompleted(); 116 //------------------- END Functions overridden in test classes for specific behavior------ 117 118 H324MConfigInterface* iH324MConfig; 119 PVCommandId iEncoderIFCommandId; 120 PVCommandId i324mIFCommandId; 121 PVCommandId iCancelCmdId; 122 PVCommandId iQueryInterfaceCmdId; 123 124 bool iStackIFSet; 125 bool iEncoderIFSet; 126 bool iSIP; 127 128 PVMFFormatType iAudSrcFormatType, iAudSinkFormatType; 129 PVMFFormatType iVidSrcFormatType, iVidSinkFormatType; 130 PVInterface* iTempH324MConfigIterface; 131 }; 132 133 134 #endif 135 136 137