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_TESTSET11_H_INCLUDED 19 #define TEST_PV_PLAYER_ENGINE_TESTSET11_H_INCLUDED 20 21 /** 22 * @file test_pv_player_engine_testset11.h 23 * @brief This file contains the class definitions for the eleventh set of 24 * test cases for PVPlayerEngine - Generic(local, PDL & streaming) CancelAllCommands tests 25 * 26 */ 27 28 #ifndef TEST_PV_PLAYER_ENGINE_H_INCLUDED 29 #include "test_pv_player_engine.h" 30 #endif 31 32 #ifndef TEST_PV_PLAYER_ENGINE_CONFIG_H_INCLUDED 33 #include "test_pv_player_engine_config.h" 34 #endif 35 36 #ifndef PVMF_STREAMING_DATA_SOURCE_H_INCLUDED 37 #include "pvmf_streaming_data_source.h" 38 #endif 39 40 #if RUN_FASTTRACK_TESTCASES 41 #ifndef PVPVXPARSER_H_INCLUDED 42 #include "pvpvxparser.h" 43 #endif 44 #endif 45 46 #ifndef PVMF_DOWNLOAD_DATA_SOURCE_H_INCLUDED 47 #include "pvmf_download_data_source.h" 48 #endif 49 #ifndef PVMF_SOURCE_CONTEXT_DATA_H_INCLUDED 50 #include "pvmf_source_context_data.h" 51 #endif 52 53 #ifndef DEFAULT_URLS_DEFINED 54 #define DEFAULT_URLS_DEFINED 55 56 #define AMR_MPEG4_RTSP_URL "rtsp://pvserveroha.pv.com/public/Interop/3GPP/pv2/pv-amr-475_mpeg4-20.3gp" 57 #define AMR_MPEG4_RTSP_URL_2 "rtsp://pvserveroha.pv.com/public/metadata/pvmetadata.mp4" 58 #define H263_AMR_RTSP_URL "rtsp://pvserveroha.pv.com/public/Interop/3GPP/pv2/pv-amr-122_h263-64.3gp" 59 #define MPEG4_RTSP_URL "rtsp://pvserveroha.pv.com/public/Interop/3GPP/pv2/pv-mpeg4rdatapartr64.3gp" 60 #define MPEG4_SHRT_HDR_RTSP_URL "rtsp://pvserveroha.pv.com/public/Interop/3GPP/pv2/pv-mpeg4shorthdrr64.3gp" 61 #define AAC_RTSP_URL "rtsp://pvserveroha.pv.com/public/Interop/3GPP/pv2/pv-aac64_novisual.3gp" 62 #define MPEG4_AAC_RTSP_URL "rtsp://pvserveroha.pv.com/public/Interop/3GPP/pv2/pv2-aac64_mpeg4-rvlcs-64.3gp" 63 #define AMR_MPEG4_SDP_FILE "pv_amr_mpeg4.sdp" 64 #endif 65 66 class PVPlayerDataSourceURL; 67 class PVPlayerDataSink; 68 class PVPlayerDataSink; 69 class PVPlayerDataSinkFilename; 70 class PvmfFileOutputNodeConfigInterface; 71 class PvmiCapabilityAndConfig; 72 class PVMFDownloadDataSourcePVX; 73 74 75 /*! 76 * Test cases to test CancellAllCommands() call (right after/while processing) each state when playing an local/PDL/rtsp url 77 * - Data Source: Specified by user of test case 78 * - Data Sink(s): Video[FileOutputNode-test_player_genericcancelall_video.dat]\n 79 * Audio[FileOutputNode-test_player_genericcancelall_audio.dat] 80 * - Sequence: 81 * -# CreatePlayer() 82 * -# CancelAllCommands() is called after/in one of the following states based on the test case 83 * -# AddDataSource() 84 * -# Init() 85 * -# AddDataSink() (video) 86 * -# AddDataSink() (audio) 87 * -# Prepare() 88 * -# Start() 89 * -# Play 10 sec 90 * -# SetPlaybackRange() if seekEnable flag is made true 91 * -# Pause() if pauseresumeEnable flag is made true 92 * -# WAIT 10 sec 93 * -# Resume() 94 * -# Play until EOS 95 * -# Stop() 96 * -# RemoveDataSink() (video) 97 * -# RemoveDataSink() (audio) 98 * -# Reset() 99 * -# RemoveDataSource() 100 * -# DeletePlayer() 101 * 102 */ 103 class pvplayer_async_test_genericcancelall : public pvplayer_async_test_base 104 { 105 public: pvplayer_async_test_genericcancelall(PVPlayerAsyncTestParam aTestParam,PVMFFormatType aVideoSinkFormat,PVMFFormatType aAudioSinkFormat,uint32 aTestID,bool aPauseResumeEnable,bool aSeekEnable,bool aWaitForEOS,bool aCloaking,bool aCancelDuringPrepare,int lastState,bool aCancelAllWhileProc)106 pvplayer_async_test_genericcancelall(PVPlayerAsyncTestParam aTestParam, 107 PVMFFormatType aVideoSinkFormat, 108 PVMFFormatType aAudioSinkFormat, 109 uint32 aTestID, 110 bool aPauseResumeEnable, 111 bool aSeekEnable, 112 bool aWaitForEOS, 113 bool aCloaking, 114 bool aCancelDuringPrepare, 115 int lastState, 116 bool aCancelAllWhileProc) 117 : pvplayer_async_test_base(aTestParam) 118 , iPlayer(NULL) 119 , iDataSource(NULL) 120 , iDataSinkVideo(NULL) 121 , iDataSinkAudio(NULL) 122 , iIONodeVideo(NULL) 123 , iIONodeAudio(NULL) 124 , iMIOFileOutVideo(NULL) 125 , iMIOFileOutAudio(NULL) 126 , iCurrentCmdId(0) 127 , iCancelAllCmdId(0) 128 , iSessionDuration(0) 129 , bcloaking(aCloaking) 130 , oLiveSession(false) 131 , iProtocolRollOver(false) 132 , iProtocolRollOverWithUnknownURLType(false) 133 , iPlayListURL(false) 134 , iSourceContextData(NULL) 135 , iStreamDataSource(NULL) 136 , iDownloadContextDataPVX(NULL) 137 , iPlayStarted(false) 138 , iSeekDone(false) 139 { 140 iVideoSinkFormatType = aVideoSinkFormat; 141 iAudioSinkFormatType = aAudioSinkFormat; 142 oPauseResumeEnable = aPauseResumeEnable; 143 oSeekEnable = aSeekEnable; 144 oWaitForEOS = aWaitForEOS; 145 oCancelDuringPrepare = aCancelDuringPrepare; 146 iTestID = aTestID; 147 iNumPlay = 0; 148 iTargetNumPlay = 1; 149 iNumBufferingStart = iNumBufferingComplete = iNumUnderflow = iNumDataReady = iNumEOS = 0; 150 iDownloadOnly = iDownloadThenPlay = false; 151 iEndState = (PVTestState)lastState; 152 iCancelAllWhileProc = aCancelAllWhileProc; 153 } 154 ~pvplayer_async_test_genericcancelall()155 ~pvplayer_async_test_genericcancelall() {} 156 157 void StartTest(); 158 void Run(); 159 160 void CommandCompleted(const PVCmdResponse& aResponse); 161 void HandleErrorEvent(const PVAsyncErrorEvent& aEvent); 162 void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent); 163 164 165 PVTestState iState; 166 PVTestState iEndState; 167 bool iCancelAllWhileProc; 168 169 PVPlayerInterface* iPlayer; 170 PVPlayerDataSourceURL* iDataSource; 171 PVPlayerDataSink* iDataSinkVideo; 172 PVPlayerDataSink* iDataSinkAudio; 173 PVMFNodeInterface* iIONodeVideo; 174 PVMFNodeInterface* iIONodeAudio; 175 PvmiMIOControl* iMIOFileOutVideo; 176 PvmiMIOControl* iMIOFileOutAudio; 177 PVCommandId iCurrentCmdId; 178 PVCommandId iCancelAllCmdId; 179 180 setMultiplePlayMode(uint32 aNum)181 void setMultiplePlayMode(uint32 aNum) 182 { 183 iMultiplePlay = true; 184 iTargetNumPlay = aNum; 185 } 186 setProtocolRollOverMode()187 void setProtocolRollOverMode() 188 { 189 iProtocolRollOver = true; 190 } 191 setProtocolRollOverModeWithUnknownURL()192 void setProtocolRollOverModeWithUnknownURL() 193 { 194 iProtocolRollOverWithUnknownURLType = true; 195 } 196 setPlayListMode()197 void setPlayListMode() 198 { 199 iPlayListURL = true; 200 } 201 202 private: 203 void HandleSocketNodeErrors(int32 aErr); 204 void HandleRTSPNodeErrors(int32 aErr); 205 void HandleStreamingManagerNodeErrors(int32 aErr); 206 void HandleJitterBufferNodeErrors(int32 aErr); 207 void HandleMediaLayerNodeErrors(int32 aErr); 208 void HandleProtocolEngineNodeErrors(int32 aErr); 209 210 211 void PrintMetadataInfo(); 212 213 PVMFFormatType iVideoSinkFormatType; 214 PVMFFormatType iAudioSinkFormatType; 215 OSCL_wHeapString<OsclMemAllocator> wFileName; 216 oscl_wchar output[512]; 217 bool oPauseResumeEnable; 218 bool oSeekEnable; 219 bool oCancelDuringPrepare; 220 bool oWaitForEOS; 221 uint32 iTestID; 222 223 PVPMetadataList iMetadataKeyList; 224 Oscl_Vector<PvmiKvp, OsclMemAllocator> iMetadataValueList; 225 int32 iNumValues; 226 227 uint32 iSessionDuration; 228 bool bcloaking; 229 bool oLiveSession; 230 231 bool iMultiplePlay; 232 uint32 iNumPlay; 233 uint32 iTargetNumPlay; 234 235 bool iProtocolRollOver; 236 bool iProtocolRollOverWithUnknownURLType; 237 bool iPlayListURL; 238 239 PvmiCapabilityAndConfig* iPlayerCapConfigIF; 240 PvmiKvp* iErrorKVP; 241 PvmiKvp iKVPSetAsync; 242 OSCL_StackString<128> iKeyStringSetAsync; 243 PVMFSourceContextData* iSourceContextData; 244 245 PVMFStreamingDataSource* iStreamDataSource; 246 247 //FTDL 248 void CreateDownloadDataSource(); 249 uint8 iPVXFileBuf[4096]; 250 PVMFDownloadDataSourcePVX* iDownloadContextDataPVX; 251 PVMFDownloadDataSourceHTTP* iDownloadContextDataHTTP; 252 int32 iDownloadMaxfilesize; 253 #if RUN_FASTTRACK_TESTCASES 254 CPVXInfo iDownloadPvxInfo; 255 #endif 256 OSCL_wHeapString<OsclMemAllocator> iDownloadURL; 257 OSCL_wHeapString<OsclMemAllocator> iDownloadFilename; 258 OSCL_HeapString<OsclMemAllocator> iDownloadProxy; 259 OSCL_wHeapString<OsclMemAllocator> iDownloadConfigFilename; 260 int32 iNumBufferingStart, iNumBufferingComplete, iNumUnderflow, iNumDataReady, iNumEOS; 261 bool iDownloadOnly, iDownloadThenPlay; 262 bool iContentTooLarge; 263 bool iPlayStarted, iSeekDone; 264 }; 265 266 #endif 267