videoplayback/videoplaybackviews/src/mpxvideoplaybackdisplayhandler.cpp
branchRCL_3
changeset 16 7f2b2a65da29
parent 13 112a725ff2c2
child 53 2d690156cf8f
equal deleted inserted replaced
14:8970fbd719ec 16:7f2b2a65da29
    14 * Description:   Implementation of video playback display handler
    14 * Description:   Implementation of video playback display handler
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // Version : %version: 12 %
    19 // Version : %version: 14 %
    20 
    20 
    21 
    21 
    22 #include <sysutil.h>
    22 #include <sysutil.h>
    23 #include <s32file.h>
    23 #include <s32file.h>
    24 #include <mpxcommand.h>
    24 #include <mpxcommand.h>
   108     AddDisplayWindowL( aScreenDevice, aWin, &aWin );
   108     AddDisplayWindowL( aScreenDevice, aWin, &aWin );
   109 #endif
   109 #endif
   110 }
   110 }
   111 
   111 
   112 // -------------------------------------------------------------------------------------------------
   112 // -------------------------------------------------------------------------------------------------
   113 //   CMPXVideoPlaybackDisplayHandler::SignalSurfaceRemovedL()
       
   114 // -------------------------------------------------------------------------------------------------
       
   115 //
       
   116 void CMPXVideoPlaybackDisplayHandler::SignalSurfaceRemovedL()
       
   117 {
       
   118     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SignalSurfaceRemovedL()"));
       
   119 
       
   120     CMPXCommand* cmd = CMPXCommand::NewL();
       
   121     CleanupStack::PushL( cmd );
       
   122 
       
   123     cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
       
   124     cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
       
   125     cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
       
   126     cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand,
       
   127                                                      EPbCmdSurfaceRemoved );
       
   128 
       
   129     iPlaybackUtility->CommandL( *cmd );
       
   130 
       
   131     CleanupStack::PopAndDestroy( cmd );
       
   132 }
       
   133 
       
   134 // -------------------------------------------------------------------------------------------------
       
   135 //   CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
   113 //   CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
   136 // -------------------------------------------------------------------------------------------------
   114 // -------------------------------------------------------------------------------------------------
   137 //
   115 //
   138 void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow( TBool aSignalPlaybackPlugin )
   116 void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
   139 {
   117 {
   140     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()"),
   118     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()"));
   141                    _L("aSignalPlaybackPlugin = %d"), aSignalPlaybackPlugin );
       
   142 
   119 
   143 #ifdef SYMBIAN_BUILD_GCE
   120 #ifdef SYMBIAN_BUILD_GCE
   144     if ( iVideoDisplay )
   121     if ( iVideoDisplay )
   145     {
   122     {
   146         //
   123         //
   147         //  Surface is being removed, signal the container so it can reset the background
   124         //  Surface is being removed, signal the container so it can reset the background
   148         //
   125         //
   149         if ( iContainer )
   126         if ( iContainer )
   150         {
   127         {
   151             iContainer->HandleCommandL( EMPXPbvSurfaceRemoved );
   128             MPX_TRAPD( err, iContainer->HandleCommandL( EMPXPbvSurfaceRemoved ) );
   152         }
   129         }
   153 
   130 
   154         delete iVideoDisplay;
   131         delete iVideoDisplay;
   155         iVideoDisplay = NULL;
   132         iVideoDisplay = NULL;
   156     }
   133     }
   157 #endif
   134 #endif
   158 
   135 
   159     if ( ! iSurfaceId.IsNull() )
   136     iSurfaceId = TSurfaceId::CreateNullId();
   160     {
   137 }
   161         if ( aSignalPlaybackPlugin )
   138 
   162         {
   139 // -------------------------------------------------------------------------------------------------
   163             //
   140 //   CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL()
   164             //  Signal to the Playback Plugin that the surface has been removed
       
   165             //
       
   166             TRAP_IGNORE( SignalSurfaceRemovedL() );
       
   167         }
       
   168 
       
   169         iSurfaceId = TSurfaceId::CreateNullId();
       
   170     }
       
   171 }
       
   172 
       
   173 // -------------------------------------------------------------------------------------------------
       
   174 //   CMPXVideoPlaybackDisplayHandler::HandleVideoDisplaySyncMessageL()
       
   175 // -------------------------------------------------------------------------------------------------
   141 // -------------------------------------------------------------------------------------------------
   176 //
   142 //
   177 void
   143 void
   178 CMPXVideoPlaybackDisplayHandler::HandleVideoDisplaySyncMessageL( CMPXMessage* aMessage )
   144 CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* aMessage )
   179 {
   145 {
   180     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::HandleVideoDisplaySyncMessageL()"));
   146     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL()"));
   181 
   147 
   182     TMPXVideoDisplayCommand message =
   148     TMPXVideoDisplayCommand message =
   183         ( *(aMessage->Value<TMPXVideoDisplayCommand>(KMPXMediaVideoDisplayCommand)) );
   149         ( *(aMessage->Value<TMPXVideoDisplayCommand>(KMPXMediaVideoDisplayCommand)) );
   184 
   150 
   185     switch ( message )
   151     switch ( message )
   201         {
   167         {
   202             MPX_DEBUG(_L(" message = EPbMsgVideoSurfaceRemoved"));
   168             MPX_DEBUG(_L(" message = EPbMsgVideoSurfaceRemoved"));
   203             SurfaceRemoved();
   169             SurfaceRemoved();
   204             break;
   170             break;
   205         }
   171         }
   206         case EPbMsgVideoRemoveDisplayWindow:
       
   207         {
       
   208             MPX_DEBUG(_L(" message = EPbMsgVideoRemoveDisplayWindow"));
       
   209             RemoveDisplayWindow( EFalse );
       
   210             break;
       
   211         }
       
   212 #endif
   172 #endif
   213     }
   173     }
   214 
       
   215     //
       
   216     //  Signal Sync Message handling is complete
       
   217     //
       
   218     iPlaybackUtility->CommandL( EPbCmdSyncMsgComplete );
       
   219 }
   174 }
   220 
   175 
   221 // -------------------------------------------------------------------------------------------------
   176 // -------------------------------------------------------------------------------------------------
   222 //   CMPXVideoPlaybackDisplayHandler::SetAspectRatioL()
   177 //   CMPXVideoPlaybackDisplayHandler::SetAspectRatioL()
   223 // -------------------------------------------------------------------------------------------------
   178 // -------------------------------------------------------------------------------------------------
   571 
   526 
   572     if ( iVideoDisplay )
   527     if ( iVideoDisplay )
   573     {
   528     {
   574         if ( iContainer )
   529         if ( iContainer )
   575         {
   530         {
   576             iContainer->HandleCommandL( EMPXPbvSurfaceRemoved );
   531             MPX_TRAPD( err, iContainer->HandleCommandL( EMPXPbvSurfaceRemoved ) );
   577         }
   532         }
   578 
   533 
   579         iVideoDisplay->RemoveSurface();
   534         iVideoDisplay->RemoveSurface();
   580     }
   535     }
   581 
   536