javauis/mmapi_akn/baseline/src.nga/cmmasurfacewindow.cpp
branchRCL_3
changeset 21 4376525cdefb
parent 18 9ac0a0a7da70
child 24 6c158198356e
equal deleted inserted replaced
19:71c436fe3ce0 21:4376525cdefb
    15 *               in graphics surface based displays for Helix engine.
    15 *               in graphics surface based displays for Helix engine.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 //  Include Files
    19 //  Include Files
       
    20 #include <AccMonitorInfo.h>
       
    21 #include <AccMonitorCapabilities.h>
    20 #include "jdebug.h"
    22 #include "jdebug.h"
    21 #include "cmmasurfacewindow.h"
    23 #include "cmmasurfacewindow.h"
    22 #include "cmmaplayer.h"
    24 #include "cmmaplayer.h"
    23 
    25 
    24 // Used for iDisplay member
    26 // Used for iDisplay member
    25 #include "mmmadisplay.h"
    27 #include "mmmadisplay.h"
    26 
    28 
    27 CMMASurfaceWindow* CMMASurfaceWindow::NewL(
    29 EXPORT_C CMMASurfaceWindow* CMMASurfaceWindow::NewL(
    28     CMMAEventSource* aEventSource,
    30     CMMAEventSource* aEventSource,
    29     CMMAPlayer* aPlayer)
    31     CMMAPlayer* aPlayer,
       
    32     TBool aAVCableConnStatus)
    30 {
    33 {
    31     CMMASurfaceWindow* self =
    34     CMMASurfaceWindow* self =
    32         new(ELeave) CMMASurfaceWindow(aEventSource,
    35         new(ELeave) CMMASurfaceWindow(aEventSource,
    33                                       aPlayer);
    36                                       aPlayer,
       
    37                                       aAVCableConnStatus);
    34     return self;
    38     return self;
    35 }
    39 }
    36 
    40 
    37 // Destructor (virtual by CBase)
    41 // Destructor (virtual by CBase)
    38 CMMASurfaceWindow::~CMMASurfaceWindow()
    42 CMMASurfaceWindow::~CMMASurfaceWindow()
    44     // event from UI to be received by MUiEventConsumer.
    48     // event from UI to be received by MUiEventConsumer.
    45 }
    49 }
    46 
    50 
    47 CMMASurfaceWindow::CMMASurfaceWindow(
    51 CMMASurfaceWindow::CMMASurfaceWindow(
    48     CMMAEventSource* aEventSource,
    52     CMMAEventSource* aEventSource,
    49     CMMAPlayer* aPlayer):
    53     CMMAPlayer* aPlayer,
       
    54     TBool aAVCableConnStatus):
    50         iEventSource(aEventSource),
    55         iEventSource(aEventSource),
    51         iPlayer(aPlayer),
    56         iPlayer(aPlayer),
    52         iVideoDisplayInitState(EUIResourcesAndSurfaceParametersNotSet)
    57         iVideoDisplayInitState(EUIResourcesAndSurfaceParametersNotSet),
       
    58         iAVCableConnected(aAVCableConnStatus)
    53 {
    59 {
    54     // Empty rect until video size is known
    60     // Empty rect until video size is known
    55     iContentRect.SetRect(0, 0, 0, 0);
    61     iContentRect.SetRect(0, 0, 0, 0);
    56     iParentRect.SetRect(0, 0, 0, 0);
    62     iParentRect.SetRect(0, 0, 0, 0);
    57     iRWindowRect.SetRect(0, 0, 0, 0);
    63     iRWindowRect.SetRect(0, 0, 0, 0);
   118 TInt CMMASurfaceWindow::SetClipRect()
   124 TInt CMMASurfaceWindow::SetClipRect()
   119 {
   125 {
   120     DEBUG("MID::CMMASurfaceWindow::SetClipRect");
   126     DEBUG("MID::CMMASurfaceWindow::SetClipRect");
   121 
   127 
   122     // CMediaClientVideoDisplay expects client to RemoveDisplayWindow
   128     // CMediaClientVideoDisplay expects client to RemoveDisplayWindow
   123     // and AddDisplayWindow again everytime when RWindow rect changes
   129     // and AddDisplayWindow again everytime when RWindow rect changes.
   124     if (iMediaClientVideoDisplay && iWindow)
   130     // If audio/video cable is connected do not reposition the video,
       
   131     // this is done to prevent video playback pause.
       
   132     if (iMediaClientVideoDisplay && iWindow && !iAVCableConnected)
   125     {
   133     {
   126         iMediaClientVideoDisplay->RemoveDisplayWindow(*iWindow);
   134         iMediaClientVideoDisplay->RemoveDisplayWindow(*iWindow);
   127 
   135 
   128         TRect contentRect;
   136         TRect contentRect;
   129         if (iVisible)
   137         if (iVisible)
   307 {
   315 {
   308     // We are in UI thread context now.
   316     // We are in UI thread context now.
   309     CleanVideoDisplay();
   317     CleanVideoDisplay();
   310 }
   318 }
   311 
   319 
   312 void CMMASurfaceWindow::SetDisplay(MMMADisplay *aDisplay)
   320 EXPORT_C void CMMASurfaceWindow::SetDisplay(MMMADisplay *aDisplay)
   313 {
   321 {
   314     DEBUG("MID::CMMASurfaceWindow::SetDisplay +");
   322     DEBUG("MID::CMMASurfaceWindow::SetDisplay +");
   315 
   323 
   316     if (iDisplay != aDisplay)
   324     if (iDisplay != aDisplay)
   317     {
   325     {
   459     }
   467     }
   460     break;
   468     break;
   461     }
   469     }
   462 }
   470 }
   463 
   471 
   464 void CMMASurfaceWindow::SetSurfaceParameters(const TSurfaceId& aSurfaceId,
   472 EXPORT_C void CMMASurfaceWindow::SetSurfaceParameters(const TSurfaceId& aSurfaceId,
   465         const TRect& aCropRect,
   473         const TRect& aCropRect,
   466         const TVideoAspectRatio& aPixelAspectRatio)
   474         const TVideoAspectRatio& aPixelAspectRatio)
   467 {
   475 {
   468     iSurfaceId = aSurfaceId;
   476     iSurfaceId = aSurfaceId;
   469     iCropRect = aCropRect;
   477     iCropRect = aCropRect;
   508     {
   516     {
   509         iDisplay->UIGetCallback(*this, CMMASurfaceWindow::EInitVideoDisplay);
   517         iDisplay->UIGetCallback(*this, CMMASurfaceWindow::EInitVideoDisplay);
   510     }
   518     }
   511 }
   519 }
   512 
   520 
   513 void CMMASurfaceWindow::SetChangedSurfaceParameters(const TSurfaceId& aSurfaceId,
   521 EXPORT_C void CMMASurfaceWindow::SetChangedSurfaceParameters(const TSurfaceId& aSurfaceId,
   514         const TRect& aCropRect,
   522         const TRect& aCropRect,
   515         const TVideoAspectRatio& aPixelAspectRatio)
   523         const TVideoAspectRatio& aPixelAspectRatio)
   516 {
   524 {
   517     iSurfaceId = aSurfaceId;
   525     iSurfaceId = aSurfaceId;
   518     iCropRect = aCropRect;
   526     iCropRect = aCropRect;
   522     {
   530     {
   523         iDisplay->UIGetCallback(*this, CMMASurfaceWindow::ESetChangedSurfaceParameters);
   531         iDisplay->UIGetCallback(*this, CMMASurfaceWindow::ESetChangedSurfaceParameters);
   524     }
   532     }
   525 }
   533 }
   526 
   534 
   527 void CMMASurfaceWindow::RemoveSurface()
   535 EXPORT_C void CMMASurfaceWindow::RemoveSurface()
   528 {
   536 {
   529     if (iDisplay)
   537     if (iDisplay)
   530     {
   538     {
   531         iDisplay->UIGetCallback(*this,
   539         iDisplay->UIGetCallback(*this,
   532                                 CMMASurfaceWindow::ERemoveSurface);
   540                                 CMMASurfaceWindow::ERemoveSurface);
   657     }
   665     }
   658 
   666 
   659     DEBUG("MID::CMMASurfaceWindow::CleanVideoDisplay -");
   667     DEBUG("MID::CMMASurfaceWindow::CleanVideoDisplay -");
   660 }
   668 }
   661 
   669 
       
   670 void CMMASurfaceWindow::SetAVCableConnStatus(TBool aStatus)
       
   671 {
       
   672     iAVCableConnected = aStatus;
       
   673     if (iDisplay && !iAVCableConnected)
       
   674     {
       
   675         iDisplay->UIGetCallback(*this,
       
   676                                 CMMASurfaceWindow::ESetClipRect);
       
   677     }
       
   678 }
       
   679 
   662 //  END OF FILE
   680 //  END OF FILE