imagehandlingutilities/thumbnailmanager/plugins/audio/inc/thumbnailimagedecoderv3.h
changeset 0 2014ca87e772
child 5 82749d516180
equal deleted inserted replaced
-1:000000000000 0:2014ca87e772
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  Image thumbnail decoder.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef THUMBNAILIMAGEDECODERV3_H
       
    20 #define THUMBNAILIMAGEDECODERV3_H
       
    21 
       
    22 #include "thumbnailprovider.h"
       
    23 
       
    24 class CImageDecoder;
       
    25 class CFbsBitmap;
       
    26 
       
    27 // Size of buffer to load from file start to get EXIF thumbnail
       
    28 const TInt KJpegLoadBufferSize = 64 * 1024;
       
    29 
       
    30 
       
    31 /**
       
    32  *  Image thumbnail decoder.
       
    33  *
       
    34  *  @since S60 v5.0
       
    35  */
       
    36 class CThumbnailImageDecoderv3: public CActive
       
    37     {
       
    38 public:
       
    39 
       
    40     /**
       
    41      * C++ default constructor
       
    42      *
       
    43      * @since S60 v5.0
       
    44      * @param aFs File server session
       
    45      * @return New image thumbnail decoder instance.
       
    46      */
       
    47     CThumbnailImageDecoderv3( RFs& aFs );
       
    48 
       
    49     /**
       
    50      * Destructor
       
    51      *
       
    52      * @since S60 v5.0
       
    53      */
       
    54     virtual ~CThumbnailImageDecoderv3();
       
    55 
       
    56 
       
    57     /**
       
    58      * Creates a decoder from the given image buffer and gets image
       
    59      * information
       
    60      *
       
    61      * @since S60 v5.0
       
    62      * @param aBuffer Source image buffer.
       
    63      * @param aObserver Observer to relay notifications about completed
       
    64      *                  operations.
       
    65      * @param aFlags Decoding option flags.
       
    66      * @param aMimeType Mime-type of image to be decoded.
       
    67      * @param aSize desired size of thumbnail.
       
    68      */    
       
    69     void CreateL( const TDesC8* aBuffer, MThumbnailProviderObserver&
       
    70         aObserver, const CThumbnailManager::TThumbnailFlags aFlags, const
       
    71         TDataType& aMimeType, const TSize& aSize );    
       
    72     
       
    73     /**
       
    74      * Decode image.
       
    75      *
       
    76      * @since S60 v5.0
       
    77      * @param aDisplayMode Preferred display mode.
       
    78      */
       
    79     void DecodeL( const TDisplayMode aDisplayMode );
       
    80 
       
    81     /**
       
    82      * Returns the size of original image.
       
    83      *
       
    84      * @since S60 v5.0
       
    85      * @return Size of original image.
       
    86      */
       
    87     const TSize& OriginalSize()const;
       
    88 
       
    89 private:
       
    90     /**
       
    91      * Used to release reserved resources.
       
    92      *
       
    93      * @since S60 v5.0
       
    94      */
       
    95     void Release();
       
    96 
       
    97     /**
       
    98      * Implements cancellation of an outstanding request.
       
    99      *
       
   100      * @since S60 v5.0
       
   101      */
       
   102     void DoCancel();
       
   103 
       
   104     /**
       
   105      * Handles an active object's request completion event.
       
   106      *
       
   107      * @since S60 v5.0
       
   108      */
       
   109     void RunL();
       
   110 
       
   111 
       
   112     /**
       
   113      * Creates image decoder to be used.
       
   114      *
       
   115      * @since S60 v5.0
       
   116      */
       
   117     void CreateDecoderL();
       
   118 
       
   119    
       
   120 
       
   121 private:
       
   122     // data
       
   123 
       
   124     /**
       
   125      * Requested size.
       
   126      */
       
   127     TSize iSize;
       
   128 
       
   129     /**
       
   130      * Image decoder.
       
   131      * Own.
       
   132      */
       
   133     CImageDecoder* iDecoder;
       
   134 
       
   135     /**
       
   136      * Decoded bitmap.
       
   137      * Own.
       
   138      */
       
   139     CFbsBitmap* iBitmap;
       
   140 
       
   141     /**
       
   142      * Image info flags (from TFrameInfo)
       
   143      */
       
   144     TUint32 iFrameInfoFlags;
       
   145 
       
   146     /**
       
   147      * Original size of the image in pixels.
       
   148      */
       
   149     TSize iOriginalSize;
       
   150 
       
   151     /**
       
   152      * Used fileserver.
       
   153      */
       
   154     RFs& iFs;
       
   155 
       
   156 
       
   157     /**
       
   158      * Buffer from which thumbnail is to be created.
       
   159      */    
       
   160     const TDesC8* iBuffer;
       
   161 
       
   162     /**
       
   163      * Observer.
       
   164      */
       
   165     MThumbnailProviderObserver* iObserver; // not own
       
   166 
       
   167     /**
       
   168      * Mime-type.
       
   169      */
       
   170     TDataType iMimeType;
       
   171 };
       
   172 
       
   173 #endif // THUMBNAILIMAGEDECODERV3_H