46 #include <mpxvideoplaybackdefs.h> |
46 #include <mpxvideoplaybackdefs.h> |
47 #include "mpxvideo_debug.h" |
47 #include "mpxvideo_debug.h" |
48 |
48 |
49 using namespace AknLayoutScalable_Apps; |
49 using namespace AknLayoutScalable_Apps; |
50 |
50 |
51 // CONSTANTS |
51 // |
|
52 // CONSTANTS |
|
53 // |
|
54 const TInt KMPXRealOneLogoTimeOut = 600000; |
52 |
55 |
53 // ======== MEMBER FUNCTIONS ======================================================================= |
56 // ======== MEMBER FUNCTIONS ======================================================================= |
54 |
57 |
55 // ------------------------------------------------------------------------------------------------- |
58 // ------------------------------------------------------------------------------------------------- |
56 // CMPXVideoPlaybackContainer::CMPXVideoPlaybackContainer() |
59 // CMPXVideoPlaybackContainer::CMPXVideoPlaybackContainer() |
94 SetRect( screenRect ); |
97 SetRect( screenRect ); |
95 |
98 |
96 CreateControlsL(); |
99 CreateControlsL(); |
97 |
100 |
98 iUserInputHandler = |
101 iUserInputHandler = |
99 CMPXVideoPlaybackUserInputHandler::NewL( this, iFileDetails->iTvOutConnected ); |
102 CMPXVideoPlaybackUserInputHandler::NewL( this ); |
100 |
103 |
101 ActivateL(); |
104 ActivateL(); |
102 } |
105 } |
103 |
106 |
104 // ------------------------------------------------------------------------------------------------- |
107 // ------------------------------------------------------------------------------------------------- |
105 // CMPXVideoPlaybackContainer::~CMPXVideoPlaybackContainer() |
108 // CMPXVideoPlaybackContainer::~CMPXVideoPlaybackContainer() |
106 // ------------------------------------------------------------------------------------------------- |
109 // ------------------------------------------------------------------------------------------------- |
107 // |
110 // |
108 CMPXVideoPlaybackContainer::~CMPXVideoPlaybackContainer() |
111 CMPXVideoPlaybackContainer::~CMPXVideoPlaybackContainer() |
109 { |
112 { |
|
113 if ( iRealOneBitmapTimer ) |
|
114 { |
|
115 iRealOneBitmapTimer->Cancel(); |
|
116 delete iRealOneBitmapTimer; |
|
117 iRealOneBitmapTimer = NULL; |
|
118 } |
|
119 |
110 if ( iFileDetails ) |
120 if ( iFileDetails ) |
111 { |
121 { |
112 delete iFileDetails; |
122 delete iFileDetails; |
113 iFileDetails = NULL; |
123 iFileDetails = NULL; |
114 } |
124 } |
132 // CMPXVideoPlaybackContainer::AddFileDetailsL() |
142 // CMPXVideoPlaybackContainer::AddFileDetailsL() |
133 // ------------------------------------------------------------------------------------------------- |
143 // ------------------------------------------------------------------------------------------------- |
134 // |
144 // |
135 void CMPXVideoPlaybackContainer::AddFileDetailsL( CMPXVideoPlaybackViewFileDetails* aDetails ) |
145 void CMPXVideoPlaybackContainer::AddFileDetailsL( CMPXVideoPlaybackViewFileDetails* aDetails ) |
136 { |
146 { |
137 iControlsController->AddFileDetailsL( aDetails ); |
147 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackContainer::AddFileDetailsL()")); |
138 |
148 |
139 // |
149 // |
140 // Delete the temp file details since plugin initialization is complete |
150 // If clip is audio only Real Media, delay adding the file details until the |
141 // |
151 // Real One bitmap has been shown. |
142 if ( iFileDetails ) |
152 // |
143 { |
153 if ( iRealOneBitmapTimer && iRealOneBitmapTimer->IsActive() && ! aDetails->iVideoEnabled ) |
144 delete iFileDetails; |
154 { |
145 iFileDetails = NULL; |
155 MPX_DEBUG(_L("CMPXVideoPlaybackContainer::AddFileDetailsL() file details delayed")); |
|
156 |
|
157 iDelayedFileDetails = aDetails; |
|
158 } |
|
159 else |
|
160 { |
|
161 iControlsController->AddFileDetailsL( aDetails ); |
|
162 |
|
163 // |
|
164 // Delete the temp file details since plugin initialization is complete |
|
165 // |
|
166 if ( iFileDetails ) |
|
167 { |
|
168 delete iFileDetails; |
|
169 iFileDetails = NULL; |
|
170 } |
146 } |
171 } |
147 } |
172 } |
148 |
173 |
149 // ------------------------------------------------------------------------------------------------- |
174 // ------------------------------------------------------------------------------------------------- |
150 // CMPXVideoPlaybackContainer::GetWindow() |
175 // CMPXVideoPlaybackContainer::GetWindow() |
241 |
266 |
242 // ------------------------------------------------------------------------------------------------- |
267 // ------------------------------------------------------------------------------------------------- |
243 // Handles rocker's middle key => Toggles between play & pause |
268 // Handles rocker's middle key => Toggles between play & pause |
244 // ------------------------------------------------------------------------------------------------- |
269 // ------------------------------------------------------------------------------------------------- |
245 // |
270 // |
246 void CMPXVideoPlaybackContainer::HandleRockerMiddleKeyL(const TKeyEvent& aKeyEvent, |
271 void CMPXVideoPlaybackContainer::HandleRockerMiddleKeyL( const TKeyEvent& aKeyEvent, |
247 TEventCode aType) |
272 TEventCode aType ) |
248 { |
273 { |
249 if ( aKeyEvent.iCode == EKeyNull && aType == EEventKeyDown ) |
274 if ( aKeyEvent.iCode == EKeyNull && aType == EEventKeyDown ) |
250 { |
275 { |
251 iView->HandleCommandL(EMPXPbvCmdPlayPause); |
276 iView->HandleCommandL(EMPXPbvCmdPlayPause); |
252 } |
277 } |
254 |
279 |
255 // ------------------------------------------------------------------------------------------------- |
280 // ------------------------------------------------------------------------------------------------- |
256 // Starts/Stops Seeking Forward |
281 // Starts/Stops Seeking Forward |
257 // ------------------------------------------------------------------------------------------------- |
282 // ------------------------------------------------------------------------------------------------- |
258 // |
283 // |
259 void CMPXVideoPlaybackContainer::HandleSeekFwdL(TEventCode aType) |
284 void CMPXVideoPlaybackContainer::HandleSeekFwdL( TEventCode aType ) |
260 { |
285 { |
261 if (aType == EEventKeyDown) |
286 if ( aType == EEventKeyDown ) |
262 { |
287 { |
263 iView->HandleCommandL(EMPXPbvCmdSeekForward); |
288 iView->HandleCommandL( EMPXPbvCmdSeekForward ); |
264 } |
289 } |
265 else if (aType == EEventKeyUp) |
290 else if ( aType == EEventKeyUp ) |
266 { |
291 { |
267 iView->HandleCommandL(EMPXPbvCmdEndSeek); |
292 iView->HandleCommandL( EMPXPbvCmdEndSeek ); |
268 } |
293 } |
269 } |
294 } |
270 |
295 |
271 // ------------------------------------------------------------------------------------------------- |
296 // ------------------------------------------------------------------------------------------------- |
272 // Starts/Stops Seeking Backward |
297 // Starts/Stops Seeking Backward |
273 // ------------------------------------------------------------------------------------------------- |
298 // ------------------------------------------------------------------------------------------------- |
274 // |
299 // |
275 void CMPXVideoPlaybackContainer::HandleSeekBackL(TEventCode aType) |
300 void CMPXVideoPlaybackContainer::HandleSeekBackL( TEventCode aType ) |
276 { |
301 { |
277 if (aType == EEventKeyDown) |
302 if ( aType == EEventKeyDown ) |
278 { |
303 { |
279 iView->HandleCommandL(EMPXPbvCmdSeekBackward); |
304 iView->HandleCommandL(EMPXPbvCmdSeekBackward); |
280 } |
305 } |
281 else if (aType == EEventKeyUp) |
306 else if ( aType == EEventKeyUp ) |
282 { |
307 { |
283 iView->HandleCommandL(EMPXPbvCmdEndSeek); |
308 iView->HandleCommandL( EMPXPbvCmdEndSeek ); |
284 } |
309 } |
285 } |
310 } |
286 |
311 |
287 // ------------------------------------------------------------------------------------------------- |
312 // ------------------------------------------------------------------------------------------------- |
288 // From CCoeControl |
313 // From CCoeControl |
299 // Gets the control's help context. |
324 // Gets the control's help context. |
300 // ------------------------------------------------------------------------------------------------- |
325 // ------------------------------------------------------------------------------------------------- |
301 // |
326 // |
302 void CMPXVideoPlaybackContainer::GetHelpContext( TCoeHelpContext& /*aContext*/ ) const |
327 void CMPXVideoPlaybackContainer::GetHelpContext( TCoeHelpContext& /*aContext*/ ) const |
303 { |
328 { |
304 //aContext.iMajor = KAppUidMusicPlayerX; |
|
305 } |
329 } |
306 |
330 |
307 // ------------------------------------------------------------------------------------------------- |
331 // ------------------------------------------------------------------------------------------------- |
308 // From CCoeControl |
332 // From CCoeControl |
309 // Gets the number of controls contained in a compound control. |
333 // Gets the number of controls contained in a compound control. |
310 // ------------------------------------------------------------------------------------------------- |
334 // ------------------------------------------------------------------------------------------------- |
311 // |
335 // |
312 TInt CMPXVideoPlaybackContainer::CountComponentControls() const |
336 TInt CMPXVideoPlaybackContainer::CountComponentControls() const |
313 { |
337 { |
314 TInt count = 0; |
338 TInt count = 0; |
315 |
339 |
316 if ( iRealOneBitmap ) |
340 if ( iRealOneBitmap ) |
317 { |
341 { |
318 count = 1; |
342 count = 1; |
319 } |
343 } |
320 |
344 |
321 return count; |
345 return count; |
322 } |
346 } |
323 |
347 |
324 // ------------------------------------------------------------------------------------------------- |
348 // ------------------------------------------------------------------------------------------------- |
325 // From CCoeControl |
349 // From CCoeControl |
326 // Gets an indexed component of a compound control. |
350 // Gets an indexed component of a compound control. |
348 // |
372 // |
349 void CMPXVideoPlaybackContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
373 void CMPXVideoPlaybackContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
350 { |
374 { |
351 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackContainer::HandlePointerEventL()")); |
375 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackContainer::HandlePointerEventL()")); |
352 |
376 |
353 iUserInputHandler->ProcessPointerEventL(this, aPointerEvent, EMpxVideoPlaybackContainer); |
377 iUserInputHandler->ProcessPointerEventL( this, aPointerEvent, EMpxVideoPlaybackContainer ); |
354 } |
378 } |
355 |
379 |
356 |
380 |
357 // ------------------------------------------------------------------------------------------------- |
381 // ------------------------------------------------------------------------------------------------- |
358 // CMPXVideoPlaybackContainer::DoHandlePointerEventL() |
382 // CMPXVideoPlaybackContainer::DoHandlePointerEventL() |
378 void CMPXVideoPlaybackContainer::Draw( const TRect& aRect ) const |
402 void CMPXVideoPlaybackContainer::Draw( const TRect& aRect ) const |
379 { |
403 { |
380 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackContainer::Draw()")); |
404 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackContainer::Draw()")); |
381 |
405 |
382 CWindowGc& gc = SystemGc(); |
406 CWindowGc& gc = SystemGc(); |
383 |
407 |
384 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
408 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
385 |
409 |
386 // |
410 // |
387 // Make the window transparent when a surface has been created |
411 // Make the window transparent when a surface has been created |
388 // unless TV-Out is connected |
412 // unless TV-Out is connected |
429 { |
453 { |
430 iUserInputHandler->SetForeground(ETrue); |
454 iUserInputHandler->SetForeground(ETrue); |
431 } |
455 } |
432 else if ( aEvent == EMPXControlCmdTvOutConnected ) |
456 else if ( aEvent == EMPXControlCmdTvOutConnected ) |
433 { |
457 { |
434 iTvOutConnected = ETrue; |
458 iTvOutConnected = ETrue; |
435 iUserInputHandler->HandleTVOutEvent(ETrue); |
|
436 DrawNow(); |
459 DrawNow(); |
437 } |
460 } |
438 else if ( aEvent == EMPXControlCmdTvOutDisconnected ) |
461 else if ( aEvent == EMPXControlCmdTvOutDisconnected ) |
439 { |
462 { |
440 iTvOutConnected = EFalse; |
463 iTvOutConnected = EFalse; |
441 iUserInputHandler->HandleTVOutEvent(EFalse); |
|
442 DrawNow(); |
464 DrawNow(); |
443 } |
465 } |
444 |
466 |
445 iControlsController->HandleEventL( aEvent, aValue ); |
467 iControlsController->HandleEventL( aEvent, aValue ); |
446 } |
468 } |
487 iView->SetPropertyL( EPbPropertyVolume, aValue ); |
507 iView->SetPropertyL( EPbPropertyVolume, aValue ); |
488 break; |
508 break; |
489 } |
509 } |
490 case EMPXPbvSurfaceCreated: |
510 case EMPXPbvSurfaceCreated: |
491 { |
511 { |
492 iSurfaceCreated = ETrue; |
512 iSurfaceCreated = ETrue; |
493 iControlsController->HandleEventL( EMPXControlCmdSurfaceCreated ); |
513 iControlsController->HandleEventL( EMPXControlCmdSurfaceCreated ); |
494 DrawNow(); |
514 DrawNow(); |
|
515 break; |
|
516 } |
|
517 case EMPXPbvSurfaceRemoved: |
|
518 { |
|
519 iSurfaceCreated = EFalse; |
|
520 iControlsController->HandleEventL( EMPXControlCmdSurfaceRemoved ); |
|
521 DrawNow(); |
495 break; |
522 break; |
496 } |
523 } |
497 default: |
524 default: |
498 { |
525 { |
499 iView->HandleCommandL( aCommand ); |
526 iView->HandleCommandL( aCommand ); |
554 |
581 |
555 // |
582 // |
556 // Retrieve the Real One Logo bitmap |
583 // Retrieve the Real One Logo bitmap |
557 // |
584 // |
558 iRealOneBitmap = iControlsController->GetBitmap( EMPXRealLogoBitmap ); |
585 iRealOneBitmap = iControlsController->GetBitmap( EMPXRealLogoBitmap ); |
|
586 |
|
587 if ( iRealOneBitmap ) |
|
588 { |
|
589 // |
|
590 // Start timer since Real One bitmap is created |
|
591 // |
|
592 iRealOneBitmapTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
593 |
|
594 iRealOneBitmapTimer->Start( |
|
595 KMPXRealOneLogoTimeOut, |
|
596 0, |
|
597 TCallBack( CMPXVideoPlaybackContainer::HandleRealOneBitmapTimeout, this ) ); |
|
598 |
|
599 DrawNow(); |
|
600 } |
|
601 |
559 iTvOutConnected = iFileDetails->iTvOutConnected; |
602 iTvOutConnected = iFileDetails->iTvOutConnected; |
560 } |
603 } |
561 |
604 |
562 // ------------------------------------------------------------------------------------------------- |
605 // ------------------------------------------------------------------------------------------------- |
563 // CMPXVideoPlaybackContainer::UserInputHandler() |
606 // CMPXVideoPlaybackContainer::UserInputHandler() |
564 // ------------------------------------------------------------------------------------------------- |
607 // ------------------------------------------------------------------------------------------------- |
565 // |
608 // |
566 EXPORT_C CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackContainer::UserInputHandler() |
609 EXPORT_C CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackContainer::UserInputHandler() |
567 { |
610 { |
568 MPX_DEBUG(_L("CMPXVideoPlaybackContainer::UserInputHandler()")); |
611 MPX_DEBUG(_L("CMPXVideoPlaybackContainer::UserInputHandler()")); |
569 |
|
570 return iUserInputHandler; |
612 return iUserInputHandler; |
571 } |
613 } |
572 |
614 |
|
615 // ------------------------------------------------------------------------------------------------- |
|
616 // CMPXVideoPlaybackContainer::IsRealOneBitmapTimerActive() |
|
617 // ------------------------------------------------------------------------------------------------- |
|
618 // |
|
619 TBool CMPXVideoPlaybackContainer::IsRealOneBitmapTimerActive() |
|
620 { |
|
621 TBool timerActive( EFalse ); |
|
622 |
|
623 if ( iRealOneBitmapTimer ) |
|
624 { |
|
625 timerActive = iRealOneBitmapTimer->IsActive(); |
|
626 } |
|
627 |
|
628 MPX_DEBUG(_L("CMPXVideoPlaybackContainer::IsRealOneBitmapTimerActive(%d)"), timerActive); |
|
629 |
|
630 return timerActive; |
|
631 } |
|
632 |
|
633 |
|
634 // ------------------------------------------------------------------------------------------------- |
|
635 // CMPXVideoPlaybackContainer::HandleRealOneBitmapTimeout |
|
636 // ------------------------------------------------------------------------------------------------- |
|
637 // |
|
638 TInt CMPXVideoPlaybackContainer::HandleRealOneBitmapTimeout( TAny* aPtr ) |
|
639 { |
|
640 MPX_DEBUG(_L("CMPXVideoPlaybackContainer::HandleRealOneBitmapTimeout()")); |
|
641 static_cast<CMPXVideoPlaybackContainer*>(aPtr)->DoHandleRealOneBitmapTimeout(); |
|
642 return KErrNone; |
|
643 } |
|
644 |
|
645 // ------------------------------------------------------------------------------------------------- |
|
646 // CMPXVideoPlaybackContainer::DoHandleRealOneBitmapTimeout |
|
647 // ------------------------------------------------------------------------------------------------- |
|
648 // |
|
649 void CMPXVideoPlaybackContainer::DoHandleRealOneBitmapTimeout() |
|
650 { |
|
651 MPX_DEBUG(_L("CMPXVideoPlaybackContainer::DoHandleRealOneBitmapTimeout()")); |
|
652 |
|
653 if ( iDelayedFileDetails ) |
|
654 { |
|
655 iControlsController->AddFileDetailsL( iDelayedFileDetails ); |
|
656 |
|
657 // |
|
658 // Delete the temp file details since plugin initialization is complete |
|
659 // |
|
660 if ( iFileDetails ) |
|
661 { |
|
662 delete iFileDetails; |
|
663 iFileDetails = NULL; |
|
664 } |
|
665 |
|
666 iDelayedFileDetails = NULL; |
|
667 } |
|
668 |
|
669 if ( iRealOneBitmapTimer->IsActive() ) |
|
670 { |
|
671 iRealOneBitmapTimer->Cancel(); |
|
672 delete iRealOneBitmapTimer; |
|
673 iRealOneBitmapTimer = NULL; |
|
674 } |
|
675 |
|
676 iView->HandleCommandL( EMPXPbvCmdRealOneBitmapTimeout ); |
|
677 } |
|
678 |
573 // EOF |
679 // EOF |