| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2004-2010 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: bape_encoder.h $ |
|---|
| 39 | * $brcm_Revision: Hydra_Software_Devel/11 $ |
|---|
| 40 | * $brcm_Date: 1/31/12 6:17p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: Encoder |
|---|
| 44 | * Specific APIs related to Audio Encoding |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /magnum/portinginterface/ape/7422/bape_encoder.h $ |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/11 1/31/12 6:17p jgarrett |
|---|
| 51 | * SW7425-2268: Adding initial voice conferencing support |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/10 12/19/11 4:27p jgarrett |
|---|
| 54 | * SW7425-1018: Adding initial A/85 implementation |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/9 12/8/11 2:21p jgarrett |
|---|
| 57 | * SW7425-1478: Adding WMA Std settings interface |
|---|
| 58 | * |
|---|
| 59 | * Hydra_Software_Devel/8 12/7/11 5:44p jgarrett |
|---|
| 60 | * SW7425-1478: Adding WMA encoder interface |
|---|
| 61 | * |
|---|
| 62 | * Hydra_Software_Devel/7 6/16/11 3:27p jgarrett |
|---|
| 63 | * SW7425-741: Adding MP3 encoder |
|---|
| 64 | * |
|---|
| 65 | * Hydra_Software_Devel/6 6/14/11 3:37p jgarrett |
|---|
| 66 | * SW7425-716: Updating AAC bitrate comments |
|---|
| 67 | * |
|---|
| 68 | * Hydra_Software_Devel/5 3/21/11 7:07p jgarrett |
|---|
| 69 | * SW7422-355: Adding encoder updates |
|---|
| 70 | * |
|---|
| 71 | * Hydra_Software_Devel/4 3/1/11 7:26p jgarrett |
|---|
| 72 | * SW7422-146: Adding encoders |
|---|
| 73 | * |
|---|
| 74 | * Hydra_Software_Devel/3 2/22/11 5:43p jgarrett |
|---|
| 75 | * SW7422-146: Implemented type renaming based on filter graph review |
|---|
| 76 | * comments |
|---|
| 77 | * |
|---|
| 78 | * Hydra_Software_Devel/2 1/13/11 5:26p jgarrett |
|---|
| 79 | * SW7422-146: Renaming encoder codec settings |
|---|
| 80 | * |
|---|
| 81 | * Hydra_Software_Devel/1 1/12/11 4:24p jgarrett |
|---|
| 82 | * SW7422-146: Adding additional APIs |
|---|
| 83 | * |
|---|
| 84 | ***************************************************************************/ |
|---|
| 85 | |
|---|
| 86 | #ifndef BAPE_ENCODER_H__ |
|---|
| 87 | #define BAPE_ENCODER_H__ |
|---|
| 88 | |
|---|
| 89 | #include "bape.h" |
|---|
| 90 | |
|---|
| 91 | /*************************************************************************** |
|---|
| 92 | Summary: |
|---|
| 93 | Audio Encoder Settings |
|---|
| 94 | ***************************************************************************/ |
|---|
| 95 | typedef struct BAPE_Encoder *BAPE_EncoderHandle; |
|---|
| 96 | |
|---|
| 97 | /*************************************************************************** |
|---|
| 98 | Summary: |
|---|
| 99 | Audio Encoder Settings |
|---|
| 100 | ***************************************************************************/ |
|---|
| 101 | typedef struct BAPE_EncoderSettings |
|---|
| 102 | { |
|---|
| 103 | BAVC_AudioCompressionStd codec; /* Codec to output. Cannot be changed while running. */ |
|---|
| 104 | |
|---|
| 105 | bool loudnessEquivalenceEnabled; /* If true, loudness equivalence will be enabled based on the mode specified |
|---|
| 106 | in BAPE_Settings.loudnessMode. Ignored if BAPE_Settings.loudnessMode is |
|---|
| 107 | set to BAPE_LoudnessEquivalenceMode_eNone. Default is true. */ |
|---|
| 108 | } BAPE_EncoderSettings; |
|---|
| 109 | |
|---|
| 110 | /*************************************************************************** |
|---|
| 111 | Summary: |
|---|
| 112 | Get default settings for an Audio Encoder stage |
|---|
| 113 | ***************************************************************************/ |
|---|
| 114 | void BAPE_Encoder_GetDefaultSettings( |
|---|
| 115 | BAPE_EncoderSettings *pSettings /* [out] default settings */ |
|---|
| 116 | ); |
|---|
| 117 | |
|---|
| 118 | /*************************************************************************** |
|---|
| 119 | Summary: |
|---|
| 120 | Open an Audio Encoder stage |
|---|
| 121 | ***************************************************************************/ |
|---|
| 122 | BERR_Code BAPE_Encoder_Create( |
|---|
| 123 | BAPE_Handle deviceHandle, |
|---|
| 124 | const BAPE_EncoderSettings *pSettings, |
|---|
| 125 | BAPE_EncoderHandle *pHandle /* [out] */ |
|---|
| 126 | ); |
|---|
| 127 | |
|---|
| 128 | /*************************************************************************** |
|---|
| 129 | Summary: |
|---|
| 130 | Close an Audio Encoder stage |
|---|
| 131 | |
|---|
| 132 | Description: |
|---|
| 133 | Input to the stage must be removed prior to closing. |
|---|
| 134 | ***************************************************************************/ |
|---|
| 135 | void BAPE_Encoder_Destroy( |
|---|
| 136 | BAPE_EncoderHandle handle |
|---|
| 137 | ); |
|---|
| 138 | |
|---|
| 139 | /*************************************************************************** |
|---|
| 140 | Summary: |
|---|
| 141 | Get Settings for an Audio Encoder stage |
|---|
| 142 | ***************************************************************************/ |
|---|
| 143 | void BAPE_Encoder_GetSettings( |
|---|
| 144 | BAPE_EncoderHandle handle, |
|---|
| 145 | BAPE_EncoderSettings *pSettings /* [out] Settings */ |
|---|
| 146 | ); |
|---|
| 147 | |
|---|
| 148 | /*************************************************************************** |
|---|
| 149 | Summary: |
|---|
| 150 | Set Settings for an Audio Encoder stage |
|---|
| 151 | ***************************************************************************/ |
|---|
| 152 | BERR_Code BAPE_Encoder_SetSettings( |
|---|
| 153 | BAPE_EncoderHandle handle, |
|---|
| 154 | const BAPE_EncoderSettings *pSettings |
|---|
| 155 | ); |
|---|
| 156 | |
|---|
| 157 | /*************************************************************************** |
|---|
| 158 | Summary: |
|---|
| 159 | AC3 Encode Settings |
|---|
| 160 | ***************************************************************************/ |
|---|
| 161 | typedef struct BAPE_Ac3EncodeSettings |
|---|
| 162 | { |
|---|
| 163 | bool spdifHeaderEnabled; /* If true, SPDIF header generation is enabled. */ |
|---|
| 164 | bool certificationMode; |
|---|
| 165 | } BAPE_Ac3EncodeSettings; |
|---|
| 166 | |
|---|
| 167 | /*************************************************************************** |
|---|
| 168 | Summary: |
|---|
| 169 | DTS Encode Settings |
|---|
| 170 | ***************************************************************************/ |
|---|
| 171 | typedef struct BAPE_DtsEncodeSettings |
|---|
| 172 | { |
|---|
| 173 | bool spdifHeaderEnabled; /* If true, SPDIF header generation is enabled. */ |
|---|
| 174 | } BAPE_DtsEncodeSettings; |
|---|
| 175 | |
|---|
| 176 | /*************************************************************************** |
|---|
| 177 | Summary: |
|---|
| 178 | AAC Encode Settings |
|---|
| 179 | ***************************************************************************/ |
|---|
| 180 | typedef struct BAPE_AacEncodeSettings |
|---|
| 181 | { |
|---|
| 182 | unsigned bitRate; /* Output bitrate of the encoder in bps. |
|---|
| 183 | For AAC-Plus, bitrates from 16000 to 48000 are valid. |
|---|
| 184 | For AAC-LC, bitrates from 16000 to 320000 are valid. */ |
|---|
| 185 | BAPE_ChannelMode channelMode; /* Output channel mode. Currently only 2_0 and 1_0 are supported. */ |
|---|
| 186 | } BAPE_AacEncodeSettings; |
|---|
| 187 | |
|---|
| 188 | /*************************************************************************** |
|---|
| 189 | Summary: |
|---|
| 190 | MPEG Encode Settings |
|---|
| 191 | ***************************************************************************/ |
|---|
| 192 | typedef struct BAPE_MpegEncodeSettings |
|---|
| 193 | { |
|---|
| 194 | unsigned bitRate; /* Output bitrate of the encoder in bps. Ranges from 32000 to 320000. */ |
|---|
| 195 | |
|---|
| 196 | bool privateBit; /* If true, the private bit will be asserted in the header */ |
|---|
| 197 | bool copyrightBit; /* If true, the copyright bit will be asserted in the header */ |
|---|
| 198 | bool originalBit; /* If true, the original bit will be asserted in the header */ |
|---|
| 199 | BAPE_MpegEmphasisMode emphasisMode; /* De-Emphasis mode */ |
|---|
| 200 | } BAPE_MpegEncodeSettings; |
|---|
| 201 | |
|---|
| 202 | /*************************************************************************** |
|---|
| 203 | Summary: |
|---|
| 204 | WMA Encode Settings |
|---|
| 205 | ***************************************************************************/ |
|---|
| 206 | typedef struct BAPE_WmaEncodeSettings |
|---|
| 207 | { |
|---|
| 208 | unsigned bitRate; /* Output bitrate of the encoder in bps. Default is 192000. Lower bitrates may cause very high DSP load. */ |
|---|
| 209 | |
|---|
| 210 | BAPE_ChannelMode channelMode; /* Output channel mode. Currently only 2_0 and 1_0 are supported. */ |
|---|
| 211 | } BAPE_WmaEncodeSettings; |
|---|
| 212 | |
|---|
| 213 | /*************************************************************************** |
|---|
| 214 | Summary: |
|---|
| 215 | G.711/G.726 Compression Modes |
|---|
| 216 | ***************************************************************************/ |
|---|
| 217 | typedef enum BAPE_G711G726CompressionMode |
|---|
| 218 | { |
|---|
| 219 | BAPE_G711G726CompressionMode_eUlaw, /* u-Law Compression. Typically used in North America and Japan. */ |
|---|
| 220 | BAPE_G711G726CompressionMode_eAlaw, /* a-Law Compression. Typically used in Europe and elsewhere. */ |
|---|
| 221 | BAPE_G711G726CompressionMode_eMax |
|---|
| 222 | } BAPE_G711G726CompressionMode; |
|---|
| 223 | |
|---|
| 224 | /*************************************************************************** |
|---|
| 225 | Summary: |
|---|
| 226 | G.711 Encode Settings |
|---|
| 227 | ***************************************************************************/ |
|---|
| 228 | typedef struct BAPE_G711EncodeSettings |
|---|
| 229 | { |
|---|
| 230 | BAPE_G711G726CompressionMode compressionMode; /* Select compression mode. */ |
|---|
| 231 | } BAPE_G711EncodeSettings; |
|---|
| 232 | |
|---|
| 233 | /*************************************************************************** |
|---|
| 234 | Summary: |
|---|
| 235 | G.726 Encode Settings |
|---|
| 236 | ***************************************************************************/ |
|---|
| 237 | typedef struct BAPE_G726EncodeSettings |
|---|
| 238 | { |
|---|
| 239 | BAPE_G711G726CompressionMode compressionMode; /* Select compression mode. */ |
|---|
| 240 | |
|---|
| 241 | unsigned bitRate; /* Output bitrate of the encoder in bps. Valid values are 16000, 24000, 32000, and 40000 for G.726 */ |
|---|
| 242 | } BAPE_G726EncodeSettings; |
|---|
| 243 | |
|---|
| 244 | /*************************************************************************** |
|---|
| 245 | Summary: |
|---|
| 246 | G.729 Encode Settings |
|---|
| 247 | ***************************************************************************/ |
|---|
| 248 | typedef struct BAPE_G729EncodeSettings |
|---|
| 249 | { |
|---|
| 250 | bool dtxEnabled; /* If true, DTX (Discontinuous Transmission) is enabled to conserve bandwidth during silence. */ |
|---|
| 251 | |
|---|
| 252 | unsigned bitRate; /* Output bitrate of the encoder in bps. Valid values are 6400, 8000, and 11800 for G.729 */ |
|---|
| 253 | } BAPE_G729EncodeSettings; |
|---|
| 254 | |
|---|
| 255 | /*************************************************************************** |
|---|
| 256 | Summary: |
|---|
| 257 | G.723.1 Encode Settings |
|---|
| 258 | ***************************************************************************/ |
|---|
| 259 | typedef struct BAPE_G723_1EncodeSettings |
|---|
| 260 | { |
|---|
| 261 | bool vadEnabled; /* If true, VAD (Voice Activity Detection) is enabled to conserve bandwidth during silence. */ |
|---|
| 262 | bool hpfEnabled; /* If true, a high-pass filter will be enabled. */ |
|---|
| 263 | |
|---|
| 264 | unsigned bitRate; /* Output bitrate of the encoder in bps. Valid values are 6300 and 5300 for G.723.1 */ |
|---|
| 265 | } BAPE_G723_1EncodeSettings; |
|---|
| 266 | |
|---|
| 267 | /*************************************************************************** |
|---|
| 268 | Summary: |
|---|
| 269 | Codec-Specific Settings for an audio encoder |
|---|
| 270 | ***************************************************************************/ |
|---|
| 271 | typedef struct BAPE_EncoderCodecSettings |
|---|
| 272 | { |
|---|
| 273 | BAVC_AudioCompressionStd codec; /* this is used for the codecSettings lookup */ |
|---|
| 274 | union |
|---|
| 275 | { |
|---|
| 276 | BAPE_Ac3EncodeSettings ac3; |
|---|
| 277 | BAPE_DtsEncodeSettings dts; |
|---|
| 278 | BAPE_AacEncodeSettings aac; |
|---|
| 279 | BAPE_AacEncodeSettings aacPlus; |
|---|
| 280 | BAPE_MpegEncodeSettings mp3; |
|---|
| 281 | BAPE_WmaEncodeSettings wmaStd; |
|---|
| 282 | BAPE_G711EncodeSettings g711; |
|---|
| 283 | BAPE_G726EncodeSettings g726; |
|---|
| 284 | BAPE_G729EncodeSettings g729; |
|---|
| 285 | BAPE_G723_1EncodeSettings g723_1; |
|---|
| 286 | } codecSettings; |
|---|
| 287 | } BAPE_EncoderCodecSettings; |
|---|
| 288 | |
|---|
| 289 | /*************************************************************************** |
|---|
| 290 | Summary: |
|---|
| 291 | Get Codec-Specific Settings for an Audio Encoder stage |
|---|
| 292 | ***************************************************************************/ |
|---|
| 293 | void BAPE_Encoder_GetCodecSettings( |
|---|
| 294 | BAPE_EncoderHandle handle, |
|---|
| 295 | BAVC_AudioCompressionStd codec, /* the codec for which you are retrieving settings. */ |
|---|
| 296 | BAPE_EncoderCodecSettings *pSettings /* [out] Settings */ |
|---|
| 297 | ); |
|---|
| 298 | |
|---|
| 299 | /*************************************************************************** |
|---|
| 300 | Summary: |
|---|
| 301 | Set Codec-Specific Settings for an Audio Encoder stage |
|---|
| 302 | ***************************************************************************/ |
|---|
| 303 | BERR_Code BAPE_Encoder_SetCodecSettings( |
|---|
| 304 | BAPE_EncoderHandle handle, |
|---|
| 305 | const BAPE_EncoderCodecSettings *pSettings |
|---|
| 306 | ); |
|---|
| 307 | |
|---|
| 308 | /*************************************************************************** |
|---|
| 309 | Summary: |
|---|
| 310 | Get the audio connector for an Audio Encoder stage |
|---|
| 311 | ***************************************************************************/ |
|---|
| 312 | void BAPE_Encoder_GetConnector( |
|---|
| 313 | BAPE_EncoderHandle handle, |
|---|
| 314 | BAPE_Connector *pConnector /* [out] */ |
|---|
| 315 | ); |
|---|
| 316 | |
|---|
| 317 | /*************************************************************************** |
|---|
| 318 | Summary: |
|---|
| 319 | Add an input to this processing stage |
|---|
| 320 | ***************************************************************************/ |
|---|
| 321 | BERR_Code BAPE_Encoder_AddInput( |
|---|
| 322 | BAPE_EncoderHandle handle, |
|---|
| 323 | BAPE_Connector input |
|---|
| 324 | ); |
|---|
| 325 | |
|---|
| 326 | /*************************************************************************** |
|---|
| 327 | Summary: |
|---|
| 328 | Remove an input from this processing stage |
|---|
| 329 | ***************************************************************************/ |
|---|
| 330 | BERR_Code BAPE_Encoder_RemoveInput( |
|---|
| 331 | BAPE_EncoderHandle handle, |
|---|
| 332 | BAPE_Connector input |
|---|
| 333 | ); |
|---|
| 334 | |
|---|
| 335 | /*************************************************************************** |
|---|
| 336 | Summary: |
|---|
| 337 | Remove all inputs from this processing stage |
|---|
| 338 | ***************************************************************************/ |
|---|
| 339 | BERR_Code BAPE_Encoder_RemoveAllInputs( |
|---|
| 340 | BAPE_EncoderHandle handle |
|---|
| 341 | ); |
|---|
| 342 | |
|---|
| 343 | #endif /* #ifndef BAPE_ENCODER_H__ */ |
|---|
| 344 | |
|---|
| 345 | |
|---|