tvout/tvoutengine/inc/glxhdmisurfaceupdater.h
changeset 55 fb37077c270f
parent 36 6481344a6d67
child 69 45459746d5e8
equal deleted inserted replaced
49:f291796e213d 55:fb37077c270f
    37     {
    37     {
    38 public:
    38 public:
    39     virtual void DoGenCallback() = 0;
    39     virtual void DoGenCallback() = 0;
    40     };
    40     };
    41 
    41 
       
    42 /**
       
    43  * Class Description
       
    44  * This is the main class which processes images to the surface
       
    45  *
       
    46  */        
       
    47 
    42 class CGlxHdmiSurfaceUpdater: public CBase
    48 class CGlxHdmiSurfaceUpdater: public CBase
    43     {
    49     {
    44 public:
    50 public:
    45     /*
    51     /**
    46      * NewL
    52      * NewL
       
    53      * @param aWindow RWindow
       
    54      * @param aImageFile Image File path
       
    55      * @param aFsBitmap Fullscreen bitmap (if FS not available,make sure to send grid or default bitmap
       
    56      * else it would appear white screen on TV )
       
    57      * @param aCallBack MGlxGenCallback instance
       
    58      * @param aEffectsOn If Effects should be on
    47      */
    59      */
    48     static CGlxHdmiSurfaceUpdater* NewL(RWindow* aWindow, const TDesC& aImageFile, 
    60     static CGlxHdmiSurfaceUpdater* NewL(RWindow* aWindow, const TDesC& aImageFile, 
    49             CFbsBitmap* aFsBitmap, MGlxGenCallback* aCallBack,TBool aEffectsOn);
    61             CFbsBitmap* aFsBitmap, MGlxGenCallback* aCallBack,TBool aEffectsOn);
    50 
    62 
    51     /*
    63     /**
    52      * Destructor
    64      * Destructor
    53      */
    65      */
    54     ~CGlxHdmiSurfaceUpdater();
    66     ~CGlxHdmiSurfaceUpdater();
    55 
    67 
    56 public:
    68 public:
    57     /*
    69     /**
    58      * This is to cancel the active object from decoding 
    70      * This is to cancel the active object from decoding 
    59      */
    71      */
    60     void HandleRunL(TRequestStatus& aStatus);
    72     void HandleRunL(TRequestStatus& aStatus);
    61 
    73 
    62     /*
    74     /**
    63      * This updates the new image.
    75      * This updates the new image.
       
    76      * @param aImageFile image path
       
    77      * @param aFsBitmap Fullscreen Bitmap
       
    78      * 
       
    79      * NOTE : if FS not available,make sure to send grid or default bitmap
       
    80      * else it would appear white screen on TV 
    64      */
    81      */
    65     void UpdateNewImageL(const TDesC& aImageFile,CFbsBitmap* aFsBitmap);
    82     void UpdateNewImageL(const TDesC& aImageFile,CFbsBitmap* aFsBitmap);
    66 
    83 
    67     /*
    84     /**
    68      * Activate Zoom 
    85      * Activate Zoom 
       
    86      * @param aAutoZoomOut if it should auto zoom out
    69      */
    87      */
    70     void ActivateZoom(TBool aAutoZoomOut);
    88     void ActivateZoom(TBool aAutoZoomOut);
    71     /*
    89     
       
    90     /**
    72      * Deactivate Zoom 
    91      * Deactivate Zoom 
    73      */
    92      */
    74     void DeactivateZoom();
    93     void DeactivateZoom();
    75 
    94 
    76     /*
    95     /**
    77 	ShiftToCloningMOde
    96      * ShiftToCloningMOde
    78      */
    97      */
    79     void ShiftToCloningMode();
    98     void ShiftToCloningMode();
    80 
    99 
    81     /*
   100     /**
    82 	ShiftToPostingMode
   101      * ShiftToPostingMode
    83      */
   102      */
    84     void ShiftToPostingMode();
   103     void ShiftToPostingMode();
    85 
   104 
    86     /*
   105     /**
    87      * Fadeing of the Surface
   106      * Fadeing of the Surface
    88      * @param1 ETrue - FadeIn ( as in gaining brightness )
   107      * @param aFadeInOut ETrue - FadeIn ( as in gaining brightness )
    89      *         EFalse - FadeOut ( as in loosing brightness ) 
   108      *                   EFalse - FadeOut ( as in loosing brightness ) 
    90      */
   109      */
    91     void FadeTheSurface(TBool aFadeInOut);
   110     void FadeTheSurface(TBool aFadeInOut);
    92 
   111 
    93 private:
   112 private:
    94     /*
   113     /**
    95      * Constructor 
   114      * Constructor 
       
   115      * @param aWindow RWindow
       
   116      * @param aCallBack MGlxGenCallback instance
       
   117      * @param aEffectsOn if effects should be on
    96      */
   118      */
    97     CGlxHdmiSurfaceUpdater(RWindow* aWindow, MGlxGenCallback* aCallBack,TBool aEffectsOn);
   119     CGlxHdmiSurfaceUpdater(RWindow* aWindow, MGlxGenCallback* aCallBack,TBool aEffectsOn);
    98 
   120 
    99     /*
   121     /**
   100      * ConstructL()
   122      * ConstructL
       
   123      * @param aFsBitmap Fullscreen Bitmap
       
   124      * @param aImageFile image file path
   101      */
   125      */
   102     void ConstructL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);   
   126     void ConstructL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);   
   103 
   127 
   104     /*
   128     /**
   105      * Create a New surface with given size
   129      * Create a New surface with given size
   106      */
   130      */
   107     void CreateSurfaceL();
   131     void CreateSurfaceL();
   108     /*
   132 
   109      * @param1 size 
   133     /**
       
   134      * MapSurfaceL
   110      */
   135      */
   111     void MapSurfaceL();
   136     void MapSurfaceL();
   112 
   137 
   113     /*
   138     /**
   114      * This fundtion wont be called , could be used if double buffering is planned in future
   139      * This fundtion wont be called , could be used if double buffering is planned in future
   115      * to start the second decoder AO and update the surface with a new session. 
   140      * to start the second decoder AO and update the surface with a new session. 
   116      */
   141      */
   117     static TInt SurfBuffer0Ready(TAny* aObject);    
   142     static TInt SurfBuffer0Ready(TAny* aObject);    
   118     
   143     
   119     /*
   144     /**
   120      * Call a refresh on the screen  
   145      * Call a refresh on the screen  
   121      */
   146      */
   122     void Refresh();
   147     void Refresh();
   123 
   148 
   124     /*
   149     /**
   125      * Dump the buffer on to the surface stride 
   150      * Dump the buffer on to the surface stride 
   126      */
   151      */
   127     void SwapBuffers();
   152     void SwapBuffers();
   128 
   153 
   129     /*
   154     /**
   130      * Release contents 
   155      * Release contents 
   131      */
   156      */
   132     void ReleaseContent();
   157     void ReleaseContent();
   133 
   158 
   134     /*
   159     /**
   135      * Create bitmap  
   160      * Create bitmap  
   136      */
   161      */
   137     void CreateBitmapL();
   162     void CreateBitmapL();
   138 
   163 
   139     /*
   164     /**
   140      * Create an image decoder with given file
   165      * Create an image decoder with given file
   141      * @param1 - Image file 
       
   142      */
   166      */
   143     void CreateImageDecoderL();
   167     void CreateImageDecoderL();
   144 
   168 
   145     /*
   169     /**
   146      * Creating all enablers for HDMI
   170      * Creating all enablers for HDMI
   147      * @param1 if creating a surface is required, 
   171      * @param aCreateSurface if creating a surface is required, 
   148      * by default it is not required
   172      *                       by default it is not required
   149      */
   173      */
   150     void CreateHdmiL(TBool aCreateSurface = ETrue);
   174     void CreateHdmiL(TBool aCreateSurface = ETrue);
   151 
   175 
   152     /*
   176     /**
   153      * Zoom in our out depending on parameter 
   177      * Zoom in our out depending on parameter 
       
   178      * @param aZoom if should be zoomed
   154      */
   179      */
   155     void Zoom(TBool aZoom);
   180     void Zoom(TBool aZoom);
   156 
   181 
   157     /*
   182     /**
   158      * This if for zoom timer timeout
   183      * This if for zoom timer timeout
   159      */
   184      */
   160     static TInt TimeOut(TAny* aSelf);
   185     static TInt TimeOut(TAny* aSelf);
   161     
   186     
   162     /*
   187     /**
   163      * Animation time out timer
   188      * Animation time out timer
   164      */
   189      */
   165     static TInt AnimationTimeOut(TAny* aSelf);
   190     static TInt AnimationTimeOut(TAny* aSelf);
   166     
   191     
   167     /*
   192     /**
   168      * ModifySurface positions of the surface to be displayed on screen
   193      * ModifySurface positions of the surface to be displayed on screen
   169      */
   194      */
   170     void ModifySurfacePostion();
   195     void ModifySurfacePostion();
   171 
   196 
   172     /*
   197     /**
   173      * Process the image for TV 
   198      * Process the image for TV 
   174      */
   199      */
   175     void ProcessTvImage();
   200     void ProcessTvImage();
   176 
   201 
   177     /*
   202     /**
   178      * Shows the FS thumbnail first before showing 
   203      * Shows the FS thumbnail first before showing 
   179      * Decoded HD image 
   204      * Decoded HD image 
   180      */
   205      */
   181     void ShowFsThumbnailL();
   206     void ShowFsThumbnailL();
   182 
   207 
   183     /*
   208     /**
   184      * Recalculate the size for png/bmp as decoder fails to 
   209      * Recalculate the size for png/bmp as decoder fails to 
   185      * decode for desired size 
   210      * decode for desired size 
       
   211      * @return the Size of the desired image supported by the decoder 
   186      */
   212      */
   187     TSize ReCalculateSizeL();
   213     TSize ReCalculateSizeL();
   188 
   214 
   189     /*
   215     /**
   190      * If the image format is non jpeg, then we need to calculate as per
   216      * If the image format is non jpeg, then we need to calculate as per
   191      * reduction factor and reduced size as what the decoder is going to return us
   217      * reduction factor and reduced size as what the decoder is going to return us
   192      * This function returns if that needs to be done. 
   218      * This function returns if that needs to be done. 
       
   219      * 
       
   220      * @return check the image mime type and return True if the recaulation of size needs
       
   221      * to be done else return false 
   193      */
   222      */
   194     TBool DoesMimeTypeNeedsRecalculateL();
   223     TBool DoesMimeTypeNeedsRecalculateL();
   195 
   224 
   196     /*
   225     /**
   197      * If the image format is non jpeg, then we need to scale the bitmap after it is
   226      * If the image format is non jpeg, then we need to scale the bitmap after it is
   198      * decoded, as the return value would not fit the screen 
   227      * decoded, as the return value would not fit the screen
       
   228      * @param  
   199      */
   229      */
   200     void ScaleDecodedBitmapL(TInt aBitmapIndex);
   230     void ScaleDecodedBitmapL(TInt aBitmapIndex);
   201 
   231 
   202     /*
   232     /**
   203      * InitiateHDMI
   233      * InitiateHDMI
       
   234      * @param aFsBitmap Fullscreen Bitmap  
       
   235      * @param aImageFile Image path
   204      */
   236      */
   205     void InitiateHdmiL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);
   237     void InitiateHdmiL(CFbsBitmap* aFsBitmap,const TDesC& aImageFile);
   206 
   238 
   207     /*
   239     /**
   208      * Animate untill loop is complete 
   240      * Animate untill loop is complete 
   209      */
   241      */
   210     void Animate();
   242     void Animate();
   211 
   243 
   212 private:
   244 private:
   213     RWindow*            iWindow;                    // window object
   245     /// window object
   214     CFbsBitmap*         iFsBitmap;                  // FS bitmap
   246     RWindow*            iWindow;                    
   215     MGlxGenCallback*    iCallBack;                  // callback to the HdmiContainer window
   247     /// FS bitmap
   216     HBufC*              iImagePath;                 // To store the image uri path
   248     CFbsBitmap*         iFsBitmap;                  
       
   249     /// callback to the HdmiContainer window
       
   250     MGlxGenCallback*    iCallBack;                  
       
   251     /// To store the image uri path
       
   252     HBufC*              iImagePath;                 
   217     TBool               iEffectsOn;
   253     TBool               iEffectsOn;
   218 
   254 
   219     TBool       iShwFsThumbnail;                    // If the Fs thumbnail is to be shown before decoding HD images
   255     /// If the Fs thumbnail is to be shown before decoding HD images
   220     TBool       iIsNonJpeg;                         // If the item is non jpeg
   256     TBool       iShwFsThumbnail;                    
   221     TBool       iFadeIn;                            // If FadeIn or Out for only SLideshow animation
   257     /// If the item is non jpeg
   222     
   258     TBool       iIsNonJpeg;                         
   223     // GCE Surface
   259     /// If FadeIn or Out for only SLideshow animation
       
   260     TBool       iFadeIn;                            
       
   261     
       
   262     /// GCE Surface
   224     RSurfaceUpdateSession iSurfUpdateSession;
   263     RSurfaceUpdateSession iSurfUpdateSession;
   225     TSurfaceId              iSurfId;                // TSurfaceId                             
   264     /// TSurfaceId
   226     RSurfaceManager*        iSurfManager;           // RSurfaceManager
   265     TSurfaceId              iSurfId;                                             
   227     RChunk*                 iSurfChunk;             // RChunk
   266     /// RSurfaceManager
   228     TInt                    iSurfaceStride;         // surface stride
   267     RSurfaceManager*        iSurfManager;           
   229     TSurfaceConfiguration   iConfig;                // surface configuration for zoom
   268     /// RChunk
   230 
   269     RChunk*                 iSurfChunk;             
   231     CFbsBitmap*         iDecodedBitmap[3];          // Array of Decoded bitmaps of the focussed image
   270     /// surface stride
   232                                                     // 1 - contains FS/Grid Thumbnail, 2- HD image, 
   271     TInt                    iSurfaceStride;         
   233                                                     // (optional)3-Scaled png/bmp images
   272     /// surface configuration for zoom
   234 
   273     TSurfaceConfiguration   iConfig;                
   235     void*               iSurfBuffer;               // Surface buffer
   274 
   236     CGlxActiveCallBack* iSurfBufferAO;             // Surface buffer AO 
   275     /** Array of Decoded bitmaps of the focussed image
       
   276      * 1 - contains FS/Grid Thumbnail, 2- HD image,
       
   277      * (optional)3-Scaled png/bmp images 
       
   278      */
       
   279     CFbsBitmap*         iDecodedBitmap[3];         
       
   280 
       
   281     /// Surface buffer
       
   282     void*               iSurfBuffer;               
       
   283     /// Surface buffer AO
       
   284     CGlxActiveCallBack* iSurfBufferAO;              
   237 
   285 
   238     CAlfCompositionSource* ialfCompositionSurface;
   286     CAlfCompositionSource* ialfCompositionSurface;
   239 
   287 
   240     //ICL
   288     /// Internal Image decoder AO
   241     CGlxHdmiDecoderAO*  iGlxDecoderAO;              // Internal Image decoder AO              
   289     CGlxHdmiDecoderAO*  iGlxDecoderAO;                            
   242     CImageDecoder*      iImageDecoder;              // Image Decoder
   290     /// Image Decoder
   243     RFs                 iFsSession;                 // RFs
   291     CImageDecoder*      iImageDecoder;              
   244 
   292     /// RFs
   245     TPoint      iLeftCornerForZoom;                 //  
   293     RFs                 iFsSession;                 
   246     CPeriodic*  iTimer;                             // Timer for Zoom 
   294 
   247     CPeriodic*  iAnimTimer;                         // Timer for Animation
   295     TPoint      iLeftCornerForZoom;                   
       
   296     /// Timer for Zoom
       
   297     CPeriodic*  iTimer;                              
       
   298     /// Timer for Animation
       
   299     CPeriodic*  iAnimTimer;                         
   248     TInt        iAnimCounter;
   300     TInt        iAnimCounter;
   249 
   301 
   250     // Various objects to store sizes and count
   302     /// Various objects to store sizes and count
   251     TSize       iTvScreenSize;                      // to store the Tv screen size
   303     /// to store the Tv screen size
   252     TSize       iTargetBitmapSize;                  // To Store the target bitmap size to display(as per Aspect Ratio)
   304     TSize       iTvScreenSize;                      
   253     
   305     /// To Store the target bitmap size to display(as per Aspect Ratio)
   254     // Various flags to store values
   306     TSize       iTargetBitmapSize;                  
   255     TBool       iZoom;                              // Is zoomed
   307     
   256     TBool       iBitmapReady;                       // If the bitmap is decoded and ready
   308     /// Various flags to store values
   257     TBool       iAutoZoomOut;                       // If the UI has asked for auto zoomout
   309     /// Is zoomed
   258     TBool       iSurfSessionConnected;              // If surface session is connected
   310     TBool       iZoom;                              
       
   311     /// If the bitmap is decoded and ready
       
   312     TBool       iBitmapReady;                       
       
   313     /// If the UI has asked for auto zoomout
       
   314     TBool       iAutoZoomOut;                       
       
   315     /// If surface session is connected
       
   316     TBool       iSurfSessionConnected;            
       
   317     /// If it is set to shift to cloning mode
   259 	TBool       iShiftToCloning;
   318 	TBool       iShiftToCloning;
   260 #ifdef _DEBUG
   319 #ifdef _DEBUG
   261     TTime iStartTime;
   320     TTime iStartTime;
   262     TTime iStopTime;
   321     TTime iStopTime;
   263 #endif   
   322 #endif   
   264 	// The bitmap index in the array of bitmaps
   323 	/// The bitmap index in the array of bitmaps
   265     enum {
   324     enum {
   266         EFSBitmapIndex = 0,
   325         EFSBitmapIndex = 0,
   267         EJpgDecodedBitmapIndex,
   326         EJpgDecodedBitmapIndex,
   268 		ENonJpgDecodedBitmapIndex
   327 		ENonJpgDecodedBitmapIndex
   269         };
   328         };