Update contrib.
2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
22 @internalComponent - Internal Symbian test code
25 #ifndef __TUIANDVIDEO_H__
26 #define __TUIANDVIDEO_H__
32 #include "te_conestepbase.h"
34 _LIT(KTUiAndVideo,"tuiandvideo");
42 //#include <eikmenup.h>
43 //#include <eikon.hrh>
44 //#include <eikon.rsg>
46 #include <videoplayer2.h>
50 class CTUiAndVideoAppUi;
53 Helper class to manage commands between test framework and test thread.
55 class CCommandSink : public CActive
58 CCommandSink(CTestAppView* aTestView);
60 void Init(RThread* aTargetThread, TRequestStatus* aTargetStatus);
68 CTestAppView* iTestView;
69 TRequestStatus* iTargetStatus;
70 RThread* iTargetThread;
75 class CTUiAndVideo : public CTe_ConeStepBase
82 virtual TVerdict doTestStepL();
83 virtual void InitUIL(CCoeEnv* aCoeEnv);
84 void IssueCommand (TUint aCommand);
85 void StepState (TUint aNextState, TUint aPause);
88 CTUiAndVideoAppUi* iAppUi;
89 TRequestStatus iTestState;
92 //************************************************************************************************************
94 //************************************************************************************************************
96 class CTUiAndVideoAppUi : public CEikAppUi, public MVideoPlayerUtilityObserver
99 void ConstructL(TRequestStatus iCommandSource);
100 ~CTUiAndVideoAppUi();
102 public: // from MVIdeoPlayerUtilityObserver
103 void MvpuoOpenComplete(TInt aError);
104 void MvpuoPrepareComplete(TInt aError);
105 void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
106 void MvpuoPlayComplete(TInt aError);
107 void MvpuoEvent(const TMMFEvent &aEvent);
111 void HandleCommandL(TInt aCommand);
112 void HandleForegroundEventL(TBool aForeground);
113 static TInt BackgroundCallBack(TAny* aSelf);
114 static TInt UIMoverCallBack(TAny* aSelf);
116 void BringToForeground();
117 static TInt PlayTimerCallBack(TAny* aSelf);
120 void Bounce (TBool aBounce);
121 void Jump (TBool aJump);
123 TInt PopulateDirFilesL(const TDesC& aDir);
124 void OpenSelectedFileL(const TDesC& aFile);
125 TInt PlayNextFileL();
126 TInt PlayPreviousFileL();
127 void LogError(const TDesC& aFileName, const TDesC& aErrorMsg);
128 TRequestStatus* CommandSink ();
132 CCommandSink* iCommandSink;
133 CTestAppView* iAppView;
134 CVideoPlayerUtility2* iLoadingPlayer;
135 CPeriodic* iIdleTimer;
137 CPeriodic* iPlayTimer;
140 TFileName iCurrentFile;
145 //************************************************************************************************************
147 //************************************************************************************************************
149 class CTestAppView : public CCoeControl, public MCoeControlObserver
152 static CTestAppView* NewL(const TRect& aWindowedRect);
154 RWindow& TheWindow();
155 const RWindow& TheWindow() const { return const_cast<CTestAppView*>(this)->TheWindow(); }
156 void EnableVideo(CVideoPlayerUtility2*& aPlayer);
158 TRect VideoPaneRect() const;
160 void SetRunMode (TUint32 aMode);
165 void PlayComplete(TInt aError);
166 void SetPos(TPoint* aPos);
169 void ConstructL(const TRect& aRect);
170 void SetVideoSize(CVideoPlayerUtility2& aVideo) const;
171 void UpdateButtonState();
174 private: // from MCoeControlObserver
175 void HandleControlEventL(CCoeControl *aControl, TCoeEvent aEventType);
177 private: // from CCoeControl
178 void HandlePointerEventL(const TPointerEvent& aPointerEvent);
179 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
181 void Draw(const TRect& aRect) const;
189 TRect iWindowedViewRect;
190 TSize iNativeVideoSize;
191 TPoint iPointerDownPos;
192 TTime iPointerDownTime;
193 CVideoPlayerUtility2* iCurrentPlayer;
196 CFbsBitmap* iBkgrdImage;
197 CFbsBitmap* iBkgrdMask;
199 CVideoPane* iVideoPane;
203 KFourButtonControlID,
204 KThreeButtonControlID,
209 enum TButtonPaneAction
211 KButtonEventNotInit = -2,
212 KButtonEventDoNothing = -1,
213 KButtonEventDoPlayPause = 10,
214 KButtonEventDoBackward,
215 KButtonEventDoForward,
216 KButtonEventDoOpenFile
220 //************************************************************************************************************
221 //** CVideoPane class - place 'video' window
222 //************************************************************************************************************
224 class CVideoPane : public CCoeControl
229 void ConstructL(CCoeControl& aParent);
230 RWindow& TheWindow() { return Window(); }
231 const RWindow& TheWindow() const { return const_cast<CVideoPane*>(this)->TheWindow(); }
232 TBool IsVideoPanePointerEvent();
234 void SetVideoUseRect(const TRect& aRect);
235 void EnableSubtitle(CVideoPlayerUtility2* aSubtitlePlayer);
236 private: // from CCoeControl
238 void HandlePointerEventL(const TPointerEvent& aPointerEvent);
239 void Draw(const TRect& aRect) const;
241 TBool iIsVideoPanePointerEvent;
244 CVideoPlayerUtility2* iSubtitlePlayer;