|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Controller class for handling browser requests to play video. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef BAVPCONTROLLERVIDEO_H |
|
20 #define BAVPCONTROLLERVIDEO_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <browser_platform_variant.hrh> |
|
24 |
|
25 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
26 #include <VideoPlayer2.h> |
|
27 #else |
|
28 #include <VideoPlayer.h> |
|
29 #endif |
|
30 #include "BavpController.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class MBavpView; |
|
34 class CBavpViewFullScreen; |
|
35 |
|
36 |
|
37 // CLASS DECLARATIONS |
|
38 /** |
|
39 * CBavpController. |
|
40 * Controller class for handling browser requests to play video. |
|
41 * @lib npBrowserVideoPlugin.lib |
|
42 * @since 3.2 |
|
43 */ |
|
44 class CBavpControllerVideo : public CBavpController, |
|
45 public MVideoPlayerUtilityObserver, |
|
46 public MVideoLoadingObserver, |
|
47 public MBeating |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 */ |
|
54 static CBavpControllerVideo* NewL( MBavpView* aView, |
|
55 TUint aAccessPtId, |
|
56 TBavpMediaType aMediaType, |
|
57 const TDesC& aFileName ); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 ~CBavpControllerVideo(); |
|
63 |
|
64 private: // New methods |
|
65 |
|
66 /** |
|
67 * C++ default constructor. |
|
68 */ |
|
69 CBavpControllerVideo( MBavpView* aView, TUint aAccessPtId ); |
|
70 |
|
71 /** |
|
72 * By default Symbian 2nd phase constructor is private. |
|
73 * @param none |
|
74 * @return void |
|
75 */ |
|
76 void ConstructL( TBavpMediaType aMediaType, const TDesC& aFileName ); |
|
77 |
|
78 /** |
|
79 * Open a video URL link |
|
80 * @since 3.2 |
|
81 * @param none |
|
82 * @return void |
|
83 */ |
|
84 void OpenVideoUrlL(); |
|
85 |
|
86 /** |
|
87 * Opens the video file to be played. |
|
88 * @param none |
|
89 * @return void |
|
90 */ |
|
91 void OpenVideoFileL(); |
|
92 |
|
93 /** |
|
94 * Handle the leaving methods needed by MvpuoPrepareComplete |
|
95 * @param none |
|
96 * @return void |
|
97 */ |
|
98 void PrepareCompleteL(); |
|
99 |
|
100 /** |
|
101 * Non leaving version of initialize the video player plugin |
|
102 * @param none |
|
103 * @return void |
|
104 */ |
|
105 void InitVideoPlayer(); |
|
106 |
|
107 /** |
|
108 * Initialize the video player plugin |
|
109 * @param none |
|
110 * @return void |
|
111 */ |
|
112 void InitVideoPlayerL(); |
|
113 |
|
114 /** |
|
115 * Closes the player and delete the player instance |
|
116 * @param none |
|
117 * @return void |
|
118 */ |
|
119 void UnInitVideoPlayer(); |
|
120 |
|
121 /** |
|
122 * Rotate the screen if its height is bigger than width |
|
123 * @param none |
|
124 * @return void |
|
125 */ |
|
126 void RotateScreen90(); |
|
127 |
|
128 /** |
|
129 * Switch from normal screen to full screen display |
|
130 * @param none |
|
131 * @return void |
|
132 */ |
|
133 void RevertToFullScreenL(); |
|
134 |
|
135 /** |
|
136 * Switch from full screen to normal screen display |
|
137 * @param none |
|
138 * @return void |
|
139 */ |
|
140 void RevertToNormalScreenL(); |
|
141 |
|
142 /** |
|
143 * Switch between normal screen display and full screen display |
|
144 * @since 3.2 |
|
145 * @param none |
|
146 * @return void |
|
147 */ |
|
148 void ToggleScreen(); |
|
149 |
|
150 /** |
|
151 * Refresh the coordinates of the rectangle to be drawn |
|
152 * @since 3.2 |
|
153 * @param none |
|
154 * @return void |
|
155 */ |
|
156 void RefreshRectCoordinatesL(); |
|
157 |
|
158 /** |
|
159 * Switches between normal screen display and full screen display |
|
160 * @since 3.2 |
|
161 * @param TAny* aThisData: the controller itself |
|
162 * @return TInt error code |
|
163 */ |
|
164 static TInt WaitForScreenSwitch( TAny* aThisData ); |
|
165 |
|
166 /** |
|
167 * wrapper function for WaitForScreenSwitch, that leaves |
|
168 * Switches between normal screen display and full screen display |
|
169 * @since 3.2 |
|
170 * @param TAny* aThisData: the controller itself |
|
171 * @return TInt error code |
|
172 */ |
|
173 static void WaitForScreenSwitchL( TAny* aThisData ); |
|
174 |
|
175 /** |
|
176 * Fastforward the video file currently being played or paused |
|
177 * @since S60 v3.2 |
|
178 * @param TAny* aThisData: the controller itself |
|
179 * @return TInt error code |
|
180 */ |
|
181 static TInt DoFastForwardL( TAny* aThisData ); |
|
182 |
|
183 /** |
|
184 * Rewind the video file currently being played or paused |
|
185 * @since S60 v3.2 |
|
186 * @param TAny* aThisData: the controller itself |
|
187 * @return TInt error code |
|
188 */ |
|
189 static TInt DoRewindL( TAny* aThisData ); |
|
190 |
|
191 public: // Methods overridden from base class CBavpController |
|
192 |
|
193 /** |
|
194 * Handles the error |
|
195 * @param TInt aError: error to be handled |
|
196 * @return void |
|
197 */ |
|
198 void HandleError( TInt aError ); |
|
199 |
|
200 /** |
|
201 * Handles the keys offered by the CCoeControl |
|
202 * @since 3.2 |
|
203 * @param TInt aKeyEvent: Which key pressed |
|
204 * @param TInt aEventCode: Key down, key up... |
|
205 * @return TKeyResponse: Was the key consumed |
|
206 */ |
|
207 TKeyResponse HandleKeysL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
208 |
|
209 /** |
|
210 * Handles commands from Option Menu, defined in resource files |
|
211 * @since 3.2 |
|
212 * @param TBavpCommandIds aCommand: a Command Id |
|
213 * @return void |
|
214 */ |
|
215 void HandleCommandL( TBavpCommandIds aCommand ); |
|
216 |
|
217 TBool HandleGesture(RT_GestureHelper::TGestureEvent *gesture); |
|
218 |
|
219 public: // From MBavpController |
|
220 |
|
221 /** |
|
222 * Handles request to play the audio or video content |
|
223 * @since 3.2 |
|
224 * @param none |
|
225 * @return void |
|
226 */ |
|
227 void PlayAudioVideoL(); |
|
228 |
|
229 /** |
|
230 * Handles request to stop playing the content |
|
231 * @param none |
|
232 * @return void |
|
233 */ |
|
234 void Stop(); |
|
235 |
|
236 /** |
|
237 * Handles request to play content |
|
238 * @param none |
|
239 * @return void |
|
240 */ |
|
241 void PlayL(); |
|
242 |
|
243 /** |
|
244 * Handles request to pause playing content |
|
245 * @param none |
|
246 * @return void |
|
247 */ |
|
248 void PauseL(); |
|
249 |
|
250 /** |
|
251 * Handles request to fast forward content |
|
252 * @param none |
|
253 * @return void |
|
254 */ |
|
255 void FastForwardL(); |
|
256 |
|
257 /** |
|
258 * Handles request to rewind content |
|
259 * @param none |
|
260 * @return void |
|
261 */ |
|
262 void RewindL(); |
|
263 |
|
264 /** |
|
265 * Set the volume in the player, we send volume value 0-10, this method |
|
266 * will scale before calling player's SetVolume() |
|
267 * @param aVolume the new volume: 0(mute) - 10(max) |
|
268 * @return void |
|
269 */ |
|
270 void SetPlayerVolume( TInt aVolume ); |
|
271 |
|
272 /** |
|
273 * Get the current volume of the player |
|
274 * This needs to be scaled to 0-10 (CR value) before returning |
|
275 * @param none |
|
276 * @return player volume scaled: 0(mute) - 10(max) |
|
277 */ |
|
278 TInt GetPlayerVolume(); |
|
279 |
|
280 /** |
|
281 * To get the current position of the clip |
|
282 * @since 3.2 |
|
283 * @param none |
|
284 * @return TTimeIntervalMicroSeconds |
|
285 */ |
|
286 TTimeIntervalMicroSeconds getPositionL(); |
|
287 |
|
288 /** |
|
289 * To set the position of the clip |
|
290 * @since 3.2 |
|
291 * @param TTimeIntervalMicroSeconds |
|
292 * @return void |
|
293 */ |
|
294 void setPositionL(TTimeIntervalMicroSeconds); |
|
295 |
|
296 /** |
|
297 * Handles the incoming call |
|
298 * @param none |
|
299 * @return void |
|
300 */ |
|
301 void HandleInComingCallL(); |
|
302 |
|
303 |
|
304 public: // Methods from MVideoPlayerUtilityObserver |
|
305 |
|
306 /** |
|
307 * Notification to the client that the opening of the video clip has completed, successfully, or otherwise. |
|
308 * with the system clock |
|
309 * @since 3.2 |
|
310 * @param TInt aError: The status of the video sample after opening |
|
311 * @return void |
|
312 */ |
|
313 void MvpuoOpenComplete( TInt aError ); |
|
314 |
|
315 /** |
|
316 * Notification to the client that the opening of the video clip has been prepared |
|
317 * successfully, or otherwise. This callback is called in response to a call to CVideoPlayerUtility::Prepare(). |
|
318 * @since 3.2 |
|
319 * @param TInt aError: The status of the video sample after opening |
|
320 * @return void |
|
321 */ |
|
322 void MvpuoPrepareComplete( TInt aError ); |
|
323 |
|
324 /** |
|
325 * Notification that the frame requested by a call to GetFrameL is ready |
|
326 * @since 3.2 |
|
327 * @param TInt aError: The status of the video sample after opening |
|
328 * @return void |
|
329 */ |
|
330 void MvpuoFrameReady( CFbsBitmap& /*aFrame*/, TInt /*aError*/ ) {}; |
|
331 |
|
332 /** |
|
333 * Notification that video playback has completed. This is not called if playback is |
|
334 * explicitly stopped by calling Stop. |
|
335 * @since 3.2 |
|
336 * @param TInt aError: The status of the video sample after opening |
|
337 * @return void |
|
338 */ |
|
339 void MvpuoPlayComplete( TInt aError ); |
|
340 |
|
341 /** |
|
342 * General event notification from controller. These events are specified by the |
|
343 * supplier of the controller |
|
344 * @since 3.2 |
|
345 * @param TMMFEvent &aEvent: multimedia framework event |
|
346 * @return void |
|
347 */ |
|
348 void MvpuoEvent( const TMMFEvent &aEvent ); |
|
349 |
|
350 /** |
|
351 * Notification that video clip loading/rebuffering has completed |
|
352 * @since 3.2 |
|
353 * @param TMMFEvent &aEvent: multimedia framework event |
|
354 * @return void |
|
355 */ |
|
356 void MvloLoadingStarted(); |
|
357 |
|
358 /** |
|
359 * Notification that video clip loading/rebuffering has started |
|
360 * @since 3.2 |
|
361 * @param TMMFEvent &aEvent: multimedia framework event |
|
362 * @return void |
|
363 */ |
|
364 void MvloLoadingComplete(); |
|
365 // MBeating |
|
366 public: |
|
367 /** |
|
368 * Handles a regular heartbeat timer event |
|
369 * @since S60 v3.2 |
|
370 * @param none |
|
371 * @return void |
|
372 */ |
|
373 void Beat(); |
|
374 |
|
375 /** |
|
376 * Handles a heartbeat timer event where the timer completes out of synchronisation |
|
377 * with the system clock |
|
378 * @since S60 v3.2 |
|
379 * @param none |
|
380 * @return void |
|
381 */ |
|
382 void Synchronize(); |
|
383 |
|
384 private: |
|
385 /** |
|
386 * Handles the heart beat to retrieve the current playback position |
|
387 * @param none |
|
388 * @return void |
|
389 */ |
|
390 void HandleScreenSaver(); |
|
391 |
|
392 TBool NoScreenSaverMode(); |
|
393 void SetDefaultAspectRatioL(); |
|
394 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
395 /** |
|
396 * Handles a window rect update timer event where the timer completes the KWindowChangeUpdateTimeout |
|
397 * with the system clock |
|
398 * @since S60 v5.2 |
|
399 * @param none |
|
400 * @return void |
|
401 */ |
|
402 void UpdateWindowSize(); |
|
403 #endif |
|
404 private: // Data |
|
405 |
|
406 // Used to call MMF for video functionality |
|
407 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
408 /** |
|
409 * MMF Client API has updated with new methods to control video display |
|
410 *windows and video picture positioning to produce a new version of the API, |
|
411 *CVideoPlayerUtility2. The new API is the preferred way to play video on graphics |
|
412 *surfaces, and will support new features such as more flexible window positioning. |
|
413 */ |
|
414 CVideoPlayerUtility2* iVideoPlayer; |
|
415 #else |
|
416 CVideoPlayerUtility* iVideoPlayer; |
|
417 #endif |
|
418 // Active object for display update |
|
419 CIdle* iDisplayUpdater; |
|
420 |
|
421 // The full screen view |
|
422 CBavpViewFullScreen* iBavpViewFullScreen; |
|
423 //heart beat progress |
|
424 CHeartbeat* iBackLightUpdater; |
|
425 TRect iNormalScreenRect; |
|
426 RWindow* iActiveWindow; |
|
427 }; |
|
428 |
|
429 #endif // CBAVPCONTROLLERVIDEO_H |
|
430 |
|
431 // End of File |