72 |
72 |
73 // Close the video plugin, and delete it |
73 // Close the video plugin, and delete it |
74 if ( iVideoPlayer ) |
74 if ( iVideoPlayer ) |
75 { |
75 { |
76 iVideoPlayer->Close(); |
76 iVideoPlayer->Close(); |
|
77 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
78 iVideoPlayer->RemoveDisplayWindow(iBavpView->WindowInst()); |
|
79 #endif |
77 delete iVideoPlayer; |
80 delete iVideoPlayer; |
78 } |
81 } |
79 |
82 |
80 // CIdle AO used for display update |
83 // CIdle AO used for display update |
81 if ( iDisplayUpdater ) |
84 if ( iDisplayUpdater ) |
99 // CBavpControllerVideo::CBavpControllerVideo |
102 // CBavpControllerVideo::CBavpControllerVideo |
100 // C++ default constructor can NOT contain any code, that |
103 // C++ default constructor can NOT contain any code, that |
101 // might leave. |
104 // might leave. |
102 // ----------------------------------------------------------------------------- |
105 // ----------------------------------------------------------------------------- |
103 CBavpControllerVideo::CBavpControllerVideo( MBavpView* aView, TUint aAccessPtId ) |
106 CBavpControllerVideo::CBavpControllerVideo( MBavpView* aView, TUint aAccessPtId ) |
104 : CBavpController( aView, aAccessPtId ) |
107 : CBavpController( aView, aAccessPtId ), iActiveWindow(NULL) |
105 { |
108 { |
106 } |
109 } |
107 |
110 |
108 // ----------------------------------------------------------------------------- |
111 // ----------------------------------------------------------------------------- |
109 // CBavpControllerVideo::ConstructL |
112 // CBavpControllerVideo::ConstructL |
185 |
188 |
186 if ( IsClipSeekable() ) |
189 if ( IsClipSeekable() ) |
187 { |
190 { |
188 iVideoPlayer->SetPositionL( iClipInfo->iPosition ); |
191 iVideoPlayer->SetPositionL( iClipInfo->iPosition ); |
189 } |
192 } |
|
193 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
194 TRect rect( iBavpView->CoeControl().Rect() ); |
|
195 CEikonEnv* eikon = CEikonEnv::Static(); |
|
196 RWsSession& ws = eikon->WsSession(); |
|
197 CWsScreenDevice* screenDevice = eikon->ScreenDevice(); |
|
198 // Clip rect manipulation. |
|
199 // Calculate the rect for display, including title and status pane |
|
200 TRect clipRect = GetClipRect( rect ); |
|
201 TRAPD(errAdd, iVideoPlayer->AddDisplayWindowL(CCoeEnv::Static()->WsSession(), |
|
202 *screenDevice, |
|
203 iBavpView->WindowInst(), |
|
204 rect, |
|
205 clipRect)); |
|
206 TRAPD(errScale, iVideoPlayer->SetAutoScaleL(iBavpView->WindowInst(), EAutoScaleBestFit)); |
|
207 if( ( errAdd != KErrNone ) && (iActiveWindow != &iBavpView->WindowInst()) ) |
|
208 { |
|
209 iActiveWindow = &iBavpView->WindowInst(); |
|
210 } |
|
211 Log( EFalse, _L("CBavpControllerVideo::InitVideoPlayerL() AddDisplayWindowL %d"), errAdd ); |
|
212 Log( EFalse, _L("CBavpControllerVideo::InitVideoPlayerL() SetAutoScaleL %d"), errScale ); |
|
213 #endif |
190 } |
214 } |
191 |
215 |
192 // ----------------------------------------------------------------------------- |
216 // ----------------------------------------------------------------------------- |
193 // CBavpControllerVideo::InitVideoPlayer |
217 // CBavpControllerVideo::InitVideoPlayer |
194 // The non-leaving version that calls the leaving version. Closes the current |
218 // The non-leaving version that calls the leaving version. Closes the current |
229 TRect clipRect = GetClipRect( rect ); |
256 TRect clipRect = GetClipRect( rect ); |
230 |
257 |
231 Log( EFalse, _L("InitVideoPlayerL() - calling CVideoPlayerUtility::NewL") ); |
258 Log( EFalse, _L("InitVideoPlayerL() - calling CVideoPlayerUtility::NewL") ); |
232 |
259 |
233 // Initialize the videoplayer |
260 // Initialize the videoplayer |
|
261 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
262 iVideoPlayer = CVideoPlayerUtility2::NewL( *this, EMdaPriorityNormal, |
|
263 EMdaPriorityPreferenceNone); |
|
264 #else |
234 iVideoPlayer = CVideoPlayerUtility::NewL( *this, EMdaPriorityNormal, |
265 iVideoPlayer = CVideoPlayerUtility::NewL( *this, EMdaPriorityNormal, |
235 EMdaPriorityPreferenceNone, |
266 EMdaPriorityPreferenceNone, |
236 ws, *screenDevice, |
267 ws, *screenDevice, |
237 iBavpView->WindowInst(), rect, |
268 iBavpView->WindowInst(), rect, |
238 clipRect); |
269 clipRect); |
|
270 #endif |
239 |
271 |
240 // Register for loading notification |
272 // Register for loading notification |
241 iVideoPlayer->RegisterForVideoLoadingNotification( *this ); |
273 iVideoPlayer->RegisterForVideoLoadingNotification( *this ); |
242 |
274 |
243 switch ( iClipInfo->iMediaType ) |
275 switch ( iClipInfo->iMediaType ) |
295 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
330 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
296 |
331 |
297 // Rotate only if screen rect height is greater than its width |
332 // Rotate only if screen rect height is greater than its width |
298 if ( screenRect.Height() > screenRect.Width() ) |
333 if ( screenRect.Height() > screenRect.Width() ) |
299 { |
334 { |
300 TRAP_IGNORE( iVideoPlayer->SetRotationL( EVideoRotationClockwise90 ) ); |
335 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
336 TRAP_IGNORE( iVideoPlayer->SetRotationL(iBavpView->WindowInst(), EVideoRotationClockwise90 ) ); |
|
337 #else |
|
338 TRAP_IGNORE( iVideoPlayer->SetRotationL( EVideoRotationClockwise90 ) ); |
|
339 #endif |
|
340 |
301 } |
341 } |
302 } |
342 } |
303 |
343 |
304 // ----------------------------------------------------------------------------- |
344 // ----------------------------------------------------------------------------- |
305 // CBavpControllerVideo::RevertToFullScreenL |
345 // CBavpControllerVideo::RevertToFullScreenL |
308 void CBavpControllerVideo::RevertToFullScreenL() |
348 void CBavpControllerVideo::RevertToFullScreenL() |
309 { |
349 { |
310 Log( EFalse, _L("CBavpControllerVideo::RevertToFullScreenL()")); |
350 Log( EFalse, _L("CBavpControllerVideo::RevertToFullScreenL()")); |
311 CBavpPluginEcomMain* npm = (CBavpPluginEcomMain*)Dll::Tls(); |
351 CBavpPluginEcomMain* npm = (CBavpPluginEcomMain*)Dll::Tls(); |
312 bool fullscreen = true; |
352 bool fullscreen = true; |
313 |
353 |
314 iVideoPlayer->StopDirectScreenAccessL(); |
354 //This method is not supported when using CVideoPlayerUtility2, and will |
|
355 //always leave with KErrNotSupported. instead of variating for new player |
|
356 //we are ignoring the Leave |
|
357 TRAP_IGNORE( iVideoPlayer->StopDirectScreenAccessL() ); |
|
358 |
|
359 |
315 iClipInfo->iInFullScreenMode = ETrue; |
360 iClipInfo->iInFullScreenMode = ETrue; |
316 |
361 |
317 npm->Funcs()->setvalue(iBavpView->bavPlugin()->getNPP(), |
362 npm->Funcs()->setvalue(iBavpView->bavPlugin()->getNPP(), |
318 NPPVpluginFullScreenBool, |
363 NPPVpluginFullScreenBool, |
319 static_cast<void*>(&fullscreen)); |
364 static_cast<void*>(&fullscreen)); |
329 TRect screenRect = eikon->EikAppUi()->ApplicationRect(); |
374 TRect screenRect = eikon->EikAppUi()->ApplicationRect(); |
330 |
375 |
331 CCoeControl* parentView = iBavpView->CoeControl().Parent(); |
376 CCoeControl* parentView = iBavpView->CoeControl().Parent(); |
332 parentView->SetRect(screenRect); |
377 parentView->SetRect(screenRect); |
333 iBavpView->CoeControl().SetExtent(TPoint(0,0), screenRect.Size()); |
378 iBavpView->CoeControl().SetExtent(TPoint(0,0), screenRect.Size()); |
334 |
379 |
335 iVideoPlayer->SetDisplayWindowL( ws, *screenDevice, |
380 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
381 |
|
382 iVideoPlayer->RemoveDisplayWindow(iBavpView->WindowInst()); |
|
383 TRAPD(errAdd, iVideoPlayer->AddDisplayWindowL(ws,*screenDevice,iBavpView->WindowInst(), screenRect, screenRect)); |
|
384 TRAPD(errScale, iVideoPlayer->SetAutoScaleL(iBavpView->WindowInst(), EAutoScaleBestFit)); |
|
385 Log( EFalse, _L("CBavpControllerVideo::RevertToFullScreenL() errAdd %d"), errAdd); |
|
386 Log( EFalse, _L("CBavpControllerVideo::RevertToFullScreenL() errScale %d"), errScale); |
|
387 #else |
|
388 iVideoPlayer->SetDisplayWindowL( ws, *screenDevice, |
336 iBavpView->WindowInst(), |
389 iBavpView->WindowInst(), |
337 screenRect, screenRect ); |
390 screenRect, screenRect ); |
338 |
391 |
339 RotateScreen90(); |
392 RotateScreen90(); |
|
393 #endif |
340 } |
394 } |
341 |
395 |
342 // ----------------------------------------------------------------------------- |
396 // ----------------------------------------------------------------------------- |
343 // CBavpControllerVideo::RevertToNormalScreenL |
397 // CBavpControllerVideo::RevertToNormalScreenL |
344 // Set back to normal display mode |
398 // Set back to normal display mode |
350 RWsSession& ws = eikon->WsSession(); |
404 RWsSession& ws = eikon->WsSession(); |
351 CWsScreenDevice* screenDevice = eikon->ScreenDevice(); |
405 CWsScreenDevice* screenDevice = eikon->ScreenDevice(); |
352 CBavpPluginEcomMain* npm = (CBavpPluginEcomMain*)Dll::Tls(); |
406 CBavpPluginEcomMain* npm = (CBavpPluginEcomMain*)Dll::Tls(); |
353 bool fullscreen = false; |
407 bool fullscreen = false; |
354 |
408 |
355 iVideoPlayer->StopDirectScreenAccessL(); |
409 //This method is not supported when using CVideoPlayerUtility2, and will |
|
410 //always leave with KErrNotSupported. instead of variating for new player |
|
411 //we are ignoring the Leave |
|
412 TRAP_IGNORE( iVideoPlayer->StopDirectScreenAccessL() ); |
356 |
413 |
357 npm->Funcs()->setvalue(iBavpView->bavPlugin()->getNPP(), |
414 npm->Funcs()->setvalue(iBavpView->bavPlugin()->getNPP(), |
358 NPPVpluginFullScreenBool, |
415 NPPVpluginFullScreenBool, |
359 static_cast<void*>(&fullscreen)); |
416 static_cast<void*>(&fullscreen)); |
360 |
417 |
362 parentView->SetRect(iNormalScreenRect); |
419 parentView->SetRect(iNormalScreenRect); |
363 iBavpView->CoeControl().SetExtent(TPoint(0,0), iNormalScreenRect.Size()); |
420 iBavpView->CoeControl().SetExtent(TPoint(0,0), iNormalScreenRect.Size()); |
364 |
421 |
365 iClipInfo->iInFullScreenMode = EFalse; |
422 iClipInfo->iInFullScreenMode = EFalse; |
366 RefreshRectCoordinatesL(); |
423 RefreshRectCoordinatesL(); |
367 iVideoPlayer->SetRotationL( EVideoRotationNone ); |
424 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
425 iVideoPlayer->SetRotationL(iBavpView->WindowInst(), EVideoRotationNone ); |
|
426 #else |
|
427 iVideoPlayer->SetRotationL( EVideoRotationNone ); |
|
428 #endif |
|
429 |
368 iBavpView->ControllerStateChangedL(); |
430 iBavpView->ControllerStateChangedL(); |
369 } |
431 } |
370 |
432 |
371 // ----------------------------------------------------------------------------- |
433 // ----------------------------------------------------------------------------- |
372 // CBavpControllerVideo::ToggleScreen |
434 // CBavpControllerVideo::ToggleScreen |
395 if ( IsClipFullScreen() ) { |
457 if ( IsClipFullScreen() ) { |
396 return; |
458 return; |
397 } |
459 } |
398 if ( iVideoPlayer ) |
460 if ( iVideoPlayer ) |
399 { |
461 { |
|
462 |
|
463 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
464 UpdateWindowSize(); |
|
465 #else |
400 TRect rect( iBavpView->CoeControl().Rect() ); |
466 TRect rect( iBavpView->CoeControl().Rect() ); |
401 |
467 |
402 TRect wr(iBavpView->WindowRect()); //can have negative coordinates |
468 TRect wr(iBavpView->WindowRect()); //can have negative coordinates |
403 //if video scrolled out of viewport |
469 //if video scrolled out of viewport |
404 // Windows' absolute position, relative to the current screen |
470 CEikonEnv* eikon = CEikonEnv::Static(); |
|
471 RWsSession& ws = eikon->WsSession(); |
|
472 CWsScreenDevice* screenDevice = eikon->ScreenDevice(); |
|
473 |
|
474 // Windows' absolute position, relative to the current screen |
405 TPoint pt = iBavpView->WindowInst().AbsPosition(); |
475 TPoint pt = iBavpView->WindowInst().AbsPosition(); |
406 rect.Move( pt.iX, pt.iY ); |
476 rect.Move( pt.iX, pt.iY ); |
407 wr.Move( pt.iX, pt.iY ); |
477 wr.Move( pt.iX, pt.iY ); |
408 |
478 |
409 |
479 // Reset clipRect |
410 CEikonEnv* eikon = CEikonEnv::Static(); |
|
411 RWsSession& ws = eikon->WsSession(); |
|
412 CWsScreenDevice* screenDevice = eikon->ScreenDevice(); |
|
413 |
|
414 // Reset clipRect |
|
415 TRect clipRect = rect; |
480 TRect clipRect = rect; |
416 clipRect = GetClipRect( rect ); |
481 clipRect = GetClipRect( rect ); |
417 |
482 |
418 Log( EFalse, _L("\nPosition: == clipRect to DAS: ==\n") ); |
483 Log( EFalse, _L("\nPosition: == clipRect to DAS: ==\n") ); |
419 Log( EFalse, _L("\nPosition:: clipRect.x = \n"), clipRect.iTl.iX ); |
484 Log( EFalse, _L("\nPosition:: clipRect.x = \n"), clipRect.iTl.iX ); |
425 ( |
490 ( |
426 iVideoPlayer->SetDisplayWindowL( ws, *screenDevice, |
491 iVideoPlayer->SetDisplayWindowL( ws, *screenDevice, |
427 iBavpView->WindowInst(), |
492 iBavpView->WindowInst(), |
428 wr, clipRect ); |
493 wr, clipRect ); |
429 ); |
494 ); |
430 if( iCurrentState == EBavpPaused || iCurrentState == EBavpStopped || iCurrentState == EBavpPlayComplete ) |
495 |
431 { |
496 #endif |
432 iVideoPlayer->RefreshFrameL(); |
497 if( iCurrentState == EBavpPaused || iCurrentState == EBavpStopped || iCurrentState == EBavpPlayComplete ) |
433 } |
498 { |
434 } |
499 iVideoPlayer->RefreshFrameL(); |
|
500 } |
|
501 |
|
502 } //end of iVideoPlayer |
435 } |
503 } |
436 |
504 |
437 // ----------------------------------------------------------------------------- |
505 // ----------------------------------------------------------------------------- |
438 // CBavpControllerVideo::WaitForScreenSwitch |
506 // CBavpControllerVideo::WaitForScreenSwitch |
439 // Switches between normal screen and full screen |
507 // Switches between normal screen and full screen |
1371 break; |
1439 break; |
1372 } |
1440 } |
1373 } |
1441 } |
1374 return ret; |
1442 return ret; |
1375 } |
1443 } |
|
1444 #ifdef BRDO_VIDEOPLAYER2_ENABLED_FF |
|
1445 // ----------------------------------------------------------------------------- |
|
1446 // CBavpControllerVideo::UpdateWindowSize |
|
1447 // Refreshing the window co-ordinates. |
|
1448 // ----------------------------------------------------------------------------- |
|
1449 /* |
|
1450 * MMF Client API has updated with new methods to control video display |
|
1451 * Windows and video picture positioning to produce a new version of the API, |
|
1452 * CVideoPlayerUtility2. The new API is the preferred way to play video on graphics |
|
1453 * surfaces, and will support new features such as more flexible window positioning. |
|
1454 * Updatewindow has made in separate method so that in future, timer can be |
|
1455 * implemented for redusing the call to update window. |
|
1456 */ |
|
1457 void CBavpControllerVideo::UpdateWindowSize() |
|
1458 { |
|
1459 TRect rect( iBavpView->CoeControl().Rect() ); |
|
1460 TRect wr(iBavpView->WindowRect()); //can have negative coordinates |
|
1461 //if video scrolled out of viewport |
|
1462 CEikonEnv* eikon = CEikonEnv::Static(); |
|
1463 RWsSession& ws = eikon->WsSession(); |
|
1464 CWsScreenDevice* screenDevice = eikon->ScreenDevice(); |
|
1465 // Reset clipRect |
|
1466 TRect clipRect = rect; |
|
1467 clipRect = GetClipRect( rect ); |
|
1468 if( ( iActiveWindow != &iBavpView->WindowInst() ) && ( iActiveWindow != NULL ) ) |
|
1469 { |
|
1470 //Remove the active window and add the new window |
|
1471 iVideoPlayer->RemoveDisplayWindow(iBavpView->WindowInst()); |
|
1472 TRAPD(errAdd, iVideoPlayer->AddDisplayWindowL(ws,*screenDevice,iBavpView->WindowInst(), wr, clipRect)); |
|
1473 TRAP_IGNORE(iVideoPlayer->SetAutoScaleL(iBavpView->WindowInst(), EAutoScaleBestFit)); |
|
1474 if( errAdd == KErrNone ) |
|
1475 iActiveWindow = &iBavpView->WindowInst(); |
|
1476 } |
|
1477 else |
|
1478 { |
|
1479 //window is already active, only needs the window size changed or position change |
|
1480 TRAPD(err1,iVideoPlayer->SetVideoExtentL(iBavpView->WindowInst(),wr)); |
|
1481 TRAPD(err2,iVideoPlayer->SetWindowClipRectL(iBavpView->WindowInst(),clipRect)); |
|
1482 Log( EFalse, _L("SetVideoExtent err1 = %d"), err1 ); |
|
1483 Log( EFalse, _L("SetVideoExtent err2 = %d"), err2 ); |
|
1484 } |
|
1485 } |
|
1486 #endif |
1376 // End of File |
1487 // End of File |