mmshplugins/mmcctranscoder/tsrc/stubs/inc/vedvideoclipinfo.h
changeset 22 496ad160a278
parent 0 f0cf47e981f9
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2003 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 __VEDVIDEOCLIPINFO_H__
       
    20 #define __VEDVIDEOCLIPINFO_H__
       
    21 
       
    22 #include "VedCommon.h"
       
    23 
       
    24 #include <gdi.h>
       
    25 
       
    26 #define KFrameIndexBestThumb (-1) // search for best possible thumbnail from video
       
    27 
       
    28 /*
       
    29  *  Forward declarations.
       
    30  */
       
    31 class CFbsBitmap;  
       
    32 class CVedVideoClipInfo;
       
    33 class CVedVideoClipGenerator;
       
    34 
       
    35 /**
       
    36  * Observer for notifying that video clip info
       
    37  * is ready for reading.
       
    38  *
       
    39  * @see  CVedVideoClipInfo
       
    40  */
       
    41 class MVedVideoClipInfoObserver 
       
    42     {
       
    43 public:
       
    44     /**
       
    45      * Called to notify that video clip info is ready
       
    46      * for reading.
       
    47      *
       
    48      * Possible error codes:
       
    49      *  - <code>KErrNotFound</code> if there is no file with the specified name
       
    50      *    in the specified directory (but the directory exists)
       
    51      *  - <code>KErrPathNotFound</code> if the specified directory
       
    52      *    does not exist
       
    53      *  - <code>KErrUnknown</code> if the specified file is of unknown format
       
    54      *
       
    55      * @param aInfo   video clip info
       
    56      * @param aError  <code>KErrNone</code> if info is ready
       
    57      *                for reading; one of the system wide
       
    58      *                error codes if reading file failed
       
    59      */
       
    60     virtual void NotifyVideoClipInfoReady(CVedVideoClipInfo& aInfo, 
       
    61                                           TInt aError) = 0;
       
    62     };
       
    63 
       
    64 
       
    65 /**
       
    66  * Observer for notifying that video clip frame has been completed.
       
    67  *
       
    68  * @see  CVedVideoClipInfo
       
    69  */
       
    70 class MVedVideoClipFrameObserver
       
    71     {
       
    72 public:
       
    73     /**
       
    74      * Called to notify that video clip frame 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 aFrame  pointer to frame if it was completed successfully;
       
    81      *                <code>NULL</code> if generating frame failed
       
    82      */
       
    83     virtual void NotifyVideoClipFrameCompleted(CVedVideoClipInfo& aInfo, 
       
    84                                                TInt aError, 
       
    85                                                CFbsBitmap* aFrame) = 0;
       
    86     };
       
    87 
       
    88 /**
       
    89  * Utility class for getting information about video clip files.
       
    90  */
       
    91 class CVedVideoClipInfo : public CBase
       
    92     {
       
    93 public:
       
    94 
       
    95     /* Constructors & destructor. */
       
    96 
       
    97     /**
       
    98      * Constructs a new CVedVideoClipInfo 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 CVedVideoClipInfo instance
       
   114      */
       
   115     IMPORT_C static CVedVideoClipInfo* NewL(const TDesC& aFileName,
       
   116                                             MVedVideoClipInfoObserver& aObserver);
       
   117 
       
   118     /**
       
   119      * Constructs a new CVedVideoClipInfo object to get information
       
   120      * about the specified video clip file. The constructed object
       
   121      * is left in the cleanup stack. The specified observer
       
   122      * is notified when info is ready for reading. This method
       
   123      * may leave if no resources are available to construct a new
       
   124      * object.
       
   125      * The file will be opened in EFileShareReadersOnly mode by default, 
       
   126      * and the same mode should be used by the client too if it need to open
       
   127      * the file at the same time.
       
   128      * 
       
   129      * Possible leave codes:
       
   130      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   131      *
       
   132      * @param aFileName  name of video clip file
       
   133      * @param aObserver  observer to notify when info is ready for reading
       
   134      *
       
   135      * @return  pointer to a new CVedVideoClipInfo instance
       
   136      */
       
   137     IMPORT_C static CVedVideoClipInfo* NewLC(const TDesC& aFileName,
       
   138                                              MVedVideoClipInfoObserver& aObserver);
       
   139 
       
   140     /* General property methods. */
       
   141 
       
   142 
       
   143     /**
       
   144      * Returns a descriptive name for the clip. Panics if info is not yet
       
   145      * ready for reading.
       
   146      *
       
   147      * @return  descriptive name of the clip
       
   148      */
       
   149     virtual TPtrC DescriptiveName() const = 0;
       
   150 
       
   151     /**
       
   152      * Returns the file name of the clip. Panics if there is no file 
       
   153      * associated with this clip or info is not yet ready for reading.
       
   154      * 
       
   155      * @return  file name of the clip
       
   156      */
       
   157     virtual TPtrC FileName() const = 0;
       
   158 
       
   159     /**
       
   160      * Returns the generator of the clip. Panics if there is no video clip
       
   161      * generator associated with the clip or info is not yet ready for reading.
       
   162      *
       
   163      * @return  generator of the clip
       
   164      */
       
   165     virtual CVedVideoClipGenerator* Generator() const = 0;
       
   166 
       
   167     /**
       
   168      * Returns the class of the clip.
       
   169      *
       
   170      * @return  class of the clip
       
   171      */
       
   172     virtual TVedVideoClipClass Class() const = 0;
       
   173 
       
   174     /**
       
   175      * Returns the video format of the clip. Panics if there is no file 
       
   176      * associated with this clip or info is not yet ready for reading.
       
   177      * 
       
   178      * @return  video format of the clip
       
   179      */
       
   180     virtual TVedVideoFormat Format() const = 0;
       
   181 
       
   182     /**
       
   183      * Returns the video type of the clip. Panics if there is no file 
       
   184      * associated with this clip or info is not yet ready for reading.
       
   185      * 
       
   186      * @return  video type of the clip
       
   187      */
       
   188     virtual TVedVideoType VideoType() const = 0;
       
   189 
       
   190     /**
       
   191      * Returns the resolution of the clip. Panics if info
       
   192      * is not yet ready for reading.
       
   193      * 
       
   194      * @return  resolution of the clip
       
   195      */
       
   196     virtual TSize Resolution() const = 0;
       
   197 
       
   198     /**
       
   199      * Returns whether this video clip has an audio track or not.
       
   200      * Panics if info is not yet ready for reading.  
       
   201      *
       
   202      * @return  <code>ETrue</code> if clip has an audio track;
       
   203      *          <code>EFalse</code> otherwise
       
   204      */
       
   205     virtual TBool HasAudio() const = 0;
       
   206 
       
   207     /**
       
   208      * Returns the audio type of the clip audio track. Panics if there is no file 
       
   209      * associated with this clip or info is not yet ready for reading.
       
   210      * 
       
   211      * @return  audio type of the clip audio track
       
   212      */
       
   213     virtual TVedAudioType AudioType() const = 0;
       
   214 
       
   215     /**
       
   216      * Returns the channel mode of the audio if applicable.
       
   217      *
       
   218      * @return  channel mode
       
   219      */
       
   220     virtual TVedAudioChannelMode AudioChannelMode() const = 0;
       
   221 
       
   222     /**
       
   223      * Returns the sampling rate in kilohertz.
       
   224      *
       
   225      * @return  sampling rate
       
   226      */
       
   227     virtual TInt AudioSamplingRate() const = 0;
       
   228 
       
   229     /**
       
   230      * Returns the duration of the clip in microseconds. Panics if info
       
   231      * is not yet ready for reading.
       
   232      * 
       
   233      * @return  duration of the clip
       
   234      */
       
   235     virtual TTimeIntervalMicroSeconds Duration() const = 0;
       
   236 
       
   237 
       
   238     /* Video frame property methods. */
       
   239 
       
   240     /**
       
   241      * Returns the number of video frames in this clip. Panics if info
       
   242      * is not yet ready for reading.
       
   243      * 
       
   244      * @return  number of video frames in this clip
       
   245      */
       
   246     virtual TInt VideoFrameCount() const = 0;
       
   247     
       
   248     /** 
       
   249      * Returns the start time of the video frame at the specified index. 
       
   250      * Panics if info is not yet ready for reading or the index is illegal.
       
   251      *
       
   252      * @param aIndex  index
       
   253      *
       
   254      * @return  start time of the video frame at the specified index in microseconds
       
   255      */ 
       
   256     virtual TTimeIntervalMicroSeconds VideoFrameStartTimeL(TInt aIndex) = 0;
       
   257 
       
   258     /** 
       
   259      * Returns the end time of the video frame at the specified index. 
       
   260      * Panics if info is not yet ready for reading or the index is illegal.
       
   261      *
       
   262      * @param aIndex  index
       
   263      *
       
   264      * @return  end time of the video frame at the specified index in microseconds
       
   265      */ 
       
   266     virtual TTimeIntervalMicroSeconds VideoFrameEndTimeL(TInt aIndex) = 0;
       
   267 
       
   268     /** 
       
   269      * Returns the duration of the video frame at the specified index. 
       
   270      * Panics if info is not yet ready for reading or the index is illegal.
       
   271      *
       
   272      * @param aIndex  index
       
   273      *
       
   274      * @return  duration of the video frame at the specified index in microseconds
       
   275      */ 
       
   276     virtual TTimeIntervalMicroSeconds VideoFrameDurationL(TInt aIndex) = 0;
       
   277 
       
   278     /** 
       
   279      * Returns the size of the video frame at the specified index. 
       
   280      * Panics if there is no file associated with this clip, or info is not 
       
   281      * yet ready for reading, or the index is illegal.
       
   282      *
       
   283      * @param aIndex  index
       
   284      *
       
   285      * @return  size of the video frame at the specified index in bytes
       
   286      */ 
       
   287     virtual TInt VideoFrameSizeL(TInt aIndex) = 0;
       
   288 
       
   289     /** 
       
   290      * Returns whether the video frame at the specified index is an intra
       
   291      * frame or not. Panics if info is not yet ready for reading or 
       
   292      * the index is illegal.
       
   293      *
       
   294      * @param aIndex  index
       
   295      *
       
   296      * @return  <code>ETrue</code>, if the video frame at the specified index is an
       
   297      *          intra frame; <code>EFalse</code>, otherwise
       
   298      */ 
       
   299     virtual TBool VideoFrameIsIntraL(TInt aIndex) = 0;
       
   300 
       
   301     /**
       
   302      * Returns the video frame index at the specified time. Panics if info is not yet 
       
   303      * ready for reading or the time is illegal.
       
   304      *
       
   305      * @param aTime  time
       
   306      *
       
   307      * @return  video frame index at the specified time
       
   308      */
       
   309     virtual TInt GetVideoFrameIndexL(TTimeIntervalMicroSeconds aTime) = 0;
       
   310 
       
   311 
       
   312     /* Frame methods. */
       
   313 
       
   314     /**
       
   315      * Generates a bitmap of the given frame from video clip.
       
   316      * The frame bitmap is scaled to the specified resolution and converted
       
   317      * to the specified display mode. This method is asynchronous. The frame
       
   318      * is generated in background and the observer is notified when the frame
       
   319      * is complete. This method panics if info is not yet ready for reading or 
       
   320      * the resolution is illegal.
       
   321      * 
       
   322      * Possible leave codes:
       
   323      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   324      *  - <code>KErrNotSupported</code>, if the specified combination of 
       
   325      *                                   parameters is not supported
       
   326      *
       
   327      * @param aObserver    observer to be notified when the frame is completed
       
   328      * @param aIndex       index of frame, or KFrameIndexBestThumb to look for
       
   329      *                     most suitable thumbnail frame.
       
   330      * @param aResolution  resolution of the desired frame bitmap, or
       
   331      *                     <code>NULL</code> if the frame should be
       
   332      *                     in the original resolution
       
   333      * @param aDisplayMode desired display mode; or <code>ENone</code> if 
       
   334      *                     any display mode is acceptable
       
   335      * @param aEnhance     apply image enhancement algorithms to improve
       
   336      *                     frame quality; note that this may considerably
       
   337      *                     increase the processing time needed to prepare
       
   338      *                     the frame
       
   339      * @param aPriority    priority of the frame generation
       
   340      */
       
   341     virtual void GetFrameL(MVedVideoClipFrameObserver& aObserver,
       
   342                             TInt aIndex = KFrameIndexBestThumb,
       
   343                             TSize* const aResolution = 0,
       
   344                             TDisplayMode aDisplayMode = ENone,
       
   345                             TBool aEnhance = EFalse,
       
   346                             TInt aPriority = CActive::EPriorityIdle) = 0;
       
   347     
       
   348     /**
       
   349      * Cancels frame generation. If no frame is currently being 
       
   350      * generated, the function does nothing.
       
   351      */
       
   352     virtual void CancelFrame() = 0;
       
   353 
       
   354     /**
       
   355      * Sets the transcode factor.
       
   356      *
       
   357      * @param aFactor  transcode factor
       
   358      */
       
   359     virtual void SetTranscodeFactor(TVedTranscodeFactor aFactor) = 0;
       
   360 
       
   361     /**
       
   362      * Returns the transcode factor.
       
   363      *
       
   364      * @return  transcode factor.
       
   365      */
       
   366     virtual TVedTranscodeFactor TranscodeFactor() = 0;
       
   367 
       
   368     /**
       
   369      * Returns whether video clip is MMSCompatible.
       
   370      *
       
   371      * @return  ETrue if compatible with MMS
       
   372      */
       
   373     virtual TBool IsMMSCompatible() = 0;
       
   374     };
       
   375 
       
   376 
       
   377 
       
   378 #endif // __VEDVIDEOCLIPINFO_H__
       
   379