M4_Common.h revision 7c9d8018755adf1857571125ba1b3598c96ea506
1/*
2 * Copyright (C) 2004-2011 NXP Software
3 * Copyright (C) 2011 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18*************************************************************************
19 * @file   M4_Common.h
20 * @brief  Common data structure between shells
21 * @note
22*************************************************************************
23*/
24#ifndef __M4_COMMON_H__
25#define __M4_COMMON_H__
26
27#include "M4OSA_Types.h"
28
29/**
30 ************************************************************************
31 * structure    _parameterSet
32 * @brief        This structure defines the structure of parameters for the avc
33 *               decoder specific info
34 * @note
35 ************************************************************************
36*/
37typedef struct _parameterSet
38{
39    M4OSA_UInt16 m_length;                /* Number of items*/
40    M4OSA_UInt8* m_pParameterSetUnit;   /* Array of items*/
41} ParameterSet ;
42
43/**
44 ************************************************************************
45 * structure    _avcSpecificInfo
46 * @brief        This structure defines the structure of specific info for the avc decoder
47 * @note
48 ************************************************************************
49*/
50typedef struct _avcSpecificInfo
51{
52    M4OSA_UInt8        m_nalUnitLength;                /* length in bytes of the NALUnitLength
53                                                            field in a AVC sample */
54    M4OSA_UInt8        m_numOfSequenceParameterSets;   /* Number of sequence parameter sets*/
55    M4OSA_UInt8        m_numOfPictureParameterSets;    /* Number of picture parameter sets*/
56    ParameterSet    *m_pSequenceParameterSet;        /* Sequence parameter sets array*/
57    ParameterSet    *m_pPictureParameterSet;        /* Picture parameter sets array*/
58} AvcSpecificInfo ;
59
60/**
61 ************************************************************************
62 * structure    M4_SynthesisAudioInfo
63 * @brief        This structure contains specific pointers used for synthesis audio format
64 ************************************************************************
65*/
66typedef struct _synthesisAudioInfo
67{
68    M4OSA_Void*        m_pInputBuf;
69    M4OSA_Void*        m_pInputInfo;
70    M4OSA_UInt16    m_uiNbSubFramePerStep;
71    M4OSA_UInt32    m_uiUsedBytes;
72} M4_SynthesisAudioInfo;
73
74
75/*
76 ************************************************************************
77 * enum     M4_AACDownsamplingMode
78 * @brief   This enum states modes for Down sampling
79 ************************************************************************
80*/
81typedef enum
82{
83    AAC_kDS_OFF    = 0,        /**< No Down sampling */
84    AAC_kDS_BY_2   = 1,        /**< Down sampling by 2
85                                 Profile = AAC :
86                                            output sampling rate = aac_samp_freq/2
87                                 Profile = HE_AAC and input is AAC:
88                                            Output sampling rate = aac_samp_freq.(No downsamping).
89                                 Profile = HE_AAC and input is HE_AAC:
90                                            Output sampling rate = aac_samp_freq (Downsampling
91                                            occurs in SBR tool).
92                                 case profile = HE_AAC_v2 :
93                                            Not Supported */
94    AAC_kDS_BY_3   = 2,        /**< Down sampling by 3  - only for AAC profile */
95    AAC_kDS_BY_4   = 3,        /**< Down sampling by 4  - only for AAC profile */
96    AAC_kDS_BY_8   = 4        /**< Down sampling by 8  - only for AAC profile */
97
98} M4_AACDownsamplingMode;
99
100
101/*
102 ************************************************************************
103 * enum     M4_AACOutputMode
104 * @brief   This enum defines the output mode
105 ************************************************************************
106*/
107typedef enum
108{
109    AAC_kMono      = 0,    /**< Output is Mono  */
110    AAC_kStereo    = 1     /**< Output is Stereo */
111} M4_AACOutputMode;
112
113
114/*
115 ************************************************************************
116 * enum     M4_AACDecProfile
117 * @brief   This enum defines the AAC decoder profile
118 ************************************************************************
119*/
120typedef enum
121{
122    AAC_kAAC       = 0,        /**< AAC profile (only AAC LC object are supported) */
123    AAC_kHE_AAC    = 1,        /**< HE AAC or AAC+ profile (SBR in LP Mode)  */
124    AAC_kHE_AAC_v2 = 2        /**< HE AAC v2 or Enhanced AAC+ profile (SBR Tool in HQ Mode) */
125} M4_AACDecProfile;
126
127
128/**
129 ************************************************************************
130 * structure    M4_AacDecoderConfig
131 * @brief        This structure defines specific settings according to
132 *                the user requirements
133 ************************************************************************
134*/
135typedef struct
136{
137    M4_AACDecProfile        m_AACDecoderProfile;
138    M4_AACDownsamplingMode    m_DownSamplingMode;
139    M4_AACOutputMode        m_OutputMode;
140
141} M4_AacDecoderConfig;
142
143
144/**
145 ************************************************************************
146 * structure M4READER_AudioSbrUserdata
147 * @brief    This structure defines the user's data needed to decode the
148 *            AACplus stream
149 * @note    The field m_pFirstAU is used in case of local files    and
150 *            the field m_bIsSbrEnabled is used in streaming case.
151 ************************************************************************
152*/
153typedef struct
154{
155  M4OSA_Void*            m_pFirstAU;                /**< The first AU from where SBR data are
156                                                         extracted (local file case)*/
157  M4OSA_Bool            m_bIsSbrEnabled;        /**< A boolean that indicates if the stream is
158                                                    AACplus (streaming case)*/
159  M4_AacDecoderConfig*    m_pAacDecoderUserConfig;/**< Decoder specific user setting */
160
161} M4READER_AudioSbrUserdata;
162
163#endif /* __M4_COMMON_H__*/
164
165