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_AUTHOR_ENGINE_TESTSET4_H_INCLUDED 19 #define TEST_PV_AUTHOR_ENGINE_TESTSET4_H_INCLUDED 20 21 #ifndef PVAETEST_H_INCLUDED 22 #include "pvaetest.h" 23 #endif 24 25 #ifndef TEST_PV_AUTHOR_ENGINE_TYPEDEFS_H 26 #include "test_pv_author_engine_typedefs.h" 27 #endif 28 #ifndef PVMI_CONFIG_AND_CAPABILITY_H_INCLUDED 29 #include "pvmi_config_and_capability.h" 30 #endif 31 #define PVPATB_TEST_IS_TRUE( condition ) (iTestCase->test_is_true_stub( (condition), (#condition), __FILE__, __LINE__ )) 32 33 34 class pvauthor_async_compressed_test_errorhandling: public pvauthor_async_test_base 35 { 36 public: pvauthor_async_compressed_test_errorhandling(PVAuthorAsyncTestParam aTestParam,const char * aInputFileNameAudio,const char * aInputFileNameVideo,const char * aInputFileNameText,const char * aOutputFileName,PVAETestInputType aAudioInputType,PVAETestInputType aVideoInputType,PVAETestInputType aTextInputType,const char * aComposerMimeType,const char * aAudioEncoderMimeType,const char * aVideoEncoderMimeType,const char * aTextEncoderMimeType,AVTConfig aAVTConfig,bool aPauseResumeEnable,uint32 aAuthoringTime,FAIL_STATE aFailState)37 pvauthor_async_compressed_test_errorhandling(PVAuthorAsyncTestParam aTestParam, const char* aInputFileNameAudio, 38 const char* aInputFileNameVideo, const char* aInputFileNameText, const char* aOutputFileName, 39 PVAETestInputType aAudioInputType, PVAETestInputType aVideoInputType, 40 PVAETestInputType aTextInputType, const char* aComposerMimeType, 41 const char* aAudioEncoderMimeType, const char* aVideoEncoderMimeType, 42 const char* aTextEncoderMimeType, AVTConfig aAVTConfig, bool aPauseResumeEnable, uint32 aAuthoringTime, 43 FAIL_STATE aFailState) 44 45 : pvauthor_async_test_base(aTestParam) 46 47 , iComposerMimeType(aComposerMimeType) 48 , iAudioEncoderMimeType(aAudioEncoderMimeType) 49 , iVideoEncoderMimeType(aVideoEncoderMimeType) 50 , iTextEncoderMimeType(aTextEncoderMimeType) 51 , iAudioInputType(aAudioInputType) 52 , iVideoInputType(aVideoInputType) 53 , iTextInputType(aTextInputType) 54 , iAuthor(NULL) 55 , iComposer(NULL) 56 , iComposerConfig(NULL) 57 , iAudioEncoderConfig(NULL) 58 , iVideoEncoderConfig(NULL) 59 , iTextEncoderConfig(NULL) 60 , iOutputSizeAndDurationConfig(NULL) 61 , iAVTConfig(aAVTConfig) 62 , bAudioTrack(true) 63 , bVideoTrack(true) 64 , iPauseResumeEnable(aPauseResumeEnable) 65 , iAuthoringTime(aAuthoringTime) 66 , iAuthoringCounter(0) 67 , iFailureState(aFailState) 68 69 { 70 iLogger = PVLogger::GetLoggerObject("pvauthor_async_compressed_test_errorhandling"); 71 72 if (iAuthoringTime > 0) 73 { 74 // KAuthoringSessionUnit is kept here as 1800 secs 75 // if iAuthoringTime > AuthoringSessionUnit 76 // set the counter here for loop 77 if (iAuthoringTime > KAuthoringSessionUnit) 78 { 79 // iAuthoringTime time set at cmd line is in secs 80 iAuthoringCounter = iAuthoringTime / KAuthoringSessionUnit; 81 iTestDuration = KAuthoringSessionUnit * 1000 * 1000; 82 } 83 else 84 { 85 // iAuthoringCounter is not set here 86 iTestDuration = iAuthoringTime * 1000 * 1000; 87 } 88 } 89 else 90 { 91 // no Authoring time given 92 iTestDuration = KAuthoringSessionUnit * 1000 * 1000; // use default authoring time here 93 } 94 iInputFileNameAudio = NULL; 95 iInputFileNameVideo = NULL; 96 iInputFileNameText = NULL; 97 iOutputFileName = NULL; 98 99 if (oscl_strlen(aInputFileNameAudio) != 0) 100 { 101 oscl_wchar output1[ARRAY_SIZE]; 102 oscl_UTF8ToUnicode(aInputFileNameAudio, oscl_strlen(aInputFileNameAudio), output1, ARRAY_SIZE); 103 iInputFileNameAudio.set(output1, oscl_strlen(output1)); 104 } 105 106 if (oscl_strlen(aInputFileNameVideo) != 0) 107 { 108 oscl_wchar output2[ARRAY_SIZE]; 109 oscl_UTF8ToUnicode(aInputFileNameVideo, oscl_strlen(aInputFileNameVideo), output2, ARRAY_SIZE); 110 iInputFileNameVideo.set(output2, oscl_strlen(output2)); 111 } 112 113 if (oscl_strlen(aOutputFileName) != 0) 114 { 115 oscl_wchar output3[ARRAY_SIZE]; 116 oscl_UTF8ToUnicode(aOutputFileName, oscl_strlen(aOutputFileName), output3, ARRAY_SIZE); 117 iOutputFileName.set(output3, oscl_strlen(output3)); 118 } 119 120 if (oscl_strlen(aInputFileNameText) != 0) 121 { 122 oscl_wchar output4[ARRAY_SIZE]; 123 oscl_UTF8ToUnicode(aInputFileNameText, oscl_strlen(aInputFileNameText), output4, ARRAY_SIZE); 124 iInputFileNameText.set(output4, oscl_strlen(output4)); 125 } 126 iRemoveDataSourceDone = 0; 127 } 128 ~pvauthor_async_compressed_test_errorhandling()129 ~pvauthor_async_compressed_test_errorhandling() 130 { 131 Cleanup(); 132 } 133 void Run(); 134 void StartTest(); 135 136 // Author engine observer functions 137 void HandleErrorEvent(const PVAsyncErrorEvent& aEvent); 138 void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent); 139 void CommandCompleted(const PVCmdResponse& aResponse); 140 141 PVAECmdType iState; 142 // Test output 143 OSCL_wHeapString<OsclMemAllocator> iOutputFileName; 144 OSCL_wHeapString<OsclMemAllocator> iInputFileNameAudio; 145 OSCL_wHeapString<OsclMemAllocator> iInputFileNameVideo; 146 OSCL_wHeapString<OsclMemAllocator> iInputFileNameText; 147 148 OSCL_HeapString<OsclMemAllocator> iComposerMimeType; 149 OSCL_HeapString<OsclMemAllocator> iAudioEncoderMimeType; 150 OSCL_HeapString<OsclMemAllocator> iVideoEncoderMimeType; 151 OSCL_HeapString<OsclMemAllocator> iTextEncoderMimeType; 152 // Test inputs 153 PVAETestInputType iAudioInputType; 154 PVAETestInputType iVideoInputType; 155 PVAETestInputType iTextInputType; 156 157 private: 158 // Methods to create test input nodes and add to author engine 159 //bool CreateTestInputs(); 160 int CreateAudioInput(); 161 int CreateVideoInput(); 162 int CreateTextInput(); 163 bool AddDataSource(PVAETestInput& aInput); 164 165 // Methods to configure composers 166 void SelectComposer(); 167 bool ConfigComposer(); 168 bool ConfigAmrAacComposer(); 169 bool ConfigMp43gpComposer(); 170 171 // Method to configure max filesize/duration interface 172 bool QueryComposerOutputInterface(); 173 bool ConfigComposerOutput(); 174 175 // Methods to add media tracks 176 bool AddAudioMediaTrack(); 177 bool AddVideoMediaTrack(); 178 bool AddTextMediaTrack(); 179 180 // Methods to configure encoders 181 bool ConfigureVideoEncoder(); 182 bool ConfigureAudioEncoder(); 183 bool ConfigureTextEncoder(); 184 185 bool DeleteTestInputs(); 186 187 void ResetAuthorConfig(); 188 189 void Cleanup(); 190 ///////////////////////////////////////////// 191 // Author engine related variables 192 PVAuthorEngineInterface* iAuthor; 193 OsclAny* iComposer; 194 PVInterface* iComposerConfig; 195 PVInterface* iAudioEncoderConfig; 196 PVInterface* iVideoEncoderConfig; 197 PVInterface* iTextEncoderConfig; 198 PVInterface* iOutputSizeAndDurationConfig; 199 200 // Meta data strings 201 OSCL_wHeapString<OsclMemAllocator> iVersionString; 202 OSCL_wHeapString<OsclMemAllocator> iTitleString; 203 OSCL_wHeapString<OsclMemAllocator> iAuthorString; 204 OSCL_wHeapString<OsclMemAllocator> iCopyrightString; 205 OSCL_wHeapString<OsclMemAllocator> iDescriptionString; 206 OSCL_wHeapString<OsclMemAllocator> iRatingString; 207 OSCL_wHeapString<OsclMemAllocator> iAlbumTitle; 208 uint16 iRecordingYear; 209 210 AVTConfig iAVTConfig; 211 Oscl_Vector<PVAETestInput, OsclMemAllocator> iTestInputs; 212 213 PVLogger* iLogger; 214 bool bAudioTrack; //keep track if audio track has been added 215 bool bVideoTrack; 216 bool iPauseResumeEnable; 217 uint iRemoveDataSourceDone;//to keep track of how many removeDataSource calls done 218 uint32 iAuthoringTime; 219 int iAuthoringCounter; 220 uint32 iTestDuration; 221 FAIL_STATE iFailureState; 222 //For CapConfig 223 PvmiCapabilityAndConfig* iAuthorCapConfigIF; 224 PvmiKvp* iErrorKVP; 225 }; 226 227 #endif 228