| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2005, 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: bsettop_decode_audio.h $ |
|---|
| 11 | * $brcm_Revision: 4 $ |
|---|
| 12 | * $brcm_Date: 8/10/05 3:17p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/api/include/bsettop_stream.h $ |
|---|
| 19 | ***************************************************************************/ |
|---|
| 20 | #ifndef BSETTOP_DECODE_AUDIO_H__ |
|---|
| 21 | #define BSETTOP_DECODE_AUDIO_H__ |
|---|
| 22 | |
|---|
| 23 | #include "bsettop_types.h" |
|---|
| 24 | #include "bsettop_stream.h" |
|---|
| 25 | |
|---|
| 26 | #ifdef __cplusplus |
|---|
| 27 | extern "C" { |
|---|
| 28 | #endif |
|---|
| 29 | |
|---|
| 30 | typedef struct baudio_decode *baudio_decode_t; |
|---|
| 31 | typedef struct baudio_decode_status { |
|---|
| 32 | unsigned fifo_depth; |
|---|
| 33 | unsigned fifo_size; |
|---|
| 34 | uint32_t pts; |
|---|
| 35 | uint32_t stc; |
|---|
| 36 | bool hold_enable; |
|---|
| 37 | uint16_t pid; |
|---|
| 38 | bool copyright; /* for ac3 Dolby IEC-60958 status flag */ |
|---|
| 39 | } baudio_decode_status; |
|---|
| 40 | /* |
|---|
| 41 | Summary: |
|---|
| 42 | Audio rate change callback |
|---|
| 43 | */ |
|---|
| 44 | typedef void (*baudio_decode_change_cb_t)(baudio_decode_t audio, /* audio decode contect handle */ |
|---|
| 45 | void *data_ptr, /* rate_change_data */ |
|---|
| 46 | void *cbData /* BRAP_DSPCHN_SampleRateChangeInfo* */ |
|---|
| 47 | ); |
|---|
| 48 | typedef enum baudio_downmix { |
|---|
| 49 | baudio_downmix_stereo, /* If applicable, down mix source to stereo output [default]. */ |
|---|
| 50 | baudio_downmix_multichannel, /* Output decoded data as-is. If number of channels exceeds HW capabilities, |
|---|
| 51 | downmix to match maximum number of output channels. No audio will be lost. */ |
|---|
| 52 | baudio_downmix_none, /* Output decoded data as-is. If number of channels exceeds HW capabilities, |
|---|
| 53 | additional audio channels will be lost. */ |
|---|
| 54 | baudio_downmix_left, /* Take left channel and duplicate to left/right outputs. */ |
|---|
| 55 | baudio_downmix_right, /* Take right channel and duplicate to left/right outputs. */ |
|---|
| 56 | baudio_downmix_monomix /* Mix left and right channels and output result to left/right outputs. This only applies if the stream |
|---|
| 57 | is a dual mono stream. If not, it will be equivalent to baudio_downmix_stereo. */ |
|---|
| 58 | } baudio_downmix; |
|---|
| 59 | |
|---|
| 60 | /* |
|---|
| 61 | * Summary: |
|---|
| 62 | * |
|---|
| 63 | * Dual Mono channel select modes |
|---|
| 64 | * */ |
|---|
| 65 | typedef enum baudio_dualmono { |
|---|
| 66 | baudio_dualmono_left, /* BRAP_DSPCHN_DualMonoMode_eLeftMono Selects left source channel of dual mono audio */ |
|---|
| 67 | baudio_dualmono_right, /* BRAP_DSPCHN_DualMonoMode_eRightMono Selects right source channel of dual mono audio */ |
|---|
| 68 | baudio_dualmono_stereo, /* BRAP_DSPCHN_DualMonoMode_eStere Pass-Thru */ |
|---|
| 69 | baudio_dualmono_monomix /* BRAP_DSPCHN_DualMonoMode_eDualMonoMix Mixes left and right channels */ |
|---|
| 70 | } baudio_dualmono; |
|---|
| 71 | |
|---|
| 72 | /* |
|---|
| 73 | * Summary: |
|---|
| 74 | * Controls the downmix type used by the AAC audio decoder |
|---|
| 75 | * */ |
|---|
| 76 | typedef enum baudio_aac_downmix |
|---|
| 77 | { |
|---|
| 78 | baudio_aac_downmix_matrix = 0, // BRAP_DSPCHN_AAC_DownmixType_eMatrix |
|---|
| 79 | baudio_aac_downmix_arib = 1, // BRAP_DSPCHN_AAC_DownmixType_eArib |
|---|
| 80 | baudio_aac_downmix_ltrt = 2 // BRAP_DSPCHN_AAC_DownmixType_eLtRt |
|---|
| 81 | } baudio_aac_downmix; |
|---|
| 82 | |
|---|
| 83 | typedef enum baudio_dolby_drc_mode |
|---|
| 84 | { |
|---|
| 85 | baudio_dolby_drc_mode_custom_a, // BRAP_DSPCHN_Ac3CompMode_eCustomA |
|---|
| 86 | baudio_dolby_drc_mode_custom_d, // BRAP_DSPCHN_Ac3CompMode_eCustomD |
|---|
| 87 | baudio_dolby_drc_mode_line, // BRAP_DSPCHN_Ac3CompMode_eLine |
|---|
| 88 | baudio_dolby_drc_mode_rf, // BRAP_DSPCHN_Ac3CompMode_eRf |
|---|
| 89 | baudio_dolby_drc_mode_off // BRAP_DSPCHN_Ac3CompMode_eOff |
|---|
| 90 | } baudio_dolby_drc_mode; |
|---|
| 91 | |
|---|
| 92 | typedef enum baudio_dolby_stereo_downmix_mode |
|---|
| 93 | { |
|---|
| 94 | baudio_dolby_stereo_downmix_mode_automatic, // BRAP_DSPCHN_Ac3StereoMode_eAuto |
|---|
| 95 | baudio_dolby_stereo_downmix_mode_dolby_surround_compatible, // BRAP_DSPCHN_Ac3StereoMode_eLtRt |
|---|
| 96 | baudio_dolby_stereo_downmix_mode_standard // BRAP_DSPCHN_Ac3StereoMode_eLoRo |
|---|
| 97 | } baudio_dolby_stereo_downmix_mode; |
|---|
| 98 | |
|---|
| 99 | typedef struct baudio_dolby_settings |
|---|
| 100 | { |
|---|
| 101 | baudio_dolby_drc_mode drc_mode; |
|---|
| 102 | baudio_dolby_stereo_downmix_mode stereo_downmix_mode; |
|---|
| 103 | unsigned short cut; |
|---|
| 104 | unsigned short boost; |
|---|
| 105 | bool lfe; |
|---|
| 106 | bool dialog_norm; /* this should be true for normal operation */ |
|---|
| 107 | } baudio_dolby_settings; |
|---|
| 108 | |
|---|
| 109 | typedef struct baudio_aac_settings |
|---|
| 110 | { |
|---|
| 111 | baudio_aac_downmix downmix; |
|---|
| 112 | } baudio_aac_settings; |
|---|
| 113 | |
|---|
| 114 | typedef struct baudio_decode_config { |
|---|
| 115 | baudio_decode_change_cb_t rate_change_cb; /* normaly used to notify HDMI of rate change */ |
|---|
| 116 | void *rate_change_data; /* passed to baudio_decode_change_cb_t in data_ptr */ |
|---|
| 117 | unsigned int left_volume; |
|---|
| 118 | unsigned int right_volume; |
|---|
| 119 | bool mute; |
|---|
| 120 | bool deemphasized; /* Disable for test purposes */ |
|---|
| 121 | bool hdmi_compress; |
|---|
| 122 | bool mono_mix; |
|---|
| 123 | baudio_downmix downmix; |
|---|
| 124 | baudio_dualmono dualmono; |
|---|
| 125 | baudio_dolby_settings dolby; |
|---|
| 126 | baudio_aac_downmix aac_downmix; |
|---|
| 127 | bool hd_mute; |
|---|
| 128 | bool copyright; /* for ac3 Dolby IEC-60958 status flag */ |
|---|
| 129 | uint8_t category_code; /* for ac3 Dolby IEC-60958 status flag */ |
|---|
| 130 | bool avl; /* avl is enabled */ |
|---|
| 131 | int avl_target; |
|---|
| 132 | int avl_lowerbound; |
|---|
| 133 | int avl_fixedboost; |
|---|
| 134 | } baudio_decode_config; |
|---|
| 135 | |
|---|
| 136 | baudio_decode_t baudio_decode_open(bobject_t id); |
|---|
| 137 | void baudio_decode_close(baudio_decode_t codec); |
|---|
| 138 | bresult baudio_decode_start(baudio_decode_t codec, |
|---|
| 139 | bdisplay_t display, |
|---|
| 140 | bstream_t stream); |
|---|
| 141 | void baudio_decode_stop(baudio_decode_t codec); |
|---|
| 142 | bresult baudio_decode_get_status(baudio_decode_t codec, |
|---|
| 143 | baudio_decode_status *status); |
|---|
| 144 | void baudio_decode_get_config(baudio_decode_t codec, |
|---|
| 145 | baudio_decode_config *config); |
|---|
| 146 | bresult baudio_decode_set_config(baudio_decode_t codec, |
|---|
| 147 | const baudio_decode_config *config); |
|---|
| 148 | void baudio_decode_get_avl_level(baudio_decode_t audio, int num_energy, long *level); |
|---|
| 149 | void baudio_decode_test_tone(baudio_decode_t audio, |
|---|
| 150 | uint32_t *samples, /* array of samples, num_samples long */ |
|---|
| 151 | uint32_t num_samples, /* Number of samples, should be less than sample array size */ |
|---|
| 152 | bool leftChannel, /* true - program left channel, flase program right channel */ |
|---|
| 153 | bool enable /* enable/disable hifidac tone test */ |
|---|
| 154 | ); |
|---|
| 155 | /** |
|---|
| 156 | Summary: |
|---|
| 157 | Supported video format. Returns NULL if stream_type (from PMT) not supported. |
|---|
| 158 | **/ |
|---|
| 159 | bsettop_av_stream_type_t *bdecode_supported_audio(unsigned char stream_type); |
|---|
| 160 | |
|---|
| 161 | #ifdef __cplusplus |
|---|
| 162 | } |
|---|
| 163 | #endif |
|---|
| 164 | |
|---|
| 165 | #endif /* BSETTOP_DECODE_AUDIO_H__ */ |
|---|
| 166 | |
|---|
| 167 | |
|---|