| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2006-2012, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bape_decoder.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/18 $ |
|---|
| 12 | * $brcm_Date: 3/7/12 4:35p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: Audio Decoder Interface |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/ape/7422/bape_decoder.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/18 3/7/12 4:35p jgarrett |
|---|
| 21 | * SW7435-24: Adding DSP index for decode and dsp mixer |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/17 2/17/12 4:13p jgarrett |
|---|
| 24 | * SW7425-2262: Adding API to enter Non-Realtime Gap Fill mode |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/16 2/9/12 11:21a jgarrett |
|---|
| 27 | * SW7425-2074: Enabling input halt and revising MAI shutown for |
|---|
| 28 | * multichannel PCM |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/15 12/19/11 4:27p jgarrett |
|---|
| 31 | * SW7425-1018: Adding initial A/85 implementation |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/14 11/21/11 11:44a jgarrett |
|---|
| 34 | * SW7425-1756: Adding overflow and status ready interrupts |
|---|
| 35 | * |
|---|
| 36 | * Hydra_Software_Devel/13 11/16/11 5:15p jgarrett |
|---|
| 37 | * SW7425-1519: Adding external PCM mixing option |
|---|
| 38 | * |
|---|
| 39 | * Hydra_Software_Devel/12 9/14/11 6:58p jgarrett |
|---|
| 40 | * SW7425-1045: Adding unmapped settings and status values for some |
|---|
| 41 | * decoder algorithms |
|---|
| 42 | * |
|---|
| 43 | * Hydra_Software_Devel/11 8/22/11 7:03p jgarrett |
|---|
| 44 | * SWDTV-8271: Adding low delay mode support |
|---|
| 45 | * |
|---|
| 46 | * Hydra_Software_Devel/10 6/21/11 3:50p jgarrett |
|---|
| 47 | * SW7425-654: Adding NRT APIs to decoder and mux |
|---|
| 48 | * |
|---|
| 49 | * Hydra_Software_Devel/9 3/11/11 6:02p jgarrett |
|---|
| 50 | * SW7422-146: Decoder supports external inputs |
|---|
| 51 | * |
|---|
| 52 | * Hydra_Software_Devel/8 3/3/11 6:31p jgarrett |
|---|
| 53 | * SW7422-146: Adding SRC and DSOLA and path review feedback |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/7 2/22/11 5:43p jgarrett |
|---|
| 56 | * SW7422-146: Implemented type renaming based on filter graph review |
|---|
| 57 | * comments |
|---|
| 58 | * |
|---|
| 59 | * Hydra_Software_Devel/6 2/15/11 4:07p jgarrett |
|---|
| 60 | * SW7422-146: Adding additional codec settings and types |
|---|
| 61 | * |
|---|
| 62 | * Hydra_Software_Devel/5 2/7/11 11:30a jgarrett |
|---|
| 63 | * SW7422-146: Implementing DDP -> AC3 conversion and status for |
|---|
| 64 | * MPEG/AAC/AC3 |
|---|
| 65 | * |
|---|
| 66 | * Hydra_Software_Devel/4 1/19/11 6:13p jgarrett |
|---|
| 67 | * SW7422-146: Enabling TSM |
|---|
| 68 | * |
|---|
| 69 | * Hydra_Software_Devel/3 1/12/11 4:24p jgarrett |
|---|
| 70 | * SW7422-146: Adding additional APIs |
|---|
| 71 | * |
|---|
| 72 | * Hydra_Software_Devel/2 12/16/10 4:04p jgarrett |
|---|
| 73 | * SW7422-146: Initial compilable APE for 7422 |
|---|
| 74 | * |
|---|
| 75 | * Hydra_Software_Devel/1 12/14/10 2:16p jgarrett |
|---|
| 76 | * SW7422-146: Adding initial API for APE/DSP |
|---|
| 77 | * |
|---|
| 78 | ***************************************************************************/ |
|---|
| 79 | |
|---|
| 80 | #ifndef BAPE_DECODER_H_ |
|---|
| 81 | #define BAPE_DECODER_H_ |
|---|
| 82 | |
|---|
| 83 | #include "bavc.h" |
|---|
| 84 | #include "bape_types.h" |
|---|
| 85 | #include "bape_input.h" |
|---|
| 86 | #include "bape_codec_types.h" |
|---|
| 87 | |
|---|
| 88 | /*************************************************************************** |
|---|
| 89 | Summary: |
|---|
| 90 | Decoder Handle |
|---|
| 91 | ***************************************************************************/ |
|---|
| 92 | typedef struct BAPE_Decoder *BAPE_DecoderHandle; |
|---|
| 93 | |
|---|
| 94 | /*************************************************************************** |
|---|
| 95 | Summary: |
|---|
| 96 | Decoder Open settings |
|---|
| 97 | ***************************************************************************/ |
|---|
| 98 | typedef struct BAPE_DecoderOpenSettings |
|---|
| 99 | { |
|---|
| 100 | unsigned dspIndex; /* Index of the DSP you would like to use. Default = 0. */ |
|---|
| 101 | } BAPE_DecoderOpenSettings; |
|---|
| 102 | |
|---|
| 103 | /*************************************************************************** |
|---|
| 104 | Summary: |
|---|
| 105 | Get default open settings for an audio decoder |
|---|
| 106 | ***************************************************************************/ |
|---|
| 107 | void BAPE_Decoder_GetDefaultOpenSettings( |
|---|
| 108 | BAPE_DecoderOpenSettings *pSettings /* [out] */ |
|---|
| 109 | ); |
|---|
| 110 | |
|---|
| 111 | /*************************************************************************** |
|---|
| 112 | Summary: |
|---|
| 113 | Open an audio decoder |
|---|
| 114 | ***************************************************************************/ |
|---|
| 115 | BERR_Code BAPE_Decoder_Open( |
|---|
| 116 | BAPE_Handle deviceHandle, |
|---|
| 117 | unsigned index, |
|---|
| 118 | const BAPE_DecoderOpenSettings *pSettings, |
|---|
| 119 | BAPE_DecoderHandle *pHandle /* [out] */ |
|---|
| 120 | ); |
|---|
| 121 | |
|---|
| 122 | /*************************************************************************** |
|---|
| 123 | Summary: |
|---|
| 124 | Close an audio decoder |
|---|
| 125 | ***************************************************************************/ |
|---|
| 126 | void BAPE_Decoder_Close( |
|---|
| 127 | BAPE_DecoderHandle handle |
|---|
| 128 | ); |
|---|
| 129 | |
|---|
| 130 | /*************************************************************************** |
|---|
| 131 | Summary: |
|---|
| 132 | Decoder Mixing Modes |
|---|
| 133 | ***************************************************************************/ |
|---|
| 134 | typedef enum BAPE_DecoderMixingMode |
|---|
| 135 | { |
|---|
| 136 | BAPE_DecoderMixingMode_eDescription, /* In this mixing mode, channels will be mixed using |
|---|
| 137 | volume coefficients contained in the secondary audio |
|---|
| 138 | program. This is typically used in audio services for |
|---|
| 139 | the visually impaired (as described in DTG D-Book section 4.5), |
|---|
| 140 | where a voice over track can be mixed with the primary |
|---|
| 141 | audio track. */ |
|---|
| 142 | BAPE_DecoderMixingMode_eSoundEffects, /* In this mixing mode, channels will be mixed using static |
|---|
| 143 | coefficients in the mixer as opposed to stream-based |
|---|
| 144 | coefficients. */ |
|---|
| 145 | BAPE_DecoderMixingMode_eMax |
|---|
| 146 | } BAPE_DecoderMixingMode; |
|---|
| 147 | |
|---|
| 148 | /*************************************************************************** |
|---|
| 149 | Summary: |
|---|
| 150 | Start-time settings for an audio decoder |
|---|
| 151 | ***************************************************************************/ |
|---|
| 152 | typedef struct BAPE_DecoderStartSettings |
|---|
| 153 | { |
|---|
| 154 | BAVC_AudioCompressionStd codec; |
|---|
| 155 | BAVC_StreamType streamType; /* Required for TSM computation */ |
|---|
| 156 | |
|---|
| 157 | unsigned stcIndex; /* Which STC index should be used */ |
|---|
| 158 | |
|---|
| 159 | const BAVC_XptContextMap *pContextMap; /* What RAVE context should be read while decoding. |
|---|
| 160 | If decoding from an input port, pass NULL for this |
|---|
| 161 | setting */ |
|---|
| 162 | BAPE_InputPort inputPort; /* What input port to read data from. If decoding from |
|---|
| 163 | RAVE, pass NULL for this setting */ |
|---|
| 164 | |
|---|
| 165 | bool targetSyncEnabled; /* If true, normal frame sync operation will be used (default). This flag can be set to false |
|---|
| 166 | for certification applications that require the last frame of the input buffer to be consumed |
|---|
| 167 | without the audio decoder finding the start of the successive frame. */ |
|---|
| 168 | |
|---|
| 169 | bool ppmCorrection; /* If true, PPM correction will be performed for 2ms lipsync |
|---|
| 170 | precision on PCM outputs. Not available with any compressed |
|---|
| 171 | or multichannel data outputs into hardware. */ |
|---|
| 172 | |
|---|
| 173 | bool decodeRateControl; /* If true, decoder rate control is enabled for trick mode |
|---|
| 174 | operations. Not availble with ppmCorrection or if any |
|---|
| 175 | compressed or multichannel data outputs into hardware. */ |
|---|
| 176 | |
|---|
| 177 | bool nonRealTime; /* Normal operation for decoding is real time, if this is set to 'true' then decoding is used as a |
|---|
| 178 | source for non-realtime transcode operations */ |
|---|
| 179 | |
|---|
| 180 | BAPE_DspDelayMode delayMode; /* DSP Delay mode for this task. Default uses a fixed path delay irrespective of source codec. |
|---|
| 181 | Low delay mode provides lower delay depending on the input codec, but has restrictions on |
|---|
| 182 | running only a single DSP task at a time as well as limits on the post-processing that can |
|---|
| 183 | be performed */ |
|---|
| 184 | |
|---|
| 185 | BAPE_DecoderMixingMode mixingMode; /* Mixing mode to be used when multiple decoders are mixed */ |
|---|
| 186 | } BAPE_DecoderStartSettings; |
|---|
| 187 | |
|---|
| 188 | /*************************************************************************** |
|---|
| 189 | Summary: |
|---|
| 190 | Get default start settings for an audio decoder |
|---|
| 191 | ***************************************************************************/ |
|---|
| 192 | void BAPE_Decoder_GetDefaultStartSettings( |
|---|
| 193 | BAPE_DecoderStartSettings *pSettings /* [out] */ |
|---|
| 194 | ); |
|---|
| 195 | |
|---|
| 196 | /*************************************************************************** |
|---|
| 197 | Summary: |
|---|
| 198 | Start an audio decoder |
|---|
| 199 | ***************************************************************************/ |
|---|
| 200 | BERR_Code BAPE_Decoder_Start( |
|---|
| 201 | BAPE_DecoderHandle handle, |
|---|
| 202 | const BAPE_DecoderStartSettings *pSettings |
|---|
| 203 | ); |
|---|
| 204 | |
|---|
| 205 | /*************************************************************************** |
|---|
| 206 | Summary: |
|---|
| 207 | Stop an audio decoder |
|---|
| 208 | ***************************************************************************/ |
|---|
| 209 | void BAPE_Decoder_Stop( |
|---|
| 210 | BAPE_DecoderHandle handle |
|---|
| 211 | ); |
|---|
| 212 | |
|---|
| 213 | /*************************************************************************** |
|---|
| 214 | Summary: |
|---|
| 215 | Pause an audio decoder |
|---|
| 216 | ***************************************************************************/ |
|---|
| 217 | BERR_Code BAPE_Decoder_Pause( |
|---|
| 218 | BAPE_DecoderHandle handle |
|---|
| 219 | ); |
|---|
| 220 | |
|---|
| 221 | /*************************************************************************** |
|---|
| 222 | Summary: |
|---|
| 223 | Resume an audio decoder from a paused state |
|---|
| 224 | ***************************************************************************/ |
|---|
| 225 | BERR_Code BAPE_Decoder_Resume( |
|---|
| 226 | BAPE_DecoderHandle handle |
|---|
| 227 | ); |
|---|
| 228 | |
|---|
| 229 | /*************************************************************************** |
|---|
| 230 | Summary: |
|---|
| 231 | Advance an audio decoder in ms units. Must be paused first. |
|---|
| 232 | ***************************************************************************/ |
|---|
| 233 | BERR_Code BAPE_Decoder_Advance( |
|---|
| 234 | BAPE_DecoderHandle handle, |
|---|
| 235 | unsigned milliseconds /* Milliseconds to advance */ |
|---|
| 236 | ); |
|---|
| 237 | |
|---|
| 238 | /*************************************************************************** |
|---|
| 239 | Summary: |
|---|
| 240 | Prepare the decoder to flush (called prior to flushing RAVE context) |
|---|
| 241 | ***************************************************************************/ |
|---|
| 242 | BERR_Code BAPE_Decoder_DisableForFlush( |
|---|
| 243 | BAPE_DecoderHandle handle |
|---|
| 244 | ); |
|---|
| 245 | |
|---|
| 246 | /*************************************************************************** |
|---|
| 247 | Summary: |
|---|
| 248 | Flush the decoder's buffers (called after flushing RAVE context) |
|---|
| 249 | ***************************************************************************/ |
|---|
| 250 | BERR_Code BAPE_Decoder_Flush( |
|---|
| 251 | BAPE_DecoderHandle handle |
|---|
| 252 | ); |
|---|
| 253 | |
|---|
| 254 | /*************************************************************************** |
|---|
| 255 | Summary: |
|---|
| 256 | Audio Decoder TSM Settings |
|---|
| 257 | ***************************************************************************/ |
|---|
| 258 | typedef struct BAPE_DecoderTsmSettings |
|---|
| 259 | { |
|---|
| 260 | bool tsmEnabled; |
|---|
| 261 | bool astmEnabled; |
|---|
| 262 | bool playback; |
|---|
| 263 | uint32_t ptsOffset; /* PTS offset value in 45 kHz ticks. Will be internally converted to |
|---|
| 264 | 27MHz if required. */ |
|---|
| 265 | uint32_t stcOffset; /* SW STC Offset in 45kHz ticks. Will be internaly converted to |
|---|
| 266 | 27 MHz if required.*/ |
|---|
| 267 | /* All thresholds below are programmed in milliseconds. */ |
|---|
| 268 | struct |
|---|
| 269 | { |
|---|
| 270 | unsigned discard; /* Threshold (ms) beyond which frames will be discarded */ |
|---|
| 271 | unsigned grossAdjustment; /* Threshold (ms) beyond which gross adjustments will be performed */ |
|---|
| 272 | unsigned smoothTrack; /* Threshold (ms) beyond which smooth tracking (ppm) adjustments will be performed */ |
|---|
| 273 | unsigned syncLimit; /* Sets the sync limit for audio master mode (in ms). Set to 0 to disable audio master mode */ |
|---|
| 274 | } thresholds; |
|---|
| 275 | } BAPE_DecoderTsmSettings; |
|---|
| 276 | |
|---|
| 277 | /*************************************************************************** |
|---|
| 278 | Summary: |
|---|
| 279 | Get Audio Decoder TSM Settings |
|---|
| 280 | ***************************************************************************/ |
|---|
| 281 | void BAPE_Decoder_GetTsmSettings( |
|---|
| 282 | BAPE_DecoderHandle handle, |
|---|
| 283 | BAPE_DecoderTsmSettings *pSettings /* [out] */ |
|---|
| 284 | ); |
|---|
| 285 | |
|---|
| 286 | /*************************************************************************** |
|---|
| 287 | Summary: |
|---|
| 288 | Get Audio Decoder TSM Settings in isr context |
|---|
| 289 | ***************************************************************************/ |
|---|
| 290 | void BAPE_Decoder_GetTsmSettings_isr( |
|---|
| 291 | BAPE_DecoderHandle handle, |
|---|
| 292 | BAPE_DecoderTsmSettings *pSettings /* [out] */ |
|---|
| 293 | ); |
|---|
| 294 | |
|---|
| 295 | /*************************************************************************** |
|---|
| 296 | Summary: |
|---|
| 297 | Set Audio Decoder TSM Settings |
|---|
| 298 | ***************************************************************************/ |
|---|
| 299 | BERR_Code BAPE_Decoder_SetTsmSettings( |
|---|
| 300 | BAPE_DecoderHandle handle, |
|---|
| 301 | const BAPE_DecoderTsmSettings *pSettings |
|---|
| 302 | ); |
|---|
| 303 | |
|---|
| 304 | /*************************************************************************** |
|---|
| 305 | Summary: |
|---|
| 306 | Set Audio Decoder TSM Settings in isr context |
|---|
| 307 | ***************************************************************************/ |
|---|
| 308 | BERR_Code BAPE_Decoder_SetTsmSettings_isr( |
|---|
| 309 | BAPE_DecoderHandle handle, |
|---|
| 310 | const BAPE_DecoderTsmSettings *pSettings |
|---|
| 311 | ); |
|---|
| 312 | |
|---|
| 313 | /*************************************************************************** |
|---|
| 314 | Summary: |
|---|
| 315 | Indicate a playback STC is valid to the decoder in isr context |
|---|
| 316 | ***************************************************************************/ |
|---|
| 317 | BERR_Code BAPE_Decoder_SetStcValid_isr( |
|---|
| 318 | BAPE_DecoderHandle handle |
|---|
| 319 | ); |
|---|
| 320 | |
|---|
| 321 | /*************************************************************************** |
|---|
| 322 | Summary: |
|---|
| 323 | Audio Decoder TSM Status |
|---|
| 324 | ***************************************************************************/ |
|---|
| 325 | typedef struct BAPE_DecoderTsmStatus |
|---|
| 326 | { |
|---|
| 327 | BAVC_PTSInfo ptsInfo; |
|---|
| 328 | int32_t ptsStcDifference; /* PTS - STC value */ |
|---|
| 329 | unsigned lastFrameLength; /* In ms */ |
|---|
| 330 | } BAPE_DecoderTsmStatus; |
|---|
| 331 | |
|---|
| 332 | /*************************************************************************** |
|---|
| 333 | Summary: |
|---|
| 334 | Get Audio Decoder TSM Status |
|---|
| 335 | ***************************************************************************/ |
|---|
| 336 | BERR_Code BAPE_Decoder_GetTsmStatus( |
|---|
| 337 | BAPE_DecoderHandle handle, |
|---|
| 338 | BAPE_DecoderTsmStatus *pStatus /* [out] */ |
|---|
| 339 | ); |
|---|
| 340 | |
|---|
| 341 | /*************************************************************************** |
|---|
| 342 | Summary: |
|---|
| 343 | Get Audio Decoder TSM Status in isr context |
|---|
| 344 | ***************************************************************************/ |
|---|
| 345 | BERR_Code BAPE_Decoder_GetTsmStatus_isr( |
|---|
| 346 | BAPE_DecoderHandle handle, |
|---|
| 347 | BAPE_DecoderTsmStatus *pStatus /* [out] */ |
|---|
| 348 | ); |
|---|
| 349 | |
|---|
| 350 | /*************************************************************************** |
|---|
| 351 | Summary: |
|---|
| 352 | Normal Playback Rate |
|---|
| 353 | ***************************************************************************/ |
|---|
| 354 | #define BAPE_NORMAL_DECODE_RATE (100) |
|---|
| 355 | |
|---|
| 356 | /*************************************************************************** |
|---|
| 357 | Summary: |
|---|
| 358 | Audio Decoder Settings that are changeable on the fly |
|---|
| 359 | ***************************************************************************/ |
|---|
| 360 | typedef struct BAPE_DecoderSettings |
|---|
| 361 | { |
|---|
| 362 | BAPE_MultichannelFormat multichannelFormat; /* Controls whether the decoder outputs 2.0, 5.1, or 7.1 data on the multichannel path. |
|---|
| 363 | This is not changeable on the fly. */ |
|---|
| 364 | BAPE_ChannelMode outputMode; /* Can not be set to a wider value than multichannelFormat (e.g. 3_4 is not possible |
|---|
| 365 | when multichannel format is 5.1 */ |
|---|
| 366 | bool outputLfe; |
|---|
| 367 | |
|---|
| 368 | bool loudnessEquivalenceEnabled; /* If true, loudness equivalence will be enabled based on the mode specified |
|---|
| 369 | in BAPE_Settings.loudnessMode. Ignored if BAPE_Settings.loudnessMode is |
|---|
| 370 | set to BAPE_LoudnessEquivalenceMode_eNone. Default is true. */ |
|---|
| 371 | |
|---|
| 372 | BAPE_DualMonoMode dualMonoMode; |
|---|
| 373 | |
|---|
| 374 | unsigned decodeRate; /* Playback Rate for trick modes. Use BAPE_NORMAL_DECODE_RATE |
|---|
| 375 | for normal operation. Ranges from BAPE_NORMAL_DECODE_RATE/2 |
|---|
| 376 | to BAPE_NORMAL_DECODE_RATE*2. ppmCorrection is not available |
|---|
| 377 | if the rate is non-standard. This is ignored unless |
|---|
| 378 | BAPE_DecoderStartSettings.decodeRateControl is true */ |
|---|
| 379 | } BAPE_DecoderSettings; |
|---|
| 380 | |
|---|
| 381 | /*************************************************************************** |
|---|
| 382 | Summary: |
|---|
| 383 | Get Audio Decoder Settings |
|---|
| 384 | ***************************************************************************/ |
|---|
| 385 | void BAPE_Decoder_GetSettings( |
|---|
| 386 | BAPE_DecoderHandle handle, |
|---|
| 387 | BAPE_DecoderSettings *pSettings /* [out] */ |
|---|
| 388 | ); |
|---|
| 389 | |
|---|
| 390 | /*************************************************************************** |
|---|
| 391 | Summary: |
|---|
| 392 | Set Audio Decoder Settings |
|---|
| 393 | ***************************************************************************/ |
|---|
| 394 | BERR_Code BAPE_Decoder_SetSettings( |
|---|
| 395 | BAPE_DecoderHandle handle, |
|---|
| 396 | const BAPE_DecoderSettings *pSettings |
|---|
| 397 | ); |
|---|
| 398 | |
|---|
| 399 | /*************************************************************************** |
|---|
| 400 | Summary: |
|---|
| 401 | Audio Decoder Status |
|---|
| 402 | ***************************************************************************/ |
|---|
| 403 | typedef struct BAPE_DecoderStatus |
|---|
| 404 | { |
|---|
| 405 | BAVC_AudioCompressionStd codec; |
|---|
| 406 | BAPE_DecoderTsmStatus tsmStatus; |
|---|
| 407 | unsigned sampleRate; |
|---|
| 408 | unsigned framesDecoded; |
|---|
| 409 | unsigned frameErrors; |
|---|
| 410 | unsigned dummyFrames; |
|---|
| 411 | union |
|---|
| 412 | { |
|---|
| 413 | BAPE_MpegStatus mpeg; |
|---|
| 414 | BAPE_Ac3Status ac3; |
|---|
| 415 | BAPE_AacStatus aac; |
|---|
| 416 | BAPE_WmaStatus wma; |
|---|
| 417 | BAPE_WmaProStatus wmaPro; |
|---|
| 418 | BAPE_DtsStatus dts; |
|---|
| 419 | BAPE_PcmWavStatus pcmWav; |
|---|
| 420 | BAPE_AmrStatus amr; |
|---|
| 421 | BAPE_DraStatus dra; |
|---|
| 422 | BAPE_CookStatus cook; |
|---|
| 423 | } codecStatus; |
|---|
| 424 | } BAPE_DecoderStatus; |
|---|
| 425 | |
|---|
| 426 | /*************************************************************************** |
|---|
| 427 | Summary: |
|---|
| 428 | Get Audio Decoder Status |
|---|
| 429 | ***************************************************************************/ |
|---|
| 430 | void BAPE_Decoder_GetStatus( |
|---|
| 431 | BAPE_DecoderHandle handle, |
|---|
| 432 | BAPE_DecoderStatus *pStatus /* [out] */ |
|---|
| 433 | ); |
|---|
| 434 | |
|---|
| 435 | /*************************************************************************** |
|---|
| 436 | Summary: |
|---|
| 437 | Audio Decoder Codec-Specific Settings |
|---|
| 438 | ***************************************************************************/ |
|---|
| 439 | typedef struct BAPE_DecoderCodecSettings |
|---|
| 440 | { |
|---|
| 441 | BAVC_AudioCompressionStd codec; |
|---|
| 442 | union |
|---|
| 443 | { |
|---|
| 444 | BAPE_Ac3Settings ac3; |
|---|
| 445 | BAPE_Ac3Settings ac3Plus; |
|---|
| 446 | BAPE_AacSettings aac; /* Applies to both ADTS/LOAS */ |
|---|
| 447 | BAPE_AacSettings aacPlus; /* Applies to both ADTS/LOAS */ |
|---|
| 448 | BAPE_WmaProSettings wmaPro; |
|---|
| 449 | BAPE_DtsSettings dts; /* Applies to DTS, DTS-HD, DTS-Legacy */ |
|---|
| 450 | BAPE_AdpcmSettings adpcm; |
|---|
| 451 | } codecSettings; |
|---|
| 452 | } BAPE_DecoderCodecSettings; |
|---|
| 453 | |
|---|
| 454 | /*************************************************************************** |
|---|
| 455 | Summary: |
|---|
| 456 | Get Audio Decoder Codec-Specific Settings |
|---|
| 457 | ***************************************************************************/ |
|---|
| 458 | void BAPE_Decoder_GetCodecSettings( |
|---|
| 459 | BAPE_DecoderHandle handle, |
|---|
| 460 | BAVC_AudioCompressionStd codec, |
|---|
| 461 | BAPE_DecoderCodecSettings *pSettings /* [out] */ |
|---|
| 462 | ); |
|---|
| 463 | |
|---|
| 464 | /*************************************************************************** |
|---|
| 465 | Summary: |
|---|
| 466 | Set Audio Decoder Codec-Specific Settings |
|---|
| 467 | ***************************************************************************/ |
|---|
| 468 | BERR_Code BAPE_Decoder_SetCodecSettings( |
|---|
| 469 | BAPE_DecoderHandle handle, |
|---|
| 470 | const BAPE_DecoderCodecSettings *pSettings |
|---|
| 471 | ); |
|---|
| 472 | |
|---|
| 473 | /*************************************************************************** |
|---|
| 474 | Summary: |
|---|
| 475 | Get connector for decoder output data |
|---|
| 476 | ***************************************************************************/ |
|---|
| 477 | void BAPE_Decoder_GetConnector( |
|---|
| 478 | BAPE_DecoderHandle handle, |
|---|
| 479 | BAPE_ConnectorFormat format, |
|---|
| 480 | BAPE_Connector *pConnector /* [out] */ |
|---|
| 481 | ); |
|---|
| 482 | |
|---|
| 483 | /*************************************************************************** |
|---|
| 484 | Summary: |
|---|
| 485 | Decoder Interrupt Handlers |
|---|
| 486 | ***************************************************************************/ |
|---|
| 487 | typedef struct BAPE_DecoderInterruptHandlers |
|---|
| 488 | { |
|---|
| 489 | /* Interrupt fires when first PTS is received */ |
|---|
| 490 | struct |
|---|
| 491 | { |
|---|
| 492 | void (*pCallback_isr)(void *pParam1, int param2, const BAPE_DecoderTsmStatus *pTsmStatus); |
|---|
| 493 | void *pParam1; |
|---|
| 494 | int param2; |
|---|
| 495 | } firstPts; |
|---|
| 496 | /* Interrupt fires when TSM Fail (PTS Error) occurs */ |
|---|
| 497 | struct |
|---|
| 498 | { |
|---|
| 499 | void (*pCallback_isr)(void *pParam1, int param2, const BAPE_DecoderTsmStatus *pTsmStatus); |
|---|
| 500 | void *pParam1; |
|---|
| 501 | int param2; |
|---|
| 502 | } tsmFail; |
|---|
| 503 | /* Interrupt fires when TSM transitions from fail -> pass in ASTM mode */ |
|---|
| 504 | struct |
|---|
| 505 | { |
|---|
| 506 | void (*pCallback_isr)(void *pParam1, int param2, const BAPE_DecoderTsmStatus *pTsmStatus); |
|---|
| 507 | void *pParam1; |
|---|
| 508 | int param2; |
|---|
| 509 | } tsmPass; |
|---|
| 510 | /* Interrupt fires when the decoder receives the first or any new sample rate in the stream */ |
|---|
| 511 | struct |
|---|
| 512 | { |
|---|
| 513 | void (*pCallback_isr)(void *pParam1, int param2, unsigned sampleRate); |
|---|
| 514 | void *pParam1; |
|---|
| 515 | int param2; |
|---|
| 516 | } sampleRateChange; |
|---|
| 517 | /* Interrupt fires when the decoder achieves frame lock */ |
|---|
| 518 | struct |
|---|
| 519 | { |
|---|
| 520 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 521 | void *pParam1; |
|---|
| 522 | int param2; |
|---|
| 523 | } lock; |
|---|
| 524 | /* Interrupt fires when the decoder loses frame lock */ |
|---|
| 525 | struct |
|---|
| 526 | { |
|---|
| 527 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 528 | void *pParam1; |
|---|
| 529 | int param2; |
|---|
| 530 | } unlock; |
|---|
| 531 | /* Interrupt fires when the decoder status is ready for the host to read. |
|---|
| 532 | Typically, this occurs after the first frame is successfully decoded. */ |
|---|
| 533 | struct |
|---|
| 534 | { |
|---|
| 535 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 536 | void *pParam1; |
|---|
| 537 | int param2; |
|---|
| 538 | } statusReady; |
|---|
| 539 | /* Interrupt fires with stream channel mode (acmod) changes. |
|---|
| 540 | Call BAPE_Decoder_GetStatus() from task context to determine |
|---|
| 541 | latest status. */ |
|---|
| 542 | struct |
|---|
| 543 | { |
|---|
| 544 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 545 | void *pParam1; |
|---|
| 546 | int param2; |
|---|
| 547 | } modeChange; |
|---|
| 548 | /* Interrupt fires with stream bitrate changes. Call BAPE_Decoder_GetStatus() |
|---|
| 549 | from task context to determine latest status. */ |
|---|
| 550 | struct |
|---|
| 551 | { |
|---|
| 552 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 553 | void *pParam1; |
|---|
| 554 | int param2; |
|---|
| 555 | } bitrateChange; |
|---|
| 556 | /* This interrupt fires when the CDB and/or ITB overflow */ |
|---|
| 557 | struct |
|---|
| 558 | { |
|---|
| 559 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 560 | void *pParam1; |
|---|
| 561 | int param2; |
|---|
| 562 | } cdbItbOverflow; |
|---|
| 563 | /* This interrupt fires when the active input has changed to an incompatible format and been halted. |
|---|
| 564 | The application must call BAPE_Decoder_Stop() and BAPE_Decoder_Start() to resume processing. */ |
|---|
| 565 | struct |
|---|
| 566 | { |
|---|
| 567 | void (*pCallback_isr)(void *pParam1, int param2); |
|---|
| 568 | void *pParam1; |
|---|
| 569 | int param2; |
|---|
| 570 | } inputHalted; |
|---|
| 571 | } BAPE_DecoderInterruptHandlers; |
|---|
| 572 | |
|---|
| 573 | /*************************************************************************** |
|---|
| 574 | Summary: |
|---|
| 575 | Get Currently Registered Interrupt Handlers |
|---|
| 576 | ***************************************************************************/ |
|---|
| 577 | void BAPE_Decoder_GetInterruptHandlers( |
|---|
| 578 | BAPE_DecoderHandle handle, |
|---|
| 579 | BAPE_DecoderInterruptHandlers *pInterrupts /* [out] */ |
|---|
| 580 | ); |
|---|
| 581 | |
|---|
| 582 | /*************************************************************************** |
|---|
| 583 | Summary: |
|---|
| 584 | Set Interrupt Handlers |
|---|
| 585 | |
|---|
| 586 | Description: |
|---|
| 587 | To disable any unwanted interrupt, pass NULL for its callback routine |
|---|
| 588 | ***************************************************************************/ |
|---|
| 589 | BERR_Code BAPE_Decoder_SetInterruptHandlers( |
|---|
| 590 | BAPE_DecoderHandle handle, |
|---|
| 591 | const BAPE_DecoderInterruptHandlers *pInterrupts |
|---|
| 592 | ); |
|---|
| 593 | |
|---|
| 594 | /*************************************************************************** |
|---|
| 595 | Summary: |
|---|
| 596 | Get Default CDB/ITB configuration for decoding |
|---|
| 597 | ***************************************************************************/ |
|---|
| 598 | void BAPE_Decoder_GetDefaultCdbItbConfig( |
|---|
| 599 | BAPE_DecoderHandle handle, |
|---|
| 600 | BAVC_CdbItbConfig *pConfig /* [out] */ |
|---|
| 601 | ); |
|---|
| 602 | |
|---|
| 603 | /*************************************************************************** |
|---|
| 604 | Summary: |
|---|
| 605 | Treat input underflows as gaps in non-realtime mode. |
|---|
| 606 | |
|---|
| 607 | Description: |
|---|
| 608 | In non-realtime mode, underflow conditions are not typically treated as a |
|---|
| 609 | gap in data and the decoder will stall waiting for more data. This can |
|---|
| 610 | lead to deadlock scenarios if there is an actual gap in the data. When |
|---|
| 611 | this routine is called, the decoder will enter a gap-fill mode and will |
|---|
| 612 | treat input underflows as missing frames until valid input data is received. |
|---|
| 613 | |
|---|
| 614 | This routine can only be called if the decoder is started and running |
|---|
| 615 | in non-realtime mode. |
|---|
| 616 | ***************************************************************************/ |
|---|
| 617 | BERR_Code BAPE_Decoder_EnterUnderflowMode( |
|---|
| 618 | BAPE_DecoderHandle handle |
|---|
| 619 | ); |
|---|
| 620 | |
|---|
| 621 | #endif |
|---|
| 622 | |
|---|