videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackdisplayhandler.cpp
changeset 15 cf5481c2bc0b
child 20 b9e04db066d4
equal deleted inserted replaced
2:dec420019252 15:cf5481c2bc0b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Implementation of video playback display handler
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version:  4 %
       
    19 
       
    20 #include <sysutil.h>
       
    21 #include <s32file.h>
       
    22 #include <mpxcommand.h>
       
    23 #include <mpxcommandgeneraldefs.h>
       
    24 #include <mpxplaybackutility.h>
       
    25 #include <mpxvideoplaybackdefs.h>
       
    26 
       
    27 #include "mpxvideoviewwrapper.h"
       
    28 #include "mpxvideoplaybackdisplayhandler.h"
       
    29 #include "mpxvideoregion.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 
       
    37 
       
    38 CMPXVideoPlaybackDisplayHandler::CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil,
       
    39                                                                   CMPXVideoViewWrapper* aViewWrapper )
       
    40     : iPlaybackUtility( aPlayUtil )
       
    41     , iViewWrapper( aViewWrapper )
       
    42 {
       
    43 }
       
    44 
       
    45 CMPXVideoPlaybackDisplayHandler::~CMPXVideoPlaybackDisplayHandler()
       
    46 {
       
    47 }
       
    48 
       
    49 CMPXVideoPlaybackDisplayHandler*
       
    50 CMPXVideoPlaybackDisplayHandler::NewL( MMPXPlaybackUtility* aPlayUtil,
       
    51                                        CMPXVideoViewWrapper* aViewWrapper )
       
    52 {
       
    53     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::NewL()"));
       
    54 
       
    55     CMPXVideoPlaybackDisplayHandler* self =
       
    56         new(ELeave) CMPXVideoPlaybackDisplayHandler( aPlayUtil, aViewWrapper );
       
    57 
       
    58     CleanupStack::PushL( self );
       
    59     self->ConstructL();
       
    60     CleanupStack::Pop();
       
    61     return self;
       
    62 }
       
    63 
       
    64 // -------------------------------------------------------------------------------------------------
       
    65 //  CMPXVideoPlaybackDisplayHandler::ConstructL()
       
    66 // -------------------------------------------------------------------------------------------------
       
    67 //
       
    68 void CMPXVideoPlaybackDisplayHandler::ConstructL()
       
    69 {
       
    70     LoadAspectRatioL();
       
    71 }
       
    72 
       
    73 // -------------------------------------------------------------------------------------------------
       
    74 //   CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL()
       
    75 // -------------------------------------------------------------------------------------------------
       
    76 //
       
    77 void CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL(
       
    78                                           RWsSession& aWs,
       
    79                                           CWsScreenDevice& aScreenDevice,
       
    80                                           RWindow& aWin,
       
    81                                           TRect aDisplayRect )
       
    82 {
       
    83     Q_UNUSED( aWs );
       
    84     Q_UNUSED( aScreenDevice );
       
    85     Q_UNUSED( aWin );
       
    86     Q_UNUSED( aDisplayRect );
       
    87 }
       
    88 
       
    89 // -------------------------------------------------------------------------------------------------
       
    90 //   CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
       
    91 // -------------------------------------------------------------------------------------------------
       
    92 //
       
    93 void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
       
    94 {
       
    95 #ifdef SYMBIAN_BUILD_GCE
       
    96     if ( iVideoDisplay )
       
    97     {
       
    98         delete iVideoDisplay;
       
    99         iVideoDisplay = NULL;
       
   100     }
       
   101 #else
       
   102     if ( iDirectScreenAccess )
       
   103     {
       
   104         delete iDirectScreenAccess;
       
   105         iDirectScreenAccess = NULL;
       
   106     }
       
   107 #endif
       
   108 }
       
   109 
       
   110 // -------------------------------------------------------------------------------------------------
       
   111 //   CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL()
       
   112 // -------------------------------------------------------------------------------------------------
       
   113 //
       
   114 void CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* aMessage )
       
   115 {
       
   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 }
       
   141 
       
   142 
       
   143 // -------------------------------------------------------------------------------------------------
       
   144 //   CMPXVideoPlaybackDisplayHandler::SetAspectRatioL()
       
   145 // -------------------------------------------------------------------------------------------------
       
   146 //
       
   147 TInt CMPXVideoPlaybackDisplayHandler::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd )
       
   148 {
       
   149     Q_UNUSED( aCmd );
       
   150     TInt aspectRatio = 0;
       
   151 
       
   152     iCurrentIndexForAspectRatio = 1;
       
   153     
       
   154     return aspectRatio;
       
   155 }
       
   156 
       
   157 
       
   158 // -------------------------------------------------------------------------------------------------
       
   159 //   CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL
       
   160 // -------------------------------------------------------------------------------------------------
       
   161 //
       
   162 TInt CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL(
       
   163                                           QMPXVideoPlaybackViewFileDetails* aFileDetails,
       
   164                                           TReal aDisplayAspectRatio )
       
   165 {
       
   166     Q_UNUSED( aFileDetails );
       
   167     Q_UNUSED( aDisplayAspectRatio );
       
   168     TInt newAspectRatio = EMMFNatural;
       
   169 
       
   170     return newAspectRatio;
       
   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 }
       
   189 
       
   190 // -------------------------------------------------------------------------------------------------
       
   191 //   CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()
       
   192 // -------------------------------------------------------------------------------------------------
       
   193 //
       
   194 void CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL(  TRect aClipRect, TBool transitionEffect  )
       
   195 {
       
   196     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()"));
       
   197     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 
       
   204 }
       
   205 
       
   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