| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2004-2011 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_mux_output.h $ |
|---|
| 39 | * $brcm_Revision: Hydra_Software_Devel/2 $ |
|---|
| 40 | * $brcm_Date: 6/21/11 3:50p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * API name: MuxOutput |
|---|
| 44 | * Specific APIs related to Audio Transcoder Output |
|---|
| 45 | * |
|---|
| 46 | * Revision History: |
|---|
| 47 | * |
|---|
| 48 | * $brcm_Log: /magnum/portinginterface/ape/7422/bape_mux_output.h $ |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/2 6/21/11 3:50p jgarrett |
|---|
| 51 | * SW7425-654: Adding NRT APIs to decoder and mux |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/1 3/21/11 7:08p jgarrett |
|---|
| 54 | * SW7422-356: Adding MuxOutput |
|---|
| 55 | * |
|---|
| 56 | ***************************************************************************/ |
|---|
| 57 | |
|---|
| 58 | #include "bape.h" |
|---|
| 59 | #include "bavc_rap.h" |
|---|
| 60 | #include "bavc_xpt.h" |
|---|
| 61 | |
|---|
| 62 | /*************************************************************************** |
|---|
| 63 | Summary: |
|---|
| 64 | Mux Output Handle |
|---|
| 65 | ***************************************************************************/ |
|---|
| 66 | typedef struct BAPE_MuxOutput *BAPE_MuxOutputHandle; |
|---|
| 67 | |
|---|
| 68 | /*************************************************************************** |
|---|
| 69 | Summary: |
|---|
| 70 | Creation Settings for a MuxOutput object |
|---|
| 71 | ***************************************************************************/ |
|---|
| 72 | typedef struct BAPE_MuxOutputCreateSettings |
|---|
| 73 | { |
|---|
| 74 | const BAVC_XptContextMap *pContextMap; /* Context data will be sent to */ |
|---|
| 75 | } BAPE_MuxOutputCreateSettings; |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | /*************************************************************************** |
|---|
| 79 | Summary: |
|---|
| 80 | Get default settings for a MuxOutput object |
|---|
| 81 | ***************************************************************************/ |
|---|
| 82 | void BAPE_MuxOutput_GetDefaultCreateSettings( |
|---|
| 83 | BAPE_MuxOutputCreateSettings *pSettings /* [out] default settings */ |
|---|
| 84 | ); |
|---|
| 85 | |
|---|
| 86 | /*************************************************************************** |
|---|
| 87 | Summary: |
|---|
| 88 | Open a MuxOutput object |
|---|
| 89 | ***************************************************************************/ |
|---|
| 90 | BERR_Code BAPE_MuxOutput_Create( |
|---|
| 91 | BAPE_Handle deviceHandle, |
|---|
| 92 | const BAPE_MuxOutputCreateSettings *pSettings, |
|---|
| 93 | BAPE_MuxOutputHandle *pHandle /* [out] */ |
|---|
| 94 | ); |
|---|
| 95 | |
|---|
| 96 | /*************************************************************************** |
|---|
| 97 | Summary: |
|---|
| 98 | Close a MuxOutput object |
|---|
| 99 | |
|---|
| 100 | Description: |
|---|
| 101 | Input must be removed prior to closing. |
|---|
| 102 | ***************************************************************************/ |
|---|
| 103 | void BAPE_MuxOutput_Destroy( |
|---|
| 104 | BAPE_MuxOutputHandle handle |
|---|
| 105 | ); |
|---|
| 106 | |
|---|
| 107 | /*************************************************************************** |
|---|
| 108 | Summary: |
|---|
| 109 | Start-time settings for a MuxOutput object |
|---|
| 110 | ***************************************************************************/ |
|---|
| 111 | typedef struct BAPE_MuxOutputStartSettings |
|---|
| 112 | { |
|---|
| 113 | unsigned stcIndex; /* Which STC index should be used */ |
|---|
| 114 | unsigned presentationDelay; /* Arrival to Presentation Delay in ms */ |
|---|
| 115 | |
|---|
| 116 | const BAVC_Xpt_StcSoftIncRegisters *pNonRealTimeIncrement; /* If provided, mux output will run |
|---|
| 117 | in non-realtime mode and update the |
|---|
| 118 | soft increment registers provided. |
|---|
| 119 | Important: This field requires the |
|---|
| 120 | MuxOutput to be started prior to |
|---|
| 121 | starting any inputs. */ |
|---|
| 122 | } BAPE_MuxOutputStartSettings; |
|---|
| 123 | |
|---|
| 124 | /*************************************************************************** |
|---|
| 125 | Summary: |
|---|
| 126 | Get Default Start-time Settings for a MuxOutput object |
|---|
| 127 | ***************************************************************************/ |
|---|
| 128 | void BAPE_MuxOutput_GetDefaultStartSettings( |
|---|
| 129 | BAPE_MuxOutputStartSettings *pSettings /* [out] Settings */ |
|---|
| 130 | ); |
|---|
| 131 | |
|---|
| 132 | /*************************************************************************** |
|---|
| 133 | Summary: |
|---|
| 134 | Start a MuxOutput Object |
|---|
| 135 | |
|---|
| 136 | Description: |
|---|
| 137 | Typically, this is called prior to BAPE_Decoder_Start() in order to |
|---|
| 138 | guarantee all data is captured. |
|---|
| 139 | |
|---|
| 140 | See Also: |
|---|
| 141 | BAPE_MuxOutput_GetDefaultStartSettings |
|---|
| 142 | BAPE_MuxOutput_Stop |
|---|
| 143 | ***************************************************************************/ |
|---|
| 144 | BERR_Code BAPE_MuxOutput_Start( |
|---|
| 145 | BAPE_MuxOutputHandle handle, |
|---|
| 146 | const BAPE_MuxOutputStartSettings *pSettings |
|---|
| 147 | ); |
|---|
| 148 | |
|---|
| 149 | /*************************************************************************** |
|---|
| 150 | Summary: |
|---|
| 151 | Stop a MuxOutput Object |
|---|
| 152 | |
|---|
| 153 | Description: |
|---|
| 154 | Typically, this is called after BAPE_Decoder_Stop() in order to |
|---|
| 155 | guarantee all data is captured. |
|---|
| 156 | |
|---|
| 157 | See Also: |
|---|
| 158 | BAPE_MuxOutput_Start |
|---|
| 159 | ***************************************************************************/ |
|---|
| 160 | void BAPE_MuxOutput_Stop( |
|---|
| 161 | BAPE_MuxOutputHandle handle |
|---|
| 162 | ); |
|---|
| 163 | |
|---|
| 164 | /*************************************************************************** |
|---|
| 165 | Summary: |
|---|
| 166 | Get MuxOutput Buffer Descriptors |
|---|
| 167 | |
|---|
| 168 | Description: |
|---|
| 169 | Returns audio buffer descriptors for CDB content in the |
|---|
| 170 | BAVC_AudioBufferDescriptor array(s) |
|---|
| 171 | ***************************************************************************/ |
|---|
| 172 | BERR_Code BAPE_MuxOutput_GetBufferDescriptors( |
|---|
| 173 | BAPE_MuxOutputHandle handle, |
|---|
| 174 | const BAVC_AudioBufferDescriptor **pBuffer, /* [out] pointer to BAVC_AudioBufferDescriptor structs */ |
|---|
| 175 | size_t *pSize, /* [out] size of pBuffer in bytes (not number of BAVC_AudioBufferDescriptor structs) */ |
|---|
| 176 | const BAVC_AudioBufferDescriptor **pBuffer2, /* [out] pointer to BAVC_AudioBufferDescriptor structs after wrap around */ |
|---|
| 177 | size_t *pSize2 /* [out] size of pBuffer2 in bytes (not number of BAVC_AudioBufferDescriptor structs) */ |
|---|
| 178 | ); |
|---|
| 179 | |
|---|
| 180 | /*************************************************************************** |
|---|
| 181 | Summary: |
|---|
| 182 | Consume MuxOutput Buffer Descriptors |
|---|
| 183 | |
|---|
| 184 | Description: |
|---|
| 185 | Reclaims the specified number of audio buffer descriptors |
|---|
| 186 | The CDB read pointer is updated accordingly |
|---|
| 187 | ***************************************************************************/ |
|---|
| 188 | BERR_Code BAPE_MuxOutput_ConsumeBufferDescriptors( |
|---|
| 189 | BAPE_MuxOutputHandle handle, |
|---|
| 190 | unsigned numBufferDecsriptors /* must be <= pSize+pSize2 returned by last BAPE_MuxOutput_GetBufferDescriptors call. */ |
|---|
| 191 | ); |
|---|
| 192 | |
|---|
| 193 | /*************************************************************************** |
|---|
| 194 | Summary: |
|---|
| 195 | Get MuxOutput Buffer Status |
|---|
| 196 | |
|---|
| 197 | Description: |
|---|
| 198 | Returns the output buffer status (e.g. the base virtual address) |
|---|
| 199 | ***************************************************************************/ |
|---|
| 200 | BERR_Code BAPE_MuxOutput_GetBufferStatus( |
|---|
| 201 | BAPE_MuxOutputHandle handle, |
|---|
| 202 | BAVC_AudioBufferStatus *pBufferStatus /* [out] */ |
|---|
| 203 | ); |
|---|
| 204 | |
|---|
| 205 | /*************************************************************************** |
|---|
| 206 | Summary: |
|---|
| 207 | Get the audio connector for a MuxOutput object |
|---|
| 208 | ***************************************************************************/ |
|---|
| 209 | void BAPE_MuxOutput_GetConnector( |
|---|
| 210 | BAPE_MuxOutputHandle handle, |
|---|
| 211 | BAPE_Connector *pConnector |
|---|
| 212 | ); |
|---|
| 213 | |
|---|
| 214 | /*************************************************************************** |
|---|
| 215 | Summary: |
|---|
| 216 | Add an input to this processing stage |
|---|
| 217 | ***************************************************************************/ |
|---|
| 218 | BERR_Code BAPE_MuxOutput_AddInput( |
|---|
| 219 | BAPE_MuxOutputHandle handle, |
|---|
| 220 | BAPE_Connector input |
|---|
| 221 | ); |
|---|
| 222 | |
|---|
| 223 | /*************************************************************************** |
|---|
| 224 | Summary: |
|---|
| 225 | Remove an input from this processing stage |
|---|
| 226 | ***************************************************************************/ |
|---|
| 227 | BERR_Code BAPE_MuxOutput_RemoveInput( |
|---|
| 228 | BAPE_MuxOutputHandle handle, |
|---|
| 229 | BAPE_Connector input |
|---|
| 230 | ); |
|---|
| 231 | |
|---|
| 232 | /*************************************************************************** |
|---|
| 233 | Summary: |
|---|
| 234 | Remove all inputs from this processing stage |
|---|
| 235 | ***************************************************************************/ |
|---|
| 236 | BERR_Code BAPE_MuxOutput_RemoveAllInputs( |
|---|
| 237 | BAPE_MuxOutputHandle handle |
|---|
| 238 | ); |
|---|
| 239 | |
|---|
| 240 | /*************************************************************************** |
|---|
| 241 | Summary: |
|---|
| 242 | Audio Mux Output Delay Status |
|---|
| 243 | ***************************************************************************/ |
|---|
| 244 | typedef struct BAPE_MuxOutputDelayStatus |
|---|
| 245 | { |
|---|
| 246 | unsigned endToEndDelay; /* End to end delay for the current input and codec in ms */ |
|---|
| 247 | } BAPE_MuxOutputDelayStatus; |
|---|
| 248 | |
|---|
| 249 | /*************************************************************************** |
|---|
| 250 | Summary: |
|---|
| 251 | Get Audio Mux Output delay |
|---|
| 252 | |
|---|
| 253 | Description: |
|---|
| 254 | This routine will return the path delay status for the audio mux buffer. |
|---|
| 255 | The MuxOutput handle must be connected to the expected data source prior |
|---|
| 256 | to calling this routine in order to determine the correct delay value. |
|---|
| 257 | ***************************************************************************/ |
|---|
| 258 | BERR_Code BAPE_MuxOutput_GetDelayStatus( |
|---|
| 259 | BAPE_MuxOutputHandle handle, |
|---|
| 260 | BAVC_AudioCompressionStd codec, |
|---|
| 261 | BAPE_MuxOutputDelayStatus *pStatus /* [out] */ |
|---|
| 262 | ); |
|---|
| 263 | |
|---|