mmlibs/mmfw/src/Client/Video/mmfclientvideoplayerbody.cpp
changeset 57 1cbb0d5bf7f2
parent 41 f7bf1ed8db72
equal deleted inserted replaced
56:b6488ac24ddc 57:1cbb0d5bf7f2
   655  		if (iDirectScreenAccess)
   655  		if (iDirectScreenAccess)
   656  			{
   656  			{
   657  			iDirectScreenAccess->Cancel();
   657  			iDirectScreenAccess->Cancel();
   658   			AbortNow(RDirectScreenAccess::ETerminateCancel);
   658   			AbortNow(RDirectScreenAccess::ETerminateCancel);
   659  			}
   659  			}
   660 
       
   661 		// try to remove the display window first no matter it is active or not.
       
   662 		// This method won't leave
       
   663 		RemoveDisplayWindow(aWindow);
       
   664 		
   660 		
   665 		// When using surfaces for CVPU we use DoAddDisplayWindowL() which requires clip rectangle and video extent
   661 		// When using surfaces for CVPU we use DoAddDisplayWindowL() which requires clip rectangle and video extent
   666 		// as arguments. Video extent is not supported by CVPU so aWindowRect is used instead. This function
   662 		// as arguments. Video extent is not supported by CVPU so aWindowRect is used instead. This function
   667 		// assumes these args are relative to the window. However they are relative to the display and must be
   663 		// assumes these args are relative to the window. However they are relative to the display and must be
   668 		// converted.
   664 		// converted.
   669 		TRect windowRectRelativeToWindow;
   665 		TRect windowRectRelativeToWindow;
   670 		TRect clipRectRelativeToWindow;		
   666 		TRect clipRectRelativeToWindow;		
   671 		ConvertFromRelativeToDisplayToRelativeToWindow(aWindow, aWindowRect, aClipRect, windowRectRelativeToWindow, clipRectRelativeToWindow);
   667 		ConvertFromRelativeToDisplayToRelativeToWindow(aWindow, aWindowRect, aClipRect, windowRectRelativeToWindow, clipRectRelativeToWindow);
   672 
   668 
   673         DoAddDisplayWindowL(aWs, aScreenDevice.GetScreenNumber(), aWindow, clipRectRelativeToWindow, windowRectRelativeToWindow, NULL);
   669 		// check if display for window already exists and if so do an update else create a new display
       
   670 		TRAPD(err, CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow));
       
   671 		if (err == KErrNone)
       
   672 		    {
       
   673 		    DoUpdateDisplayWindowL(aWs, aWindow, clipRectRelativeToWindow, windowRectRelativeToWindow, NULL);
       
   674 		    }
       
   675 		else
       
   676 		    {
       
   677 		    DoAddDisplayWindowL(aWs, aScreenDevice.GetScreenNumber(), aWindow, clipRectRelativeToWindow, windowRectRelativeToWindow, NULL);
       
   678 		    }
   674 		}
   679 		}
   675 #else
   680 #else
   676 	PrepareDSAL(aWs, aScreenDevice, aWindow);
   681 	PrepareDSAL(aWs, aScreenDevice, aWindow);
   677 	
   682 	
   678 	if (iControllerOpen)
   683 	if (iControllerOpen)
  1591 		config.iRotation = iGlobalRotation;
  1596 		config.iRotation = iGlobalRotation;
  1592 		iSubtitleUtility->AddSubtitleConfig(config); // ignore error from add subtitle config because the window can still display video properly
  1597 		iSubtitleUtility->AddSubtitleConfig(config); // ignore error from add subtitle config because the window can still display video properly
  1593 		}
  1598 		}
  1594 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1599 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
  1595 	}
  1600 	}
       
  1601 
       
  1602 void CVideoPlayerUtility::CBody::DoUpdateDisplayWindowL(RWsSession& aWs, RWindowBase& aWindow,
       
  1603                                 const TRect& aClipRect, const TRect& aVideoExtent, RWindow* aWindow2)
       
  1604     {
       
  1605     iWs = &aWs;
       
  1606 
       
  1607     // check opening the source is complete and the client has been recieved an MvpuoOpenComplete() callback
       
  1608     if (!iControllerOpen)
       
  1609         {
       
  1610         User::Leave(KErrNotReady);
       
  1611         }
       
  1612 
       
  1613     CMediaClientVideoDisplayBody* display = NULL;
       
  1614     TRAPD(err, display = CMediaClientVideoDisplayBody::FindDisplayWithWindowL(iActiveDisplays, aWindow));
       
  1615     User::LeaveIfError(err);
       
  1616 
       
  1617     display->UpdateDisplayWindowL(&aWindow, aClipRect, iCropRegion, aVideoExtent, iGlobalScaleWidth, iGlobalScaleHeight,
       
  1618                                 iGlobalRotation, iGlobalAutoScaleType, iGlobalHorizPos, iGlobalVertPos, aWindow2);
       
  1619 
       
  1620 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
       
  1621     if (iSubtitleUtility)
       
  1622         {
       
  1623         // subtitles were enabled already, so update subtitles on this window
       
  1624         TMMFSubtitleWindowConfig config;
       
  1625         config.iWindowId = aWindow.WsHandle();
       
  1626         config.iWindowClipRect = aClipRect;
       
  1627         config.iDisplayMode = aWindow.DisplayMode();
       
  1628         config.iRotation = iGlobalRotation;
       
  1629         iSubtitleUtility->UpdateSubtitleConfig(config); // ignore error from add subtitle config because the window can still display video properly
       
  1630         }
       
  1631 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
       
  1632     }
  1596 
  1633 
  1597 void CVideoPlayerUtility::CBody::RemoveDisplayWindow(RWindowBase& aWindow)
  1634 void CVideoPlayerUtility::CBody::RemoveDisplayWindow(RWindowBase& aWindow)
  1598 	{
  1635 	{
  1599     DEBUG_PRINTF("CVideoPlayerUtility::CBody::RemoveDisplayWindow++");
  1636     DEBUG_PRINTF("CVideoPlayerUtility::CBody::RemoveDisplayWindow++");
  1600     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::RemoveDisplayWindow - aWindow WsHandle 0x%X", aWindow.WsHandle());
  1637     DEBUG_PRINTF2("CVideoPlayerUtility::CBody::RemoveDisplayWindow - aWindow WsHandle 0x%X", aWindow.WsHandle());