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