mmserv/thumbnailengine/TneProcessorInc/TNEProcessor.h
changeset 0 71ca22bcf22a
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 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:   Thumbnail processor interface class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __TNEPROCESSOR_H__
       
    22 #define __TNEPROCESSOR_H__
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <e32std.h>
       
    26 #include <gdi.h>
       
    27 
       
    28 #include <TNECommon.h>
       
    29 
       
    30 /*
       
    31  * Forward declarations.
       
    32  */
       
    33 class CTNEProcessorImpl;
       
    34 
       
    35 // @@ YHK Do we need this observer
       
    36 // probably dont need it
       
    37 class MTNEMovieProcessingObserver;
       
    38 
       
    39 /**
       
    40  * Video processor.
       
    41  */
       
    42 class CTNEProcessor : public CBase
       
    43 	{
       
    44 public:
       
    45 
       
    46 	/** 
       
    47 	 * Constructors for instantiating new video processors.
       
    48 	 * Should reserve as little resources as possible at this point.
       
    49 	 */
       
    50 	static CTNEProcessor* NewL();
       
    51 	static CTNEProcessor* NewLC();
       
    52 
       
    53 	/** 
       
    54 	 * Destructor can be called at any time (i.e., also in the middle of a processing operation).
       
    55 	 * Should release all allocated resources, including releasing all allocated memory and 
       
    56 	 * *deleting* all output files that are currently being processed but not yet completed.
       
    57 	 */
       
    58 	virtual ~CTNEProcessor();
       
    59 
       
    60     /**
       
    61 	 * Read the header from the specified video clip file and return its properties.
       
    62 	 * The file should be opened with EFileShareReadersOnly share mode.
       
    63 	 *
       
    64 	 * Possible leave codes:
       
    65 	 *	- <code>KErrNoMemory</code> if memory allocation fails
       
    66 	 *	- <code>KErrNotFound</code> if there is no file with the specified name
       
    67 	 *    in the specified directory (but the directory exists)
       
    68 	 *	- <code>KErrPathNotFound</code> if the specified directory
       
    69 	 *    does not exist
       
    70 	 *	- <code>KErrUnknown</code> if the specified file is of unknown format
       
    71 	 *
       
    72 	 * @param aFileHandle           file handle to read
       
    73 	 * @param aVideoFormat          for returning the video format
       
    74 	 * @param aVideoType            for returning the video type
       
    75 	 * @param aResolution           for returning the resolution
       
    76 	 * @param aVideoFrameCount      for returning the number of video frames
       
    77 	 */
       
    78 	void GetVideoClipPropertiesL(RFile& aFileHandle,
       
    79 		                         TTNEVideoFormat& aFormat,
       
    80 								 TTNEVideoType& aVideoType, 
       
    81 								 TSize& aResolution,
       
    82 								 TInt& aVideoFrameCount);
       
    83 	
       
    84 
       
    85 	/**
       
    86 	 * Do all initializations necessary to start generating a thumbnail, e.g. open files, 
       
    87 	 * allocate memory. The video clip file should be opened with EFileShareReadersOnly 
       
    88 	 * share mode. The thumbnail should be scaled to the specified resolution and 
       
    89 	 * converted to the specified display mode. If this method leaves, destructor should be called to free 
       
    90 	 * allocated resources.
       
    91 	 * 
       
    92 	 * Possible leave codes:
       
    93 	 *	- <code>KErrNoMemory</code> if memory allocation fails
       
    94 	 *	- <code>KErrNotFound</code> if there is no file with the specified name
       
    95 	 *    in the specified directory (but the directory exists)
       
    96 	 *	- <code>KErrPathNotFound</code> if the specified directory
       
    97 	 *    does not exist
       
    98 	 *	- <code>KErrUnknown</code> if the specified file is of unknown format
       
    99 	 *  - <code>KErrNotSupported</code> if the specified combination of parameters
       
   100 	 *                                  is not supported
       
   101 	 *
       
   102 	 * @param aFileName  name of the file to generate thumbnail from
       
   103      * @param aIndex       Frame index for selecting the thumbnail frame
       
   104      *                     -1 means the best thumbnail is retrieved
       
   105  	 * @param aResolution  resolution of the desired thumbnail bitmap, or
       
   106 	 *                     <code>NULL</code> if the thumbnail should be
       
   107 	 *                     in the original resolution
       
   108 	 * @param aDisplayMode desired display mode; or <code>ENone</code> if 
       
   109 	 *                     any display mode is acceptable
       
   110 	 * @param aEnhance	   apply image enhancement algorithms to improve
       
   111 	 *                     thumbnail quality; note that this may considerably
       
   112 	 *                     increase the processing time needed to prepare
       
   113 	 *                     the thumbnail
       
   114 	 */
       
   115 	void StartThumbL(RFile& aFileHandle, TInt aIndex, TSize aResolution, 
       
   116 					 TDisplayMode aDisplayMode, TBool aEnhance);	
       
   117 	
       
   118      /**
       
   119 	 * Starts thumbnail generation. Thumbnail generation is an asynchronous operation,
       
   120 	 * and its completion is informed to the caller via Active object request completion;
       
   121 	 * the iStatus member of the caller is passed as a parameter to this method.
       
   122 	 *
       
   123 	 * This method may leave if an error occurs in initiating the thumbnail generation.	
       
   124 	 * If this method leaves, destructor should be called to free allocated resources.	
       
   125 	 * 
       
   126 	 * @param aStatus     Reference to caller's iStatus member variable
       
   127 	 *
       
   128 	 * @return  
       
   129 	 *          
       
   130 	 */
       
   131 	void ProcessThumbL(TRequestStatus &aStatus);
       
   132 	
       
   133 	/** 
       
   134 	 * Method for retrieving the completed thumbnail bitmap.
       
   135 	 * 
       
   136 	 * Video processor should not free the CFbsBitmap instance after it has passed it on 
       
   137 	 * as a return value of this function 
       
   138 	 *	 
       
   139 	 */
       
   140 	void FetchThumb(CFbsBitmap*& aThumb);
       
   141 
       
   142 
       
   143 protected:
       
   144 	CTNEProcessor();
       
   145 
       
   146 	void ConstructL();
       
   147 
       
   148 private:
       
   149 	TInt iThumbProgress;
       
   150 	CTNEProcessorImpl* iTNEProcessor;
       
   151 	
       
   152 	};
       
   153 
       
   154 
       
   155 #endif // __TNEPROCESSOR_H__
       
   156