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