Update contrib.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Header file: Declaration for Various Classes used for Audio Resource Notification tests for Video Client.
19 @file Testvideoplayer_apr.h
22 #ifndef TESTVIDEOPLAYER_APR_H
23 #define TESTVIDEOPLAYER_APR_H
26 #include "testvideoplayer.h"
27 #include "mdaaudiosampleplayer.h"
31 const TInt KSizeBuf = 256;
32 const TInt KMaxEvents = 2;
34 //------------------------------------------------------------------------------
35 //********************PREQ 797 - Audio Resource Notification********************
36 //------------------------------------------------------------------------------
41 static TInt stopActiveScheduler(TAny*)
43 CActiveScheduler::Stop();
52 //Custom Error Codes & CONST Declarations.
54 const TInt KErrUser = -1000;
55 const TInt KErrBadResult = (KErrUser - 1);
56 const TInt KMicroSecsInOneSec = 1000000;
57 const TUint KSampleRate8000Hz = 8000;
60 //Forward class declarations
63 class CTestAVPlayerAPRCallbackSupport;
64 class CVclntAviAprWillResumeTimer;
65 //------------------------------------------------------------------------------
66 //******************CR 0805 - Auto Pause Resume for video client*******************
67 //------------------------------------------------------------------------------
73 // Enum to describe the current state.
74 enum TAVPlayerAPRState
77 EStateOpenAudioPlayer1,
78 EStateOpenAudioPlayer2,
85 EStateErrInUseAudioPlayer1,
86 EStateErrInUseAudioPlayer2,
87 EStateNotifiedAudioPlayer1,
88 EStateNotifiedAudioPlayer2,
89 EStateErrInUseAudioPlayer1A,
90 EStateNotifiedAudioPlayer1A,
93 EStatePrepareVideoPlayer,
94 EStateOpenVideoPlayer,
97 EStateErrInUseVideoPlayer,
98 EStateNotifiedVideoPlayer,
99 EStateErrInUseVideoPlayer1A,
100 EStateNotifiedVideoPlayer1A,
101 EStateVideoPlaying2A,
102 EStateEndVideoPlay2A,
103 EStateNoOtherPlayerNotified
106 // Enum to decide which Event has occured.
107 enum TAVPlayerAPREvents
111 EMvpuoPrepareComplete,
119 EMarncResourceAvailable1,
120 EMarncResourceAvailable2,
121 EMarncResourceAvailable3
125 //BASE CLASS DECLARATIONS//
131 * @class CCallBackTimer
135 class CCallBackTimer : public CTimer
138 static CCallBackTimer* NewL(TCallBack aCallBack, TPriority aPriority = EPriorityStandard);
142 CCallBackTimer(TCallBack aCallBack, TPriority aPriority);
149 * Observer class to identify and pass events to the test step class
151 * @class MTestAVPlayerAPRCallback
154 class MTestAVPlayerAPRCallback
157 virtual void MvpuoOpenCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport) = 0;
158 virtual void MvpuoPrepareCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport)= 0;
159 virtual void MvpuoFrameReadyTest(CFbsBitmap &aFrame, TInt aError, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport)=0;
160 virtual void MvpuoPlayCompleteTest(TInt aError,CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport)=0;
161 virtual void MvpuoEventTest(const TMMFEvent &aEvent, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport)=0;
162 virtual void MapcInitCompleteTest(TInt aError, const TTimeIntervalMicroSeconds &aDuration, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport)=0;
163 virtual void MapcPlayCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport)=0;
164 virtual void MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport) = 0;
168 * Support class to pass the events to the test step class using the MTestAVPlayerAPRCallback
170 * @class CTestAVPlayerAPRCallbackSupport
173 class CTestAVPlayerAPRCallbackSupport : public CBase, public MVideoPlayerUtilityObserver, public MMMFAudioResourceNotificationCallback, public MMdaAudioPlayerCallback
176 static CTestAVPlayerAPRCallbackSupport* NewL(MTestAVPlayerAPRCallback& aCallback);
177 virtual void MvpuoOpenComplete(TInt aError);
178 virtual void MvpuoPrepareComplete(TInt aError);
179 virtual void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
180 virtual void MvpuoPlayComplete(TInt aError);
181 virtual void MvpuoEvent(const TMMFEvent &aEvent);
182 virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration);
183 virtual void MapcPlayComplete(TInt aError);
184 virtual void MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData);
187 CTestAVPlayerAPRCallbackSupport(MTestAVPlayerAPRCallback& aCallback);
190 MTestAVPlayerAPRCallback& iCallback;
195 * Base Class for APR functionality for most APR video player tests
197 * @class RTestMmfVclntVideoPlayerAPR
200 class RTestMmfVclntVideoPlayerAPR : public RTestMmfVclntAviStep, public MTestAVPlayerAPRCallback
204 RTestMmfVclntVideoPlayerAPR(const TDesC& aTestName, const TDesC& aSectName);
206 // Virtual methods for Preamble and Postamble.
207 virtual TVerdict DoTestStepCreateL();
208 virtual TVerdict DoTestStepDeleteL();
209 // Virtual function to access test specific methods
210 virtual TVerdict DoTestStepL();
211 // Pure function to access test specific methods
212 virtual TVerdict DoTestL()=0;
213 // from MTestAVPlayerAPRCallback
214 virtual void MvpuoOpenCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport);
215 virtual void MvpuoPrepareCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport);
216 virtual void MvpuoFrameReadyTest(CFbsBitmap &aFrame, TInt aError, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport);
217 virtual void MvpuoPlayCompleteTest(TInt aError,CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport);
218 virtual void MvpuoEventTest(const TMMFEvent &aEvent, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport);
219 virtual void MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport);
220 virtual void MapcInitCompleteTest(TInt aError, const TTimeIntervalMicroSeconds &aDuration, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport);
221 virtual void MapcPlayCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport);
223 // Centralised State Handler
224 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError)=0;
225 virtual TBool FsmCheck(TAVPlayerAPREvents aEventCode, TInt aError);
226 virtual TInt SetCacheSize();
227 virtual TInt CheckCacheError(TInt aError);
230 // StateInit Function
232 // StateChange Function
233 void StateChange(TAVPlayerAPRState aState, TAVPlayerAPREvents aExpectedEvent, TInt aExpectedError=KErrNone, TInt aEventIndex = 1);
234 // check if we can go to the next state
235 TInt AnalyseInput(TAVPlayerAPREvents aEventCode, TInt aError);
238 // CMdaAudioPlayerUtility instances
239 CMdaAudioPlayerUtility* iTestAudioPlayer1;
240 CMdaAudioPlayerUtility* iTestAudioPlayer2;
241 // CVideoPlayerUtility instances
242 CVideoPlayerUtility* iTestVideoPlayer;
243 // CTestAVPlayerAPRCallbackSupport instances
244 CTestAVPlayerAPRCallbackSupport* iVideoPlayerCallbackSupport1;
245 CTestAVPlayerAPRCallbackSupport* iAudioPlayerCallbackSupport1;
246 CTestAVPlayerAPRCallbackSupport* iAudioPlayerCallbackSupport2;
249 // Other class variable declarations
250 TBuf<KSizeBuf> iFilename1;
251 TBuf<KSizeBuf> iFilename2;
252 TBuf<KSizeBuf> iFilename3;
253 TTimeIntervalMicroSeconds iPosition;
254 TTimeIntervalMicroSeconds iDuration;
256 TAVPlayerAPRState iState;
257 TRequestStatus iRequestStatus;
258 CCallBackTimer* iCallBackTimer;
259 TAVPlayerAPREvents iExpectedEvent[KMaxEvents];
260 TInt iExpectedError[KMaxEvents];
261 TBool iCanStateChange;
271 * One-time registration for same event by a player.
273 * RTestVclntAprRegOnce4SameEvent
274 * MM-MMF-VCLNTAVIAPR-I-0001-HP
277 class RTestVclntAprRegOnce4SameEvent : public RTestMmfVclntVideoPlayerAPR
280 static RTestVclntAprRegOnce4SameEvent* NewL( const TDesC& aTestName, const TDesC& aSectName );
281 virtual TVerdict DoTestL();
282 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
285 RTestVclntAprRegOnce4SameEvent( const TDesC& aTestName, const TDesC& aSectName );
286 TVerdict PerformTestL();
290 * Register before opening Video player and receive notification of a resource available event
292 * RTestVclntAprRegB4Open
293 * MM-MMF-VCLNTAVIAPR-I-0002-HP
296 class RTestVclntAprRegB4Open : public RTestMmfVclntVideoPlayerAPR
299 static RTestVclntAprRegB4Open* NewL( const TDesC& aTestName, const TDesC& aSectName );
300 virtual TVerdict DoTestL();
301 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
304 RTestVclntAprRegB4Open( const TDesC& aTestName, const TDesC& aSectName );
305 TVerdict PerformTestL();
309 * Register (after Open and before Play of video) , receive notification of a resource available event.
311 * RTestVclntAprRegAftrOpenAndB4Play
312 * MM-MMF-VCLNTAVIAPR-I-0003-HP
315 class RTestVclntAprRegAftrOpenAndB4Play : public RTestMmfVclntVideoPlayerAPR
318 static RTestVclntAprRegAftrOpenAndB4Play* NewL( const TDesC& aTestName, const TDesC& aSectName );
319 virtual TVerdict DoTestL();
320 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
321 TTimeIntervalMicroSeconds iVidPosition;
324 RTestVclntAprRegAftrOpenAndB4Play( const TDesC& aTestName, const TDesC& aSectName );
325 TVerdict PerformTestL();
329 * Register after the highest priority client (Audio) completes playing and receive the notification of a resource availalble event.
331 * RTestVclntAprRegAftrHpClntCompltPlay
332 * MM-MMF-VCLNTAVIAPR-I-0004-HP
335 class RTestVclntAprRegAftrHpClntCompltPlay : public RTestMmfVclntVideoPlayerAPR
338 static RTestVclntAprRegAftrHpClntCompltPlay* NewL( const TDesC& aTestName, const TDesC& aSectName );
339 virtual TVerdict DoTestL();
340 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
343 RTestVclntAprRegAftrHpClntCompltPlay( const TDesC& aTestName, const TDesC& aSectName );
344 TVerdict PerformTestL();
348 * Receive notification by same priority players in the order of registration
350 * RTestVclntAprRegSamePriorityPlayers
351 * MM-MMF-VCLNTAVIAPR-I-0005-HP
354 class RTestVclntAprRegSamePriorityPlayers : public RTestMmfVclntVideoPlayerAPR
357 static RTestVclntAprRegSamePriorityPlayers* NewL( const TDesC& aTestName, const TDesC& aSectName );
358 virtual TVerdict DoTestL();
359 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
362 RTestVclntAprRegSamePriorityPlayers( const TDesC& aTestName, const TDesC& aSectName );
363 TVerdict PerformTestL();
368 * Register (at the time of Play) and Cancellation of the notification request
370 * RTestVclntAprRegAtPlayAndCancelNfn
371 * MM-MMF-VCLNTAVIAPR-I-0006-HP
374 class RTestVclntAprRegAtPlayAndCancelNfn : public RTestMmfVclntVideoPlayerAPR
377 static RTestVclntAprRegAtPlayAndCancelNfn* NewL( const TDesC& aTestName, const TDesC& aSectName );
378 virtual TVerdict DoTestL();
379 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
382 RTestVclntAprRegAtPlayAndCancelNfn( const TDesC& aTestName, const TDesC& aSectName );
383 TVerdict PerformTestL();
387 * Test for WillResumePlay() using 3 clients.
389 * RTestVclntAprTestWillResumePlay
390 * MM-MMF-VCLNTAVIAPR-I-0007-HP
393 class RTestVclntAprTestWillResumePlay : public RTestMmfVclntVideoPlayerAPR
396 static RTestVclntAprTestWillResumePlay* NewL( const TDesC& aTestName, const TDesC& aSectName );
397 virtual TVerdict DoTestL();
398 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
399 virtual void FinishedL(); // for CVclntAviAprWillResumeTimer
402 RTestVclntAprTestWillResumePlay( const TDesC& aTestName, const TDesC& aSectName );
403 TVerdict PerformTestL();
404 CVclntAviAprWillResumeTimer* iWillResumePlayTimer;
409 * CVclntAviAprWillResumeTimer
410 * MM-MMF-VCLNTAVIAPR-I-0007-HP
411 * - Timer for checking if no notification occurs in 5 seconds
412 * after calling WillResumePlay()
415 class CVclntAviAprWillResumeTimer : public CTimer
418 static CVclntAviAprWillResumeTimer* NewL(RTestVclntAprTestWillResumePlay* aParent, TTimeIntervalMicroSeconds32 aWaitTime);
421 TInt RunError(TInt aError);
424 CVclntAviAprWillResumeTimer(RTestVclntAprTestWillResumePlay* aParent, TTimeIntervalMicroSeconds32 aWaitTime);
425 RTestVclntAprTestWillResumePlay* iParent;
426 TTimeIntervalMicroSeconds32 iWaitTime;
430 * APR Alloc tests (using shared heap) for Video Player utility.
432 * RTestVclntAprAllocUsingSharedHeap
433 * MM-MMF-VCLNTAVIAPR-I-0008-HP
436 class RTestVclntAprAllocUsingSharedHeap : public RTestMmfVclntVideoPlayerAPR
439 static RTestVclntAprAllocUsingSharedHeap* NewL( const TDesC& aTestName, const TDesC& aSectName );
440 void VideoPlayAllocL();
441 virtual TVerdict DoTestStepL();
442 virtual TVerdict DoTestL();
443 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
446 RTestVclntAprAllocUsingSharedHeap( const TDesC& aTestName, const TDesC& aSectName );
447 TVerdict PerformTestL();
456 * Multiple Registration (at the time of Play) and receive notification of a resource available event
458 * RTestVclntAprMultRegAtPlay
459 * MM-MMF-VCLNTAVIAPR-I-0101-HP
462 class RTestVclntAprMultRegAtPlay : public RTestMmfVclntVideoPlayerAPR
465 static RTestVclntAprMultRegAtPlay* NewL( const TDesC& aTestName, const TDesC& aSectName );
466 virtual TVerdict DoTestL();
467 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
470 RTestVclntAprMultRegAtPlay( const TDesC& aTestName, const TDesC& aSectName );
471 TVerdict PerformTestL();
475 * Cancel when no resource Notification is requested.
477 * RTestVclntAprCancelNoResourceNfn
478 * MM-MMF-VCLNTAVIAPR-I-0102-HP
481 class RTestVclntAprCancelNoResourceNfn : public RTestMmfVclntVideoPlayerAPR
484 static RTestVclntAprCancelNoResourceNfn* NewL( const TDesC& aTestName, const TDesC& aSectName );
485 virtual TVerdict DoTestL();
486 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
489 RTestVclntAprCancelNoResourceNfn( const TDesC& aTestName, const TDesC& aSectName );
490 TVerdict PerformTestL();
494 * Register for notification with an unsupported event type.
496 * RTestVclntAprRegUnsupportedEvent
497 * MM-MMF-VCLNTAVIAPR-I-0103-HP
500 class RTestVclntAprRegUnsupportedEvent : public RTestMmfVclntVideoPlayerAPR
503 static RTestVclntAprRegUnsupportedEvent* NewL( const TDesC& aTestName, const TDesC& aSectName );
504 virtual TVerdict DoTestL();
505 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
508 RTestVclntAprRegUnsupportedEvent( const TDesC& aTestName, const TDesC& aSectName );
509 TVerdict PerformTestL();
513 * Cancellation of notification with an unsupported event type.
515 * RTestVclntAprCancelUnsupportedEvent
516 * MM-MMF-VCLNTAVIAPR-I-0104-HP
519 class RTestVclntAprCancelUnsupportedEvent : public RTestMmfVclntVideoPlayerAPR
522 static RTestVclntAprCancelUnsupportedEvent* NewL( const TDesC& aTestName, const TDesC& aSectName );
523 virtual TVerdict DoTestL();
524 virtual void Fsm(TAVPlayerAPREvents aEventCode, TInt aError);
527 RTestVclntAprCancelUnsupportedEvent( const TDesC& aTestName, const TDesC& aSectName );
528 TVerdict PerformTestL();