videoeditorengine/audioeditorengine/codecs/MP4/inc/mp4aud.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 *
       
    17 */
       
    18 
       
    19 
       
    20 /**************************************************************************
       
    21   mp4aud.h - MPEG-4 Audio structures and interface methods.
       
    22 
       
    23   Author(s): Juha Ojanpera
       
    24   Copyright (c) 2001-2004 by Nokia Research Center, Speech and Audio Systems.
       
    25   *************************************************************************/
       
    26 
       
    27 #ifndef MP4AUD_H_
       
    28 #define MP4AUD_H_
       
    29 
       
    30 /*-- Project Headers. --*/
       
    31 #include "nok_bits.h"
       
    32 #include "chandefs.h"
       
    33 
       
    34 /*-- Raw bitstream constants. --*/
       
    35 //#define LEN_PC_COMM       (8)
       
    36 
       
    37 /*-- Program configuration element --*/
       
    38 /*
       
    39 #define LEN_BYTE          (8)
       
    40 #define LEN_TAG           (4)
       
    41 #define LEN_PROFILE       (2) 
       
    42 #define LEN_SAMP_IDX      (4) 
       
    43 #define LEN_NUM_ELE       (4) 
       
    44 #define LEN_NUM_LFE       (2) 
       
    45 #define LEN_NUM_DAT       (3) 
       
    46 #define LEN_NUM_CCE       (4) 
       
    47 #define LEN_MMIX_IDX      (2) 
       
    48 #define LEN_PSUR_ENAB     (1) 
       
    49 #define LEN_ELE_IS_CPE    (1)
       
    50 #define LEN_IND_SW_CCE    (1)  
       
    51 #define LEN_COMMENT_BYTES (8)
       
    52 */
       
    53 /*
       
    54    Purpose:     MPEG-4 Audio object types.
       
    55    Explanation: - */
       
    56 typedef enum AudioObjectType
       
    57 {
       
    58   NULL_OBJECT = -1,
       
    59   AAC_MAIN,
       
    60   AAC_LC,
       
    61   AAC_SSR,
       
    62   AAC_LTP,
       
    63   AAC_SBR,
       
    64   AAC_SCALABLE,
       
    65   TWINVQ,
       
    66   CELP,
       
    67   HVXC,
       
    68   RESERVED10,
       
    69   RESERVED11,
       
    70   TTSI = 11,
       
    71   MAIN_SYNTHETIC,
       
    72   WAVETABLE_SYNTHESIS,
       
    73   GENERAL_MIDI,
       
    74   AUDIO_FX,
       
    75   ER_AAC_LC, 
       
    76   RESERVED18, 
       
    77   ER_AAC_LTP, 
       
    78   ER_AAC_SCALABLE, 
       
    79   ER_TWINVQ,
       
    80   ER_BSAC, 
       
    81   ER_AAC_LD, 
       
    82   ER_CELP, 
       
    83   ER_HVXC, 
       
    84   ER_HILN,
       
    85   ER_PARAMETRIC, 
       
    86   RESERVED28, 
       
    87   RESERVED29, 
       
    88   RESERVED30, 
       
    89   RESERVED31
       
    90 
       
    91 } AudioObjectType;
       
    92 
       
    93 /*
       
    94    Purpose:     Configuration information for MPEG-4 GA coder.
       
    95    Explanation: - */
       
    96 typedef struct GaSpecificInfoStr
       
    97 {
       
    98   /*-- Common to all object types. --*/
       
    99   BOOL FrameLengthFlag;
       
   100   BOOL DependsOnCoreCoder;
       
   101   int16 CoreCoderDelay;
       
   102 
       
   103   /*-- AAC Scalable parameters. --*/
       
   104   uint8 layerNr;
       
   105 
       
   106   /*-- ER BSAC parameters. --*/
       
   107   uint8 numOfSubframe;
       
   108   int16 layer_length;
       
   109 
       
   110   /*-- ER object specific data. --*/
       
   111   BOOL aacSectionDataResilienceFlag;
       
   112   BOOL aacScalefactorDataResilienceFlag;
       
   113   BOOL aacSpectralDataResilienceFlag;
       
   114   
       
   115   /*-- Future extension flag. --*/
       
   116   BOOL extensionFlag3;
       
   117 
       
   118 } GaSpecificInfo;
       
   119 
       
   120 /*
       
   121    Purpose:     Configuration information for MPEG-4 audio coder.
       
   122    Explanation: - */
       
   123 typedef struct AudioSpecificInfoStr
       
   124 {
       
   125   AudioObjectType audioObject; /* Object type.                            */
       
   126   uint8 samplingFreqIdx;       /* Index to sampling frequency table.      */
       
   127   int32 samplingFrequency;     /* Sampling frequency if not in the table. */
       
   128   uint8 channelConfiguration;  /* Index to channel configuration table.   */
       
   129   GaSpecificInfo gaInfo;       /* Config information for GA coder.        */
       
   130 
       
   131   AudioObjectType extAudioObject;
       
   132   int16 syncExtensionType;
       
   133   int32 extSamplingFrequency;
       
   134   uint8 extSamplingFreqIdx;
       
   135   uint8 sbrPresentFlag;
       
   136 
       
   137 } AudioSpecificInfo;
       
   138 
       
   139 /*
       
   140    Purpose:     Information about the audio channel.
       
   141    Explanation: - */
       
   142 typedef struct 
       
   143 {
       
   144   int16 num_ele;
       
   145   int16 ele_is_cpe[1 << LEN_TAG];
       
   146   int16 ele_tag[1 << LEN_TAG];
       
   147 
       
   148 } EleList;
       
   149 
       
   150 /*
       
   151    Purpose:     Mixing information for downmixing multichannel input
       
   152                 into two-channel output.
       
   153    Explanation: - */
       
   154 typedef struct 
       
   155 {
       
   156   int16 present;
       
   157   int16 ele_tag;
       
   158   int16 pseudo_enab;
       
   159 
       
   160 } MIXdown;
       
   161 
       
   162 /*
       
   163    Purpose:     Program configuration element.
       
   164    Explanation: - */
       
   165 typedef struct 
       
   166 {
       
   167   int16 tag;
       
   168   int16 profile;
       
   169   int16 sample_rate_idx;
       
   170 
       
   171   BOOL pce_present;
       
   172 
       
   173   EleList front;
       
   174   EleList side;
       
   175   EleList back;
       
   176   EleList lfe;
       
   177   EleList data;
       
   178   EleList coupling;
       
   179 
       
   180   MIXdown mono_mix;
       
   181   MIXdown stereo_mix;
       
   182   MIXdown matrix_mix;
       
   183 
       
   184   int16 num_comment_bytes;
       
   185   char comments[(1 << LEN_PC_COMM) + 1];
       
   186 
       
   187 } ProgConfig;
       
   188 
       
   189 /*
       
   190    Purpose:     MPEG-4 AAC transport handle.
       
   191    Explanation: - */
       
   192 typedef struct mp4AACTransportHandleStr
       
   193 {
       
   194   ProgConfig progCfg;
       
   195   AudioSpecificInfo audioInfo;
       
   196 
       
   197 } mp4AACTransportHandle;
       
   198 
       
   199 
       
   200 /*-- Access methods. --*/
       
   201 
       
   202 BOOL
       
   203 ReadMP4AudioConfig(uint8 *buffer, uint32 bufLen, mp4AACTransportHandle *mp4AAC_ff);
       
   204 
       
   205 void
       
   206 WriteMP4AudioConfig(uint8 *buffer, uint32 bufLen, mp4AACTransportHandle *mp4AAC_ff);
       
   207 
       
   208 #endif /*-- MP4AUD_H_ --*/