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_TESTSET1_H_INCLUDED 19 #define TEST_PV_AUTHOR_ENGINE_TESTSET1_H_INCLUDED 20 21 #ifndef PVAETEST_H_INCLUDED 22 #include "pvaetest.h" 23 #endif 24 #ifndef PVMI_MIO_FILEINPUT_H_INCLUDED 25 #include "pvmi_mio_fileinput.h" 26 #endif 27 #ifndef TEST_PV_AUTHOR_ENGINE_TYPEDEFS_H 28 #include "test_pv_author_engine_typedefs.h" 29 #endif 30 #define PVPATB_TEST_IS_TRUE( condition ) (iTestCase->test_is_true_stub( (condition), (#condition), __FILE__, __LINE__ )) 31 32 class pvauthor_async_test_miscellaneous: public pvauthor_async_test_base 33 { 34 public: 35 pvauthor_async_test_miscellaneous(PVAuthorAsyncTestParam aTestParam, const char* aInputFileNameAudio, 36 const char* aInputFileNameVideo, const char* aInputFileNameText, 37 const char* aOutputFileName, PVAETestInputType aAudioInputType, 38 PVAETestInputType aVideoInputType, PVAETestInputType aTextInputType, 39 const char* aComposerMimeType, const char* aAudioEncoderMimeType, const char* aVideoEncoderMimeType, 40 const char* aTextEncoderMimeType, AVTConfig aAVTConfig, bool aPauseResumeEnable, uint32 aAuthoringTime, 41 bool aUseExtrnFileDesc = false) 42 43 : pvauthor_async_test_base(aTestParam) 44 45 , iComposerMimeType(aComposerMimeType) 46 , iAudioEncoderMimeType(aAudioEncoderMimeType) 47 , iVideoEncoderMimeType(aVideoEncoderMimeType) 48 , iTextEncoderMimeType(aTextEncoderMimeType) 49 , iAudioInputType(aAudioInputType) 50 , iVideoInputType(aVideoInputType) 51 , iTextInputType(aTextInputType) 52 , iAuthor(NULL) 53 , iComposer(NULL) 54 , iComposerConfig(NULL) 55 , iAudioEncoderConfig(NULL) 56 , iVideoEncoderConfig(NULL) 57 , iTextEncoderConfig(NULL) 58 , iOutputSizeAndDurationConfig(NULL) 59 , iAVTConfig(aAVTConfig) 60 , bAudioTrack(true) 61 , bVideoTrack(true) 62 , iPauseResumeEnable(aPauseResumeEnable) 63 , iAuthoringTime(aAuthoringTime) 64 , iAuthoringCounter(0) 65 , iUseExtrnFileDesc(aUseExtrnFileDesc) 66 67 { 68 iLogger = PVLogger::GetLoggerObject("pvauthor_async_test_miscellaneous"); 69 iFileHandle = NULL; 70 71 if (iAuthoringTime > 0) 72 { 73 // KAuthoringSessionUnit is kept here as 1800 secs 74 // if iAuthoringTime > AuthoringSessionUnit 75 // set the counter here for loop 76 if (iAuthoringTime > KAuthoringSessionUnit) 77 { 78 // iAuthoringTime time set at cmd line is in secs 79 iAuthoringCounter = iAuthoringTime / KAuthoringSessionUnit; 80 iTestDuration = KAuthoringSessionUnit * 1000 * 1000; 81 } 82 else 83 { 84 // iAuthoringCounter is not set here 85 iTestDuration = iAuthoringTime * 1000 * 1000; 86 } 87 } 88 else 89 { 90 // no Authoring time given 91 iTestDuration = KAuthoringSessionUnit * 1000 * 1000; // use default authoring time here 92 } 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(aInputFileNameText) != 0) 114 { 115 oscl_wchar output3[ARRAY_SIZE]; 116 oscl_UTF8ToUnicode(aInputFileNameText, oscl_strlen(aInputFileNameText), output3, ARRAY_SIZE); 117 iInputFileNameText.set(output3, oscl_strlen(output3)); 118 } 119 120 if (oscl_strlen(aOutputFileName) != 0) 121 { 122 oscl_wchar output4[ARRAY_SIZE]; 123 oscl_UTF8ToUnicode(aOutputFileName, oscl_strlen(aOutputFileName), output4, ARRAY_SIZE); 124 iOutputFileName.set(output4, oscl_strlen(output4)); 125 } 126 iRemoveDataSourceDone = 0; 127 } 128 129 ~pvauthor_async_test_miscellaneous() 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 149 OSCL_HeapString<OsclMemAllocator> iComposerMimeType; 150 OSCL_HeapString<OsclMemAllocator> iAudioEncoderMimeType; 151 OSCL_HeapString<OsclMemAllocator> iVideoEncoderMimeType; 152 OSCL_HeapString<OsclMemAllocator> iTextEncoderMimeType; 153 // Test inputs 154 PVAETestInputType iAudioInputType; 155 PVAETestInputType iVideoInputType; 156 PVAETestInputType iTextInputType; 157 158 private: 159 // Methods to create test input nodes and add to author engine 160 //bool CreateTestInputs(); 161 int CreateAudioInput(); 162 int CreateVideoInput(); 163 int CreateTextInput(); 164 bool AddDataSource(PVAETestInput& aInput); 165 166 // Methods to configure composers 167 void SelectComposer(); 168 bool ConfigComposer(); 169 bool ConfigAmrAacComposer(); 170 bool ConfigMp43gpComposer(); 171 172 173 // Methods to add media tracks 174 bool AddAudioMediaTrack(); 175 bool AddVideoMediaTrack(); 176 bool AddTextMediaTrack(); 177 178 // Methods to configure encoders 179 bool ConfigureVideoEncoder(); 180 bool ConfigureAudioEncoder(); 181 bool ConfigureTextEncoder(); 182 void SetAuthoringDuration(); 183 bool DeleteTestInputs(); 184 185 void ResetAuthorConfig(); 186 187 void Cleanup(); 188 uint32 GetMin(uint32 a, uint32 b); 189 ///////////////////////////////////////////// 190 // Author engine related variables 191 PVAuthorEngineInterface* iAuthor; 192 OsclAny* iComposer; 193 PVInterface* iComposerConfig; 194 PVInterface* iAudioEncoderConfig; 195 PVInterface* iVideoEncoderConfig; 196 PVInterface* iTextEncoderConfig; 197 PVInterface* iOutputSizeAndDurationConfig; 198 199 // Meta data strings 200 OSCL_wHeapString<OsclMemAllocator> iVersionString; 201 OSCL_wHeapString<OsclMemAllocator> iTitleString; 202 OSCL_wHeapString<OsclMemAllocator> iAuthorString; 203 OSCL_wHeapString<OsclMemAllocator> iCopyrightString; 204 OSCL_wHeapString<OsclMemAllocator> iDescriptionString; 205 OSCL_wHeapString<OsclMemAllocator> iRatingString; 206 OSCL_wHeapString<OsclMemAllocator> iAlbumTitle; 207 uint16 iRecordingYear; 208 209 AVTConfig iAVTConfig; 210 Oscl_Vector<PVAETestInput, OsclMemAllocator> iTestInputs; 211 212 PVLogger* iLogger; 213 bool bAudioTrack; //keep track if audio track has been added 214 bool bVideoTrack; 215 bool bTextTrack; 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 bool iUseExtrnFileDesc; 222 OsclFileHandle *iFileHandle; 223 Oscl_FileServer fileserv; 224 }; 225 226 #endif 227