videoeditor_plat/video_editor_engine_api/inc/VedAudioClipInfo.h
branchRCL_3
changeset 3 e0b5df5c0969
parent 0 951a5db380a0
child 5 4c409de21d23
equal deleted inserted replaced
0:951a5db380a0 3:e0b5df5c0969
     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 __VEDAUDIOCLIPINFO_H__
       
    22 #define __VEDAUDIOCLIPINFO_H__
       
    23 
       
    24 #include <f32file.h>
       
    25 #include "VedCommon.h"
       
    26 
       
    27 /*
       
    28  *  Forward declarations.
       
    29  */
       
    30 class CVedAudioClipInfo;
       
    31 
       
    32 /**
       
    33  * Observer for notifying that audio clip info
       
    34  * is ready for reading.
       
    35  *
       
    36  * @see  CVedAudioClipInfo
       
    37  */
       
    38 class MVedAudioClipInfoObserver 
       
    39     {
       
    40 public:
       
    41     /**
       
    42      * Called to notify that audio clip info is ready
       
    43      * for reading.
       
    44      *
       
    45      * Possible error codes:
       
    46      *  - <code>KErrNotFound</code> if there is no file with the specified name
       
    47      *    in the specified directory (but the directory exists)
       
    48      *  - <code>KErrPathNotFound</code> if the specified directory
       
    49      *    does not exist
       
    50      *  - <code>KErrUnknown</code> if the specified file is of unknown type
       
    51      *
       
    52      * @param aInfo   audio clip info
       
    53      * @param aError  <code>KErrNone</code> if info is ready
       
    54      *                for reading; one of the system wide
       
    55      *                error codes if reading file failed
       
    56      */
       
    57     virtual void NotifyAudioClipInfoReady(CVedAudioClipInfo& aInfo, 
       
    58                                           TInt aError) = 0;
       
    59     };
       
    60 
       
    61 
       
    62 /**
       
    63  * Observer for audio clip visualization.
       
    64  *
       
    65  * @see  CVedAudioClipInfo
       
    66  */
       
    67 class MVedAudioClipVisualizationObserver
       
    68     {
       
    69 public:
       
    70 
       
    71     /**
       
    72      * Called to notify that audio clip visualization has been started. 
       
    73      * 
       
    74      * @param aInfo  audio clip info
       
    75      */
       
    76     virtual void NotifyAudioClipVisualizationStarted(const CVedAudioClipInfo& aInfo) = 0;
       
    77 
       
    78     /**
       
    79      * Called to inform about the current progress of the audio clip visualization.
       
    80      *
       
    81      * @param aInfo        audio clip info
       
    82      * @param aPercentage  percentage of the operation completed, must be 
       
    83        *                     in range 0..100
       
    84      */
       
    85     virtual void NotifyAudioClipVisualizationProgressed(const CVedAudioClipInfo& aInfo, 
       
    86                                                         TInt aPercentage) = 0;
       
    87 
       
    88     /**
       
    89      * Called to notify that audio clip visualization has been completed. 
       
    90      * Note that if the visualization was successfully completed, the ownership 
       
    91      * of the visualization array is passed to the observer and the observer is 
       
    92      * responsible for freeing the array).
       
    93      * 
       
    94      * @param aInfo           audio clip info
       
    95      * @param aError          <code>KErrNone</code> if visualization was
       
    96      *                          completed successfully; one of the system wide
       
    97      *                          error codes if generating visualization failed
       
    98      * @param aVisualization  pointer to the array containing the visualization values;
       
    99      *                        note that the ownership of the array is passed to the
       
   100      *                        observer (i.e., the observer is responsible for freeing
       
   101      *                        the array); or 0, if generating the visualization failed
       
   102      * @param aResolution     resolution of the visualization (i.e., the number of values
       
   103      *                        in the visualization array); or 0, if generating the 
       
   104      *                        visualization failed
       
   105      */
       
   106     virtual void NotifyAudioClipVisualizationCompleted(const CVedAudioClipInfo& aInfo, 
       
   107                                                        TInt aError, TInt8* aVisualization,
       
   108                                                        TInt aResolution) = 0;
       
   109     };
       
   110 
       
   111     
       
   112 /**
       
   113  * Utility class for getting information about audio clip files.
       
   114  *
       
   115  */
       
   116 class CVedAudioClipInfo : public CBase
       
   117     {
       
   118 public:
       
   119 
       
   120     /* Constructors & destructor. */
       
   121 
       
   122     /**
       
   123      * Constructs a new CVedAudioClipInfo object to get information
       
   124      * about the specified audio clip file. The specified observer
       
   125      * is notified when info is ready for reading. This method
       
   126      * may leave if no resources are available to construct 
       
   127      * a new object.
       
   128      * 
       
   129      * Possible leave codes:
       
   130      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   131      *
       
   132      * @param aFileName  name of audio clip file
       
   133      * @param aObserver  observer to notify when info is ready for reading
       
   134      *
       
   135      * @return  pointer to a new CVedAudioClipInfo instance
       
   136      */
       
   137     IMPORT_C static CVedAudioClipInfo* NewL(const TDesC& aFileName,
       
   138                                             MVedAudioClipInfoObserver& aObserver);
       
   139 
       
   140     /**
       
   141      * Constructs a new CVedAudioClipInfo object to get information
       
   142      * about the specified audio clip file. The constructed object
       
   143      * is left in the cleanup stack. The specified observer
       
   144      * is notified when info is ready for reading. This method
       
   145      * may leave if no resources are available to construct a new
       
   146      * object.
       
   147      * 
       
   148      * Possible leave codes:
       
   149      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   150      *
       
   151      * @param aFileName  name of audio clip file
       
   152      * @param aObserver  observer to notify when info is ready for reading
       
   153      *
       
   154      * @return  pointer to a new CVedAudioClipInfo instance
       
   155      */
       
   156     IMPORT_C static CVedAudioClipInfo* NewLC(const TDesC& aFileName,
       
   157                                              MVedAudioClipInfoObserver& aObserver);
       
   158 
       
   159     /* Property methods. */
       
   160 
       
   161     /**
       
   162      * Returns the file name of the clip. Panics if info
       
   163      * is not yet ready for reading.
       
   164      * 
       
   165      * @return  file name
       
   166      */
       
   167     virtual TPtrC FileName() const = 0;
       
   168 
       
   169     /**
       
   170      * Returns the audio type of the clip. Panics if info
       
   171      * is not yet ready for reading.
       
   172      * 
       
   173      * @return  audio type
       
   174      */
       
   175     virtual TVedAudioType Type() const = 0;
       
   176 
       
   177     /**
       
   178      * Returns the duration of the clip. Panics if info
       
   179      * is not yet ready for reading.
       
   180      * 
       
   181      * @return  duration in microseconds
       
   182      */
       
   183     virtual TTimeIntervalMicroSeconds Duration() const = 0;
       
   184 
       
   185     /**
       
   186      * Returns the channel mode of the audio if applicable.
       
   187      *
       
   188      * @return  channel mode
       
   189      */
       
   190     virtual TVedAudioChannelMode ChannelMode() const = 0;
       
   191 
       
   192     /**
       
   193      * Returns the audio format of the clip. Panics if info
       
   194      * is not yet ready for reading.
       
   195      * 
       
   196      * @return  audio format of the clip
       
   197      */
       
   198     virtual TVedAudioFormat Format() const = 0;
       
   199 
       
   200     /**
       
   201      * Returns the sampling rate in hertz.
       
   202      *
       
   203      * @return  sampling rate
       
   204      */
       
   205     virtual TInt SamplingRate() const = 0;
       
   206 
       
   207     /**
       
   208      * Returns the bitrate mode.
       
   209      *
       
   210      * @return  bitrate mode
       
   211      */
       
   212     virtual TVedBitrateMode BitrateMode() const = 0;
       
   213 
       
   214     /**
       
   215      * Returns the bitrate.
       
   216      *
       
   217      * @return  bitrate in bits per second
       
   218      */
       
   219     virtual TInt Bitrate() const = 0;
       
   220 
       
   221     /* Visualization methods. */
       
   222 
       
   223     /**
       
   224      * Generates a visualization of the audio clip. The visualization consists
       
   225      * of an array of values with the specified resolution. This method is 
       
   226      * asynchronous. The visualization is generated in background and the observer 
       
   227      * is notified when the visualization is complete. This method panics if info 
       
   228      * is not yet ready for reading or the resolution is illegal.
       
   229      * 
       
   230      * Possible leave codes:
       
   231      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   232      *
       
   233      * @param aObserver    observer to be notified when the visualization is completed
       
   234      * @param aResolution  resolution of the visualization (i.e., the number of values
       
   235      *                     in the visualization array)
       
   236      * @param aPriority    priority of the visualization
       
   237      */
       
   238     virtual void GetVisualizationL(MVedAudioClipVisualizationObserver& aObserver,
       
   239                                    TInt aResolution, TInt aPriority) = 0;
       
   240     
       
   241     /**
       
   242      * Cancels visualization generation. If no visualization is currently being 
       
   243      * generated, the function does nothing.
       
   244      */
       
   245     virtual void CancelVisualizationL() = 0;
       
   246     
       
   247      /**
       
   248      * Constructs a new CVedAudioClipInfo object to get information
       
   249      * about the specified audio clip file. The specified observer
       
   250      * is notified when info is ready for reading. This method
       
   251      * may leave if no resources are available to construct 
       
   252      * a new object.
       
   253      * 
       
   254      * Possible leave codes:
       
   255      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   256      *
       
   257      * @param aFileHandle handle of audio clip file
       
   258      * @param aObserver  observer to notify when info is ready for reading
       
   259      *
       
   260      * @return  pointer to a new CVedAudioClipInfo instance
       
   261      */
       
   262     IMPORT_C static CVedAudioClipInfo* NewL(RFile* aFileHandle,
       
   263                                             MVedAudioClipInfoObserver& aObserver);
       
   264 
       
   265     /**
       
   266      * Constructs a new CVedAudioClipInfo object to get information
       
   267      * about the specified audio clip file. The constructed object
       
   268      * is left in the cleanup stack. The specified observer
       
   269      * is notified when info is ready for reading. This method
       
   270      * may leave if no resources are available to construct a new
       
   271      * object.
       
   272      * 
       
   273      * Possible leave codes:
       
   274      *  - <code>KErrNoMemory</code> if memory allocation fails
       
   275      *     
       
   276      * @param aFileHandle handle of audio clip file
       
   277      * @param aObserver  observer to notify when info is ready for reading
       
   278      *
       
   279      * @return  pointer to a new CVedAudioClipInfo instance
       
   280      */
       
   281     IMPORT_C static CVedAudioClipInfo* NewLC(RFile* aFileHandle,
       
   282                                              MVedAudioClipInfoObserver& aObserver);
       
   283                                              
       
   284      /**
       
   285      * Returns the file handle of the clip. Panics if there is no file 
       
   286      * associated with this clip or info is not yet ready for reading.
       
   287      * 
       
   288      * @return  file name of the clip
       
   289      */
       
   290     virtual RFile* FileHandle() const = 0;
       
   291     
       
   292     
       
   293     };
       
   294 
       
   295 #endif // __VEDAUDIOCLIPINFO_H__