videoeditorengine/mp3aacManipLib/inc/auddef.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   auddef.h - Constants and general declarations for MPEG type of audio formats.
       
    22 
       
    23   Author(s): Juha Ojanpera
       
    24   Copyright (c) 1999-2004 by Nokia Research Center, Speech and Audio Systems.
       
    25   *************************************************************************/
       
    26 
       
    27 #ifndef MPAUD_DEF_H_
       
    28 #define MPAUD_DEF_H_
       
    29 
       
    30 /*- Project Headers. --*/
       
    31 #include "defines.h"
       
    32 
       
    33 
       
    34 /**************************************************************************
       
    35   External Objects Provided
       
    36   *************************************************************************/
       
    37 
       
    38 /*-- General MPx Definitions. --*/
       
    39 /*
       
    40 #ifndef PI
       
    41 #define PI                   (3.14159265358979)
       
    42 #endif
       
    43 #define MPEG_AUDIO_ID        (1)
       
    44 #define MPEG_PHASE2_LSF      (0)
       
    45 #define SBLIMIT              (32)
       
    46 #define SSLIMIT              (18)
       
    47 #define MAX_MONO_SAMPLES     (SBLIMIT * SSLIMIT)
       
    48 #define HAN_SIZE             (512)
       
    49 #define NUM_SUBWIN           (16)
       
    50 #define SCALE                (32768L)
       
    51 #define SYNC_WORD            ((long) 0x7ff)
       
    52 
       
    53 #define HEADER_BITS          (20)
       
    54 #define MAX_LONG_SFB_BANDS   (22)
       
    55 #define MAX_SHORT_SFB_BANDS  (13)
       
    56 #define MAX_BITRESER_SIZE    (512)
       
    57 #define CRC_MAX_PAYLOAD      (34)
       
    58 */
       
    59 #define MP_SYNC_WORD_LENGTH  (11)
       
    60 /*-- MPEG Header Definitions - Mode Values --*/
       
    61 #define MPG_MD_STEREO        (0)
       
    62 #define MPG_MD_JOINT_STEREO  (1)
       
    63 #define MPG_MD_DUAL_CHANNEL  (2)
       
    64 #define MPG_MD_MONO          (3)
       
    65 
       
    66 /*-- Channel definitions. --*/
       
    67 #define MONO_CHAN            (0)
       
    68 #define MAX_CHANNELS         (2)
       
    69 #define LEFT_CHANNEL         (MONO_CHAN)
       
    70 #define RIGHT_CHANNEL        (MONO_CHAN + 1)
       
    71 
       
    72 /*
       
    73    Purpose:     Masks those bit fields from the header to zero that
       
    74                 do not remain fixed from frame to frame.
       
    75    Explanation: Following fields are assumed to be fixed :
       
    76                  * 12th bit from the sync word
       
    77                  * version
       
    78                  * layer description
       
    79                  * sampling rate
       
    80                  * channel mode (layer 3 only)
       
    81                  * copyright bit
       
    82                  * original bit
       
    83                  * de-emphasis
       
    84 
       
    85                 Following fields can vary from frame to frame :
       
    86                  * protection bit
       
    87                  * bit rate
       
    88                  * padding bit
       
    89                  * private bit
       
    90                  * channel mode extension
       
    91                 */
       
    92 #define HEADER_MASK(header) ((uint32)header & 0x001E0CCF)
       
    93 
       
    94 /*
       
    95    Purpose:     Macro to extract layer description.
       
    96    Explanation: This is the bit value, use MP_Header::layer_number method
       
    97                 to interpret this value. */
       
    98 #define LAYER_MASK(header) (((uint32)header >> 17) & 3)
       
    99 
       
   100 /*
       
   101    Purpose:     Frame detection status.
       
   102    Explanation: - */
       
   103 typedef enum SEEK_STATUS
       
   104 {
       
   105   SYNC_FOUND = 0,
       
   106   SYNC_LOST,
       
   107   SYNC_BITS_OUT,
       
   108   SYNC_MP3_FREE
       
   109 
       
   110 } SEEK_STATUS;
       
   111 
       
   112 /*
       
   113    Purpose:     Sync layer codes.
       
   114    Explanation: - */
       
   115 typedef enum SYNC_STATUS
       
   116 {
       
   117   LAYER1_STREAM,
       
   118   LAYER2_STREAM,
       
   119   LAYER3_STREAM,
       
   120 
       
   121   INIT_LAYER1_STREAM,
       
   122   INIT_LAYER2_STREAM,
       
   123   INIT_LAYER3_STREAM,
       
   124 
       
   125   INIT_MP_STREAM,
       
   126   GET_1ST_MPSYNC_STREAM,
       
   127   GET_MPSYNC_STREAM,
       
   128   GET_MPHEADER_STREAM,
       
   129 
       
   130   INIT_AAC_STREAM,
       
   131   ADTS_STREAM,
       
   132   GET_ADTSSYNC_STREAM,
       
   133   GET_ADTSHEADER_STREAM
       
   134 
       
   135 } SYNC_STATUS;
       
   136 
       
   137 /*
       
   138    Purpose:     Bitrate modes.
       
   139    Explanation: - */
       
   140 /*
       
   141 typedef enum BrType
       
   142 {
       
   143   UNKNOWN,
       
   144   CBR,
       
   145   VBR,
       
   146   FREE
       
   147 
       
   148 } BrType;
       
   149 */
       
   150 /*
       
   151    Purpose:     
       
   152    Explanation: - */
       
   153 typedef enum GLITCH
       
   154 {
       
   155   GLITCH_FREE,
       
   156   GLITCH0,
       
   157   GLITCH1
       
   158 
       
   159 } GLITCH;
       
   160 
       
   161 /*
       
   162    Purpose:     Message definitions.
       
   163    Explanation: - */
       
   164 typedef enum MsgType
       
   165 {
       
   166   NO_MESSAGES,
       
   167   UPDATE_BUFFER,
       
   168   SEEK_BUFFER,
       
   169   GET_POSITION,
       
   170   GET_SIZE
       
   171   
       
   172 } MsgType;
       
   173 
       
   174 
       
   175 /*
       
   176    Purpose:     Definition of generic message parameter.
       
   177    Explanation: - */
       
   178 typedef uint32 MsgParam;
       
   179 
       
   180 /*
       
   181    Purpose:     Message structure of the decoder and/or player.
       
   182    Explanation: - */
       
   183 typedef struct MsgStr
       
   184 {
       
   185   MsgType msgType;
       
   186   MsgParam msgInParam;
       
   187   MsgParam msgOutParam;
       
   188   
       
   189 } Msg;
       
   190 
       
   191 /*
       
   192    Purpose:     Execution state for user specified functions.
       
   193    Explanation: - */
       
   194 typedef struct ExecStateStr
       
   195 {
       
   196   GLITCH execMode;
       
   197   int16 a0_s16[3];
       
   198   uint32 a0_u32[3];
       
   199   Msg *msg;
       
   200 
       
   201 } ExecState;
       
   202 
       
   203 /*
       
   204    Purpose:     Parent structure for sync layer processing.
       
   205    Explanation: - */
       
   206 typedef struct SyncInfoStr
       
   207 {
       
   208   int16 sync_length;       /* Length of sync word.                    */
       
   209   int16 sync_word;         /* Synchronization word.                   */
       
   210   int16 sync_mask;         /* Bitmask for sync word detection.        */
       
   211   SYNC_STATUS sync_status; /* Which layer we supposed to be decoding. */
       
   212 
       
   213 } SyncInfo;
       
   214 
       
   215 enum
       
   216 {
       
   217   VBR_MODE = 1,
       
   218   FILE_SIZE_KNOWN = 2
       
   219 };
       
   220 
       
   221 /*
       
   222    Purpose:     Frame detection status.
       
   223    Explanation: - */
       
   224 /*
       
   225 
       
   226 CAN BE FOUND IN auddef.h
       
   227 typedef enum SEEK_STATUS
       
   228 {
       
   229   SYNC_FOUND,
       
   230   SYNC_LOST,
       
   231   SYNC_BITS_OUT
       
   232 
       
   233 } SEEK_STATUS;
       
   234 */
       
   235 /*
       
   236    Purpose:     State of the decoder.
       
   237    Explanation: - */
       
   238 typedef enum DecState
       
   239 {
       
   240   STATE_UNDEFINED,
       
   241   DEC_INIT,
       
   242   DEC_INIT_COMPLETE,
       
   243   FIND_FIRST_FRAME,
       
   244   FIND_FRAME,
       
   245   FIND_PAYLOAD,
       
   246   FIND_AVERAGE_BR,
       
   247   DECODE_FRAME,
       
   248   CORRUPTED_FRAME,
       
   249   GET_PAYLOAD,
       
   250   RESTART_AFTER_VBR,
       
   251   DECODE_FRAME_CORRUPTED
       
   252 
       
   253 } DecState;
       
   254 
       
   255 /*
       
   256    Purpose:     Supported UI features.
       
   257    Explanation: - */
       
   258 typedef enum UIMode
       
   259 {
       
   260   UI_UNDEFINED,
       
   261   UI_PLAY,
       
   262   UI_STOP,
       
   263   UI_WIND_FORWARD,
       
   264   UI_WIND_BACKWARD,
       
   265   UI_REPEAT_LOOP
       
   266 
       
   267 } UIMode;
       
   268 
       
   269 /*
       
   270    Purpose:     A-B repeat.
       
   271    Explanation: - */
       
   272 typedef enum MARKER_ID
       
   273 {
       
   274   RESET_MARKERS = -1,
       
   275   A_MARKER,
       
   276   B_MARKER
       
   277 
       
   278 } MARKER_ID;
       
   279 
       
   280 /*
       
   281    Purpose:     Bitrate modes.
       
   282    Explanation: - */
       
   283 
       
   284 typedef enum BrType
       
   285 {
       
   286   UNKNOWN,
       
   287   CBR,
       
   288   VBR,
       
   289   FREE
       
   290 
       
   291 } BrType;
       
   292 
       
   293 
       
   294 /*
       
   295    Purpose:     Playback quality mappings.
       
   296    Explanation: - */
       
   297 typedef enum QUALITY
       
   298 {
       
   299   FULL_QUALITY,
       
   300   HALF_QUALITY,
       
   301   QUARTER_QUALITY
       
   302 
       
   303 } QUALITY;
       
   304 
       
   305 /*
       
   306    Purpose:     Error codes of the player.
       
   307    Explanation: - */
       
   308 typedef enum MP3_ERROR
       
   309 {
       
   310   AUDIO_OK = 0,
       
   311   AUDIO_ERROR_CRC,
       
   312   AUDIO_INVALID_LAYER,
       
   313   AUDIO_INVALID_SYNTAX,
       
   314   AUDIO_FREE_FORMAT_ERROR,
       
   315   AUDIO_FREE_FORMAT_BR_ERROR,
       
   316   AUDIO_BUFFER_TOO_SMALL
       
   317 
       
   318 } MP3_Error;
       
   319 
       
   320 /*
       
   321    Purpose:     General info about the file/stream.
       
   322    Explanation: - */
       
   323 typedef struct TrackInfoStr
       
   324 {
       
   325   int32 frequency;
       
   326   int16 bitRate;
       
   327   int16 numChannels;
       
   328   int32 lengthInms;
       
   329   uint32 numFrames;
       
   330   BrType brType;
       
   331 
       
   332 } TrackInfo;
       
   333 
       
   334 /*
       
   335    Purpose:     Playback quality parameters and general init info.
       
   336    Explanation: - */
       
   337 typedef struct InitParamStr
       
   338 {
       
   339   uint8 out_channels;
       
   340   uint8 decim_factor;
       
   341   uint8 window_pruning;
       
   342   uint8 alias_subbands;
       
   343   uint8 imdct_subbands;
       
   344   uint32 specFreqBinLimit;
       
   345 
       
   346   int16 bitrate;
       
   347   int32 VBRframesLimit;
       
   348 
       
   349 } InitParam;
       
   350 
       
   351 
       
   352 
       
   353 
       
   354 #endif /*-- MPAUD_DEF_H_ --*/