author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:34:36 +0300 | |
branch | RCL_3 |
changeset 70 | 375929f879c2 |
parent 57 | befca0ec475f |
permissions | -rw-r--r-- |
57 | 1 |
/* |
2 |
* Copyright (c) 2008 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 "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: Implementation of MPXVideoPlaybackControlsController |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
70
375929f879c2
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
19 |
// Version : %version: 19 % |
57 | 20 |
|
21 |
||
22 |
#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ |
|
23 |
#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_ |
|
24 |
||
25 |
// INCLUDES |
|
26 |
#include <mpxplaybackframeworkdefs.h> |
|
27 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
28 |
#include <f32file.h> |
|
29 |
#include <MMFScalingCustomCommandConstants.h> |
|
30 |
||
31 |
#include "mpxvideo_debug.h" |
|
32 |
#include "mpxvideoplaybackviewfiledetails.h" |
|
33 |
#include "mpxvideoplaybackcontrol.hrh" |
|
34 |
||
35 |
// FORWARD DECLARATIONS |
|
36 |
class CEikLabel; |
|
37 |
class CEikImage; |
|
38 |
class MTouchFeedback; |
|
39 |
class CMPXVideoPlaybackControl; |
|
40 |
class CMPXVideoPlaybackContainer; |
|
41 |
class CMPXVideoPlaybackControlPolicy; |
|
42 |
class CAknsBasicBackgroundControlContext; |
|
43 |
class CMPXVideoPlaybackControlConfiguration; |
|
44 |
||
45 |
// DATA TYPES |
|
46 |
||
47 |
enum TMPXTimerAction |
|
48 |
{ |
|
49 |
EMPXTimerCancel, |
|
50 |
EMPXTimerReset |
|
51 |
}; |
|
52 |
||
53 |
||
54 |
// CLASS DECLARATION |
|
55 |
||
56 |
class CMPXVideoPlaybackControlsController : public CBase |
|
57 |
{ |
|
58 |
||
59 |
public: // Constructors and destructor |
|
60 |
||
61 |
/** |
|
62 |
* Two-phased constructor. |
|
63 |
*/ |
|
64 |
IMPORT_C static CMPXVideoPlaybackControlsController* NewL( |
|
65 |
CMPXVideoPlaybackContainer* aContainer, |
|
66 |
TRect aRect, |
|
67 |
CMPXVideoPlaybackViewFileDetails* aDetails ); |
|
68 |
||
69 |
/** |
|
70 |
* Destructor. |
|
71 |
*/ |
|
72 |
IMPORT_C virtual ~CMPXVideoPlaybackControlsController(); |
|
73 |
||
74 |
private: |
|
75 |
||
76 |
/** |
|
77 |
* C++ default constructor. |
|
78 |
*/ |
|
79 |
CMPXVideoPlaybackControlsController( CMPXVideoPlaybackContainer* aContainer, TRect aRect ); |
|
80 |
||
81 |
/** |
|
82 |
* Symbian 2nd phase constructor. |
|
83 |
*/ |
|
84 |
void ConstructL( CMPXVideoPlaybackViewFileDetails* aDetails ); |
|
85 |
||
86 |
public: |
|
87 |
||
88 |
/** |
|
89 |
* Handle event from container |
|
90 |
*/ |
|
91 |
IMPORT_C void HandleEventL( TMPXVideoPlaybackControlCommandIds aEvent, TInt aValue = 0 ); |
|
92 |
||
93 |
IMPORT_C CEikImage* GetBitmap( TMPXVideoPlaybackControls aBitmap ); |
|
94 |
||
95 |
// |
|
96 |
// Add the file details to the controls controller when available |
|
97 |
// |
|
98 |
IMPORT_C void AddFileDetailsL( CMPXVideoPlaybackViewFileDetails* aDetails ); |
|
99 |
||
100 |
/** |
|
101 |
* Command handling function. |
|
102 |
* Call HandleCommandL() of container |
|
103 |
*/ |
|
104 |
void HandleCommandL( TInt aCommand, TInt aValue = 0 ); |
|
105 |
||
106 |
/** |
|
107 |
* Return ETrue if TV-out cable gets connected |
|
108 |
*/ |
|
109 |
inline TBool IsTvOutConnected(); |
|
110 |
||
111 |
/** |
|
112 |
* Reset or cancel timers for the controls |
|
113 |
*/ |
|
114 |
void ResetDisappearingTimers( TMPXTimerAction aTimerAction ); |
|
115 |
||
116 |
/** |
|
117 |
* Return state |
|
118 |
*/ |
|
119 |
inline TMPXPlaybackState State(); |
|
120 |
||
121 |
/* |
|
122 |
* Return the Aspect Ratio for the clip |
|
123 |
*/ |
|
124 |
inline TMMFScalingType AspectRatio(); |
|
125 |
||
126 |
/** |
|
127 |
* Return file details |
|
128 |
*/ |
|
129 |
inline CMPXVideoPlaybackViewFileDetails* FileDetails(); |
|
130 |
||
131 |
// |
|
132 |
// Locates the bitmap file searching from y: down and then z: last |
|
133 |
// |
|
134 |
void LocateBitmapFileL( TFileName& aFileName ); |
|
135 |
||
136 |
void SetRealOneBitmapVisibility( TBool aVisible ); |
|
137 |
||
138 |
inline TBool IsRealMediaFormat(); |
|
139 |
||
140 |
private: |
|
141 |
/** |
|
142 |
* Create controls |
|
143 |
*/ |
|
144 |
void CreateControlsL(); |
|
145 |
||
146 |
/** |
|
147 |
* Update controls |
|
148 |
*/ |
|
149 |
void HandleStateChange( TMPXPlaybackState aNewState ); |
|
150 |
||
151 |
/** |
|
152 |
* Update Control's visibility |
|
153 |
*/ |
|
154 |
void UpdateControlsVisibility(); |
|
155 |
||
156 |
/** |
|
157 |
* Toggle visibility |
|
158 |
*/ |
|
159 |
void ToggleVisibility(); |
|
160 |
||
161 |
CEikImage* CreateImageL( TFileName& aIconsPath, TInt aBitmapIndex, TInt aBitmapMaskIndex ); |
|
162 |
||
163 |
CEikImage* CreateBitmapL( TFileName& aIconsPath, |
|
164 |
TInt aBitmapIndex, |
|
165 |
const TAknWindowLineLayout& aLayout ); |
|
166 |
||
167 |
/** |
|
168 |
* Create/delete controls based on updated control list |
|
169 |
*/ |
|
170 |
void ControlsListUpdatedL( TBool aUpdateVisibility = ETrue ); |
|
171 |
||
172 |
/** |
|
173 |
* Create fake softkeyL |
|
174 |
*/ |
|
175 |
void CreateFakeSoftKeyL( TInt aResource, |
|
176 |
TBool aTop, |
|
177 |
TMPXVideoPlaybackControls aControlIndex, |
|
178 |
TUint aProperties ); |
|
179 |
||
180 |
/** |
|
181 |
* Crate text label with speccific layout |
|
182 |
*/ |
|
183 |
void CreateTextLabelWithSpecificLayoutL( |
|
184 |
TInt aResource, |
|
185 |
TMPXVideoPlaybackControls aControlIndex, |
|
186 |
TUint aProperties, |
|
187 |
TAknTextComponentLayout aLayout ); |
|
188 |
||
189 |
// |
|
190 |
// Create the bitmaps for Audio Only Clips |
|
191 |
// |
|
192 |
void CreateAudioOnlyBitmapL( TFileName& aIconsPath, |
|
193 |
TInt aBitmapIndex, |
|
194 |
TInt aBitmapMaskIndex, |
|
195 |
TMPXVideoPlaybackControls aControlIndex, |
|
196 |
const TAknWindowLineLayout& aLayout, |
|
197 |
TUint aProperties ); |
|
198 |
||
199 |
// |
|
200 |
// Create the title control for Audio Only Clips |
|
201 |
// |
|
202 |
void CreateTitleControlL( TMPXVideoPlaybackControls aControlIndex, |
|
203 |
TUint aProperties ); |
|
204 |
||
205 |
/** |
|
206 |
* Create CEikLabelL |
|
207 |
*/ |
|
208 |
CEikLabel* CreateTextLabelL( const TDesC& aText ); |
|
209 |
||
210 |
/* |
|
211 |
* Handles the Controls Timer Timout |
|
212 |
*/ |
|
213 |
static TInt HandleControlsTimeout( TAny* aPtr ); |
|
214 |
||
215 |
/** |
|
216 |
* Cancels all disappearing timers and hides all controls |
|
217 |
*/ |
|
218 |
void HideAllControls(); |
|
219 |
||
220 |
/** |
|
221 |
* Show Controls and reset the timers |
|
222 |
*/ |
|
223 |
void ShowControls(); |
|
224 |
||
225 |
/** |
|
226 |
* Return ETrue if any control is visible |
|
227 |
*/ |
|
228 |
TBool IsVisible(); |
|
229 |
||
230 |
/** |
|
231 |
* Append a control based on control index |
|
232 |
*/ |
|
233 |
void AppendControlL( TMPXVideoPlaybackControls aControlIndex ); |
|
234 |
||
235 |
/** |
|
236 |
* Set changed volume |
|
237 |
*/ |
|
238 |
void VolumeChanged( TInt aVolume ); |
|
239 |
||
240 |
/** |
|
241 |
* Set changed duration |
|
242 |
*/ |
|
243 |
void DurationChangedL( TInt aDuration); |
|
244 |
||
245 |
/** |
|
246 |
* Set changed position |
|
247 |
*/ |
|
248 |
void PositionChangedL( TInt aPosition ); |
|
249 |
||
250 |
/** |
|
251 |
* Set changed position |
|
252 |
*/ |
|
253 |
void AspectRatioChanged( TInt aAspectRatio ); |
|
254 |
/* |
|
255 |
* Sets the download size on the progress bar |
|
256 |
*/ |
|
257 |
void SetDownloadSize( TInt aSize ); |
|
258 |
||
259 |
/* |
|
260 |
* Updates the download ratio on the progress bar |
|
261 |
*/ |
|
262 |
void UpdateDownloadPosition( TInt aNewSize ); |
|
263 |
||
264 |
/** |
|
265 |
* Set changed state on button bar |
|
266 |
*/ |
|
267 |
void UpdateStateOnButtonBar(); |
|
268 |
||
269 |
/** |
|
270 |
* Stop branding animation |
|
271 |
*/ |
|
272 |
void StopBrandingAnimation(); |
|
273 |
||
274 |
/** |
|
275 |
* Check whether this clip is real format or not |
|
276 |
*/ |
|
277 |
TBool IsRealFormatL( const TDesC& aDes ); |
|
278 |
||
279 |
/** |
|
280 |
* Check whether this clip is real format or not for streaming/live streaming |
|
281 |
*/ |
|
282 |
TBool RealFormatForStreamingL( const TDesC& aDes ); |
|
283 |
||
284 |
/** |
|
285 |
* Check whether this clip is real format or not for local/progressive donwload |
|
286 |
*/ |
|
287 |
TBool RealFormatForLocalL(); |
|
288 |
||
289 |
/* |
|
290 |
* Create the Real One bitmap |
|
291 |
*/ |
|
292 |
void CreateRealOneBitmapL(); |
|
293 |
||
294 |
/** |
|
295 |
* Handle errors |
|
296 |
*/ |
|
297 |
void HandleErrors(); |
|
298 |
||
299 |
/** |
|
300 |
* Return ETrue if control is visible |
|
301 |
*/ |
|
302 |
TBool IsSoftKeyVisible( TInt aValue ); |
|
303 |
||
304 |
/** |
|
305 |
* Handle tvout connected/disconnected event |
|
306 |
*/ |
|
307 |
void HandleTvOutEventL( TBool aConnected, |
|
308 |
TMPXVideoPlaybackControlCommandIds aEvent, |
|
309 |
TBool aShowArIcon ); |
|
310 |
/** |
|
311 |
* Handle softkey pressed event |
|
312 |
*/ |
|
313 |
void HandleSoftKeyPressedL( TInt aValue ); |
|
314 |
||
315 |
/* |
|
316 |
* Locate the path of the dll |
|
317 |
*/ |
|
318 |
TInt AddDllPath( TDes& aFileName ); |
|
319 |
||
320 |
/* |
|
321 |
* Shows the Meida File Details Viewer control |
|
322 |
*/ |
|
323 |
void ShowMediaDetailsViewerL(); |
|
324 |
||
325 |
/* |
|
326 |
* Checks if Media Details Viewer control is open/visible |
|
327 |
*/ |
|
328 |
TBool IsMediaDetailsViewerVisible(); |
|
329 |
||
330 |
/* |
|
331 |
* Closes Media Details Viewer |
|
332 |
*/ |
|
333 |
void CloseMediaDetailsViewer(); |
|
334 |
||
335 |
/* |
|
336 |
* Handles the Loading Started command that was received after Buffering state was |
|
337 |
* blocked by the playback view |
|
338 |
*/ |
|
339 |
void HandleLoadingStarted(); |
|
340 |
||
341 |
/* |
|
342 |
* This will cause the controls to be updated when the surface changes and the |
|
343 |
* controls are visible. |
|
344 |
*/ |
|
345 |
void RedrawControlsForSurfaceChanges(); |
|
346 |
||
347 |
private: |
|
348 |
||
349 |
CMPXVideoPlaybackControlPolicy* iControlsPolicy; |
|
350 |
CArrayPtrFlat<CMPXVideoPlaybackControl> iControls; |
|
351 |
CMPXVideoPlaybackControl* iMediaDetailsViewerControl; |
|
352 |
||
353 |
CMPXVideoPlaybackControlConfiguration* iControlsConfig; |
|
354 |
||
355 |
CEikImage* iRealOneBitmap; |
|
356 |
||
357 |
CPeriodic* iControlsTimer; |
|
358 |
||
359 |
TRect iRect; |
|
360 |
TInt iVideoResourceOffset; |
|
361 |
||
362 |
TMPXPlaybackState iState; |
|
363 |
TMMFScalingType iAspectRatio; |
|
364 |
||
365 |
CMPXVideoPlaybackViewFileDetails* iFileDetails; // not owned |
|
366 |
||
367 |
RFs iFs; |
|
368 |
TFileName iBitmapFileName; |
|
369 |
||
370 |
TBool iTvOutConnected; |
|
371 |
TBool iShowControls; |
|
372 |
TBool iRNFormat; |
|
373 |
||
374 |
#ifdef RD_TACTILE_FEEDBACK |
|
375 |
MTouchFeedback* iFeedback; |
|
376 |
#endif //RD_TACTILE_FEEDBACK |
|
377 |
||
378 |
public: |
|
379 |
CMPXVideoPlaybackContainer* iContainer; |
|
380 |
}; |
|
381 |
||
382 |
// INLINE METHODS |
|
383 |
||
384 |
inline |
|
385 |
TMPXPlaybackState CMPXVideoPlaybackControlsController::State() |
|
386 |
{ |
|
387 |
return iState; |
|
388 |
} |
|
389 |
||
390 |
inline |
|
391 |
CMPXVideoPlaybackViewFileDetails* CMPXVideoPlaybackControlsController::FileDetails() |
|
392 |
{ |
|
393 |
return iFileDetails; |
|
394 |
} |
|
395 |
||
396 |
inline |
|
397 |
TBool CMPXVideoPlaybackControlsController::IsTvOutConnected() |
|
398 |
{ |
|
399 |
MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::IsTvOutConnected(%d)"), |
|
400 |
iFileDetails->iTvOutConnected); |
|
401 |
||
402 |
return iFileDetails->iTvOutConnected; |
|
403 |
} |
|
404 |
||
405 |
inline |
|
406 |
TBool CMPXVideoPlaybackControlsController::IsRealMediaFormat() |
|
407 |
{ |
|
408 |
MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::IsRealFormat() [%d]"), iRNFormat); |
|
409 |
return iRNFormat; |
|
410 |
} |
|
411 |
||
412 |
inline |
|
413 |
TMMFScalingType CMPXVideoPlaybackControlsController::AspectRatio() |
|
414 |
{ |
|
415 |
MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::AspectRatio(%d)"), iAspectRatio); |
|
416 |
return iAspectRatio; |
|
417 |
} |
|
418 |
||
419 |
#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_*/ |
|
420 |
||
421 |
// End of File |