videoplayback/videoplaybackviews/src/mpxvideoplaybackdisplayhandler.cpp
branchRCL_3
changeset 10 ce5ada96ab30
parent 6 7d91903f795f
child 11 5294c000a26d
equal deleted inserted replaced
6:7d91903f795f 10:ce5ada96ab30
    13 *
    13 *
    14 * Description:   Implementation of video playback display handler
    14 * Description:   Implementation of video playback display handler
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 9 %
    18 // Version : %version: 10 %
    19 
    19 
    20 #include <sysutil.h>
    20 #include <sysutil.h>
    21 #include <s32file.h>
    21 #include <s32file.h>
    22 #include <mpxcommand.h>
    22 #include <mpxcommand.h>
    23 #include <mpxcommandgeneraldefs.h>
    23 #include <mpxcommandgeneraldefs.h>
    58     {
    58     {
    59         delete iVideoDisplay;
    59         delete iVideoDisplay;
    60         iVideoDisplay = NULL;
    60         iVideoDisplay = NULL;
    61     }
    61     }
    62 #endif
    62 #endif
       
    63 
       
    64     iSurfaceId = TSurfaceId::CreateNullId();
    63 }
    65 }
    64 
    66 
    65 CMPXVideoPlaybackDisplayHandler*
    67 CMPXVideoPlaybackDisplayHandler*
    66 CMPXVideoPlaybackDisplayHandler::NewL( MMPXPlaybackUtility* aPlayUtil )
    68 CMPXVideoPlaybackDisplayHandler::NewL( MMPXPlaybackUtility* aPlayUtil )
    67 {
    69 {
    99     AddDisplayWindowL( aScreenDevice, aWin, &aWin );
   101     AddDisplayWindowL( aScreenDevice, aWin, &aWin );
   100 #endif
   102 #endif
   101 }
   103 }
   102 
   104 
   103 // -------------------------------------------------------------------------------------------------
   105 // -------------------------------------------------------------------------------------------------
       
   106 //   CMPXVideoPlaybackDisplayHandler::SignalSurfaceRemovedL()
       
   107 // -------------------------------------------------------------------------------------------------
       
   108 //
       
   109 void CMPXVideoPlaybackDisplayHandler::SignalSurfaceRemovedL()
       
   110 {
       
   111     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SignalSurfaceRemovedL()"));
       
   112 
       
   113     CMPXCommand* cmd = CMPXCommand::NewL();
       
   114     CleanupStack::PushL( cmd );
       
   115 
       
   116     cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
       
   117     cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
       
   118     cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand,
       
   119                                                      EPbCmdSurfaceRemoved );
       
   120 
       
   121     iPlaybackUtility->CommandL( *cmd );
       
   122 
       
   123     CleanupStack::PopAndDestroy( cmd );
       
   124 }
       
   125 
       
   126 // -------------------------------------------------------------------------------------------------
   104 //   CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
   127 //   CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
   105 // -------------------------------------------------------------------------------------------------
   128 // -------------------------------------------------------------------------------------------------
   106 //
   129 //
   107 void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
   130 void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
   108 {
   131 {
   113     {
   136     {
   114         delete iVideoDisplay;
   137         delete iVideoDisplay;
   115         iVideoDisplay = NULL;
   138         iVideoDisplay = NULL;
   116     }
   139     }
   117 #endif
   140 #endif
       
   141 
       
   142     if ( ! iSurfaceId.IsNull() )
       
   143     {
       
   144         //
       
   145         //  Signal to the Playback Plugin that the surface has been removed
       
   146         //
       
   147         TRAP_IGNORE( SignalSurfaceRemovedL() );
       
   148 
       
   149         iSurfaceId = TSurfaceId::CreateNullId();
       
   150     }
   118 }
   151 }
   119 
   152 
   120 // -------------------------------------------------------------------------------------------------
   153 // -------------------------------------------------------------------------------------------------
   121 //   CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL()
   154 //   CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL()
   122 // -------------------------------------------------------------------------------------------------
   155 // -------------------------------------------------------------------------------------------------
   146             break;
   179             break;
   147         }
   180         }
   148         case EPbMsgVideoSurfaceRemoved:
   181         case EPbMsgVideoSurfaceRemoved:
   149         {
   182         {
   150             SurfaceRemoved();
   183             SurfaceRemoved();
       
   184             break;
       
   185         }
       
   186         case EPbMsgVideoRemoveDisplayWindow:
       
   187         {
       
   188             if ( iVideoDisplay )
       
   189             {
       
   190                 delete iVideoDisplay;
       
   191                 iVideoDisplay = NULL;
       
   192             }
       
   193 
       
   194             iSurfaceId = TSurfaceId::CreateNullId();
       
   195 
   151             break;
   196             break;
   152         }
   197         }
   153 #endif
   198 #endif
   154     }
   199     }
   155 
   200 
   419 void CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL( CMPXMessage* aMessage )
   464 void CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL( CMPXMessage* aMessage )
   420 {
   465 {
   421     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL()"));
   466     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL()"));
   422 
   467 
   423     TSurfaceId oldSurfaceId = iSurfaceId;
   468     TSurfaceId oldSurfaceId = iSurfaceId;
   424     
   469 
   425     //
   470     //
   426     //  Extract the surface parameters from the message
   471     //  Extract the surface parameters from the message
   427     //
   472     //
   428     iSurfaceId = aMessage->ValueTObjectL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId );
   473     iSurfaceId = aMessage->ValueTObjectL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId );
   429     iCropRect = aMessage->ValueTObjectL<TRect>( KMPXMediaVideoDisplayCropRect );
   474     iCropRect = aMessage->ValueTObjectL<TRect>( KMPXMediaVideoDisplayCropRect );