videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackdisplayhandler.cpp
changeset 39 f6d44a0cd476
parent 37 4eb2df7f7cbe
equal deleted inserted replaced
38:ff53afa8ad05 39:f6d44a0cd476
    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:  5 %
    18 // Version : %version:  7 %
    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>
    26 
    26 
    27 #include "mpxvideoviewwrapper.h"
    27 #include "mpxvideoviewwrapper.h"
    28 #include "mpxvideoplaybackdisplayhandler.h"
    28 #include "mpxvideoplaybackdisplayhandler.h"
    29 #include "mpxvideoregion.h"
    29 #include "mpxvideoregion.h"
    30 #include "mpxvideoplaybackviewfiledetails.h"
    30 #include "mpxvideoplaybackviewfiledetails.h"
    31 
       
    32 const TInt KVIDEORESIZINGREPEATRATE = 50000;
       
    33 const TReal32 KTRANSITIONEFFECTCNT = 8;
       
    34 
       
    35 _LIT( KAspectRatioFile, "c:\\private\\200159b2\\mpxvideoplayer_aspect_ratio.dat" );
       
    36 
    31 
    37 
    32 
    38 CMPXVideoPlaybackDisplayHandler::CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil,
    33 CMPXVideoPlaybackDisplayHandler::CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil,
    39                                                                   CMPXVideoViewWrapper* aViewWrapper )
    34                                                                   CMPXVideoViewWrapper* aViewWrapper )
    40     : iPlaybackUtility( aPlayUtil )
    35     : iPlaybackUtility( aPlayUtil )
    65 //  CMPXVideoPlaybackDisplayHandler::ConstructL()
    60 //  CMPXVideoPlaybackDisplayHandler::ConstructL()
    66 // -------------------------------------------------------------------------------------------------
    61 // -------------------------------------------------------------------------------------------------
    67 //
    62 //
    68 void CMPXVideoPlaybackDisplayHandler::ConstructL()
    63 void CMPXVideoPlaybackDisplayHandler::ConstructL()
    69 {
    64 {
    70     LoadAspectRatioL();
       
    71 }
    65 }
    72 
    66 
    73 // -------------------------------------------------------------------------------------------------
    67 // -------------------------------------------------------------------------------------------------
    74 //   CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL()
    68 //   CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL()
    75 // -------------------------------------------------------------------------------------------------
    69 // -------------------------------------------------------------------------------------------------
    90 //   CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
    84 //   CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
    91 // -------------------------------------------------------------------------------------------------
    85 // -------------------------------------------------------------------------------------------------
    92 //
    86 //
    93 void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
    87 void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
    94 {
    88 {
    95 #ifdef SYMBIAN_BUILD_GCE
       
    96     if ( iVideoDisplay )
    89     if ( iVideoDisplay )
    97     {
    90     {
    98         delete iVideoDisplay;
    91         delete iVideoDisplay;
    99         iVideoDisplay = NULL;
    92         iVideoDisplay = NULL;
   100     }
    93     }
   101 #else
       
   102     if ( iDirectScreenAccess )
       
   103     {
       
   104         delete iDirectScreenAccess;
       
   105         iDirectScreenAccess = NULL;
       
   106     }
       
   107 #endif
       
   108 }
    94 }
   109 
    95 
   110 // -------------------------------------------------------------------------------------------------
    96 // -------------------------------------------------------------------------------------------------
   111 //   CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL()
    97 //   CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL()
   112 // -------------------------------------------------------------------------------------------------
    98 // -------------------------------------------------------------------------------------------------
   113 //
    99 //
   114 void CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* aMessage )
   100 void CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* /*aMessage*/ )
   115 {
   101 {
   116 
       
   117     TMPXVideoDisplayCommand message =
       
   118         ( *(aMessage->Value<TMPXVideoDisplayCommand>(KMPXMediaVideoDisplayCommand)) );
       
   119 
       
   120     switch ( message )
       
   121     {
       
   122 #ifdef SYMBIAN_BUILD_GCE    	
       
   123         case EPbMsgVideoSurfaceCreated:
       
   124         {
       
   125             SurfaceCreatedL( aMessage );
       
   126             break;
       
   127         }
       
   128         case EPbMsgVideoSurfaceChanged:
       
   129         {
       
   130             SurfaceChangedL( aMessage );
       
   131             break;
       
   132         }
       
   133         case EPbMsgVideoSurfaceRemoved:
       
   134         {
       
   135             SurfaceRemoved();
       
   136             break;
       
   137         }
       
   138 #endif        
       
   139     }
       
   140 }
   102 }
   141 
       
   142 
   103 
   143 // -------------------------------------------------------------------------------------------------
   104 // -------------------------------------------------------------------------------------------------
   144 //   CMPXVideoPlaybackDisplayHandler::SetAspectRatioL()
   105 //   CMPXVideoPlaybackDisplayHandler::SetAspectRatioL()
   145 // -------------------------------------------------------------------------------------------------
   106 // -------------------------------------------------------------------------------------------------
   146 //
   107 //
   147 TInt CMPXVideoPlaybackDisplayHandler::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd )
   108 TInt CMPXVideoPlaybackDisplayHandler::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd )
   148 {
   109 {
   149     Q_UNUSED( aCmd );
   110     iCommand = aCmd;
   150     TInt aspectRatio = 0;
   111     
       
   112     switch ( aCmd )
       
   113     {
       
   114         case EPbCmdNaturalAspectRatio:
       
   115         {
       
   116             iAspectRatio = EMMFNatural;
       
   117             break;
       
   118         }
       
   119         case EPbCmdZoomAspectRatio:
       
   120         {
       
   121             iAspectRatio = EMMFZoom;
       
   122             break;
       
   123         }
       
   124         case EPbCmdStretchAspectRatio:
       
   125         {
       
   126             iAspectRatio = EMMFStretch;
       
   127             break;
       
   128         }
       
   129     }
   151 
   130 
   152     iCurrentIndexForAspectRatio = 1;
   131     return iAspectRatio;
   153     
       
   154     return aspectRatio;
       
   155 }
   132 }
   156 
       
   157 
   133 
   158 // -------------------------------------------------------------------------------------------------
   134 // -------------------------------------------------------------------------------------------------
   159 //   CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL
   135 //   CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL
   160 // -------------------------------------------------------------------------------------------------
   136 // -------------------------------------------------------------------------------------------------
   161 //
   137 //
   163                                           QMPXVideoPlaybackViewFileDetails* aFileDetails,
   139                                           QMPXVideoPlaybackViewFileDetails* aFileDetails,
   164                                           TReal32 aDisplayAspectRatio )
   140                                           TReal32 aDisplayAspectRatio )
   165 {
   141 {
   166     Q_UNUSED( aFileDetails );
   142     Q_UNUSED( aFileDetails );
   167     Q_UNUSED( aDisplayAspectRatio );
   143     Q_UNUSED( aDisplayAspectRatio );
   168     TInt newAspectRatio = EMMFNatural;
       
   169 
   144 
   170     return newAspectRatio;
   145     return iAspectRatio;
   171 }
       
   172 
       
   173 // -------------------------------------------------------------------------------------------------
       
   174 //   CMPXVideoPlaybackDisplayHandler::SaveAspectRatioL
       
   175 // -------------------------------------------------------------------------------------------------
       
   176 //
       
   177 void CMPXVideoPlaybackDisplayHandler::SaveAspectRatioL()
       
   178 {
       
   179 
       
   180 }
       
   181 
       
   182 // -------------------------------------------------------------------------------------------------
       
   183 //   CMPXVideoPlaybackDisplayHandler::LoadAspectRatioL
       
   184 // -------------------------------------------------------------------------------------------------
       
   185 //
       
   186 void CMPXVideoPlaybackDisplayHandler::LoadAspectRatioL()
       
   187 {
       
   188 }
   146 }
   189 
   147 
   190 // -------------------------------------------------------------------------------------------------
   148 // -------------------------------------------------------------------------------------------------
   191 //   CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()
   149 //   CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()
   192 // -------------------------------------------------------------------------------------------------
   150 // -------------------------------------------------------------------------------------------------
   193 //
   151 //
   194 void CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL(  TRect aClipRect, TBool transitionEffect  )
   152 void CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL( TRect aClipRect, TBool transitionEffect  )
   195 {
   153 {
   196     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()"));
   154     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()"));
       
   155 
   197     Q_UNUSED( transitionEffect );
   156     Q_UNUSED( transitionEffect );
   198     
       
   199     iTlXDiff = (TReal32)( aClipRect.iTl.iX );
       
   200     iTlYDiff = (TReal32)( aClipRect.iTl.iY );
       
   201     iBrXDiff = (TReal32)( aClipRect.iBr.iX );
       
   202     iBrYDiff = (TReal32)( aClipRect.iBr.iY );    
       
   203 
   157 
       
   158     iRect = aClipRect;
   204 }
   159 }
   205 
   160 
   206 // -------------------------------------------------------------------------------------------------
       
   207 //   CMPXVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL()
       
   208 // -------------------------------------------------------------------------------------------------
       
   209 //
       
   210 TInt CMPXVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL( TAny* aPtr )
       
   211 {
       
   212     Q_UNUSED( aPtr );
       
   213     return KErrNone;
       
   214 }
       
   215 
       
   216 // -------------------------------------------------------------------------------------------------
       
   217 //   CMPXVideoPlaybackDisplayHandler::CalculateVideoRectL()
       
   218 // -------------------------------------------------------------------------------------------------
       
   219 //
       
   220 void CMPXVideoPlaybackDisplayHandler::CalculateVideoRectL()
       
   221 {
       
   222 
       
   223 }
       
   224 
       
   225 // -------------------------------------------------------------------------------------------------
       
   226 //   CMPXVideoPlaybackDisplayHandler::SetVideoRectL()
       
   227 // -------------------------------------------------------------------------------------------------
       
   228 //
       
   229 void CMPXVideoPlaybackDisplayHandler::SetVideoRectL( TRect aRect )
       
   230 {
       
   231     Q_UNUSED( aRect );
       
   232 }
       
   233 
       
   234 #ifdef SYMBIAN_BUILD_GCE
       
   235 
       
   236 // -------------------------------------------------------------------------------------------------
       
   237 //   CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL()
       
   238 // -------------------------------------------------------------------------------------------------
       
   239 //
       
   240 void CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL( CWsScreenDevice& aScreenDevice,
       
   241                                                          RWindowBase& aWindowBase,
       
   242                                                          RWindow* aWin )
       
   243 {
       
   244     Q_UNUSED( aScreenDevice );
       
   245     Q_UNUSED( aWindowBase );
       
   246     Q_UNUSED( aWin );
       
   247 }
       
   248 
       
   249 // -------------------------------------------------------------------------------------------------
       
   250 //   CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL()
       
   251 // -------------------------------------------------------------------------------------------------
       
   252 //
       
   253 void CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL( CMPXMessage* aMessage )
       
   254 {
       
   255     Q_UNUSED( aMessage );
       
   256 }
       
   257 
       
   258 // -------------------------------------------------------------------------------------------------
       
   259 //   CMPXVideoPlaybackDisplayHandler::SurfaceChangedL()
       
   260 // -------------------------------------------------------------------------------------------------
       
   261 //
       
   262 void CMPXVideoPlaybackDisplayHandler::SurfaceChangedL( CMPXMessage* aMessage )
       
   263 {
       
   264     Q_UNUSED( aMessage );
       
   265 }
       
   266 
       
   267 // -------------------------------------------------------------------------------------------------
       
   268 //   CMPXVideoPlaybackDisplayHandler::SurfaceRemoved()
       
   269 // -------------------------------------------------------------------------------------------------
       
   270 //
       
   271 void CMPXVideoPlaybackDisplayHandler::SurfaceRemoved()
       
   272 {
       
   273 }
       
   274 
       
   275 // -------------------------------------------------------------------------------------------------
       
   276 //   CMPXVideoPlaybackDisplayHandler::SetNgaAspectRatioL()
       
   277 // -------------------------------------------------------------------------------------------------
       
   278 //
       
   279 TInt CMPXVideoPlaybackDisplayHandler::SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd )
       
   280 {
       
   281     Q_UNUSED( aCmd );
       
   282     return KErrNone;
       
   283 }
       
   284 
       
   285 
       
   286 #else
       
   287 
       
   288 // -------------------------------------------------------------------------------------------------
       
   289 //   CMPXVideoPlaybackDisplayHandler::SetDisplayWindowL()
       
   290 // -------------------------------------------------------------------------------------------------
       
   291 //
       
   292 void CMPXVideoPlaybackDisplayHandler::SetDisplayWindowL( RWsSession& aWs,
       
   293                                                          CWsScreenDevice& aScreenDevice,
       
   294                                                          RWindowBase& aWin,
       
   295                                                          TRect aClipRect )
       
   296 {
       
   297     Q_UNUSED( aWs );
       
   298     Q_UNUSED( aScreenDevice );
       
   299     Q_UNUSED( aWin );
       
   300     Q_UNUSED( aClipRect );
       
   301 }
       
   302 
       
   303 // -------------------------------------------------------------------------------------------------
       
   304 //  CMPXVideoPlaybackDisplayHandler::Restart()
       
   305 // -------------------------------------------------------------------------------------------------
       
   306 //
       
   307 void CMPXVideoPlaybackDisplayHandler::Restart( RDirectScreenAccess::TTerminationReasons aReason )
       
   308 {
       
   309     Q_UNUSED( aReason );
       
   310 }
       
   311 
       
   312 
       
   313 // -------------------------------------------------------------------------------------------------
       
   314 //   CMPXVideoPlaybackDisplayHandler::RestartDsaL()
       
   315 // -------------------------------------------------------------------------------------------------
       
   316 //
       
   317 void CMPXVideoPlaybackDisplayHandler::RestartDsaL()
       
   318 {
       
   319 
       
   320 }
       
   321 
       
   322 // -------------------------------------------------------------------------------------------------
       
   323 //   CMPXVideoPlaybackDisplayHandler::AbortNow()
       
   324 // -------------------------------------------------------------------------------------------------
       
   325 //
       
   326 void CMPXVideoPlaybackDisplayHandler::AbortNow( RDirectScreenAccess::TTerminationReasons aReason )
       
   327 {
       
   328     Q_UNUSED( aReason );
       
   329 }
       
   330 
       
   331 // -------------------------------------------------------------------------------------------------
       
   332 //   CMPXVideoPlaybackDisplayHandler::CreateAbortDsaCmdL()
       
   333 // -------------------------------------------------------------------------------------------------
       
   334 //
       
   335 void CMPXVideoPlaybackDisplayHandler::CreateAbortDsaCmdL()
       
   336 {
       
   337 
       
   338 }
       
   339 
       
   340 // -------------------------------------------------------------------------------------------------
       
   341 //   CMPXVideoPlaybackDisplayHandler::CreateAspectRatioCommandL()
       
   342 // -------------------------------------------------------------------------------------------------
       
   343 //
       
   344 TInt CMPXVideoPlaybackDisplayHandler::CreateAspectRatioCommandL( TMPXVideoPlaybackCommand aCmd )
       
   345 {
       
   346     Q_UNUSED( aCmd );
       
   347 }
       
   348 
       
   349 #endif
       
   350 
       
   351 // End of File
   161 // End of File