| 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: nexus_timebase.h $ |
|---|
| 39 | * $brcm_Revision: 32 $ |
|---|
| 40 | * $brcm_Date: 11/15/11 8:00p $ |
|---|
| 41 | * |
|---|
| 42 | * API Description: |
|---|
| 43 | * Management of timebase (clock rate) blocks. |
|---|
| 44 | * |
|---|
| 45 | * Revision History: |
|---|
| 46 | * |
|---|
| 47 | * $brcm_Log: /nexus/modules/transport/7400/include/nexus_timebase.h $ |
|---|
| 48 | * |
|---|
| 49 | * 32 11/15/11 8:00p bandrews |
|---|
| 50 | * SW7405-5538: back up explosion to keep 2-level nested structs, instead |
|---|
| 51 | * of all the way to 1-level |
|---|
| 52 | * |
|---|
| 53 | * 31 11/14/11 2:28p erickson |
|---|
| 54 | * SW7425-1448: add NEXUS_Timebase_SetVdecFrameRate and |
|---|
| 55 | * NEXUS_Timebase_SetHdDviFrameRate |
|---|
| 56 | * |
|---|
| 57 | * 30 11/7/11 3:42p bandrews |
|---|
| 58 | * SW7405-5538: merge to main |
|---|
| 59 | * |
|---|
| 60 | * SW7405-5538/1 11/3/11 6:22p bandrews |
|---|
| 61 | * SW7405-5538: converted |
|---|
| 62 | * |
|---|
| 63 | * 29 10/31/11 7:05p bandrews |
|---|
| 64 | * SW7231-391: merge to main |
|---|
| 65 | * |
|---|
| 66 | * SW7420-2078/1 10/11/11 8:26p bandrews |
|---|
| 67 | * SW7231-391: add support for parser band and timebase protected client |
|---|
| 68 | * usage |
|---|
| 69 | * |
|---|
| 70 | * 28 9/14/11 2:00p erickson |
|---|
| 71 | * SW7408-284: add |
|---|
| 72 | * NEXUS_TimebaseSettings.sourceSettings.pcr.jitterCorrection |
|---|
| 73 | * |
|---|
| 74 | * 27 3/21/11 9:32a erickson |
|---|
| 75 | * SWDTV-5829: add NEXUS_TimebaseSettings.sourceSettings.hdDvi.format |
|---|
| 76 | * |
|---|
| 77 | * 26 3/10/11 12:40p erickson |
|---|
| 78 | * SWDTV-5829: add |
|---|
| 79 | * NEXUS_TimebaseSettings.sourceSettings.hdDvi.vertSyncClock |
|---|
| 80 | * |
|---|
| 81 | * 25 7/14/10 5:37p erickson |
|---|
| 82 | * SW3556-1145: add NEXUS_TimebaseTrackRange to all source type settings |
|---|
| 83 | * |
|---|
| 84 | * 24 5/3/10 11:15a erickson |
|---|
| 85 | * SW7335-706: add NEXUS_TimebaseStatus.lastValueLo |
|---|
| 86 | * |
|---|
| 87 | * PR52472/1 4/1/09 8:44p bandrews |
|---|
| 88 | * PR52472: Use latched phase error instead of reading STC. This allows |
|---|
| 89 | * us to have accurate results regardless of background processing eating |
|---|
| 90 | * cpu |
|---|
| 91 | * |
|---|
| 92 | * 21 12/19/08 10:16a jgarrett |
|---|
| 93 | * PR 49587: Moving internal members to freeRun instead |
|---|
| 94 | * |
|---|
| 95 | * 20 12/2/08 3:03p jgarrett |
|---|
| 96 | * PR 49587: Merging to mainline |
|---|
| 97 | * |
|---|
| 98 | * Nexus_Devel/wince_7400/9 12/1/08 10:40a gmullen |
|---|
| 99 | * PR 49587: Merged with mainline to get Pcr Error callbacks. |
|---|
| 100 | * |
|---|
| 101 | * Nexus_Devel/wince_7400/8 12/1/08 9:40a gmullen |
|---|
| 102 | * PR 49587: Merged with mainline version 17 to get updated |
|---|
| 103 | * NEXUS_TimebaseStatus struct. |
|---|
| 104 | * |
|---|
| 105 | * Nexus_Devel/wince_7400/7 9/17/08 4:31p ptimariu |
|---|
| 106 | * PR47063: merge from nexus 3.2 mainline |
|---|
| 107 | * |
|---|
| 108 | * Nexus_Devel/wince_7400/6 4/24/08 11:32a rrlee |
|---|
| 109 | * PR42137: Update to latest Nexus code |
|---|
| 110 | * |
|---|
| 111 | * 19 11/24/08 11:45a erickson |
|---|
| 112 | * PR48846: move pcrErrorCallback outside substruct for kernel mode proxy |
|---|
| 113 | * parsing |
|---|
| 114 | * |
|---|
| 115 | * 18 11/24/08 8:10a erickson |
|---|
| 116 | * PR48846: added pcrError callback and pcrErrors status counter |
|---|
| 117 | * |
|---|
| 118 | * 17 11/19/08 9:47a erickson |
|---|
| 119 | * PR49212: merge new status functions |
|---|
| 120 | * |
|---|
| 121 | * PR49212/1 11/18/08 7:45p bandrews |
|---|
| 122 | * PR49212: ASTM overrides user settings, but it should not destroy them |
|---|
| 123 | * when it does so |
|---|
| 124 | * |
|---|
| 125 | * 16 11/17/08 11:46a erickson |
|---|
| 126 | * PR35457: fix units in comment, better example |
|---|
| 127 | * |
|---|
| 128 | * 15 11/10/08 7:18p erickson |
|---|
| 129 | * PR 35457: fix missing ; |
|---|
| 130 | * |
|---|
| 131 | * 14 11/10/08 5:45p erickson |
|---|
| 132 | * PR 35457: update comments |
|---|
| 133 | * |
|---|
| 134 | * 13 10/24/08 4:41p erickson |
|---|
| 135 | * PR47232: add trackRange for freeRun |
|---|
| 136 | * |
|---|
| 137 | * 12 10/7/08 10:40p erickson |
|---|
| 138 | * PR47232: move centerFrequency to freeRun.centerFrequency' |
|---|
| 139 | * |
|---|
| 140 | * 11 10/6/08 2:35a erickson |
|---|
| 141 | * PR47232: added |
|---|
| 142 | * NEXUS_TimebaseSettings.sourceSettings.pcr.centerFrequency |
|---|
| 143 | * |
|---|
| 144 | * 10 9/2/08 11:19a erickson |
|---|
| 145 | * PR46213: added NEXUS_TimebaseSettings.freeze |
|---|
| 146 | * |
|---|
| 147 | * 9 7/17/08 10:45a erickson |
|---|
| 148 | * PR44492: add NEXUS_TimebaseSettings.sourceSettings.i2s.sampleRate |
|---|
| 149 | * |
|---|
| 150 | * 8 7/14/08 12:04p erickson |
|---|
| 151 | * PR42739: added options for IPTV |
|---|
| 152 | * |
|---|
| 153 | * 7 7/3/08 10:40a erickson |
|---|
| 154 | * PR44492: add i2s and spdif timebase selection |
|---|
| 155 | * |
|---|
| 156 | * 6 3/21/08 11:40a erickson |
|---|
| 157 | * PR40716: merge |
|---|
| 158 | * |
|---|
| 159 | * PR40716/1 3/21/08 3:58p dyzhang |
|---|
| 160 | * PR40716: timebase settings for analog inputs are not correct. rename |
|---|
| 161 | * NEXUS_TimebaseSourceType_eVdec to NEXUS_TimebaseSourceType_eAnalog. |
|---|
| 162 | * |
|---|
| 163 | * 5 3/20/08 10:22a erickson |
|---|
| 164 | * PR40716: configure DPCR for analog video sources using frameRate, just |
|---|
| 165 | * like HdDvi. |
|---|
| 166 | * |
|---|
| 167 | * 4 3/11/08 4:23p erickson |
|---|
| 168 | * PR40363: clarified comment on pcrCallback |
|---|
| 169 | * |
|---|
| 170 | * Nexus_Devel/wince_7400/5 3/5/08 5:00p gmullen |
|---|
| 171 | * Added DPCR loops params, again! |
|---|
| 172 | * |
|---|
| 173 | * Nexus_Devel/wince_7400/4 3/5/08 4:08p gmullen |
|---|
| 174 | * Previous check-in lost members in NEXUS_TimebaseSettings. |
|---|
| 175 | * |
|---|
| 176 | * Nexus_Devel/wince_7400/3 3/5/08 2:54p gmullen |
|---|
| 177 | * Added access to the DPCR loop params |
|---|
| 178 | * |
|---|
| 179 | * Nexus_Devel/wince_7400/2 2/7/08 1:43p gmullen |
|---|
| 180 | * Merged with main. |
|---|
| 181 | * |
|---|
| 182 | * Nexus_Devel/15 1/14/08 5:47p jgarrett |
|---|
| 183 | * PR 38708: Adding PCR callback to application |
|---|
| 184 | * |
|---|
| 185 | * Nexus_Devel/14 11/29/07 2:24p erickson |
|---|
| 186 | * PR35457: doc update for 0.5 release |
|---|
| 187 | * |
|---|
| 188 | ***************************************************************************/ |
|---|
| 189 | #ifndef NEXUS_TIMEBASE_H__ |
|---|
| 190 | #define NEXUS_TIMEBASE_H__ |
|---|
| 191 | |
|---|
| 192 | #include "nexus_types.h" |
|---|
| 193 | #include "nexus_video_types.h" |
|---|
| 194 | #include "nexus_pid_channel.h" |
|---|
| 195 | |
|---|
| 196 | #ifdef __cplusplus |
|---|
| 197 | extern "C" { |
|---|
| 198 | #endif |
|---|
| 199 | |
|---|
| 200 | /*=* |
|---|
| 201 | A NEXUS_Timebase performs clock recovery using a DPCR hardware block. |
|---|
| 202 | It provides interfaces to connect and sync with various inputs. |
|---|
| 203 | |
|---|
| 204 | See nexus/examples/decode.c for an example application. |
|---|
| 205 | |
|---|
| 206 | See NEXUS_StcChannelHandle to see how NEXUS_Timebase is used to provide lipsync. |
|---|
| 207 | See NEXUS_DisplayHandle and NEXUS_AudioMixerHandle to see how NEXUS_Timebase is used to regulate output timing. |
|---|
| 208 | **/ |
|---|
| 209 | |
|---|
| 210 | /** |
|---|
| 211 | Summary: |
|---|
| 212 | The type of source that NEXUS_Timebase is connected to. |
|---|
| 213 | **/ |
|---|
| 214 | typedef enum NEXUS_TimebaseSourceType |
|---|
| 215 | { |
|---|
| 216 | NEXUS_TimebaseSourceType_ePcr, /* Lock to a PCR in a transport stream. Used for live decode. Can also be used for PVR with pacing. */ |
|---|
| 217 | NEXUS_TimebaseSourceType_eFreeRun, /* Lock to the 27MHz system clock. Used for PVR. */ |
|---|
| 218 | NEXUS_TimebaseSourceType_eAnalog, /* Lock to AnalogVideoDecoder. */ |
|---|
| 219 | NEXUS_TimebaseSourceType_eHdDviIn, /* Lock to the HdmiInput. */ |
|---|
| 220 | NEXUS_TimebaseSourceType_eCcir656In, /* Lock to the CCIR 656 video input. */ |
|---|
| 221 | NEXUS_TimebaseSourceType_eI2sIn, /* Lock to the I2S audio input. */ |
|---|
| 222 | NEXUS_TimebaseSourceType_eSpdifIn, /* Lock to the SPDIF audio input. */ |
|---|
| 223 | NEXUS_TimebaseSourceType_eMax |
|---|
| 224 | } NEXUS_TimebaseSourceType; |
|---|
| 225 | |
|---|
| 226 | /** |
|---|
| 227 | Summary: |
|---|
| 228 | Tracking range for DPCR block in units of parts per million |
|---|
| 229 | **/ |
|---|
| 230 | typedef enum NEXUS_TimebaseTrackRange |
|---|
| 231 | { |
|---|
| 232 | NEXUS_TimebaseTrackRange_e8ppm, |
|---|
| 233 | NEXUS_TimebaseTrackRange_e15ppm, |
|---|
| 234 | NEXUS_TimebaseTrackRange_e30ppm, |
|---|
| 235 | NEXUS_TimebaseTrackRange_e61ppm, |
|---|
| 236 | NEXUS_TimebaseTrackRange_e122ppm, |
|---|
| 237 | NEXUS_TimebaseTrackRange_e244ppm, |
|---|
| 238 | NEXUS_TimebaseTrackRange_eMax |
|---|
| 239 | } NEXUS_TimebaseTrackRange; |
|---|
| 240 | |
|---|
| 241 | /** |
|---|
| 242 | Summary: |
|---|
| 243 | Settings for the free-run source type |
|---|
| 244 | **/ |
|---|
| 245 | typedef struct NEXUS_TimebaseFreeRunSourceSettings |
|---|
| 246 | { |
|---|
| 247 | unsigned centerFrequency; /* Controls the absolute center frequency of the timebase relative to the crystal. |
|---|
| 248 | A 27MHz timebase is generated with 0x400000 (default). centerFrequency may be adjusted to compensate for crystal variations. |
|---|
| 249 | Adjusting centerFrequency by 1 LSB has an effect of roughly 3.8 ppm. */ |
|---|
| 250 | NEXUS_TimebaseTrackRange trackRange; |
|---|
| 251 | /* |
|---|
| 252 | ** For the internal (free-running) source, the 27 MHz clock may be scaled by the prescale and inc values. |
|---|
| 253 | ** The scaled clock signal is used to generate an imitation PCR, which the hardware uses as if it where |
|---|
| 254 | ** the real thing. |
|---|
| 255 | */ |
|---|
| 256 | uint32_t prescale; /* A prescale of N divides the clock by N+1. For example, setting prescale |
|---|
| 257 | to zero will not affect the clock. Or, setting prescale to 57 will swallow |
|---|
| 258 | 57 of every 58 clock ticks */ |
|---|
| 259 | uint32_t inc; /* Together with prescale, this value converts clock ticks to PCRs for lock. |
|---|
| 260 | The clock ticks are divided by the prescaler. At every divided event, |
|---|
| 261 | the synthesized PCR is incremented by the amount in this inc register */ |
|---|
| 262 | uint8_t loopDirectPathGain; |
|---|
| 263 | uint8_t loopGain; |
|---|
| 264 | uint8_t loopIntegratorLeak; |
|---|
| 265 | } NEXUS_TimebaseFreeRunSourceSettings; |
|---|
| 266 | |
|---|
| 267 | /** |
|---|
| 268 | Summary: |
|---|
| 269 | Settings for the PCR source type |
|---|
| 270 | **/ |
|---|
| 271 | typedef struct NEXUS_TimebasePcrSourceSettings |
|---|
| 272 | { |
|---|
| 273 | NEXUS_PidChannelHandle pidChannel; /* Pid channel for the PCR */ |
|---|
| 274 | unsigned maxPcrError; /* Maximum amount of PCR jitter which DPCR hardware will absorb. Any PCR change outside of this |
|---|
| 275 | threshold will result in the STC being updated. Measured in 33 bit PTS units (e.g. 90KHz MPEG TS). |
|---|
| 276 | Default is 255 (which, for MPEG TS, is 255/90000 = 0.0028 = 2.8 milliseconds). */ |
|---|
| 277 | NEXUS_TimebaseTrackRange trackRange; |
|---|
| 278 | NEXUS_TristateEnable jitterCorrection; |
|---|
| 279 | } NEXUS_TimebasePcrSourceSettings; |
|---|
| 280 | |
|---|
| 281 | /** |
|---|
| 282 | Summary: |
|---|
| 283 | Settings for the VDEC source type |
|---|
| 284 | **/ |
|---|
| 285 | typedef struct NEXUS_TimebaseVdecSourceSettings |
|---|
| 286 | { |
|---|
| 287 | unsigned index; /* index of the AnalogVideoDecoder */ |
|---|
| 288 | NEXUS_VideoFormat format; |
|---|
| 289 | NEXUS_VideoFrameRate frameRate; /* deprecated. use NEXUS_Timebase_SetVdecFrameRate instead. */ |
|---|
| 290 | NEXUS_TimebaseTrackRange trackRange; |
|---|
| 291 | } NEXUS_TimebaseVdecSourceSettings; |
|---|
| 292 | |
|---|
| 293 | /** |
|---|
| 294 | Summary: |
|---|
| 295 | Settings for the HDDVI source type |
|---|
| 296 | **/ |
|---|
| 297 | typedef struct NEXUS_TimebaseHddviSourceSettings |
|---|
| 298 | { |
|---|
| 299 | unsigned index; /* index of the HD-DVI input */ |
|---|
| 300 | unsigned vertSyncClock; /* Vertical sync clock measured from HD-DVI. This is the number of clock cycles between vsync's. |
|---|
| 301 | Set to 0 to ignore/bypass this value. */ |
|---|
| 302 | NEXUS_VideoFormat format; |
|---|
| 303 | NEXUS_VideoFrameRate frameRate; /* deprecated. use NEXUS_Timebase_SetHdDviFrameRate instead. */ |
|---|
| 304 | NEXUS_TimebaseTrackRange trackRange; |
|---|
| 305 | } NEXUS_TimebaseHddviSourceSettings; |
|---|
| 306 | |
|---|
| 307 | /** |
|---|
| 308 | Summary: |
|---|
| 309 | Settings for the 656 source type |
|---|
| 310 | **/ |
|---|
| 311 | typedef struct NEXUS_TimebaseCcir656SourceSettings |
|---|
| 312 | { |
|---|
| 313 | unsigned index; /* index of the CCIR 656 input */ |
|---|
| 314 | NEXUS_VideoFormat format; |
|---|
| 315 | NEXUS_TimebaseTrackRange trackRange; |
|---|
| 316 | } NEXUS_TimebaseCcir656SourceSettings; |
|---|
| 317 | |
|---|
| 318 | /** |
|---|
| 319 | Summary: |
|---|
| 320 | Settings for the I2S source type |
|---|
| 321 | **/ |
|---|
| 322 | typedef struct NEXUS_TimebaseI2sSourceSettings |
|---|
| 323 | { |
|---|
| 324 | unsigned index; /* index of the I2S input */ |
|---|
| 325 | unsigned sampleRate; /* in Hz. This must be programmed by the application when it sets NEXUS_I2sSettings.sampleRate. */ |
|---|
| 326 | NEXUS_TimebaseTrackRange trackRange; |
|---|
| 327 | } NEXUS_TimebaseI2sSourceSettings; |
|---|
| 328 | |
|---|
| 329 | /** |
|---|
| 330 | Summary: |
|---|
| 331 | Settings to configure a NEXUS_Timebase |
|---|
| 332 | **/ |
|---|
| 333 | typedef struct NEXUS_TimebaseSettings |
|---|
| 334 | { |
|---|
| 335 | NEXUS_TimebaseSourceType sourceType; /* Type of timebase source */ |
|---|
| 336 | |
|---|
| 337 | struct { |
|---|
| 338 | NEXUS_TimebaseFreeRunSourceSettings freeRun; /* valid for sourceType NEXUS_TimebaseSourceType_eFreeRun */ |
|---|
| 339 | NEXUS_TimebasePcrSourceSettings pcr; /* valid for sourceType NEXUS_TimebaseSourceType_ePcr */ |
|---|
| 340 | NEXUS_TimebaseVdecSourceSettings vdec; /* valid for sourceType NEXUS_TimebaseSourceType_eAnalog */ |
|---|
| 341 | NEXUS_TimebaseHddviSourceSettings hdDvi; /* valid for sourceType NEXUS_TimebaseSourceType_eHdDviIn */ |
|---|
| 342 | NEXUS_TimebaseCcir656SourceSettings ccir656; /* valid for sourceType NEXUS_TimebaseSource_eCcir656In */ |
|---|
| 343 | NEXUS_TimebaseI2sSourceSettings i2s; /* valid for sourceType NEXUS_TimebaseSourceType_eI2sIn */ |
|---|
| 344 | } sourceSettings; /* source-type-specific settings */ |
|---|
| 345 | |
|---|
| 346 | /* NOTE: Callbacks are outside substruct because of kernel mode proxy parser */ |
|---|
| 347 | NEXUS_CallbackDesc pcrCallback; /* Called when a new PCR is received. */ |
|---|
| 348 | NEXUS_CallbackDesc pcrErrorCallback; /* Called whenever there are two consecutive PCR out-of-range errors (as defined by maxPcrError. |
|---|
| 349 | If the callback is set, it will be fired and NEXUS_TimebaseStatus.pcrErrors will accumulate. */ |
|---|
| 350 | bool freeze; /* Stop loop tracking by freezing the integrator. */ |
|---|
| 351 | } NEXUS_TimebaseSettings; |
|---|
| 352 | |
|---|
| 353 | /** |
|---|
| 354 | Summary: |
|---|
| 355 | Update timebase settings |
|---|
| 356 | **/ |
|---|
| 357 | NEXUS_Error NEXUS_Timebase_SetSettings( |
|---|
| 358 | NEXUS_Timebase timebase, |
|---|
| 359 | const NEXUS_TimebaseSettings *pSettings /* Settings */ |
|---|
| 360 | ); |
|---|
| 361 | |
|---|
| 362 | /** |
|---|
| 363 | Summary: |
|---|
| 364 | Get current timebase settings |
|---|
| 365 | **/ |
|---|
| 366 | void NEXUS_Timebase_GetSettings( |
|---|
| 367 | NEXUS_Timebase timebase, |
|---|
| 368 | NEXUS_TimebaseSettings *pSettings /* [out] Settings */ |
|---|
| 369 | ); |
|---|
| 370 | |
|---|
| 371 | /** |
|---|
| 372 | Summary: |
|---|
| 373 | Open a timebase for exclusive use |
|---|
| 374 | |
|---|
| 375 | Description: |
|---|
| 376 | NEXUS_Timebase_Open is required for protected clients to exclusively use a timebase. |
|---|
| 377 | **/ |
|---|
| 378 | NEXUS_Timebase NEXUS_Timebase_Open( /* attr{destructor=NEXUS_Timebase_Close} */ |
|---|
| 379 | unsigned index /* Use a specific index or NEXUS_ANY_ID */ |
|---|
| 380 | ); |
|---|
| 381 | |
|---|
| 382 | /** |
|---|
| 383 | Summary: |
|---|
| 384 | Close a timebase opened with NEXUS_Timebase_Open |
|---|
| 385 | **/ |
|---|
| 386 | void NEXUS_Timebase_Close( |
|---|
| 387 | NEXUS_Timebase timebase |
|---|
| 388 | ); |
|---|
| 389 | |
|---|
| 390 | /** |
|---|
| 391 | Summary: |
|---|
| 392 | Current status of the timebase. |
|---|
| 393 | |
|---|
| 394 | Description: |
|---|
| 395 | This is chiefly used for diagnostics. |
|---|
| 396 | Call NEXUS_Timebase_GetStatus to get the status. |
|---|
| 397 | Call NEXUS_Timebase_ResetStatus to reset any acculumated values. |
|---|
| 398 | **/ |
|---|
| 399 | typedef struct NEXUS_TimebaseStatus |
|---|
| 400 | { |
|---|
| 401 | uint32_t lastValue; /* Last PCR value received. |
|---|
| 402 | For DSS, this is the full 32 bits of PCR (27 MHz units). |
|---|
| 403 | For MPEG2 TS, this is the most significant 32 bits of the 42 bit PCR (that is, 45 KHz units). |
|---|
| 404 | Throughout the system, whenever the "PCR" is referred to, it is this 32 bit value. */ |
|---|
| 405 | uint32_t lastValueLo; /* Least significant 10 bits of the last 42 bit PCR for MPEG2 TS. Unused for DSS. */ |
|---|
| 406 | int32_t lastError; /* error between last PCR and STC at time of receipt of last PCR */ |
|---|
| 407 | unsigned pcrCount; /* number of PCR's received since call to NEXUS_Timebase_ResetStatus */ |
|---|
| 408 | unsigned pcrErrors; /* number of PCR errors since call to NEXUS_Timebase_ResetStatus. This only accumulates if NEXUS_TimebaseSettings.sourceSettings.pcr.pcrError is set. */ |
|---|
| 409 | bool pcrValid; /* valid PCR was captured from the stream since call to NEXUS_Timebase_ResetStatus */ |
|---|
| 410 | NEXUS_TimebaseSourceType sourceType; /* current source type this timebase is tracking */ |
|---|
| 411 | } NEXUS_TimebaseStatus; |
|---|
| 412 | |
|---|
| 413 | /** |
|---|
| 414 | Summary: |
|---|
| 415 | Get current NEXUS_TimebaseStatus |
|---|
| 416 | **/ |
|---|
| 417 | NEXUS_Error NEXUS_Timebase_GetStatus( |
|---|
| 418 | NEXUS_Timebase timebase, |
|---|
| 419 | NEXUS_TimebaseStatus *pStatus /* [out] current status */ |
|---|
| 420 | ); |
|---|
| 421 | |
|---|
| 422 | /** |
|---|
| 423 | Summary: |
|---|
| 424 | Reset any accumulated values in NEXUS_TimebaseStatus |
|---|
| 425 | **/ |
|---|
| 426 | NEXUS_Error NEXUS_Timebase_ResetStatus( |
|---|
| 427 | NEXUS_Timebase timebase |
|---|
| 428 | ); |
|---|
| 429 | |
|---|
| 430 | /* |
|---|
| 431 | Atomically set NEXUS_TimebaseSettings.sourceSettings.hdDvi |
|---|
| 432 | This function is automatically called by the HdmiInput Interface. |
|---|
| 433 | A non-zero value will override anything set by NEXUS_TimebaseSettings. |
|---|
| 434 | */ |
|---|
| 435 | NEXUS_Error NEXUS_Timebase_SetHdDviFrameRate( |
|---|
| 436 | NEXUS_Timebase timebase, |
|---|
| 437 | NEXUS_VideoFrameRate frameRate |
|---|
| 438 | ); |
|---|
| 439 | |
|---|
| 440 | /* |
|---|
| 441 | Atomically set NEXUS_TimebaseSettings.sourceSettings.vdec |
|---|
| 442 | This function is automatically called by the AnalogVideoDecoder interface. |
|---|
| 443 | A non-zero value will override anything set by NEXUS_TimebaseSettings. |
|---|
| 444 | */ |
|---|
| 445 | NEXUS_Error NEXUS_Timebase_SetVdecFrameRate( |
|---|
| 446 | NEXUS_Timebase timebase, |
|---|
| 447 | NEXUS_VideoFrameRate frameRate |
|---|
| 448 | ); |
|---|
| 449 | |
|---|
| 450 | #ifdef __cplusplus |
|---|
| 451 | } |
|---|
| 452 | #endif |
|---|
| 453 | |
|---|
| 454 | #endif |
|---|