engine/collectionframework/thumbnailcreator/inc/glxtnquickthumbnailtask.h
changeset 71 27f2d7aec52a
parent 69 45459746d5e8
child 72 0a8e959402e5
equal deleted inserted replaced
69:45459746d5e8 71:27f2d7aec52a
     1 /*
       
     2 * Copyright (c) 2006-2006 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:   Quick thumbnail generation task.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  * @internal reviewed 30/07/2007 by Simon Brooks
       
    22  */
       
    23 
       
    24 #ifndef C_GLXTNQUICKTHUMBNAILTASK_H
       
    25 #define C_GLXTNQUICKTHUMBNAILTASK_H
       
    26 
       
    27 #include "glxtnloadthumbnailtask.h"
       
    28 #include "glxthumbnailinfo.h"
       
    29 
       
    30 // Forward declarations
       
    31 class CGlxtnFileUtility;
       
    32 class CGlxtnVideoUtility;
       
    33 class CFbsBitmap;
       
    34 
       
    35 /**
       
    36  * Task to quickly produce a thumbnail for an item, usually from the EXIF
       
    37  * thumbnail.
       
    38  *
       
    39  * The task first attempts to extract the EXIF thumbnail data from the file
       
    40  * using ExifLib.  If this succeeds, an instance of CImageDecoder is constructed
       
    41  * from the data and used to produce a bitmap.
       
    42  *
       
    43  * If this fails, an instance of CImageDecoder is constructed from the file,
       
    44  * and set to use the thumbnail.  If this fails, it is assumed that there is no
       
    45  * EXIF thumbnail in the file, and the decoder is set to scale the main image
       
    46  * as close as possible to the required thumbnail size.
       
    47  *
       
    48  * No scaling or image enhancement is applied to the decoded bitmap.
       
    49  *
       
    50  * @author Dan Rhodes
       
    51  * @ingroup glx_thumbnail_creator
       
    52  */
       
    53 NONSHARABLE_CLASS( CGlxtnQuickThumbnailTask ) : public CGlxtnLoadThumbnailTask
       
    54     {
       
    55 public:
       
    56     /**
       
    57     * Two-phased constructor.
       
    58     * @param aRequestInfo Parameters for the thumbnail request.
       
    59     * @param aFileUtility File utility for use by the task.
       
    60     * @param aClient Client initiating the request.
       
    61     */
       
    62 	static CGlxtnQuickThumbnailTask* NewL(
       
    63         const TGlxThumbnailRequest& aRequestInfo,
       
    64         CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient);
       
    65     /**
       
    66     * Destructor.
       
    67     */
       
    68     ~CGlxtnQuickThumbnailTask();
       
    69 
       
    70 protected:  // From CGlxtnTask
       
    71 
       
    72     TBool DoStartL(TRequestStatus& aStatus);
       
    73 	void DoCancel();
       
    74 	TBool DoRunL(TRequestStatus& aStatus);
       
    75     TBool DoRunError(TInt aError);
       
    76 
       
    77 private:
       
    78     /**
       
    79     * C++ default constructor.
       
    80     * @param aRequestInfo Parameters for the thumbnail request.
       
    81     * @param aFileUtility File utility for use by the task.
       
    82     * @param aClient Client initiating the request.
       
    83     */
       
    84     CGlxtnQuickThumbnailTask(const TGlxThumbnailRequest& aRequestInfo,
       
    85         CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient);
       
    86 
       
    87     /**
       
    88     * Start asynchronous decoding process for a low quality thumbnail.
       
    89     * @param aStatus Request status for the asynchronous operation.
       
    90     */
       
    91     void QuickDecodeL(TRequestStatus& aStatus);
       
    92     /**
       
    93     * Decode an image file using thumbnail embedded in the file if possible.
       
    94     * @param aStatus Request status for the asynchronous operation.
       
    95     */
       
    96     void ReadThumbnailL(TRequestStatus& aStatus);
       
    97     /**
       
    98     * Read thumbnail data from the file using ExifLib.
       
    99     */
       
   100     void ReadExifThumbnailL();
       
   101     void QuickScaleL();
       
   102 
       
   103 private:
       
   104     /** Quality of thumbnail (high if loaded, low if generated) */
       
   105     TGlxThumbnailQuality iQuality;
       
   106     /** Utility to get thumbnail from video (owned) */
       
   107     CGlxtnVideoUtility* iUtility;
       
   108     /** Bitmap to hold video frame (owned) */
       
   109     CFbsBitmap* iVideoFrame;
       
   110     /** Whether the media file is a video */
       
   111     TBool iVideo;
       
   112     /** Flag to show BadFileMarker not created so no need to delete **/
       
   113     TBool iBadFileMarkerNotNeededFlag;
       
   114     };
       
   115 
       
   116 #endif // C_GLXTNQUICKTHUMBNAILTASK_H