sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@test
|
sl@0
|
22 |
@internalComponent - Internal Symbian test code
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#ifndef __TUIANDVIDEO_H__
|
sl@0
|
26 |
#define __TUIANDVIDEO_H__
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <coecntrl.h>
|
sl@0
|
29 |
#include <coeaui.h>
|
sl@0
|
30 |
#include <eikenv.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
#include "te_conestepbase.h"
|
sl@0
|
33 |
|
sl@0
|
34 |
_LIT(KTUiAndVideo,"tuiandvideo");
|
sl@0
|
35 |
|
sl@0
|
36 |
#include <coecntrl.h>
|
sl@0
|
37 |
|
sl@0
|
38 |
#include <eikenv.h>
|
sl@0
|
39 |
#include <eikappui.h>
|
sl@0
|
40 |
#include <eikapp.h>
|
sl@0
|
41 |
#include <eikdoc.h>
|
sl@0
|
42 |
//#include <eikmenup.h>
|
sl@0
|
43 |
//#include <eikon.hrh>
|
sl@0
|
44 |
//#include <eikon.rsg>
|
sl@0
|
45 |
#include <apgcli.h>
|
sl@0
|
46 |
#include <videoplayer2.h>
|
sl@0
|
47 |
|
sl@0
|
48 |
class CTestAppView;
|
sl@0
|
49 |
class CVideoPane;
|
sl@0
|
50 |
class CTUiAndVideoAppUi;
|
sl@0
|
51 |
|
sl@0
|
52 |
/**
|
sl@0
|
53 |
Helper class to manage commands between test framework and test thread.
|
sl@0
|
54 |
*/
|
sl@0
|
55 |
class CCommandSink : public CActive
|
sl@0
|
56 |
{
|
sl@0
|
57 |
public:
|
sl@0
|
58 |
CCommandSink(CTestAppView* aTestView);
|
sl@0
|
59 |
~CCommandSink();
|
sl@0
|
60 |
void Init(RThread* aTargetThread, TRequestStatus* aTargetStatus);
|
sl@0
|
61 |
|
sl@0
|
62 |
protected:
|
sl@0
|
63 |
void DoCancel();
|
sl@0
|
64 |
|
sl@0
|
65 |
private:
|
sl@0
|
66 |
void RunL();
|
sl@0
|
67 |
|
sl@0
|
68 |
CTestAppView* iTestView;
|
sl@0
|
69 |
TRequestStatus* iTargetStatus;
|
sl@0
|
70 |
RThread* iTargetThread;
|
sl@0
|
71 |
TUint32 iState;
|
sl@0
|
72 |
};
|
sl@0
|
73 |
|
sl@0
|
74 |
|
sl@0
|
75 |
class CTUiAndVideo : public CTe_ConeStepBase
|
sl@0
|
76 |
{
|
sl@0
|
77 |
public:
|
sl@0
|
78 |
CTUiAndVideo();
|
sl@0
|
79 |
|
sl@0
|
80 |
private:
|
sl@0
|
81 |
// From CTestStep
|
sl@0
|
82 |
virtual TVerdict doTestStepL();
|
sl@0
|
83 |
virtual void InitUIL(CCoeEnv* aCoeEnv);
|
sl@0
|
84 |
void IssueCommand (TUint aCommand);
|
sl@0
|
85 |
void StepState (TUint aNextState, TUint aPause);
|
sl@0
|
86 |
|
sl@0
|
87 |
private:
|
sl@0
|
88 |
CTUiAndVideoAppUi* iAppUi;
|
sl@0
|
89 |
TRequestStatus iTestState;
|
sl@0
|
90 |
};
|
sl@0
|
91 |
|
sl@0
|
92 |
//************************************************************************************************************
|
sl@0
|
93 |
//** Application UI
|
sl@0
|
94 |
//************************************************************************************************************
|
sl@0
|
95 |
|
sl@0
|
96 |
class CTUiAndVideoAppUi : public CEikAppUi, public MVideoPlayerUtilityObserver
|
sl@0
|
97 |
{
|
sl@0
|
98 |
public:
|
sl@0
|
99 |
void ConstructL(TRequestStatus iCommandSource);
|
sl@0
|
100 |
~CTUiAndVideoAppUi();
|
sl@0
|
101 |
|
sl@0
|
102 |
public: // from MVIdeoPlayerUtilityObserver
|
sl@0
|
103 |
void MvpuoOpenComplete(TInt aError);
|
sl@0
|
104 |
void MvpuoPrepareComplete(TInt aError);
|
sl@0
|
105 |
void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
|
sl@0
|
106 |
void MvpuoPlayComplete(TInt aError);
|
sl@0
|
107 |
void MvpuoEvent(const TMMFEvent &aEvent);
|
sl@0
|
108 |
|
sl@0
|
109 |
private:
|
sl@0
|
110 |
// from CEikAppUi
|
sl@0
|
111 |
void HandleCommandL(TInt aCommand);
|
sl@0
|
112 |
void HandleForegroundEventL(TBool aForeground);
|
sl@0
|
113 |
static TInt BackgroundCallBack(TAny* aSelf);
|
sl@0
|
114 |
static TInt UIMoverCallBack(TAny* aSelf);
|
sl@0
|
115 |
void SetPos();
|
sl@0
|
116 |
void BringToForeground();
|
sl@0
|
117 |
static TInt PlayTimerCallBack(TAny* aSelf);
|
sl@0
|
118 |
|
sl@0
|
119 |
public:
|
sl@0
|
120 |
void Bounce (TBool aBounce);
|
sl@0
|
121 |
void Jump (TBool aJump);
|
sl@0
|
122 |
|
sl@0
|
123 |
TInt PopulateDirFilesL(const TDesC& aDir);
|
sl@0
|
124 |
void OpenSelectedFileL(const TDesC& aFile);
|
sl@0
|
125 |
TInt PlayNextFileL();
|
sl@0
|
126 |
TInt PlayPreviousFileL();
|
sl@0
|
127 |
void LogError(const TDesC& aFileName, const TDesC& aErrorMsg);
|
sl@0
|
128 |
TRequestStatus* CommandSink ();
|
sl@0
|
129 |
TBool iInitialised;
|
sl@0
|
130 |
|
sl@0
|
131 |
private:
|
sl@0
|
132 |
CCommandSink* iCommandSink;
|
sl@0
|
133 |
CTestAppView* iAppView;
|
sl@0
|
134 |
CVideoPlayerUtility2* iLoadingPlayer;
|
sl@0
|
135 |
CPeriodic* iIdleTimer;
|
sl@0
|
136 |
CPeriodic* iUIMover;
|
sl@0
|
137 |
CPeriodic* iPlayTimer;
|
sl@0
|
138 |
CDir* iDirList;
|
sl@0
|
139 |
TInt iCurrentIndex;
|
sl@0
|
140 |
TFileName iCurrentFile;
|
sl@0
|
141 |
};
|
sl@0
|
142 |
|
sl@0
|
143 |
|
sl@0
|
144 |
|
sl@0
|
145 |
//************************************************************************************************************
|
sl@0
|
146 |
//** View class
|
sl@0
|
147 |
//************************************************************************************************************
|
sl@0
|
148 |
|
sl@0
|
149 |
class CTestAppView : public CCoeControl, public MCoeControlObserver
|
sl@0
|
150 |
{
|
sl@0
|
151 |
public:
|
sl@0
|
152 |
static CTestAppView* NewL(const TRect& aWindowedRect);
|
sl@0
|
153 |
~CTestAppView();
|
sl@0
|
154 |
RWindow& TheWindow();
|
sl@0
|
155 |
const RWindow& TheWindow() const { return const_cast<CTestAppView*>(this)->TheWindow(); }
|
sl@0
|
156 |
void EnableVideo(CVideoPlayerUtility2*& aPlayer);
|
sl@0
|
157 |
void DisableVideo();
|
sl@0
|
158 |
TRect VideoPaneRect() const;
|
sl@0
|
159 |
|
sl@0
|
160 |
void SetRunMode (TUint32 aMode);
|
sl@0
|
161 |
|
sl@0
|
162 |
void PlayVideo();
|
sl@0
|
163 |
void PauseVideo();
|
sl@0
|
164 |
void StopVideo();
|
sl@0
|
165 |
void PlayComplete(TInt aError);
|
sl@0
|
166 |
void SetPos(TPoint* aPos);
|
sl@0
|
167 |
private:
|
sl@0
|
168 |
CTestAppView();
|
sl@0
|
169 |
void ConstructL(const TRect& aRect);
|
sl@0
|
170 |
void SetVideoSize(CVideoPlayerUtility2& aVideo) const;
|
sl@0
|
171 |
void UpdateButtonState();
|
sl@0
|
172 |
void PlayPrevious();
|
sl@0
|
173 |
void PlayNext();
|
sl@0
|
174 |
private: // from MCoeControlObserver
|
sl@0
|
175 |
void HandleControlEventL(CCoeControl *aControl, TCoeEvent aEventType);
|
sl@0
|
176 |
|
sl@0
|
177 |
private: // from CCoeControl
|
sl@0
|
178 |
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
sl@0
|
179 |
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
|
sl@0
|
180 |
void SizeChanged();
|
sl@0
|
181 |
void Draw(const TRect& aRect) const;
|
sl@0
|
182 |
|
sl@0
|
183 |
private:
|
sl@0
|
184 |
TPoint iVidPos;
|
sl@0
|
185 |
TPoint iIncrement;
|
sl@0
|
186 |
TPoint iDirection;
|
sl@0
|
187 |
TInt32 iRunMode;
|
sl@0
|
188 |
|
sl@0
|
189 |
TRect iWindowedViewRect;
|
sl@0
|
190 |
TSize iNativeVideoSize;
|
sl@0
|
191 |
TPoint iPointerDownPos;
|
sl@0
|
192 |
TTime iPointerDownTime;
|
sl@0
|
193 |
CVideoPlayerUtility2* iCurrentPlayer;
|
sl@0
|
194 |
TBool iIsPlaying;
|
sl@0
|
195 |
private:
|
sl@0
|
196 |
CFbsBitmap* iBkgrdImage;
|
sl@0
|
197 |
CFbsBitmap* iBkgrdMask;
|
sl@0
|
198 |
private:
|
sl@0
|
199 |
CVideoPane* iVideoPane;
|
sl@0
|
200 |
|
sl@0
|
201 |
enum
|
sl@0
|
202 |
{
|
sl@0
|
203 |
KFourButtonControlID,
|
sl@0
|
204 |
KThreeButtonControlID,
|
sl@0
|
205 |
KVideoControlID
|
sl@0
|
206 |
};
|
sl@0
|
207 |
};
|
sl@0
|
208 |
|
sl@0
|
209 |
enum TButtonPaneAction
|
sl@0
|
210 |
{
|
sl@0
|
211 |
KButtonEventNotInit = -2,
|
sl@0
|
212 |
KButtonEventDoNothing = -1,
|
sl@0
|
213 |
KButtonEventDoPlayPause = 10,
|
sl@0
|
214 |
KButtonEventDoBackward,
|
sl@0
|
215 |
KButtonEventDoForward,
|
sl@0
|
216 |
KButtonEventDoOpenFile
|
sl@0
|
217 |
};
|
sl@0
|
218 |
|
sl@0
|
219 |
|
sl@0
|
220 |
//************************************************************************************************************
|
sl@0
|
221 |
//** CVideoPane class - place 'video' window
|
sl@0
|
222 |
//************************************************************************************************************
|
sl@0
|
223 |
|
sl@0
|
224 |
class CVideoPane : public CCoeControl
|
sl@0
|
225 |
{
|
sl@0
|
226 |
public:
|
sl@0
|
227 |
~CVideoPane();
|
sl@0
|
228 |
CVideoPane();
|
sl@0
|
229 |
void ConstructL(CCoeControl& aParent);
|
sl@0
|
230 |
RWindow& TheWindow() { return Window(); }
|
sl@0
|
231 |
const RWindow& TheWindow() const { return const_cast<CVideoPane*>(this)->TheWindow(); }
|
sl@0
|
232 |
TBool IsVideoPanePointerEvent();
|
sl@0
|
233 |
void BlackoutPane();
|
sl@0
|
234 |
void SetVideoUseRect(const TRect& aRect);
|
sl@0
|
235 |
void EnableSubtitle(CVideoPlayerUtility2* aSubtitlePlayer);
|
sl@0
|
236 |
private: // from CCoeControl
|
sl@0
|
237 |
void SizeChanged();
|
sl@0
|
238 |
void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
sl@0
|
239 |
void Draw(const TRect& aRect) const;
|
sl@0
|
240 |
private:
|
sl@0
|
241 |
TBool iIsVideoPanePointerEvent;
|
sl@0
|
242 |
TRect iVideoUseRect;
|
sl@0
|
243 |
private:
|
sl@0
|
244 |
CVideoPlayerUtility2* iSubtitlePlayer;
|
sl@0
|
245 |
};
|
sl@0
|
246 |
|
sl@0
|
247 |
#endif
|