videoplayback/videoplaybackview/tsrc/testcontrolscontroller/stub/inc/mpxvideoplaybackdisplayhandler.h
changeset 55 4bfa887905cf
parent 50 21fe8338c6bf
child 58 d2b028fd1f7d
equal deleted inserted replaced
50:21fe8338c6bf 55:4bfa887905cf
     1 /*
       
     2 * Copyright (c) 2010 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:  2 %
       
    19 
       
    20 
       
    21 #ifndef __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__
       
    22 #define __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__
       
    23 
       
    24 // INCLUDES
       
    25 
       
    26 #include <mpxmessage2.h>
       
    27 #include <mmfscalingcustomcommandconstants.h>
       
    28 #include <mpxvideoplaybackdefs.h>
       
    29 #ifdef SYMBIAN_BUILD_GCE
       
    30 #include <mediaclientvideodisplay.h>
       
    31 #else
       
    32 #include <w32std.h>
       
    33 #endif
       
    34 
       
    35 
       
    36 // 
       
    37 //  CLASS DECLARATION
       
    38 //
       
    39 class MMPXPlaybackUtility;
       
    40 class CMPXVideoViewWrapper;
       
    41 class VideoPlaybackViewFileDetails;
       
    42 
       
    43 /*
       
    44  *  CMPXVideoPlaybackDisplayHandler
       
    45  *
       
    46  */
       
    47 class CMPXVideoPlaybackDisplayHandler : public CBase
       
    48 #ifndef SYMBIAN_BUILD_GCE
       
    49                                       , public MDirectScreenAccess
       
    50 #endif
       
    51 {
       
    52     //
       
    53     //  To save user's preference for scaling type in video ratio + screen ratio
       
    54     //
       
    55     typedef struct
       
    56     {
       
    57         TReal32         videoRatio;
       
    58         TReal32         screenRatio;
       
    59         TMMFScalingType scalingType;
       
    60     } TMPXAspectRatio ;
       
    61     
       
    62     public:
       
    63 
       
    64         ~CMPXVideoPlaybackDisplayHandler();
       
    65 
       
    66         static CMPXVideoPlaybackDisplayHandler* NewL( MMPXPlaybackUtility* aPlayUtil,
       
    67                                                       CMPXVideoViewWrapper* aViewWrapper );
       
    68 
       
    69         void CreateDisplayWindowL( RWsSession& aWs,
       
    70                                    CWsScreenDevice& aScreenDevice,
       
    71                                    RWindow& aWin,
       
    72                                    TRect aDisplayRect );
       
    73 
       
    74         void RemoveDisplayWindow();
       
    75 
       
    76         void HandleVideoDisplayMessageL( CMPXMessage* aMessage );
       
    77 
       
    78         TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd );
       
    79         
       
    80         TInt SetDefaultAspectRatioL( VideoPlaybackViewFileDetails* aFileDetails, 
       
    81                                      TReal aDisplayAspectRatio );
       
    82 
       
    83         void UpdateVideoRectL(  TRect aRect, TBool transitionEffect  );
       
    84 
       
    85     private:
       
    86 
       
    87         CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil,
       
    88                                          CMPXVideoViewWrapper* aViewWrapper );
       
    89 
       
    90         void ConstructL();
       
    91         
       
    92         void LoadAspectRatioL();
       
    93         
       
    94         void SaveAspectRatioL();
       
    95 
       
    96         void SetVideoRectL( TRect aClipRect );
       
    97 
       
    98         void CalculateVideoRectL();
       
    99 
       
   100         static TInt UpdateVideoRectTimeOutL( TAny* aPtr );
       
   101 
       
   102 #ifdef SYMBIAN_BUILD_GCE
       
   103 
       
   104     private:
       
   105         void AddDisplayWindowL( CWsScreenDevice& aScreenDevice,
       
   106                                 RWindowBase& aWindowBase,
       
   107                                 RWindow* aWin );
       
   108 
       
   109         void SurfaceCreatedL( CMPXMessage* aMessage );
       
   110         void SurfaceChangedL( CMPXMessage* aMessage );
       
   111         void SurfaceRemoved();
       
   112         TInt SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd );
       
   113 
       
   114 #else
       
   115 
       
   116     private:
       
   117         //
       
   118         //  MDirectScreenAccess Implementation
       
   119         //
       
   120         void AbortNow( RDirectScreenAccess::TTerminationReasons aReason );
       
   121         void Restart( RDirectScreenAccess::TTerminationReasons aReason );
       
   122 
       
   123         TInt CreateAspectRatioCommandL( TMPXVideoPlaybackCommand aCmd );
       
   124         
       
   125         void SetDisplayWindowL( RWsSession& aWs,
       
   126                                 CWsScreenDevice& aScreenDevice,
       
   127                                 RWindowBase& aWin,
       
   128                                 TRect aClipRect );
       
   129         void RestartDsaL();
       
   130         void CreateAbortDsaCmdL();
       
   131 
       
   132 #endif
       
   133 
       
   134     public:
       
   135         MMPXPlaybackUtility*                iPlaybackUtility;
       
   136 
       
   137         RArray<TMPXAspectRatio>             iAspectRatioArray;
       
   138         TInt                                iCurrentIndexForAspectRatio;
       
   139         TReal                               iDisplayAspectRatio;
       
   140 
       
   141         TRect                               iWindowRect;
       
   142 
       
   143         TReal32                             iTlXDiff;
       
   144         TReal32                             iTlYDiff;
       
   145         TReal32                             iBrXDiff;
       
   146         TReal32                             iBrYDiff;
       
   147 
       
   148         TInt                                iTransitionEffectCnt;
       
   149 
       
   150         CPeriodic*                          iResizingTimer;
       
   151         CMPXVideoViewWrapper*               iViewWrapper;
       
   152 
       
   153 #ifdef SYMBIAN_BUILD_GCE
       
   154         CMediaClientVideoDisplay*           iVideoDisplay;
       
   155 
       
   156         RWindowBase*                        iWindowBase;
       
   157         TBool                               iSurfaceCached;
       
   158         TSurfaceId                          iSurfaceId;
       
   159         TRect                               iCropRect;
       
   160         TVideoAspectRatio                   iAspectRatio;
       
   161         TReal32                             iScaleWidth;
       
   162         TReal32                             iScaleHeight;
       
   163         TInt                                iHorizontalPosition;
       
   164         TInt                                iVerticalPosition;
       
   165         TVideoRotation                      iRotation;
       
   166         TAutoScaleType                      iAutoScale;   
       
   167 #else
       
   168         CDirectScreenAccess*                iDirectScreenAccess;
       
   169 #endif
       
   170 
       
   171 };
       
   172 
       
   173 #endif // __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__