os/mm/mmlibs/mmfw/tsrc/mmfunittest/videorenderer/inc/testrenderer.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef TESTRENDERER_H
    17 #define TESTRENDERER_H
    18 
    19 #include <testframework.h>
    20 #include <videorenderer.h>
    21 
    22 /* 
    23 Basic test for video renderer in timed and non-timed mode 
    24 MM-MMF-VIDREND-U-0002 and MM-MMF-VIDREND-U-0003
    25 */
    26 class RTestRendererStep : public RTestStep, public MVideoRendererObserver
    27 	{
    28 public:
    29 
    30 	enum TTestRendererEvents
    31 		{
    32 		EStartTest,
    33 		EBufferAvailable,
    34 		EBufferDisplayed,
    35 		EBufferSkipped,
    36 		ETimerExpired
    37 		};
    38 
    39 	enum TTestRendererState
    40 		{
    41 		EStateIdle,
    42 		EStateCreate,
    43 		EStateUpdate,
    44 		EStateReleaseBuffer,
    45 		EStateReplaceSurface,
    46 		EStateUpdateAfterReplace
    47 		};
    48 
    49 	static RTestRendererStep* NewL(const TDesC& aStepName, TBool aTimed);
    50 
    51 	// from MVideoRendererObserver
    52 	void MvroVideoBufferAvailable();
    53 	void MvroBufferDisplayed(TInt aBufferId, const TTime& aTime);
    54 	void MvroBufferSkipped(TInt aBufferId);
    55 
    56 protected:
    57 	RTestRendererStep(const TDesC& aStepName, TBool aTimed);
    58 
    59 	virtual void FsmL(TTestRendererEvents aEventCode);
    60     void InitWservL();
    61     void DeInitWserv();
    62     TInt SetBackgroundSurface(TSurfaceId& id);
    63     void RemoveBackgroundSurface();
    64     void EndTest(TVerdict aVerdict);
    65     void CreateRendererAndSurfaceL(TInt aNumBuffers);
    66     void CreateSurfaceL(TInt aNumBuffers);
    67     void GetNextBufferAndSubmitUpdateL(TInt aExpectedBufId, TRgb aColor, const TTime& aPresentationTime);
    68     TVideoFrameBuffer* GetNextBufferL(TInt aExpectedBufId, TRgb aColor);
    69     
    70 	// from RTestStep
    71     TVerdict DoTestStepPreambleL();
    72     TVerdict DoTestStepPostambleL();
    73     TVerdict DoTestStepL();
    74 
    75 	
    76 protected:
    77 	CActiveScheduler* iActiveScheduler;
    78 	TBool iActiveSchedulerStarted;
    79 	CVideoRenderer* iVideoRenderer;
    80 	TBool iTimed;
    81 	TSurfaceId iSurfaceId;
    82 
    83     // Surface creation parameter
    84 	TSize iSize;
    85 	TUncompressedVideoFormat iVideoFormat;
    86 
    87     // Window server related objects
    88     RWsSession iWs;
    89     CWsScreenDevice* iScreen;
    90     RWindow* iWindow;
    91     RWindowGroup iRootWindow;
    92 
    93 	TTestRendererState iFsmState;
    94 	TInt iBuffAvailCallback;
    95 	TInt iBuffDisplayCallback;
    96 	TInt iBuffSkipCallback;
    97 	
    98     // values stored for Mvro callbacks
    99 	TInt iBufferId;
   100 	TTime iDisplayedTime;
   101 	};
   102 
   103 /* 
   104 Test replacing surface in timed and non-timed mode
   105 MM-MMF-VIDREND-U-0010 and MM-MMF-VIDREND-U-0011
   106 */
   107 class RTestRendererReplaceStep : public RTestRendererStep
   108 	{
   109 public:
   110 	static RTestRendererReplaceStep* NewL(const TDesC& aStepName, TBool aTimed);
   111 
   112 protected:
   113 	RTestRendererReplaceStep(const TDesC& aStepName, TBool aTimed);
   114 	void FsmL(TTestRendererEvents aEventCode);
   115 	void ReplaceSurfaceL();
   116 	};
   117 
   118 /*
   119 Timer callback class
   120 */
   121 class CCallBackTimer : public CTimer
   122 	{
   123 public:
   124 	static CCallBackTimer* NewL(TCallBack aCallBack, TPriority aPriority = EPriorityStandard);
   125 
   126 private:
   127 	void RunL();
   128 	CCallBackTimer(TCallBack aCallBack, TPriority aPriority);
   129 
   130 private:
   131 	TCallBack iCallBack;
   132 	};
   133 
   134 #endif // TESTRENDERER_H