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