diff -r 000000000000 -r 71ca22bcf22a mmserv/thumbnailengine/TneProcessorInc/TNEProcessor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/thumbnailengine/TneProcessorInc/TNEProcessor.h Tue Feb 02 01:08:46 2010 +0200 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Thumbnail processor interface class +* +*/ + + + + +#ifndef __TNEPROCESSOR_H__ +#define __TNEPROCESSOR_H__ + +#include +#include +#include + +#include + +/* + * Forward declarations. + */ +class CTNEProcessorImpl; + +// @@ YHK Do we need this observer +// probably dont need it +class MTNEMovieProcessingObserver; + +/** + * Video processor. + */ +class CTNEProcessor : public CBase + { +public: + + /** + * Constructors for instantiating new video processors. + * Should reserve as little resources as possible at this point. + */ + static CTNEProcessor* NewL(); + static CTNEProcessor* NewLC(); + + /** + * Destructor can be called at any time (i.e., also in the middle of a processing operation). + * Should release all allocated resources, including releasing all allocated memory and + * *deleting* all output files that are currently being processed but not yet completed. + */ + virtual ~CTNEProcessor(); + + /** + * Read the header from the specified video clip file and return its properties. + * The file should be opened with EFileShareReadersOnly share mode. + * + * Possible leave codes: + * - KErrNoMemory if memory allocation fails + * - KErrNotFound if there is no file with the specified name + * in the specified directory (but the directory exists) + * - KErrPathNotFound if the specified directory + * does not exist + * - KErrUnknown if the specified file is of unknown format + * + * @param aFileHandle file handle to read + * @param aVideoFormat for returning the video format + * @param aVideoType for returning the video type + * @param aResolution for returning the resolution + * @param aVideoFrameCount for returning the number of video frames + */ + void GetVideoClipPropertiesL(RFile& aFileHandle, + TTNEVideoFormat& aFormat, + TTNEVideoType& aVideoType, + TSize& aResolution, + TInt& aVideoFrameCount); + + + /** + * Do all initializations necessary to start generating a thumbnail, e.g. open files, + * allocate memory. The video clip file should be opened with EFileShareReadersOnly + * share mode. The thumbnail should be scaled to the specified resolution and + * converted to the specified display mode. If this method leaves, destructor should be called to free + * allocated resources. + * + * Possible leave codes: + * - KErrNoMemory if memory allocation fails + * - KErrNotFound if there is no file with the specified name + * in the specified directory (but the directory exists) + * - KErrPathNotFound if the specified directory + * does not exist + * - KErrUnknown if the specified file is of unknown format + * - KErrNotSupported if the specified combination of parameters + * is not supported + * + * @param aFileName name of the file to generate thumbnail from + * @param aIndex Frame index for selecting the thumbnail frame + * -1 means the best thumbnail is retrieved + * @param aResolution resolution of the desired thumbnail bitmap, or + * NULL if the thumbnail should be + * in the original resolution + * @param aDisplayMode desired display mode; or ENone if + * any display mode is acceptable + * @param aEnhance apply image enhancement algorithms to improve + * thumbnail quality; note that this may considerably + * increase the processing time needed to prepare + * the thumbnail + */ + void StartThumbL(RFile& aFileHandle, TInt aIndex, TSize aResolution, + TDisplayMode aDisplayMode, TBool aEnhance); + + /** + * Starts thumbnail generation. Thumbnail generation is an asynchronous operation, + * and its completion is informed to the caller via Active object request completion; + * the iStatus member of the caller is passed as a parameter to this method. + * + * This method may leave if an error occurs in initiating the thumbnail generation. + * If this method leaves, destructor should be called to free allocated resources. + * + * @param aStatus Reference to caller's iStatus member variable + * + * @return + * + */ + void ProcessThumbL(TRequestStatus &aStatus); + + /** + * Method for retrieving the completed thumbnail bitmap. + * + * Video processor should not free the CFbsBitmap instance after it has passed it on + * as a return value of this function + * + */ + void FetchThumb(CFbsBitmap*& aThumb); + + +protected: + CTNEProcessor(); + + void ConstructL(); + +private: + TInt iThumbProgress; + CTNEProcessorImpl* iTNEProcessor; + + }; + + +#endif // __TNEPROCESSOR_H__ +