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