mmmw_plat/thumbnail_engine_api/inc/TNEVideoClipInfo.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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __TNEVIDEOCLIPINFO_H__
       
    20 #define __TNEVIDEOCLIPINFO_H__
       
    21 
       
    22 #include "TNECommon.h"
       
    23 
       
    24 #include <gdi.h>
       
    25 
       
    26 #define KBestThumbIndex (-1) // search for best possible thumbnail from video
       
    27 
       
    28 /*
       
    29  *  Forward declarations.
       
    30  */
       
    31 class CFbsBitmap;  
       
    32 class CTNEVideoClipInfo;
       
    33 
       
    34 /**
       
    35  * Observer for notifying that video clip info
       
    36  * is ready for reading.
       
    37  *
       
    38  * @see  CTNEVideoClipInfo
       
    39  */
       
    40 class MTNEVideoClipInfoObserver 
       
    41     {
       
    42 public:
       
    43     /**
       
    44      * Called to notify that video clip info is ready
       
    45      * for reading.
       
    46      *
       
    47      * Possible error codes:
       
    48      *  - <code>KErrNotFound</code> if there is no file with the specified name
       
    49      *    in the specified directory (but the directory exists)
       
    50      *  - <code>KErrPathNotFound</code> if the specified directory
       
    51      *    does not exist
       
    52      *  - <code>KErrUnknown</code> if the specified file is of unknown format
       
    53      *
       
    54      * @param aInfo   video clip info
       
    55      * @param aError  <code>KErrNone</code> if info is ready
       
    56      *                for reading; one of the system wide
       
    57      *                error codes if reading file failed
       
    58      */
       
    59     virtual void NotifyVideoClipInfoReady(CTNEVideoClipInfo& aInfo, 
       
    60                                           TInt aError) = 0;
       
    61     };
       
    62 
       
    63 
       
    64 /**
       
    65  * Observer for notifying that video clip thumb has been completed.
       
    66  *
       
    67  * @see  CTNEVideoClipInfo
       
    68  */
       
    69 class MTNEVideoClipThumbObserver
       
    70     {
       
    71 public:
       
    72     /**
       
    73      * Called to notify that video clip thumbnail generation 
       
    74      * has been completed. 
       
    75      * 
       
    76      * @param aInfo   video clip info
       
    77      * @param aError  <code>KErrNone</code> if frame was
       
    78      *                completed successfully; one of the system wide
       
    79      *                error codes if generating frame failed
       
    80      * @param aThumb  pointer to thumb if it was generated successfully;
       
    81      *                <code>NULL</code> if generating frame failed
       
    82      */
       
    83     virtual void NotifyVideoClipThumbCompleted(CTNEVideoClipInfo& aInfo, 
       
    84                                                TInt aError, 
       
    85                                                CFbsBitmap* aThumb) = 0;
       
    86     };
       
    87 
       
    88 /**
       
    89  * Utility class for getting information about video clip.
       
    90  */
       
    91 class CTNEVideoClipInfo : public CBase
       
    92     {
       
    93 public:
       
    94 
       
    95     /* Constructors & destructor. */
       
    96 
       
    97     /**
       
    98      * Constructs a new CTNEVideoClipInfo object to get information
       
    99      * about the specified video clip file. The specified observer
       
   100      * is notified when info is ready for reading. This method
       
   101      * may leave if no resources are available to construct 
       
   102      * a new object.
       
   103      * The file will be opened in EFileShareReadersOnly mode by default, 
       
   104      * and the same mode should be used by the client too if it need to open
       
   105      * the file at the same time.
       
   106      * 
       
   107      * Possible leave codes:
       
   108      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   109      *
       
   110      * @param aFileName  name of video clip file
       
   111      * @param aObserver  observer to notify when info is ready for reading
       
   112      *
       
   113      * @return  pointer to a new CTNEVideoClipInfo instance
       
   114      */
       
   115     IMPORT_C static CTNEVideoClipInfo* NewL(const TDesC& aFileName,
       
   116                                             MTNEVideoClipInfoObserver& aObserver);
       
   117 
       
   118     IMPORT_C static CTNEVideoClipInfo* NewL(const RFile& aFileName,
       
   119                                             MTNEVideoClipInfoObserver& aObserver);
       
   120 
       
   121     /**
       
   122      * Constructs a new CTNEVideoClipInfo object to get information
       
   123      * about the specified video clip file. The constructed object
       
   124      * is left in the cleanup stack. The specified observer
       
   125      * is notified when info is ready for reading. This method
       
   126      * may leave if no resources are available to construct a new
       
   127      * object.
       
   128      * The file will be opened in EFileShareReadersOnly mode by default, 
       
   129      * and the same mode should be used by the client too if it need to open
       
   130      * the file at the same time.
       
   131      * 
       
   132      * Possible leave codes:
       
   133      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   134      *
       
   135      * @param aFileName  name of video clip file
       
   136      * @param aObserver  observer to notify when info is ready for reading
       
   137      *
       
   138      * @return  pointer to a new CTNEVideoClipInfo instance
       
   139      */
       
   140     IMPORT_C static CTNEVideoClipInfo* NewLC(const TDesC& aFileName,
       
   141                                              MTNEVideoClipInfoObserver& aObserver);
       
   142 
       
   143     IMPORT_C static CTNEVideoClipInfo* NewLC(const RFile& aFileName,
       
   144                                              MTNEVideoClipInfoObserver& aObserver);
       
   145 
       
   146     /* General property methods. */
       
   147     /**
       
   148      * Returns the file name of the clip. Panics if there is no file 
       
   149      * associated with this clip or info is not yet ready for reading.
       
   150      * 
       
   151      * @return  file name of the clip
       
   152      */
       
   153     virtual TPtrC FileName() const = 0;
       
   154     
       
   155     /* Video frame property methods. */
       
   156 
       
   157     /**
       
   158      * Returns the number of video frames in this clip. Panics if info
       
   159      * is not yet ready for reading.
       
   160      * 
       
   161      * @return  number of video frames in this clip
       
   162      */
       
   163     virtual TInt VideoFrameCount() const = 0;
       
   164 
       
   165     /* Thumbnail methods. */
       
   166 
       
   167     /**
       
   168      * Generates a bitmap of the given frame from video clip.
       
   169      * The frame bitmap is scaled to the specified resolution and converted
       
   170      * to the specified display mode. This method is asynchronous. The frame
       
   171      * is generated in background and the observer is notified when the frame
       
   172      * is complete. This method panics if info is not yet ready for reading or 
       
   173      * the resolution is illegal.
       
   174      * 
       
   175      * Possible leave codes:
       
   176      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   177      *  - <code>KErrNotSupported</code>, if the specified combination of 
       
   178      *                                   parameters is not supported
       
   179      *
       
   180      * @param aObserver    observer to be notified when the frame is completed
       
   181      * @param aIndex       index of frame, or KFrameIndexBestThumb to look for
       
   182      *                     most suitable thumbnail frame.
       
   183      * @param aResolution  resolution of the desired frame bitmap, or
       
   184      *                     <code>NULL</code> if the frame should be
       
   185      *                     in the original resolution
       
   186      * @param aDisplayMode desired display mode; or <code>ENone</code> if 
       
   187      *                     any display mode is acceptable
       
   188      * @param aEnhance     apply image enhancement algorithms to improve
       
   189      *                     frame quality; note that this may considerably
       
   190      *                     increase the processing time needed to prepare
       
   191      *                     the frame
       
   192      * @param aPriority    priority of the frame generation
       
   193      */
       
   194     virtual void GetThumbL(MTNEVideoClipThumbObserver& aObserver,
       
   195                             TInt aIndex = KBestThumbIndex,
       
   196                             TSize* const aResolution = 0,
       
   197                             TDisplayMode aDisplayMode = ENone,
       
   198                             TBool aEnhance = EFalse,
       
   199                             TInt aPriority = CActive::EPriorityIdle) = 0;
       
   200     
       
   201     /**
       
   202      * Cancels frame generation. If no frame is currently being 
       
   203      * generated, the function does nothing.
       
   204      */
       
   205     virtual void CancelThumb() = 0;
       
   206 
       
   207     };
       
   208 
       
   209 
       
   210 
       
   211 #endif // __TNEVIDEOCLIPINFO_H__
       
   212