• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_TESTSET12_H_INCLUDED
19 #define TEST_PV_PLAYER_ENGINE_TESTSET12_H_INCLUDED
20 
21 /**
22  *  @file test_pv_player_engine_testset12.h
23  *  @brief This file contains the class definitions for the twelfth set of
24  *         test cases for PVPlayerEngine - Generic(local, PDL & streaming) playback 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 
50 #ifndef PVMF_SOURCE_CONTEXT_DATA_H_INCLUDED
51 #include "pvmf_source_context_data.h"
52 #endif
53 
54 #ifndef DEFAULT_URLS_DEFINED
55 #define DEFAULT_URLS_DEFINED
56 
57 #define AMR_MPEG4_RTSP_URL ""
58 #define AMR_MPEG4_RTSP_URL_2 ""
59 #define H263_AMR_RTSP_URL ""
60 #define MPEG4_RTSP_URL ""
61 #define MPEG4_SHRT_HDR_RTSP_URL ""
62 #define AAC_RTSP_URL     ""
63 #define MPEG4_AAC_RTSP_URL ""
64 #define AMR_MPEG4_SDP_FILE "pv_amr_mpeg4.sdp"
65 #endif
66 
67 #define NUM_PAUSE -1 // No of times 'PAUSE' infinite in case of Multiple Pause
68 #define SEQUENTIAL_PAUSE_INTERVAL 1
69 #define FIRST_PAUSE_AFTER_START 10
70 #define PAUSE_RESUME_INTERVAL 1
71 
72 #define SEQUENTIAL_SEEK_INTERVAL 2
73 #define FIRST_SEEK_AFTER_START 2
74 
75 #define SLEEP_TIME_SECS 60
76 
77 class PVPlayerDataSourceURL;
78 class PVPlayerDataSink;
79 class PVPlayerDataSink;
80 class PVPlayerDataSinkFilename;
81 class PvmfFileOutputNodeConfigInterface;
82 class PvmiCapabilityAndConfig;
83 class PVMFDownloadDataSourcePVX;
84 
85 
86 /*!
87  *  Test cases to test Multiple pause resume, multiple seek during playback
88  *  and Sleep of 90 secs right after each state when playing an local/PDL/rtsp url
89  *  - Data Source: Specified by user of test case
90  *  - Data Sink(s): Video[FileOutputNode-test_player_genericopenplaystop_video.dat]\n
91  *                  Audio[FileOutputNode-test_player_genericopenplaystop_audio.dat]
92  *  - Sequence:
93  *             -# CreatePlayer()
94  *             -# Sleep() is called in each of the states for sleep tests
95  *             -# AddDataSource()
96  *             -# Init()
97  *             -# AddDataSink() (video)
98  *             -# AddDataSink() (audio)
99  *             -# Prepare()
100  *             -# Start()
101  *             -# Play 10 sec
102  *             -# SetPlaybackRange() if seekEnable flag is made true, set 10 times
103  *                 if in case of multiple seek test
104  *             -# Pause() if pauseresumeEnable flag is made true, pauseresume multiple times
105  *                  in multiple pauseresume test
106  *             -# WAIT 10 sec
107  *             -# Resume()
108  *             -# Play until EOS
109  *             -# Stop()
110  *             -# RemoveDataSink() (video)
111  *             -# RemoveDataSink() (audio)
112  *             -# Reset()
113  *             -# RemoveDataSource()
114  *             -# DeletePlayer()
115  *
116  */
117 class pvplayer_async_test_genericopenplaystop : public pvplayer_async_test_base
118 {
119     public:
120         pvplayer_async_test_genericopenplaystop(PVPlayerAsyncTestParam aTestParam,
121                                                 PVMFFormatType aVideoSinkFormat,
122                                                 PVMFFormatType aAudioSinkFormat,
123                                                 uint32 aTestID,
124                                                 bool aPauseResumeEnable,
125                                                 bool aSeekEnable,
126                                                 bool aWaitForEOS,
127                                                 bool aCloaking,
128                                                 bool aCancelDuringPrepare,
129                                                 uint32 aSleepState = STATE_CLEANUPANDCOMPLETE,
130                                                 bool aSleepInState = false)
pvplayer_async_test_base(aTestParam)131                 : pvplayer_async_test_base(aTestParam)
132                 , iPlayer(NULL)
133                 , iDataSource(NULL)
134                 , iDataSinkVideo(NULL)
135                 , iDataSinkAudio(NULL)
136                 , iIONodeVideo(NULL)
137                 , iIONodeAudio(NULL)
138                 , iMIOFileOutVideo(NULL)
139                 , iMIOFileOutAudio(NULL)
140                 , iCurrentCmdId(0)
141                 , iCancelAllCmdId(0)
142                 , iSeekAfterEOSEnable(false)
143                 , iSeekBeyondClipDurationMode(false)
144                 , iSessionDuration(0)
145                 , bcloaking(aCloaking)
146                 , oLiveSession(false)
147                 , iProtocolRollOver(false)
148                 , iProtocolRollOverWithUnknownURLType(false)
149                 , iPlayListURL(false)
150                 , iStreamDataSource(NULL)
151                 , iSourceContextData(NULL)
152                 , iDownloadContextDataPVX(NULL)
153         {
154             iVideoSinkFormatType = aVideoSinkFormat;
155             iAudioSinkFormatType = aAudioSinkFormat;
156             oPauseResumeEnable = aPauseResumeEnable;
157             oSeekEnable = aSeekEnable;
158             oWaitForEOS = aWaitForEOS;
159             oCancelDuringPrepare = aCancelDuringPrepare;
160             iTestID = aTestID;
161             iNumPlay = 0;
162             iTargetNumPlay = 1;
163             iNumBufferingStart = iNumBufferingComplete = iNumUnderflow = iNumDataReady = iNumEOS = 0;
164             iNumPause = 0;
165             iTargetNumPause = -1; // No of times 'Pause' is infinite
166             iTimeIntervalSeqPause = 1;
167             iFirstPauseTimeAfterStart = 10;
168             iDownloadOnly = iDownloadThenPlay = false;
169             iNumSeek = 0;
170             iTimeIntervalSeqSeek = 10;
171             iFirstSeekTimeAfterStart = 10;
172             iRolloverDone = false;
173             iPlayStarted = false;
174             iSleepState = (PVTestState)aSleepState;
175             iSleepInState = aSleepInState;
176         }
177 
~pvplayer_async_test_genericopenplaystop()178         ~pvplayer_async_test_genericopenplaystop() {}
179 
180         void StartTest();
181         void Run();
182 
183         void CommandCompleted(const PVCmdResponse& aResponse);
184         void HandleErrorEvent(const PVAsyncErrorEvent& aEvent);
185         void HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent);
186 
187         /*enum PVTestState
188         {
189             STATE_CREATE,
190             STATE_QUERYINTERFACE,
191             STATE_ADDDATASOURCE,
192             STATE_CONFIGPARAMS,
193             STATE_INIT,
194             STATE_GETMETADATAKEYLIST,
195             STATE_GETMETADATAVALUELIST,
196             STATE_ADDDATASINK_VIDEO,
197             STATE_ADDDATASINK_AUDIO,
198             STATE_PREPARE,
199             STATE_CANCELALL,
200             STATE_WAIT_FOR_CANCELALL,
201             STATE_START,
202             STATE_SETPLAYBACKRANGE,
203             STATE_PAUSE,
204             STATE_RESUME,
205             STATE_EOSNOTREACHED,
206             STATE_STOP,
207             STATE_REMOVEDATASINK_VIDEO,
208             STATE_REMOVEDATASINK_AUDIO,
209             STATE_RESET,
210             STATE_REMOVEDATASOURCE,
211             STATE_CLEANUPANDCOMPLETE
212         };*/
213 
214         PVTestState iState;
215         PVTestState iSleepState;
216 
217         PVPlayerInterface* iPlayer;
218         PVPlayerDataSourceURL* iDataSource;
219         PVPlayerDataSink* iDataSinkVideo;
220         PVPlayerDataSink* iDataSinkAudio;
221         PVMFNodeInterface* iIONodeVideo;
222         PVMFNodeInterface* iIONodeAudio;
223         PvmiMIOControl* iMIOFileOutVideo;
224         PvmiMIOControl* iMIOFileOutAudio;
225         PVCommandId iCurrentCmdId;
226         PVCommandId iCancelAllCmdId;
227 
setMultiplePlayMode(uint32 aNum)228         void setMultiplePlayMode(uint32 aNum)
229         {
230             iMultiplePlay = true;
231             iTargetNumPlay = aNum;
232         }
233 
234         void setMultiplePauseMode(int32 aNum1, uint32 aNum2 = 10, uint32 aNum3 = 10)
235         {
236             iMultiplePause = true;
237             iTargetNumPause = aNum1;
238             iTimeIntervalSeqPause = aNum2;
239             iFirstPauseTimeAfterStart = aNum3;
240         }
241 
242         void setMultipleSeekMode(uint32 aNum1 = 10, uint32 aNum2 = 10)
243         {
244             iTimeIntervalSeqSeek = aNum1;
245             iFirstSeekTimeAfterStart = aNum2;
246         }
247 
setProtocolRollOverMode()248         void setProtocolRollOverMode()
249         {
250             iProtocolRollOver = true;
251         }
252 
setProtocolRollOverModeWithUnknownURL()253         void setProtocolRollOverModeWithUnknownURL()
254         {
255             iProtocolRollOverWithUnknownURLType = true;
256         }
257 
setPlayListMode()258         void setPlayListMode()
259         {
260             iPlayListURL = true;
261         }
262 
setSeekAfterEOSMode()263         void setSeekAfterEOSMode()
264         {
265             iSeekAfterEOSEnable = true;
266         }
267 
setSeekBeyondClipDurationMode()268         void setSeekBeyondClipDurationMode()
269         {
270             oSeekEnable = true;
271             iSeekBeyondClipDurationMode = true;
272         }
273 
274     private:
275         void HandleSocketNodeErrors(int32 aErr);
276         void HandleRTSPNodeErrors(int32 aErr);
277         void HandleStreamingManagerNodeErrors(int32 aErr);
278         void HandleJitterBufferNodeErrors(int32 aErr);
279         void HandleMediaLayerNodeErrors(int32 aErr);
280         void HandleProtocolEngineNodeErrors(int32 aErr);
281 
282 
283         void PrintMetadataInfo();
284 
285         PVMFFormatType iVideoSinkFormatType;
286         PVMFFormatType iAudioSinkFormatType;
287         OSCL_wHeapString<OsclMemAllocator> wFileName;
288         oscl_wchar output[512];
289         bool oPauseResumeEnable;
290         bool oSeekEnable;
291         bool oCancelDuringPrepare;
292         bool oWaitForEOS;
293         uint32 iTestID;
294         bool iSeekAfterEOSEnable;
295         bool iSeekBeyondClipDurationMode;
296 
297         PVPMetadataList iMetadataKeyList;
298         Oscl_Vector<PvmiKvp, OsclMemAllocator> iMetadataValueList;
299         int32 iNumValues;
300 
301         uint32 iSessionDuration;
302         bool bcloaking;
303         bool oLiveSession;
304 
305         bool iMultiplePause;
306         int32 iNumPause;
307         int32 iTargetNumPause;
308         uint32 iTimeIntervalSeqPause;
309         uint32 iFirstPauseTimeAfterStart;
310 
311         uint32 iNumSeek;
312         uint32 iTimeIntervalSeqSeek;
313         uint32 iFirstSeekTimeAfterStart;
314 
315         bool iMultiplePlay;
316         uint32 iNumPlay;
317         uint32 iTargetNumPlay;
318 
319         bool iProtocolRollOver;
320         bool iProtocolRollOverWithUnknownURLType;
321         bool iPlayListURL;
322         bool iRolloverDone;
323         bool iPlayStarted;
324         bool iSleepInState;
325 
326         PvmiCapabilityAndConfig* iPlayerCapConfigIF;
327         PvmiKvp* iErrorKVP;
328         PvmiKvp iKVPSetAsync;
329         OSCL_StackString<128> iKeyStringSetAsync;
330 
331         PVMFStreamingDataSource* iStreamDataSource;
332 
333         PVMFSourceContextData* iSourceContextData;
334 
335         //FTDL
336         void CreateDownloadDataSource();
337         uint8 iPVXFileBuf[4096];
338         PVMFDownloadDataSourcePVX* iDownloadContextDataPVX;
339         PVMFDownloadDataSourceHTTP* iDownloadContextDataHTTP;
340         int32 iDownloadMaxfilesize;
341 #if RUN_FASTTRACK_TESTCASES
342         CPVXInfo iDownloadPvxInfo;
343 #endif
344         OSCL_wHeapString<OsclMemAllocator> iDownloadURL;
345         OSCL_wHeapString<OsclMemAllocator> iDownloadFilename;
346         OSCL_HeapString<OsclMemAllocator> iDownloadProxy;
347         OSCL_wHeapString<OsclMemAllocator> iDownloadConfigFilename;
348         int32 iNumBufferingStart, iNumBufferingComplete, iNumUnderflow, iNumDataReady, iNumEOS;
349         bool iDownloadOnly, iDownloadThenPlay;
350         bool iContentTooLarge;
351 };
352 
353 #endif
354