34
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 playback view's input handler
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// Version : %version: 6 %
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include <e32std.h>
|
|
23 |
#include <w32std.h> // RWindowBase
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <AknUtils.h>
|
|
26 |
#include <eikclbd.h>
|
|
27 |
#include <aknconsts.h>
|
|
28 |
#include <remconcoreapi.h>
|
|
29 |
#include <remconcoreapitarget.h>
|
|
30 |
#include <remconinterfaceselector.h> // Side volume key
|
|
31 |
#include <mpxplaybackframeworkdefs.h>
|
|
32 |
#include <centralrepository.h> // for peripheral display timeout setting
|
|
33 |
#include <settingsinternalcrkeys.h> // display timeout setting keys
|
|
34 |
#include <hwrmlightdomaincrkeys.h>
|
|
35 |
#include <mpxvideoplaybackdefs.h>
|
|
36 |
|
|
37 |
#include <hal.h>
|
|
38 |
#include <hal_data.h>
|
|
39 |
|
|
40 |
#include "mpxvideo_debug.h"
|
|
41 |
#include "mpxvideoviewwrapper.h"
|
|
42 |
#include "mpxcommonvideoplaybackview.hrh"
|
|
43 |
#include "mpxvideoplaybackuserinputhandler.h"
|
|
44 |
|
|
45 |
|
|
46 |
// CONSTANTS
|
|
47 |
const TInt KMPXMicroSecondsInASecond = 1000000;
|
|
48 |
|
|
49 |
|
|
50 |
// ======== MEMBER FUNCTIONS =======================================================================
|
|
51 |
|
|
52 |
// -------------------------------------------------------------------------------------------------
|
|
53 |
// MPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler()
|
|
54 |
// -------------------------------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
CMPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper )
|
|
57 |
: iViewWrapper( aWrapper )
|
|
58 |
{
|
|
59 |
}
|
|
60 |
|
|
61 |
// -------------------------------------------------------------------------------------------------
|
|
62 |
// CMPXVideoPlaybackUserInputHandler::NewL()
|
|
63 |
// -------------------------------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackUserInputHandler::NewL(
|
|
66 |
CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected )
|
|
67 |
{
|
|
68 |
MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::NewL()"));
|
|
69 |
|
|
70 |
CMPXVideoPlaybackUserInputHandler* self =
|
|
71 |
new (ELeave) CMPXVideoPlaybackUserInputHandler( aWrapper );
|
|
72 |
CleanupStack::PushL( self );
|
|
73 |
self->ConstructL( aTvOutConnected );
|
|
74 |
CleanupStack::Pop();
|
|
75 |
return self;
|
|
76 |
}
|
|
77 |
|
|
78 |
// -------------------------------------------------------------------------------------------------
|
|
79 |
// CMPXVideoPlaybackUserInputHandler::ConstructL
|
|
80 |
// Symbian 2nd phase constructor can leave.
|
|
81 |
// -------------------------------------------------------------------------------------------------
|
|
82 |
//
|
|
83 |
void CMPXVideoPlaybackUserInputHandler::ConstructL( TBool aTvOutConnected )
|
|
84 |
{
|
|
85 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ConstructL()"));
|
|
86 |
|
|
87 |
iVolumeRepeatTimer = CPeriodic::NewL( CActive::EPriorityStandard );
|
|
88 |
iDisplayTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard );
|
|
89 |
iInterfaceSelector = CRemConInterfaceSelector::NewL();
|
|
90 |
iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
|
|
91 |
|
|
92 |
iTVOutConnected = aTvOutConnected;
|
|
93 |
|
|
94 |
// Start the timer if TV out is connected
|
|
95 |
if ( iTVOutConnected )
|
|
96 |
{
|
|
97 |
// Get the display light time-out value from CenRep
|
|
98 |
CRepository* repository = CRepository::NewLC( KCRUidLightSettings );
|
|
99 |
|
|
100 |
// What's the timeout value (in seconds ) for the display light?
|
|
101 |
repository->Get( KDisplayLightsTimeout, iDisplayTimeOut );
|
|
102 |
MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ConstructL Display Timeout( %d )"), iDisplayTimeOut);
|
|
103 |
|
|
104 |
CleanupStack::PopAndDestroy( repository );
|
|
105 |
|
|
106 |
// Convert the timeout value to microseconds
|
|
107 |
iDisplayTimeOut *= KMPXMicroSecondsInASecond;
|
|
108 |
|
|
109 |
RestartDisplayTimer();
|
|
110 |
}
|
|
111 |
|
|
112 |
// not detrimental if Media Keys dont work - so ignore any errors here
|
|
113 |
TRAP_IGNORE( iInterfaceSelector->OpenTargetL() );
|
|
114 |
|
|
115 |
iProcessingInputType = EMpxVideoNone;
|
|
116 |
iForeground = ETrue;
|
|
117 |
}
|
|
118 |
|
|
119 |
// -------------------------------------------------------------------------------------------------
|
|
120 |
// CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
|
|
121 |
// -------------------------------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
|
|
124 |
{
|
|
125 |
if ( iVolumeRepeatTimer )
|
|
126 |
{
|
|
127 |
iVolumeRepeatTimer->Cancel();
|
|
128 |
delete iVolumeRepeatTimer;
|
|
129 |
}
|
|
130 |
|
|
131 |
if ( iDisplayTimer )
|
|
132 |
{
|
|
133 |
iDisplayTimer->Cancel();
|
|
134 |
delete iDisplayTimer;
|
|
135 |
}
|
|
136 |
|
|
137 |
if ( iInterfaceSelector )
|
|
138 |
{
|
|
139 |
delete iInterfaceSelector;
|
|
140 |
iCoreTarget = NULL;
|
|
141 |
iInterfaceSelector = NULL;
|
|
142 |
}
|
|
143 |
|
|
144 |
// make sure that backlight enabled when
|
|
145 |
// the view updates or deactivates
|
|
146 |
EnableBacklight();
|
|
147 |
}
|
|
148 |
|
|
149 |
// -------------------------------------------------------------------------------------------------
|
|
150 |
// CMPXVideoPlaybackUserInputHandler::MrccatoPlay()
|
|
151 |
// -------------------------------------------------------------------------------------------------
|
|
152 |
//
|
|
153 |
void CMPXVideoPlaybackUserInputHandler::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/,
|
|
154 |
TRemConCoreApiButtonAction aButtonAct )
|
|
155 |
{
|
|
156 |
MPX_ENTER_EXIT(
|
|
157 |
_L("CMPXVideoPlaybackUserInputHandler::MrccatoPlay"),
|
|
158 |
_L("aButtonAct = %d"), aButtonAct );
|
|
159 |
|
|
160 |
ProcessMediaKey(ERemConCoreApiPlay, aButtonAct);
|
|
161 |
}
|
|
162 |
|
|
163 |
// -------------------------------------------------------------------------------------------------
|
|
164 |
// CMPXVideoPlaybackUserInputHandler::MrccatoCommand()
|
|
165 |
// -------------------------------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CMPXVideoPlaybackUserInputHandler::MrccatoCommand(TRemConCoreApiOperationId aOperationId,
|
|
168 |
TRemConCoreApiButtonAction aButtonAct )
|
|
169 |
{
|
|
170 |
MPX_ENTER_EXIT(
|
|
171 |
_L("CMPXVideoPlaybackUserInputHandler::MrccatoCommand"),
|
|
172 |
_L("aButtonAct = %d"), aButtonAct );
|
|
173 |
|
|
174 |
ProcessMediaKey(aOperationId, aButtonAct);
|
|
175 |
}
|
|
176 |
|
|
177 |
|
|
178 |
// -------------------------------------------------------------------------------------------------
|
|
179 |
// CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()
|
|
180 |
// -------------------------------------------------------------------------------------------------
|
|
181 |
//
|
|
182 |
void CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey( TRemConCoreApiOperationId aOperationId,
|
|
183 |
TRemConCoreApiButtonAction aButtonAct )
|
|
184 |
{
|
|
185 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()"));
|
|
186 |
|
|
187 |
switch ( aOperationId )
|
|
188 |
{
|
|
189 |
case ERemConCoreApiStop:
|
|
190 |
{
|
|
191 |
if ( aButtonAct == ERemConCoreApiButtonClick )
|
|
192 |
{
|
|
193 |
TRAP_IGNORE(iViewWrapper->HandleCommandL( EMPXPbvCmdStop ));
|
|
194 |
}
|
|
195 |
break;
|
|
196 |
}
|
|
197 |
case ERemConCoreApiRewind:
|
|
198 |
{
|
|
199 |
HandleRewind(aButtonAct);
|
|
200 |
break;
|
|
201 |
}
|
|
202 |
case ERemConCoreApiFastForward:
|
|
203 |
{
|
|
204 |
HandleFastForward(aButtonAct);
|
|
205 |
break;
|
|
206 |
}
|
|
207 |
case ERemConCoreApiVolumeUp:
|
|
208 |
{
|
|
209 |
HandleVolumeUp(aButtonAct);
|
|
210 |
break;
|
|
211 |
}
|
|
212 |
case ERemConCoreApiVolumeDown:
|
|
213 |
{
|
|
214 |
HandleVolumeDown(aButtonAct);
|
|
215 |
break;
|
|
216 |
}
|
|
217 |
case ERemConCoreApiPausePlayFunction:
|
|
218 |
{
|
|
219 |
if ( aButtonAct == ERemConCoreApiButtonClick )
|
|
220 |
{
|
|
221 |
TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPlayPause));
|
|
222 |
}
|
|
223 |
break;
|
|
224 |
}
|
|
225 |
case ERemConCoreApiPause:
|
|
226 |
{
|
|
227 |
TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPause));
|
|
228 |
break;
|
|
229 |
}
|
|
230 |
case ERemConCoreApiPlay:
|
|
231 |
{
|
|
232 |
if ( aButtonAct == ERemConCoreApiButtonClick )
|
|
233 |
{
|
|
234 |
TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPlay));
|
|
235 |
}
|
|
236 |
break;
|
|
237 |
}
|
|
238 |
default:
|
|
239 |
break;
|
|
240 |
}
|
|
241 |
}
|
|
242 |
|
|
243 |
// -------------------------------------------------------------------------------------------------
|
|
244 |
// CMPXVideoPlaybackUserInputHandler::HandleFastForward()
|
|
245 |
// -------------------------------------------------------------------------------------------------
|
|
246 |
//
|
|
247 |
void CMPXVideoPlaybackUserInputHandler::HandleFastForward(TRemConCoreApiButtonAction aButtonAct)
|
|
248 |
{
|
|
249 |
if (aButtonAct == ERemConCoreApiButtonPress)
|
|
250 |
{
|
|
251 |
TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdSeekForward));
|
|
252 |
}
|
|
253 |
else if (aButtonAct == ERemConCoreApiButtonRelease)
|
|
254 |
{
|
|
255 |
TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdEndSeek));
|
|
256 |
}
|
|
257 |
}
|
|
258 |
|
|
259 |
|
|
260 |
// -------------------------------------------------------------------------------------------------
|
|
261 |
// CMPXVideoPlaybackUserInputHandler::HandleRewind()
|
|
262 |
// -------------------------------------------------------------------------------------------------
|
|
263 |
//
|
|
264 |
void CMPXVideoPlaybackUserInputHandler::HandleRewind(TRemConCoreApiButtonAction aButtonAct)
|
|
265 |
{
|
|
266 |
if (aButtonAct == ERemConCoreApiButtonPress)
|
|
267 |
{
|
|
268 |
TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdSeekBackward));
|
|
269 |
}
|
|
270 |
else if (aButtonAct == ERemConCoreApiButtonRelease)
|
|
271 |
{
|
|
272 |
TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdEndSeek));
|
|
273 |
}
|
|
274 |
}
|
|
275 |
|
|
276 |
// -------------------------------------------------------------------------------------------------
|
|
277 |
// CMPXVideoPlaybackUserInputHandler::HandleVolumeUp()
|
|
278 |
// -------------------------------------------------------------------------------------------------
|
|
279 |
//
|
|
280 |
void CMPXVideoPlaybackUserInputHandler::HandleVolumeUp(TRemConCoreApiButtonAction aButtonAct)
|
|
281 |
{
|
|
282 |
switch ( aButtonAct )
|
|
283 |
{
|
|
284 |
case ERemConCoreApiButtonPress:
|
|
285 |
{
|
|
286 |
// Volume Up - Pressed
|
|
287 |
if ( iVolumeRepeatTimer->IsActive() )
|
|
288 |
{
|
|
289 |
iVolumeRepeatTimer->Cancel();
|
|
290 |
}
|
|
291 |
|
|
292 |
iVolumeRepeatUp = ETrue;
|
|
293 |
iVolumeRepeatTimer->Start(
|
|
294 |
KAknStandardKeyboardRepeatRate,
|
|
295 |
KAknStandardKeyboardRepeatRate,
|
|
296 |
TCallBack(
|
|
297 |
CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL,
|
|
298 |
this ) );
|
|
299 |
|
|
300 |
break;
|
|
301 |
}
|
|
302 |
case ERemConCoreApiButtonRelease:
|
|
303 |
{
|
|
304 |
// Volume Up - Released
|
|
305 |
iVolumeRepeatTimer->Cancel();
|
|
306 |
break;
|
|
307 |
}
|
|
308 |
case ERemConCoreApiButtonClick:
|
|
309 |
{
|
|
310 |
// Volume Up - Clicked
|
|
311 |
TRAP_IGNORE( iViewWrapper->HandleCommandL( EMPXPbvCmdIncreaseVolume ) );
|
|
312 |
break;
|
|
313 |
}
|
|
314 |
}
|
|
315 |
}
|
|
316 |
|
|
317 |
|
|
318 |
// -------------------------------------------------------------------------------------------------
|
|
319 |
// CMPXVideoPlaybackUserInputHandler::HandleVolumeDown()
|
|
320 |
// -------------------------------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
void CMPXVideoPlaybackUserInputHandler::HandleVolumeDown(TRemConCoreApiButtonAction aButtonAct)
|
|
323 |
{
|
|
324 |
switch ( aButtonAct )
|
|
325 |
{
|
|
326 |
case ERemConCoreApiButtonPress:
|
|
327 |
{
|
|
328 |
// Volume Up - Pressed
|
|
329 |
if ( iVolumeRepeatTimer->IsActive() )
|
|
330 |
{
|
|
331 |
iVolumeRepeatTimer->Cancel();
|
|
332 |
}
|
|
333 |
|
|
334 |
iVolumeRepeatUp = EFalse;
|
|
335 |
iVolumeRepeatTimer->Start(
|
|
336 |
KAknStandardKeyboardRepeatRate,
|
|
337 |
KAknStandardKeyboardRepeatRate,
|
|
338 |
TCallBack(
|
|
339 |
CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL,
|
|
340 |
this ) );
|
|
341 |
|
|
342 |
break;
|
|
343 |
}
|
|
344 |
case ERemConCoreApiButtonRelease:
|
|
345 |
{
|
|
346 |
// Volume Up - Released
|
|
347 |
iVolumeRepeatTimer->Cancel();
|
|
348 |
break;
|
|
349 |
}
|
|
350 |
case ERemConCoreApiButtonClick:
|
|
351 |
{
|
|
352 |
// Volume Down - Clicked
|
|
353 |
TRAP_IGNORE( iViewWrapper->HandleCommandL( EMPXPbvCmdDecreaseVolume ) );
|
|
354 |
break;
|
|
355 |
}
|
|
356 |
}
|
|
357 |
}
|
|
358 |
|
|
359 |
// -------------------------------------------------------------------------------------------------
|
|
360 |
// CMPXVideoPlaybackUserInputHandler::ProcessKeyEvent()
|
|
361 |
// -------------------------------------------------------------------------------------------------
|
|
362 |
//
|
|
363 |
void CMPXVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& /*aKeyEvent*/,
|
|
364 |
TEventCode /*aType*/ )
|
|
365 |
{
|
|
366 |
MPX_DEBUG(_L("MPXVideoPlaybackUserInputHandler::ProcessKeyEvent"));
|
|
367 |
|
|
368 |
/*
|
|
369 |
switch (iProcessingInputType)
|
|
370 |
{
|
|
371 |
case EMpxVideoNone:
|
|
372 |
{
|
|
373 |
if (aType == EEventKeyDown && iForeground)
|
|
374 |
{
|
|
375 |
iProcessingInputType = EMpxVideoKeyboard;
|
|
376 |
iLastPressedKeyCode = aKeyEvent.iCode;
|
|
377 |
iLastPressedKeyScanCode = aKeyEvent.iScanCode;
|
|
378 |
if ( iTVOutConnected )
|
|
379 |
{
|
|
380 |
RestartDisplayTimer();
|
|
381 |
}
|
|
382 |
iViewWrapper->DoHandleKeyEventL( aKeyEvent, aType );
|
|
383 |
}
|
|
384 |
break;
|
|
385 |
}
|
|
386 |
case EMpxVideoKeyboard:
|
|
387 |
{
|
|
388 |
if (aType == EEventKeyUp)
|
|
389 |
{
|
|
390 |
// only handle up event for the key being handled
|
|
391 |
// ignore spurious key presses
|
|
392 |
if (aKeyEvent.iCode == iLastPressedKeyCode &&
|
|
393 |
aKeyEvent.iScanCode == iLastPressedKeyScanCode)
|
|
394 |
{
|
|
395 |
iViewWrapper->DoHandleKeyEventL( aKeyEvent, aType );
|
|
396 |
|
|
397 |
// reset the value only on key up event
|
|
398 |
iProcessingInputType = EMpxVideoNone;
|
|
399 |
}
|
|
400 |
}
|
|
401 |
break;
|
|
402 |
}
|
|
403 |
default:
|
|
404 |
{
|
|
405 |
// user input is disallowed
|
|
406 |
break;
|
|
407 |
}
|
|
408 |
} // switch*/
|
|
409 |
}
|
|
410 |
|
|
411 |
// -------------------------------------------------------------------------------------------------
|
|
412 |
// CMPXVideoPlaybackUserInputHandler::ProcessMediaKey()
|
|
413 |
// -------------------------------------------------------------------------------------------------
|
|
414 |
//
|
|
415 |
void CMPXVideoPlaybackUserInputHandler::ProcessMediaKey(TRemConCoreApiOperationId aOperationId,
|
|
416 |
TRemConCoreApiButtonAction aButtonAct)
|
|
417 |
{
|
|
418 |
MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ProcessMediaKey"));
|
|
419 |
|
|
420 |
switch (iProcessingInputType)
|
|
421 |
{
|
|
422 |
case EMpxVideoNone:
|
|
423 |
{
|
|
424 |
if (aButtonAct == ERemConCoreApiButtonPress && iForeground)
|
|
425 |
{
|
|
426 |
iProcessingInputType = EMpxVideoMediaKeys;
|
|
427 |
iLastMediaKeyPressed = aOperationId;
|
|
428 |
DoHandleMediaKey(aOperationId, aButtonAct);
|
|
429 |
if ( iTVOutConnected )
|
|
430 |
{
|
|
431 |
RestartDisplayTimer();
|
|
432 |
}
|
|
433 |
}
|
|
434 |
else if (aButtonAct == ERemConCoreApiButtonClick && iForeground)
|
|
435 |
{
|
|
436 |
DoHandleMediaKey(aOperationId, aButtonAct);
|
|
437 |
if ( iTVOutConnected )
|
|
438 |
{
|
|
439 |
RestartDisplayTimer();
|
|
440 |
}
|
|
441 |
// reset on click AND/OR release
|
|
442 |
iProcessingInputType = EMpxVideoNone;
|
|
443 |
}
|
|
444 |
break;
|
|
445 |
}
|
|
446 |
case EMpxVideoMediaKeys:
|
|
447 |
{
|
|
448 |
if (aButtonAct == ERemConCoreApiButtonRelease)
|
|
449 |
{
|
|
450 |
// handle only if this release is for media-key being currently handled
|
|
451 |
// ignore spurious media key presses
|
|
452 |
if (iLastMediaKeyPressed == aOperationId)
|
|
453 |
{
|
|
454 |
DoHandleMediaKey(aOperationId, aButtonAct);
|
|
455 |
// reset on click AND/OR release
|
|
456 |
iProcessingInputType = EMpxVideoNone;
|
|
457 |
}
|
|
458 |
}
|
|
459 |
break;
|
|
460 |
}
|
|
461 |
default:
|
|
462 |
{
|
|
463 |
// user input is disallowed
|
|
464 |
break;
|
|
465 |
}
|
|
466 |
} // switch
|
|
467 |
}
|
|
468 |
|
|
469 |
|
|
470 |
// -------------------------------------------------------------------------------------------------
|
|
471 |
// CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()
|
|
472 |
// -------------------------------------------------------------------------------------------------
|
|
473 |
//
|
|
474 |
TInt CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL( TAny* aPtr )
|
|
475 |
{
|
|
476 |
MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()"));
|
|
477 |
|
|
478 |
static_cast<CMPXVideoPlaybackUserInputHandler*>(aPtr)->HandleVolumeRepeatL();
|
|
479 |
|
|
480 |
return KErrNone;
|
|
481 |
}
|
|
482 |
|
|
483 |
// -------------------------------------------------------------------------------------------------
|
|
484 |
// CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
|
|
485 |
// -------------------------------------------------------------------------------------------------
|
|
486 |
//
|
|
487 |
void CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
|
|
488 |
{
|
|
489 |
MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()"));
|
|
490 |
|
|
491 |
TMPXVideoPlaybackViewCommandIds command = EMPXPbvCmdDecreaseVolume;
|
|
492 |
|
|
493 |
if ( iVolumeRepeatUp )
|
|
494 |
{
|
|
495 |
command = EMPXPbvCmdIncreaseVolume;
|
|
496 |
}
|
|
497 |
|
|
498 |
iViewWrapper->HandleCommandL( command );
|
|
499 |
}
|
|
500 |
|
|
501 |
|
|
502 |
// -------------------------------------------------------------------------------------------------
|
|
503 |
// CMPXVideoPlaybackUserInputHandler::SetForeground()
|
|
504 |
// -------------------------------------------------------------------------------------------------
|
|
505 |
//
|
|
506 |
void CMPXVideoPlaybackUserInputHandler::SetForeground(TBool aForeground)
|
|
507 |
{
|
|
508 |
iForeground = aForeground;
|
|
509 |
|
|
510 |
if ( !iForeground )
|
|
511 |
{
|
|
512 |
// we are in background so reset iProcessingInputType value
|
|
513 |
iProcessingInputType = EMpxVideoNone;
|
|
514 |
}
|
|
515 |
}
|
|
516 |
|
|
517 |
// -------------------------------------------------------------------------------------------------
|
|
518 |
// CMPXVideoPlaybackUserInputHandler::DisableBacklight()
|
|
519 |
// -------------------------------------------------------------------------------------------------
|
|
520 |
//
|
|
521 |
void CMPXVideoPlaybackUserInputHandler::DisableBacklight()
|
|
522 |
{
|
|
523 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::DisableBacklight"));
|
|
524 |
|
|
525 |
// cancel the timer
|
|
526 |
iDisplayTimer->Cancel();
|
|
527 |
|
|
528 |
// disable the backlight
|
|
529 |
HAL::Set( HALData::EBacklightState, 0 );
|
|
530 |
}
|
|
531 |
|
|
532 |
// -------------------------------------------------------------------------------------------------
|
|
533 |
// CMPXVideoPlaybackUserInputHandler::EnableBacklight()
|
|
534 |
// -------------------------------------------------------------------------------------------------
|
|
535 |
//
|
|
536 |
void CMPXVideoPlaybackUserInputHandler::EnableBacklight()
|
|
537 |
{
|
|
538 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::EnableBacklight"));
|
|
539 |
|
|
540 |
// enable the backlight
|
|
541 |
HAL::Set( HALData::EBacklightState, 1 );
|
|
542 |
}
|
|
543 |
|
|
544 |
|
|
545 |
// -------------------------------------------------------------------------------------------------
|
|
546 |
// CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent()
|
|
547 |
// -------------------------------------------------------------------------------------------------
|
|
548 |
//
|
|
549 |
void CMPXVideoPlaybackUserInputHandler::HandleTVOutEventL(TBool aTVOutConnected)
|
|
550 |
{
|
|
551 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent"));
|
|
552 |
|
|
553 |
iTVOutConnected = aTVOutConnected;
|
|
554 |
|
|
555 |
if ( iTVOutConnected )
|
|
556 |
{
|
|
557 |
// Get the display light time-out value from CenRep
|
|
558 |
CRepository* repository = CRepository::NewLC( KCRUidLightSettings );
|
|
559 |
|
|
560 |
// What's the timeout value (in seconds ) for the display light?
|
|
561 |
repository->Get( KDisplayLightsTimeout, iDisplayTimeOut );
|
|
562 |
MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ConstructL Display Timeout( %d )"), iDisplayTimeOut);
|
|
563 |
|
|
564 |
CleanupStack::PopAndDestroy( repository );
|
|
565 |
|
|
566 |
// Convert the timeout value to microseconds
|
|
567 |
iDisplayTimeOut *= KMPXMicroSecondsInASecond;
|
|
568 |
|
|
569 |
RestartDisplayTimer();
|
|
570 |
}
|
|
571 |
else
|
|
572 |
{
|
|
573 |
iDisplayTimer->Cancel();
|
|
574 |
EnableBacklight();
|
|
575 |
}
|
|
576 |
}
|
|
577 |
|
|
578 |
// -------------------------------------------------------------------------------------------------
|
|
579 |
// CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout
|
|
580 |
// -------------------------------------------------------------------------------------------------
|
|
581 |
//
|
|
582 |
TInt CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout( TAny* aPtr )
|
|
583 |
{
|
|
584 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout"));
|
|
585 |
|
|
586 |
static_cast<CMPXVideoPlaybackUserInputHandler*>(aPtr)->DisableBacklight();
|
|
587 |
|
|
588 |
return KErrNone;
|
|
589 |
}
|
|
590 |
|
|
591 |
// -----------------------------------------------------------------------------
|
|
592 |
// CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer
|
|
593 |
// -----------------------------------------------------------------------------
|
|
594 |
//
|
|
595 |
void CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer()
|
|
596 |
{
|
|
597 |
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer"));
|
|
598 |
|
|
599 |
// check if the display timer is running if so cancelit
|
|
600 |
if ( iDisplayTimer->IsActive() )
|
|
601 |
{
|
|
602 |
iDisplayTimer->Cancel();
|
|
603 |
}
|
|
604 |
else
|
|
605 |
{
|
|
606 |
// timeout has happened and the backlight is disabled
|
|
607 |
// enable the backlight
|
|
608 |
HAL::Set( HALData::EBacklightState, 1 );
|
|
609 |
}
|
|
610 |
|
|
611 |
TBool backlightState;
|
|
612 |
TInt ret = HAL::Get( HALData::EBacklightState, backlightState );
|
|
613 |
|
|
614 |
// Re start the display backlight timer
|
|
615 |
iDisplayTimer->Start( iDisplayTimeOut, iDisplayTimeOut,
|
|
616 |
TCallBack( CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout, this ) );
|
|
617 |
}
|
|
618 |
|
|
619 |
// EOF
|