tvout/tvoutengine/inc/glxhdmisurfaceupdater.h
changeset 26 c499df2dbb33
child 36 6481344a6d67
equal deleted inserted replaced
24:99ad1390cd33 26:c499df2dbb33
       
     1 /* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     2 * All rights reserved.
       
     3 * This component and the accompanying materials are made available
       
     4 * under the terms of "Eclipse Public License v1.0"
       
     5 * which accompanies this distribution, and is available
       
     6 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 *
       
     8 * Initial Contributors:
       
     9 * Nokia Corporation - initial contribution.
       
    10 *
       
    11 * Contributors:
       
    12 *
       
    13 * Description:    Handles & propogates UI state change notifications.
       
    14 *
       
    15 */
       
    16 
       
    17 #ifndef GLXHDMISURFACEUPDATER_H_
       
    18 #define GLXHDMISURFACEUPDATER_H_
       
    19 
       
    20 #include <w32std.h>
       
    21 #include <fbs.h>
       
    22 
       
    23 // GCE Surface
       
    24 #include "graphics/surfacemanager.h"
       
    25 #include "graphics/surface.h"
       
    26 #include "graphics/surfaceupdateclient.h"
       
    27 #include <graphics/surfaceconfiguration.h>
       
    28 
       
    29 // forward decleration
       
    30 class CGlxActiveCallBack;
       
    31 class CGlxHdmiDecoderAO;
       
    32 class CImageDecoder;
       
    33 class TSurfaceConfiguration;
       
    34 class MGlxGenCallback
       
    35     {
       
    36 public:
       
    37     virtual void DoGenCallback() = 0;
       
    38     };
       
    39 
       
    40 class CGlxHdmiSurfaceUpdater: public CBase
       
    41     {
       
    42 public:
       
    43     /*
       
    44      * NewL
       
    45      */
       
    46     static CGlxHdmiSurfaceUpdater* NewL(RWindow* aWindow, const TDesC& aImageFile, 
       
    47             CFbsBitmap* aFsBitmap, MGlxGenCallback* aCallBack);
       
    48 
       
    49     /*
       
    50      * Destructor
       
    51      */
       
    52     ~CGlxHdmiSurfaceUpdater();
       
    53 
       
    54 public:
       
    55     /*
       
    56      * This is to cancel the active object from decoding 
       
    57      */
       
    58     void HandleRunL(TRequestStatus& aStatus);
       
    59 
       
    60     /*
       
    61      * This updates the new image.
       
    62      */
       
    63     void UpdateNewImageL(const TDesC& aImageFile,CFbsBitmap* aFsBitmap);
       
    64 
       
    65     /*
       
    66      * Activate Zoom 
       
    67      */
       
    68     void ActivateZoom(TBool aAutoZoomOut);
       
    69     /*
       
    70      * Deactivate Zoom 
       
    71      */
       
    72     void DeactivateZoom();
       
    73     /*
       
    74      * Zoom in our out depending on parameter 
       
    75      */
       
    76     void Zoom(TBool aZoom);
       
    77 
       
    78     /*
       
    79 	ShiftToCloningMOde
       
    80      */
       
    81     void ShiftToCloningMode();
       
    82 
       
    83     /*
       
    84 	ShiftToPostingMode
       
    85      */
       
    86     void ShiftToPostingMode();
       
    87 
       
    88 private:
       
    89     /*
       
    90      * Constructor 
       
    91      */
       
    92     CGlxHdmiSurfaceUpdater(RWindow* aWindow, MGlxGenCallback* aCallBack);
       
    93 
       
    94     /*
       
    95      * ConstructL()
       
    96      */
       
    97     void ConstructL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);   
       
    98 
       
    99     /*
       
   100      * Create a New surface with given size
       
   101      */
       
   102     void CreateSurfaceL();
       
   103     /*
       
   104      * @param1 size 
       
   105      */
       
   106     void MapSurfaceL();
       
   107 
       
   108     /*
       
   109      * This fundtion wont be called , could be used if double buffering is planned in future
       
   110      * to start the second decoder AO and update the surface with a new session. 
       
   111      */
       
   112     static TInt SurfBuffer0Ready(TAny* aObject);    
       
   113     
       
   114     /*
       
   115      * Call a refresh on the screen  
       
   116      */
       
   117     void Refresh();
       
   118 
       
   119     /*
       
   120      * Dump the buffer on to the surface stride 
       
   121      */
       
   122     void SwapBuffers();
       
   123 
       
   124     /*
       
   125      * Release contents 
       
   126      */
       
   127     void ReleaseContent();
       
   128 
       
   129     /*
       
   130      * Create bitmap  
       
   131      */
       
   132     void CreateBitmapL();
       
   133 
       
   134     /*
       
   135      * Create an image decoder with given file
       
   136      * @param1 - Image file 
       
   137      */
       
   138     void CreateImageDecoderL();
       
   139 
       
   140     /*
       
   141      * Creating all enablers for HDMI
       
   142      * @param1 if creating a surface is required, 
       
   143      * by default it is not required
       
   144      */
       
   145     void CreateHdmiL(TBool aCreateSurface = ETrue);
       
   146 
       
   147     /*
       
   148      * This if for zoom timer timeout
       
   149      */
       
   150     static TInt TimeOut(TAny* aSelf);
       
   151 
       
   152     /*
       
   153      * ModifySurface positions of the surface to be displayed on screen
       
   154      */
       
   155     void ModifySurfacePostion();
       
   156 
       
   157     /*
       
   158      * Process the image for TV 
       
   159      */
       
   160     void ProcessTvImage();
       
   161 
       
   162     /*
       
   163      * Shows the FS thumbnail first before showing 
       
   164      * Decoded HD image 
       
   165      */
       
   166     void ShowFsThumbnailL();
       
   167 
       
   168     /*
       
   169      * Recalculate the size for png/bmp as decoder fails to 
       
   170      * decode for desired size 
       
   171      */
       
   172     TSize ReCalculateSizeL();
       
   173 
       
   174     /*
       
   175      * If the image format is non jpeg, then we need to calculate as per
       
   176      * reduction factor and reduced size as what the decoder is going to return us
       
   177      * This function returns if that needs to be done. 
       
   178      */
       
   179     TBool DoesMimeTypeNeedsRecalculateL();
       
   180 
       
   181     /*
       
   182      * If the image format is non jpeg, then we need to scale the bitmap after it is
       
   183      * decoded, as the return value would not fit the screen 
       
   184      */
       
   185     void ScaleDecodedBitmapL(TInt aBitmapIndex);
       
   186 
       
   187     /*
       
   188      * InitiateHDMI
       
   189      */
       
   190     void InitiateHdmiL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);
       
   191 
       
   192 private:
       
   193     RWindow*        iWindow;                        // window object
       
   194     CFbsBitmap*     iFsBitmap;                      // FS bitmap
       
   195     MGlxGenCallback* iCallBack;                     // callback to the HdmiContainer window
       
   196     HBufC*          iImagePath;                     // To store the image uri path
       
   197 
       
   198     // GCE Surface
       
   199     RSurfaceUpdateSession iSurfUpdateSession;
       
   200     TSurfaceId              iSurfId;                // TSurfaceId                             
       
   201     RSurfaceManager*        iSurfManager;           // RSurfaceManager
       
   202     RChunk*                 iSurfChunk;             // RChunk
       
   203     TInt                    iSurfaceStride;         // surface stride
       
   204     TSurfaceConfiguration   iConfig;                // surface configuration for zoom
       
   205 
       
   206     CFbsBitmap*         iDecodedBitmap[3];          // Array of Decoded bitmaps of the focussed image
       
   207                                                     // 1 - contains FS/Grid Thumbnail, 2- HD image, 
       
   208                                                     // (optional)3-Scaled png/bmp images
       
   209 
       
   210     void*               iSurfBuffer;               // Surface buffer
       
   211     CGlxActiveCallBack* iSurfBufferAO;             // Surface buffer AO 
       
   212 
       
   213     //ICL
       
   214     CGlxHdmiDecoderAO*  iGlxDecoderAO;              // Internal Image decoder AO              
       
   215     CImageDecoder*      iImageDecoder;              // Image Decoder
       
   216     RFs                 iFsSession;                 // RFs
       
   217 
       
   218     TPoint      iLeftCornerForZoom;                 //  
       
   219     CPeriodic*  iTimer;                             // Timer for Zoom   
       
   220     
       
   221     // Various objects to store sizes and count
       
   222     TSize       iTvScreenSize;                      // to store the Tv screen size
       
   223     TSize       iTargetBitmapSize;                  // To Store the target bitmap size to display(as per Aspect Ratio)
       
   224     
       
   225     // Various flags to store values
       
   226     TBool       iZoom;                              // Is zoomed
       
   227     TBool       iBitmapReady;                       // If the bitmap is decoded and ready
       
   228     TBool       iAutoZoomOut;                       // If the UI has asked for auto zoomout
       
   229     TBool       iSurfSessionConnected;              // If surface session is connected
       
   230 	TBool iShiftToCloning;
       
   231     TBool       iShwFsThumbnail;                    // If the Fs thumbnail is to be shown before decoding HD images
       
   232     TBool       iIsNonJpeg;                         // If the item is non jpeg
       
   233 
       
   234 #ifdef _DEBUG
       
   235     TTime iStartTime;
       
   236     TTime iStopTime;
       
   237 #endif   
       
   238 	// The bitmap index in the array of bitmaps
       
   239     enum {
       
   240         EFSBitmapIndex = 0,
       
   241         EJpgDecodedBitmapIndex,
       
   242 		ENonJpgDecodedBitmapIndex
       
   243         };
       
   244     };
       
   245 #endif /* GLXHDMISURFACEUPDATER_H_ */