videoeditorengine/audioeditorengine/inc/AudCommon.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 * Common definitions for audio.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __AUDCOMMON_H__
       
    23 #define __AUDCOMMON_H__
       
    24 
       
    25 #include <e32std.h>
       
    26 
       
    27 
       
    28 const TInt KErrNoAudio = -400;
       
    29 /**
       
    30  * Enumeration for audio file formats.
       
    31  */
       
    32 enum TAudFormat
       
    33     {
       
    34     EAudFormatUnrecognized = 100001,  // should always be the first one
       
    35     EAudFormat3GPP,
       
    36     EAudFormatMP4,
       
    37     EAudFormatAMR,
       
    38     EAudFormatAMRWB,
       
    39     EAudFormatMP3,
       
    40     EAudFormatAAC_ADIF,
       
    41     EAudFormatAAC_ADTS,
       
    42     EAudFormatWAV,
       
    43     EAudFormatLast  // should always be the last one
       
    44     };
       
    45 
       
    46 
       
    47 /**
       
    48  * Enumeration for audio types (that is, codecs).
       
    49  */
       
    50 enum TAudType
       
    51     {
       
    52     EAudTypeUnrecognized = 101001,  // should always be the first one
       
    53     EAudNoAudio,
       
    54     EAudAMR,
       
    55     EAudAMRWB,
       
    56     EAudMP3,
       
    57     EAudAAC_MPEG2, // EAudAAC_MPEG2 not used, all EAudAAC_MPEG is now 4
       
    58     EAudAAC_MPEG4,
       
    59     EAudWAV,
       
    60     EAudTypeLast  // should always be the last one
       
    61     };
       
    62     
       
    63 /*
       
    64    Purpose:     MPEG-4 Audio object types.
       
    65    Explanation: - */
       
    66 enum TAudAACObjectType
       
    67 {
       
    68   EAudAACObjectTypeNone = -1,
       
    69   EAudAACObjectTypeMain,
       
    70   EAudAACObjectTypeLC,
       
    71   EAudAACObjectTypeSSR,
       
    72   EAudAACObjectTypeLTP,
       
    73   EAudAACObjectTypeLast
       
    74 };
       
    75   
       
    76 /**
       
    77  * Enumeration for audio extension types (AAC+)
       
    78  */
       
    79 enum TAudExtensionType
       
    80     {
       
    81     EAudExtensionTypeNoExtension = 20000,
       
    82     EAudExtensionTypeEnhancedAACPlus,
       
    83     EAudExtensionTypeEnhancedAACPlusParametricStereo
       
    84     
       
    85     };    
       
    86 
       
    87 /**
       
    88  * Constants for audio clip priorities.
       
    89  */
       
    90 const TInt KAudClipPriorityHighest = 400;
       
    91 const TInt KAudClipPriorityHigh = 300;
       
    92 const TInt KAudClipPriorityNormal = 200;
       
    93 const TInt KAudClipPriorityLow = 100;
       
    94 const TInt KAudClipPriorityLowest = 0;
       
    95 
       
    96 
       
    97   
       
    98 
       
    99 
       
   100 /**
       
   101  * Enumeration for channel modes
       
   102  */
       
   103 enum TChannelMode 
       
   104     {
       
   105     EAudChannelModeNotRecognized = 103001,   
       
   106     EAudStereo,
       
   107     EAudDualChannel,
       
   108     EAudSingleChannel,
       
   109     EAudParametricStereoChannel
       
   110     };
       
   111 
       
   112 /**
       
   113  * Enumeration for bitrate modes
       
   114  */
       
   115 enum TBitrateMode 
       
   116     {
       
   117     EAudBitrateModeNotRecognized = 103001,
       
   118     EAudConstant,
       
   119     EAudVariable
       
   120     };
       
   121     
       
   122 /**
       
   123  * Class for storing dynamic level marks.
       
   124  */
       
   125 class TAudDynamicLevelMark 
       
   126     {
       
   127 
       
   128 public:
       
   129 
       
   130     /** Mark time. */
       
   131     TTimeIntervalMicroSeconds iTime;
       
   132 
       
   133     /** Dynamic level (-63.5 ... +63.5) in dB:s
       
   134     * one step represents 0.5 dB, hence values can be -127 ... +127
       
   135     */
       
   136     TInt8 iLevel;
       
   137 
       
   138     TAudDynamicLevelMark(TTimeIntervalMicroSeconds aTime, TInt aLevel) 
       
   139         {
       
   140         iTime = aTime;
       
   141         if ( aLevel < -127 )
       
   142             {
       
   143             iLevel = -127;
       
   144             }
       
   145         else if (aLevel > 127 )
       
   146             {
       
   147             iLevel = 127;
       
   148             }
       
   149         else
       
   150             {
       
   151             iLevel = TInt8(aLevel);
       
   152             }
       
   153         }
       
   154 
       
   155     TAudDynamicLevelMark(const TAudDynamicLevelMark& aMark) 
       
   156         {
       
   157         iTime = aMark.iTime;
       
   158         iLevel = aMark.iLevel;
       
   159         }
       
   160     };    
       
   161 
       
   162 /**
       
   163  * Class for storing general properties about an audio file.
       
   164  */
       
   165 class TAudFileProperties 
       
   166     {
       
   167 
       
   168 public:
       
   169 
       
   170     // File format
       
   171     TAudFormat iFileFormat;
       
   172     // Codec
       
   173     TAudType iAudioType;
       
   174     // Extension type
       
   175     TAudExtensionType iAudioTypeExtension;
       
   176     // Duration of the clip in microseconds
       
   177     TTimeIntervalMicroSeconds iDuration;
       
   178     // Sampling rate in Hertzes
       
   179     TInt iSamplingRate;
       
   180     // Bitrate in bits/s
       
   181     TInt iBitrate;
       
   182     // Channel mode
       
   183     TChannelMode iChannelMode;
       
   184     // Channel mode for extension
       
   185     TChannelMode iChannelModeExtension;
       
   186     // Bitrate mode (constant or variable)
       
   187     TBitrateMode iBitrateMode;
       
   188     // Number of bytes in a compressed frame
       
   189     TInt32 iFrameLen;
       
   190     // Is iFrameLen constant?
       
   191     TBool iConstantFrameLength;
       
   192     // Duration of decoded frame in microseconds
       
   193     TTimeIntervalMicroSeconds iFrameDuration;
       
   194     // Number of frames in the clip
       
   195     TInt32 iFrameCount;
       
   196 //    TCodecMode iCodecMode;
       
   197     // Number of frames in a sample (e.g. amr in mp4 has several)
       
   198     TInt iNumFramesPerSample;
       
   199     // Bitdepth in PCM data (usually 8, 16 or 24, only for PCM-data)
       
   200     TInt iNumberOfBitsPerSample; 
       
   201     // Original field in MP3 fixed header
       
   202     TBool iOriginal;
       
   203     
       
   204     // AAC object type
       
   205     TAudAACObjectType iAACObjectType;
       
   206 
       
   207     TBool isCompatible(const TAudFileProperties /*&c2*/) const 
       
   208         {
       
   209         
       
   210         // Now that the clips can be decoded and encoded
       
   211         // all the clips are "compatible" with each other        
       
   212         
       
   213         return ETrue;
       
   214 
       
   215 
       
   216         }
       
   217 
       
   218     };    
       
   219 
       
   220 
       
   221 
       
   222 #endif // __AUDCOMMON_H__
       
   223