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