videoeditorengine/audioeditorengine/inc/AudProcessor.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 
       
    22 #ifndef __AUDPROCESSOR_H__
       
    23 #define __AUDPROCESSOR_H__
       
    24 
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <e32std.h>
       
    28 
       
    29 #include "AudCommon.h"
       
    30 #include "AudClipInfo.h"
       
    31 #include "ProcClipInfoAO.h"
       
    32 #include "ProcProcessAO.h"
       
    33 #include "ProcVisualizationAO.h"
       
    34 #include "ProcTimeEstimateAO.h"
       
    35 
       
    36 /*
       
    37  * Forward declarations.
       
    38  */
       
    39 class CAudSong;
       
    40 class CAudClip;
       
    41 class MProcProcessObserver;
       
    42 class MProcClipInfoObserver;
       
    43 class CProcClipInfoAO;
       
    44 class CProcProcess;
       
    45 class CProcVisualizationAO;
       
    46 class CProcTimeEstimateAO;
       
    47 
       
    48 /**
       
    49  * Audio processor.
       
    50  */
       
    51 class CAudProcessor : public CBase
       
    52     {
       
    53 public:
       
    54 
       
    55     /** 
       
    56      * Constructors for instantiating new audio processors.
       
    57      * Should reserve as little resources as possible at this point.
       
    58      */
       
    59     static CAudProcessor* NewL();
       
    60     static CAudProcessor* NewLC();
       
    61 
       
    62     
       
    63     virtual ~CAudProcessor();
       
    64 
       
    65     /**
       
    66     * Starts a syncronous song processing
       
    67     */
       
    68     TBool StartSyncProcessingL(const CAudSong* aSong);
       
    69 
       
    70     TBool ProcessSyncPieceL(HBufC8*& aFrame, TInt& aProgress,
       
    71                                        TTimeIntervalMicroSeconds& aDuration);
       
    72 
       
    73     /**
       
    74      * Cancel song processing.
       
    75      */
       
    76     void CancelProcessing(MProcProcessObserver& aObserver);
       
    77 
       
    78 
       
    79 
       
    80     /**
       
    81      * Read the header from the specified audio clip file and return its properties.
       
    82      *
       
    83      *
       
    84      * Possible leave codes:
       
    85      *    - <code>KErrNoMemory</code> if memory allocation fails
       
    86      *    - <code>KErrNotFound</code> if there is no file with the specified name
       
    87      *    in the specified directory (but the directory exists)
       
    88      *    - <code>KErrPathNotFound</code> if the specified directory
       
    89      *    does not exist
       
    90      *    - <code>KErrUnknown</code> if the specified file is of unknown format
       
    91      *
       
    92      * @param aFileName             name of the file to read
       
    93      * @param aFileHandle             handle of the file to read
       
    94      * @param aProperties            Output parameter. Properties of the input file. 
       
    95      *                                Allocated and released by the caller
       
    96      * @param aObserver                Observer to be notified as soon as operation completes
       
    97     */
       
    98     void GetAudFilePropertiesL(const TDesC& aFileName, RFile* aFileHandle, 
       
    99                                TAudFileProperties* aProperties, 
       
   100                                MProcClipInfoObserver& aObserver, TInt aPriority);
       
   101 
       
   102     /**
       
   103     * Starts an asynchronous visualization operation for a clip. Progress
       
   104     * indications are sent to an observer
       
   105     *
       
   106     * @param aClip        Clip to be visualized
       
   107     * @param aSize        Lenght of the visualization array, must be positive
       
   108     * @param aPriority  Priority of the operation
       
   109     */
       
   110     void StartGetClipVisualizationL(const CAudClipInfo* aClipInfo, TInt aSize,
       
   111         MAudVisualizationObserver& aObserver, 
       
   112         TInt aPriority);
       
   113 
       
   114     /**
       
   115     * Cancels a clip visualization operation. If an operation is not running
       
   116     * a <code>TAudPanic::EVisualizationProcessNotRunning<code> is thrown
       
   117     */
       
   118     void CancelClipVisualization();
       
   119 
       
   120     TBool StartTimeEstimateL(const CAudSong* aSong, MAudTimeEstimateObserver& aTEObserver);
       
   121     
       
   122     void CancelTimeEstimate();
       
   123     
       
   124 
       
   125 
       
   126 protected:
       
   127     CAudProcessor();
       
   128 
       
   129     void ConstructL();
       
   130 
       
   131 private:
       
   132 
       
   133     // clip info active object owned by this
       
   134     CProcClipInfoAO* iClipInfoAO;
       
   135     
       
   136     // processing object owned by this
       
   137     CProcProcess* iProcessingObject;
       
   138     
       
   139     // visualization active object owned by this
       
   140     CProcVisualizationAO* iVisualizationAO;
       
   141     
       
   142     // Time estimation active object owned by this
       
   143     CProcTimeEstimateAO* iTimeEstimateAO;
       
   144     
       
   145     
       
   146     
       
   147     // a flag to indicate whether there is some ongoing processing
       
   148     TBool iProcessing;
       
   149 
       
   150     friend class CProcProcess;
       
   151     friend class CProcClipInfoAO;
       
   152 
       
   153 
       
   154     };
       
   155 
       
   156 
       
   157 #endif // __AudProcessor_H__
       
   158