| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2007-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_video_window.h $ |
|---|
| 39 | * $brcm_Revision: 47 $ |
|---|
| 40 | * $brcm_Date: 9/8/11 1:06p $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /nexus/modules/display/7400/include/nexus_video_window.h $ |
|---|
| 47 | * |
|---|
| 48 | * 47 9/8/11 1:06p erickson |
|---|
| 49 | * SW7425-1263: add |
|---|
| 50 | * NEXUS_CalculateVideoWindowPositionSettings.displayAspectRatio |
|---|
| 51 | * |
|---|
| 52 | * 46 7/14/11 4:35p jtna |
|---|
| 53 | * SW7420-1959: added NEXUS_VideoWindowSettings.clearRect |
|---|
| 54 | * |
|---|
| 55 | * 45 6/30/11 2:18p jtna |
|---|
| 56 | * SW7425-630: change .rightViewOffset from unsigned to int since |
|---|
| 57 | * BVDC_Window_SetDstRightRect() prototype changed |
|---|
| 58 | * |
|---|
| 59 | * 44 6/28/11 9:48a erickson |
|---|
| 60 | * SW7405-5366: add NEXUS_VideoWindowStatus.phaseDelay |
|---|
| 61 | * |
|---|
| 62 | * 43 5/27/11 3:41p erickson |
|---|
| 63 | * SW7335-469: fix comment for allocateFullScreen |
|---|
| 64 | * |
|---|
| 65 | * 42 5/26/11 1:42p erickson |
|---|
| 66 | * SW7425-645: update definition of scaleFactorRounding in |
|---|
| 67 | * NEXUS_VideoWindowSettings |
|---|
| 68 | * |
|---|
| 69 | * 41 5/13/11 9:51a erickson |
|---|
| 70 | * SW7425-525: add NEXUS_VideoWindowSettings.minimumDisplayFormat |
|---|
| 71 | * |
|---|
| 72 | * 40 4/22/11 3:13p vsilyaev |
|---|
| 73 | * SW7425-416: Updated 3D display API |
|---|
| 74 | * |
|---|
| 75 | * 39 4/19/11 1:54p erickson |
|---|
| 76 | * SW7405-5224: add NEXUS_VideoWindowSettings.preferSyncLock and |
|---|
| 77 | * NEXUS_VideoWindowStatus.isSyncLocked |
|---|
| 78 | * |
|---|
| 79 | * 38 3/2/11 12:18p erickson |
|---|
| 80 | * SW7420-1560: change NEXUS_CalculateVideoWindowPosition (not backward |
|---|
| 81 | * compatible) so that NEXUS_VideoWindowSettings param is not [in/out] |
|---|
| 82 | * |
|---|
| 83 | * 37 12/28/10 3:57p erickson |
|---|
| 84 | * SW7405-5064: added NEXUS_VideoWindowStatus.outputRect and |
|---|
| 85 | * NEXUS_VideoWindowSettings.outputRectChanged |
|---|
| 86 | * |
|---|
| 87 | * 36 12/14/10 3:18p erickson |
|---|
| 88 | * SW7420-1285: add null_allowed attribute |
|---|
| 89 | * |
|---|
| 90 | * 35 10/5/10 10:53a erickson |
|---|
| 91 | * SW7420-1135: move NEXUS_VideoWindowContentMode for external use |
|---|
| 92 | * |
|---|
| 93 | * 34 9/10/10 4:35p erickson |
|---|
| 94 | * SW7550-556: added NEXUS_VideoWindowSettings.scaleFactorRounding for |
|---|
| 95 | * manual control. default to automatic control. |
|---|
| 96 | * |
|---|
| 97 | * 33 8/16/10 2:44p erickson |
|---|
| 98 | * SWDEPRECATED-2425: clarify comment on |
|---|
| 99 | * NEXUS_VideoWindowSettings.clipBase |
|---|
| 100 | * |
|---|
| 101 | * BCM3D/1 1/29/10 11:16a erickson |
|---|
| 102 | * SW3548-2727: add NEXUS_VideoWindowSettings.sourceClip |
|---|
| 103 | * |
|---|
| 104 | * 31 1/19/10 10:32a erickson |
|---|
| 105 | * SWDEPRECATED-2425: comments |
|---|
| 106 | * |
|---|
| 107 | * 30 1/11/10 2:02p erickson |
|---|
| 108 | * SW7405-3718: add NEXUS_VideoWindowAfdSettings |
|---|
| 109 | * |
|---|
| 110 | * 29 1/6/10 11:40a erickson |
|---|
| 111 | * SW3556-967: fix units comment NEXUS_VideoWindowStatus.delay. Both this |
|---|
| 112 | * and NEXUS_VideoWindowSettings.delay are in vsyncs, not milliseconds. |
|---|
| 113 | * |
|---|
| 114 | * 28 12/3/09 11:20a erickson |
|---|
| 115 | * SW3548-2619: added NEXUS_VideoWindowSettings.minimumSourceFormat |
|---|
| 116 | * |
|---|
| 117 | * 27 11/20/09 4:45p erickson |
|---|
| 118 | * SW3548-2374: added usage comment for NEXUS_CalculateVideoWindowPosition |
|---|
| 119 | * |
|---|
| 120 | * 26 9/14/09 12:56p erickson |
|---|
| 121 | * SW3548-2374: add more sourceAspectRatio support including eSar and |
|---|
| 122 | * eSquarePixel |
|---|
| 123 | * |
|---|
| 124 | * 25 8/26/09 5:18a erickson |
|---|
| 125 | * SW3548-2374: added NEXUS_CalculateVideoWindowPosition |
|---|
| 126 | * |
|---|
| 127 | * 24 8/19/09 10:51a erickson |
|---|
| 128 | * PR57098: added NEXUS_VideoWindowSettings.delay |
|---|
| 129 | * |
|---|
| 130 | * 23 7/30/09 5:17p erickson |
|---|
| 131 | * PR57216: added dejagging and deringing to |
|---|
| 132 | * NEXUS_VideoWindowSplitScreenSettings |
|---|
| 133 | * |
|---|
| 134 | * 22 7/20/09 9:16a erickson |
|---|
| 135 | * PR55237: added NEXUS_VideoWindowSettings.allocateFullScreen |
|---|
| 136 | * |
|---|
| 137 | * 21 2/25/09 11:57a erickson |
|---|
| 138 | * PR35457: improve comments for non-linear scaling |
|---|
| 139 | * |
|---|
| 140 | * 20 11/5/08 11:48a erickson |
|---|
| 141 | * PR35457: improve comment |
|---|
| 142 | * |
|---|
| 143 | * 19 10/30/08 8:55p erickson |
|---|
| 144 | * PR47030: add NEXUS_HeapHandle for per-window heap |
|---|
| 145 | * |
|---|
| 146 | * 18 9/17/08 12:29p erickson |
|---|
| 147 | * PR47014: expose compositor blend equation in NEXUS_VideoWindowSettings |
|---|
| 148 | * and NEXUS_GraphicsSettings |
|---|
| 149 | * |
|---|
| 150 | * 17 9/8/08 11:43a erickson |
|---|
| 151 | * PR35457: update NEXUS_VideoWindowSplitScreenSettings comments |
|---|
| 152 | * |
|---|
| 153 | * 16 9/4/08 12:03p erickson |
|---|
| 154 | * PR35457: update comments |
|---|
| 155 | * |
|---|
| 156 | * 15 9/3/08 1:33p erickson |
|---|
| 157 | * PR46254: added NEXUS_VideoWindowSettings.alpha |
|---|
| 158 | * |
|---|
| 159 | * 14 5/23/08 11:50a erickson |
|---|
| 160 | * PR42998: add NEXUS_VideoWindowSettings.letterBoxAutoCut |
|---|
| 161 | * |
|---|
| 162 | * 13 5/5/08 4:48p erickson |
|---|
| 163 | * PR42445: provide API's for better display frame rate control |
|---|
| 164 | * |
|---|
| 165 | * 12 5/1/08 12:57p erickson |
|---|
| 166 | * PR41202: add NEXUS_VideoWindowSettings.forceCapture |
|---|
| 167 | * |
|---|
| 168 | * 11 4/30/08 3:08p erickson |
|---|
| 169 | * PR39453: add 3548/3556 features |
|---|
| 170 | * |
|---|
| 171 | * 10 4/2/08 9:16a erickson |
|---|
| 172 | * PR40567: merge |
|---|
| 173 | * |
|---|
| 174 | * PR40567/1 4/2/08 10:35a dyzhang |
|---|
| 175 | * PR40567: add capture/feeder pixel format control |
|---|
| 176 | * |
|---|
| 177 | * 9 3/20/08 3:00p erickson |
|---|
| 178 | * PR40411: add letterBoxDetectionChange and GetLetterBoxStatus |
|---|
| 179 | * |
|---|
| 180 | * 8 3/11/08 2:10p erickson |
|---|
| 181 | * PR40222: add NEXUS_VideoWindow_GetStatus to report video delay |
|---|
| 182 | * |
|---|
| 183 | * 7 2/29/08 5:39p erickson |
|---|
| 184 | * PR40156: implement ColorMatrix function |
|---|
| 185 | * |
|---|
| 186 | * 6 2/21/08 5:48p erickson |
|---|
| 187 | * PR39003: PQ api change |
|---|
| 188 | * |
|---|
| 189 | * 5 2/6/08 12:42p vsilyaev |
|---|
| 190 | * PR 38682: Added attributes for the linux/kernel proxy mode |
|---|
| 191 | * |
|---|
| 192 | * 4 1/23/08 9:22p vobadm |
|---|
| 193 | * PR35457: update docs |
|---|
| 194 | * |
|---|
| 195 | * 3 1/23/08 2:39p erickson |
|---|
| 196 | * PR35457: update docs |
|---|
| 197 | * |
|---|
| 198 | * 2 1/23/08 12:39p erickson |
|---|
| 199 | * PR38919: rename NEXUS_Display_GetWindow to NEXUS_VideoWindow_Open |
|---|
| 200 | * |
|---|
| 201 | * 1 1/18/08 2:20p jgarrett |
|---|
| 202 | * PR 38808: Merging to main branch |
|---|
| 203 | * |
|---|
| 204 | * Nexus_Devel/4 1/8/08 10:57a erickson |
|---|
| 205 | * PR36159: refactor some 3563 Display API's |
|---|
| 206 | * |
|---|
| 207 | * Nexus_Devel/3 1/3/08 1:37p erickson |
|---|
| 208 | * PR38442: added letterBoxDetect |
|---|
| 209 | * |
|---|
| 210 | * Nexus_Devel/2 11/30/07 10:53a erickson |
|---|
| 211 | * PR35457: api update |
|---|
| 212 | * |
|---|
| 213 | * Nexus_Devel/1 11/14/07 11:16a vsilyaev |
|---|
| 214 | * PR 34662: Promoted video window to separate interface |
|---|
| 215 | * |
|---|
| 216 | **************************************************************************/ |
|---|
| 217 | #ifndef NEXUS_VIDEO_WINDOW_H__ |
|---|
| 218 | #define NEXUS_VIDEO_WINDOW_H__ |
|---|
| 219 | |
|---|
| 220 | #include "nexus_types.h" |
|---|
| 221 | #include "nexus_surface.h" |
|---|
| 222 | #include "nexus_display_types.h" |
|---|
| 223 | |
|---|
| 224 | #ifdef __cplusplus |
|---|
| 225 | extern "C" { |
|---|
| 226 | #endif |
|---|
| 227 | |
|---|
| 228 | /** |
|---|
| 229 | Summary: |
|---|
| 230 | VideoWindow configuration |
|---|
| 231 | **/ |
|---|
| 232 | typedef struct NEXUS_VideoWindowSettings |
|---|
| 233 | { |
|---|
| 234 | NEXUS_Rect position; /* position of the window in the display coordinates */ |
|---|
| 235 | NEXUS_Rect clipRect; /* source clipping rectangle in the coordinates of clipBase. |
|---|
| 236 | if set to all zeros, no source clipping will be performed and clipBase is ignored. |
|---|
| 237 | negative source clipping (zoom out) is not supported. |
|---|
| 238 | see sourceClip for an additional method for clipping in source coordinates. */ |
|---|
| 239 | NEXUS_Rect clipBase; /* coordinates for the source clipping specified by clipRect. |
|---|
| 240 | if clipBase is equal to the position rectangle, then clipping done in the window coordinates. |
|---|
| 241 | this is useful if you want your clipping to be the same across source format changes. |
|---|
| 242 | if clipBase is equal to the source rectangle, then clipping is calculated for the source coordinates. |
|---|
| 243 | if you need pixel-precise source clipping, use sourceClip. |
|---|
| 244 | */ |
|---|
| 245 | |
|---|
| 246 | struct { |
|---|
| 247 | unsigned left, right, top, bottom; |
|---|
| 248 | } sourceClip; /* sourceClip will clip the source in source coordinates. |
|---|
| 249 | It can be specified in addition to clipRect/clipBase. The effect is cumulative. |
|---|
| 250 | If there is a source format change, the current sourceClip will simply be applied to the new source. |
|---|
| 251 | Use NEXUS_VideoInputResumeMode_eManual is you want to change the clipping before the new source is seen. */ |
|---|
| 252 | |
|---|
| 253 | bool visible; /* Is window visible? Defaults to true. */ |
|---|
| 254 | unsigned zorder; /* Z-order relative to other VideoWindows and Graphics. A higher number is on top of a lower number. */ |
|---|
| 255 | NEXUS_VideoWindowContentMode contentMode; /* automatic aspect ratio correction */ |
|---|
| 256 | bool letterBoxDetect; /* enable letter box detection in the source */ |
|---|
| 257 | NEXUS_CallbackDesc letterBoxDetectionChange; /* This callback fires if letterBoxDetect is true and there is a change in the letter box |
|---|
| 258 | state. Call NEXUS_VideoWindow_GetLetterBoxStatus to get current letter box information. */ |
|---|
| 259 | bool letterBoxAutoCut; /* If true, Nexus will automatically cut off letterbox sidebars in the source if detected. |
|---|
| 260 | If false, the application can request a letterBoxDetectionChange callback, call NEXUS_VideoWindow_GetLetterBoxStatus and cut |
|---|
| 261 | the sidebars itself with source clipping. */ |
|---|
| 262 | NEXUS_PixelFormat pixelFormat; /* pixel format of capture buffer and video feeder */ |
|---|
| 263 | bool forceCapture; /* Always capture video to memory. This consumes more memory bandwidth but is needed to always have flicker-free |
|---|
| 264 | transitions for high-level operations like SyncChannel. */ |
|---|
| 265 | bool autoMaster; /* If NEXUS_DisplaySettings.frameRateMaster is not set and if this is true, then use the source |
|---|
| 266 | attached to this window as the VEC's frame rate master. Defaults to true for window 0. */ |
|---|
| 267 | |
|---|
| 268 | uint8_t alpha; /* alpha blending of video with other video or graphics where 0xFF is opaque and 0x00 is transparent. */ |
|---|
| 269 | |
|---|
| 270 | NEXUS_CompositorBlendFactor sourceBlendFactor; /* Source refers to this video window. */ |
|---|
| 271 | NEXUS_CompositorBlendFactor destBlendFactor; /* Dest referes to whatever the video window is being blended with. */ |
|---|
| 272 | uint8_t constantAlpha; /* constantAlpha is used if either sourceBlendFactor or destBlendFactor specify it */ |
|---|
| 273 | |
|---|
| 274 | NEXUS_HeapHandle heap; /* If non-NULL, use a per-VideoWindow heap based on NEXUS_DisplayHeapSettings. |
|---|
| 275 | If NULL, use the Display Module heap based on NEXUS_DisplayModuleSettings. |
|---|
| 276 | Must be set before NEXUS_VideoWindow_AddInput is called. */ |
|---|
| 277 | |
|---|
| 278 | NEXUS_VideoFormat minimumSourceFormat; /* Have display pipeline allocate buffers for this minimum source format. This allows for glitchless source format changes. |
|---|
| 279 | The default is eUnknown, which results in no preallocation. |
|---|
| 280 | Must be set before NEXUS_VideoWindow_AddInput is called. */ |
|---|
| 281 | NEXUS_VideoFormat minimumDisplayFormat; /* Have display pipeline allocate buffers for this minimum display format. This allows for glitchless display format changes. |
|---|
| 282 | The default is eUnknown, which results in no preallocation. |
|---|
| 283 | Must be set before NEXUS_VideoWindow_AddInput is called. */ |
|---|
| 284 | |
|---|
| 285 | bool allocateFullScreen; /* Allocate capture buffers for full-screen display, regardless of current source size. |
|---|
| 286 | This reduces transition effects based on source size changes. |
|---|
| 287 | Must be set before NEXUS_VideoWindow_AddInput is called. */ |
|---|
| 288 | |
|---|
| 289 | unsigned delay; /* # of vsyncs of delay to add to this window. This delay will be added to any delay set by NEXUS_SyncChannel. */ |
|---|
| 290 | |
|---|
| 291 | struct { |
|---|
| 292 | bool enabled; /* If enabled, nexus will round scale factor according to the following tolerances. |
|---|
| 293 | If within the tolerance, no scaling is performed. |
|---|
| 294 | for example, avoid scaling 704x480 or 720x482 video to a 720x480 display. */ |
|---|
| 295 | unsigned horizontalTolerance; /* units of percentage */ |
|---|
| 296 | unsigned verticalTolerance; /* units of percentage */ |
|---|
| 297 | } scaleFactorRounding; |
|---|
| 298 | |
|---|
| 299 | NEXUS_CallbackDesc outputRectChanged; /* fired whenever a member of NEXUS_VideoWindowStatus.outputRect changes */ |
|---|
| 300 | |
|---|
| 301 | bool preferSyncLock; /* advisory setting. if you have two digital sources connected to the same display, |
|---|
| 302 | this boolean will determine which of the two paths is sync-locked. |
|---|
| 303 | or, if you have one digital source connected to two displays, this boolean will |
|---|
| 304 | determine which of the two paths is sync-locked. |
|---|
| 305 | if you have only one digital source and one display, or if you have an analog/hdmi source, |
|---|
| 306 | this setting has no effect. */ |
|---|
| 307 | |
|---|
| 308 | struct { |
|---|
| 309 | bool enabled; |
|---|
| 310 | NEXUS_Rect position; /* the clearRect position is relative to the position of this video window */ |
|---|
| 311 | NEXUS_Pixel color; /* 32-bit ARGB color */ |
|---|
| 312 | } clearRect; /* VDC will draw the specified color into the video plane */ |
|---|
| 313 | |
|---|
| 314 | struct { |
|---|
| 315 | int rightViewOffset; /* offset of the right view */ |
|---|
| 316 | } window3DSettings; |
|---|
| 317 | } NEXUS_VideoWindowSettings; |
|---|
| 318 | |
|---|
| 319 | /** |
|---|
| 320 | Summary: |
|---|
| 321 | Open a VideoWindow from its Display. |
|---|
| 322 | |
|---|
| 323 | Description: |
|---|
| 324 | See NEXUS_VideoWindow_AddInput to connect a NEXUS_VideoInput to this window. |
|---|
| 325 | **/ |
|---|
| 326 | NEXUS_VideoWindowHandle NEXUS_VideoWindow_Open( /* attr{destructor=NEXUS_VideoWindow_Close} */ |
|---|
| 327 | NEXUS_DisplayHandle display, |
|---|
| 328 | unsigned windowIndex /* The windowIndex is relative to its Display, usually 0 for main, 1 for PIP. */ |
|---|
| 329 | ); |
|---|
| 330 | |
|---|
| 331 | /** |
|---|
| 332 | Summary: |
|---|
| 333 | Close a VideoWindow |
|---|
| 334 | **/ |
|---|
| 335 | void NEXUS_VideoWindow_Close( |
|---|
| 336 | NEXUS_VideoWindowHandle window |
|---|
| 337 | ); |
|---|
| 338 | |
|---|
| 339 | /** |
|---|
| 340 | Summary: |
|---|
| 341 | Get current settings |
|---|
| 342 | **/ |
|---|
| 343 | void NEXUS_VideoWindow_GetSettings( |
|---|
| 344 | NEXUS_VideoWindowHandle window, |
|---|
| 345 | NEXUS_VideoWindowSettings *pSettings /* [out] */ |
|---|
| 346 | ); |
|---|
| 347 | |
|---|
| 348 | /** |
|---|
| 349 | Summary: |
|---|
| 350 | Apply new settings |
|---|
| 351 | **/ |
|---|
| 352 | NEXUS_Error NEXUS_VideoWindow_SetSettings( |
|---|
| 353 | NEXUS_VideoWindowHandle window, |
|---|
| 354 | const NEXUS_VideoWindowSettings *pSettings |
|---|
| 355 | ); |
|---|
| 356 | |
|---|
| 357 | /** |
|---|
| 358 | Summary: |
|---|
| 359 | Status information returned by NEXUS_VideoWindow_GetStatus |
|---|
| 360 | **/ |
|---|
| 361 | typedef struct NEXUS_VideoWindowStatus |
|---|
| 362 | { |
|---|
| 363 | unsigned delay; /* Video processing delay on this path, in vsyncs. This includes both capture buffers and video processing delays. |
|---|
| 364 | Time in milliseconds = delay * 1000*1000/NEXUS_DisplayStatus.refreshRate */ |
|---|
| 365 | int phaseDelay; /* Additional sub-field (i.e. sub-vsync) phase delay, in microseconds. */ |
|---|
| 366 | NEXUS_Rect outputRect; /* active video after scaling and clipping (includes aspect ratio correction) in display coordinates */ |
|---|
| 367 | bool isSyncLocked; /* if true, the interrupts from this window's source are driving VDC processing and tighter lipsync is possible. |
|---|
| 368 | if false (known as sync-slip), another source's interrupts are driving the display. more delay is required on sync-slip paths. */ |
|---|
| 369 | } NEXUS_VideoWindowStatus; |
|---|
| 370 | |
|---|
| 371 | /** |
|---|
| 372 | Summary: |
|---|
| 373 | Get status information about the VideoWindow |
|---|
| 374 | **/ |
|---|
| 375 | NEXUS_Error NEXUS_VideoWindow_GetStatus( |
|---|
| 376 | NEXUS_VideoWindowHandle window, |
|---|
| 377 | NEXUS_VideoWindowStatus *pStatus /* [out] */ |
|---|
| 378 | ); |
|---|
| 379 | |
|---|
| 380 | /** |
|---|
| 381 | Summary: |
|---|
| 382 | Connect a video input to this window. This causes video to be displayed. |
|---|
| 383 | **/ |
|---|
| 384 | NEXUS_Error NEXUS_VideoWindow_AddInput( |
|---|
| 385 | NEXUS_VideoWindowHandle window, |
|---|
| 386 | NEXUS_VideoInput input |
|---|
| 387 | ); |
|---|
| 388 | |
|---|
| 389 | /** |
|---|
| 390 | Summary: |
|---|
| 391 | Disconnect a video input from this window. |
|---|
| 392 | |
|---|
| 393 | Description: |
|---|
| 394 | This is called automatically by NEXUS_VideoInput_Shutdown. |
|---|
| 395 | **/ |
|---|
| 396 | NEXUS_Error NEXUS_VideoWindow_RemoveInput( |
|---|
| 397 | NEXUS_VideoWindowHandle window, |
|---|
| 398 | NEXUS_VideoInput input |
|---|
| 399 | ); |
|---|
| 400 | |
|---|
| 401 | /** |
|---|
| 402 | Summary: |
|---|
| 403 | Disconnect all video inputs from this window. |
|---|
| 404 | **/ |
|---|
| 405 | void NEXUS_VideoWindow_RemoveAllInputs( |
|---|
| 406 | NEXUS_VideoWindowHandle window |
|---|
| 407 | ); |
|---|
| 408 | |
|---|
| 409 | /** |
|---|
| 410 | Summary: |
|---|
| 411 | Capture a video buffer |
|---|
| 412 | |
|---|
| 413 | Description: |
|---|
| 414 | This allows the application to access a video buffer as a graphics surface. |
|---|
| 415 | |
|---|
| 416 | This requires the video pipeline to already be in capture mode. If not, it will return NULL. |
|---|
| 417 | Analog video is always captured. Digital video may not be. If capture is not on, you can force |
|---|
| 418 | it on with NEXUS_VideoWindowSettings.forceCapture = true. |
|---|
| 419 | |
|---|
| 420 | When the user is done with the video buffer, it must call NEXUS_VideoWindow_ReleaseVideoBuffer to return the buffer. |
|---|
| 421 | **/ |
|---|
| 422 | NEXUS_SurfaceHandle NEXUS_VideoWindow_CaptureVideoBuffer( |
|---|
| 423 | NEXUS_VideoWindowHandle window |
|---|
| 424 | ); |
|---|
| 425 | |
|---|
| 426 | /** |
|---|
| 427 | Summary: |
|---|
| 428 | Release video buffer captured with NEXUS_VideoWindow_CaptureVideoBuffer |
|---|
| 429 | **/ |
|---|
| 430 | NEXUS_Error NEXUS_VideoWindow_ReleaseVideoBuffer( |
|---|
| 431 | NEXUS_VideoWindowHandle window, |
|---|
| 432 | NEXUS_SurfaceHandle surface |
|---|
| 433 | ); |
|---|
| 434 | |
|---|
| 435 | /** |
|---|
| 436 | Summary: |
|---|
| 437 | Used to specify the split screen mode per feature in NEXUS_VideoWindowSplitScreenSettings |
|---|
| 438 | **/ |
|---|
| 439 | typedef enum NEXUS_VideoWindowSplitScreenMode |
|---|
| 440 | { |
|---|
| 441 | NEXUS_VideoWindowSplitScreenMode_eDisable = 0, /* no split screen. normal video. */ |
|---|
| 442 | NEXUS_VideoWindowSplitScreenMode_eLeft, /* the demo feature will appear on the left */ |
|---|
| 443 | NEXUS_VideoWindowSplitScreenMode_eRight /* the demo feature will appear on the right */ |
|---|
| 444 | } NEXUS_VideoWindowSplitScreenMode; |
|---|
| 445 | |
|---|
| 446 | /** |
|---|
| 447 | Summary: |
|---|
| 448 | Collection of split-screen options used to demonstrate video processing features. |
|---|
| 449 | |
|---|
| 450 | Description: |
|---|
| 451 | Use NEXUS_VideoWindow_SetSplitScreenSettings to set these. |
|---|
| 452 | **/ |
|---|
| 453 | typedef struct NEXUS_VideoWindowSplitScreenSettings |
|---|
| 454 | { |
|---|
| 455 | NEXUS_VideoWindowSplitScreenMode hue; /* used for both hue and saturation. see NEXUS_PictureCtrlCommonSettings.hue and .saturation. */ |
|---|
| 456 | NEXUS_VideoWindowSplitScreenMode contrast; /* see NEXUS_PictureCtrlCommonSettings.contrast */ |
|---|
| 457 | NEXUS_VideoWindowSplitScreenMode brightness; /* see NEXUS_PictureCtrlCommonSettings.brightness */ |
|---|
| 458 | NEXUS_VideoWindowSplitScreenMode colorTemp; /* see NEXUS_PictureCtrlCommonSettings.colorTemp */ |
|---|
| 459 | NEXUS_VideoWindowSplitScreenMode sharpness; /* see NEXUS_PictureCtrlCommonSettings.sharpness */ |
|---|
| 460 | NEXUS_VideoWindowSplitScreenMode contrastStretch;/* see NEXUS_PictureCtrlContrastStretch and NEXUS_PictureCtrlAdvColorSettings */ |
|---|
| 461 | NEXUS_VideoWindowSplitScreenMode dnr; /* see NEXUS_VideoWindowDnrSettings */ |
|---|
| 462 | NEXUS_VideoWindowSplitScreenMode anr; /* see NEXUS_VideoWindowAnrSettings */ |
|---|
| 463 | NEXUS_VideoWindowSplitScreenMode dejagging; |
|---|
| 464 | NEXUS_VideoWindowSplitScreenMode deringing; |
|---|
| 465 | |
|---|
| 466 | NEXUS_VideoWindowSplitScreenMode cm3d; /* see NEXUS_Cm3dRegion and NEXUS_Cm3dOverlappedRegion */ |
|---|
| 467 | |
|---|
| 468 | /* the following are disabled when CM3D is present */ |
|---|
| 469 | NEXUS_VideoWindowSplitScreenMode cms; |
|---|
| 470 | NEXUS_VideoWindowSplitScreenMode autoFlesh; |
|---|
| 471 | NEXUS_VideoWindowSplitScreenMode blueBoost; |
|---|
| 472 | NEXUS_VideoWindowSplitScreenMode greenBoost; |
|---|
| 473 | NEXUS_VideoWindowSplitScreenMode blueStretch; |
|---|
| 474 | } NEXUS_VideoWindowSplitScreenSettings; |
|---|
| 475 | |
|---|
| 476 | /** |
|---|
| 477 | Summary: |
|---|
| 478 | Get current split screen settings |
|---|
| 479 | **/ |
|---|
| 480 | void NEXUS_VideoWindow_GetSplitScreenSettings( |
|---|
| 481 | NEXUS_VideoWindowHandle window, |
|---|
| 482 | NEXUS_VideoWindowSplitScreenSettings *pSettings /* [out] */ |
|---|
| 483 | ); |
|---|
| 484 | |
|---|
| 485 | /** |
|---|
| 486 | Summary: |
|---|
| 487 | Set the video window into a split screen mode for a demo of various features. |
|---|
| 488 | **/ |
|---|
| 489 | NEXUS_Error NEXUS_VideoWindow_SetSplitScreenSettings( |
|---|
| 490 | NEXUS_VideoWindowHandle window, |
|---|
| 491 | const NEXUS_VideoWindowSplitScreenSettings *pSettings |
|---|
| 492 | ); |
|---|
| 493 | |
|---|
| 494 | /*************************************************************************** |
|---|
| 495 | Summary: |
|---|
| 496 | Get the 4x3 color matrix for this video window. |
|---|
| 497 | ****************************************************************************/ |
|---|
| 498 | void NEXUS_VideoWindow_GetColorMatrix( |
|---|
| 499 | NEXUS_VideoWindowHandle window, |
|---|
| 500 | NEXUS_ColorMatrix *pSettings /* [out] */ |
|---|
| 501 | ); |
|---|
| 502 | |
|---|
| 503 | /*************************************************************************** |
|---|
| 504 | Summary: |
|---|
| 505 | Sets the 4x3 color matrix for this video window. |
|---|
| 506 | |
|---|
| 507 | Description: |
|---|
| 508 | NEXUS_VideoWindow_SetColorMatrix is used to override the display color |
|---|
| 509 | matrix. Once user call this API, it is supposed that application will |
|---|
| 510 | garrantee the color matrix been programmed is correct. |
|---|
| 511 | ****************************************************************************/ |
|---|
| 512 | NEXUS_Error NEXUS_VideoWindow_SetColorMatrix( |
|---|
| 513 | NEXUS_VideoWindowHandle window, |
|---|
| 514 | const NEXUS_ColorMatrix *pSettings /* attr{null_allowed=y} if NULL, internal defaults will be used. */ |
|---|
| 515 | ); |
|---|
| 516 | |
|---|
| 517 | /*************************************************************************** |
|---|
| 518 | Summary: |
|---|
| 519 | Letter box status available from NEXUS_VideoWindow_GetLetterBoxStatus |
|---|
| 520 | ****************************************************************************/ |
|---|
| 521 | typedef struct NEXUS_VideoWindowLetterBoxStatus |
|---|
| 522 | { |
|---|
| 523 | /* active video (white box) rectangle */ |
|---|
| 524 | unsigned whiteBoxLeft; |
|---|
| 525 | unsigned whiteBoxTop; |
|---|
| 526 | unsigned whiteBoxWidth; |
|---|
| 527 | unsigned whiteBoxHeight; |
|---|
| 528 | |
|---|
| 529 | /* gray strip width: relative thin strip from white to black */ |
|---|
| 530 | unsigned grayWidthTop; |
|---|
| 531 | unsigned grayWidthLeft; |
|---|
| 532 | unsigned grayWidthRight; |
|---|
| 533 | unsigned grayWidthBottom; |
|---|
| 534 | |
|---|
| 535 | /* edge strength: brightness of white box inner edge */ |
|---|
| 536 | unsigned edgeStrengthTop; |
|---|
| 537 | unsigned edgeStrengthLeft; |
|---|
| 538 | unsigned edgeStrengthRight; |
|---|
| 539 | unsigned edgeStrengthBottom; |
|---|
| 540 | } NEXUS_VideoWindowLetterBoxStatus; |
|---|
| 541 | |
|---|
| 542 | /*************************************************************************** |
|---|
| 543 | Summary: |
|---|
| 544 | Get letter box status |
|---|
| 545 | |
|---|
| 546 | Description: |
|---|
| 547 | See NEXUS_VideoWindowSettings.letterBoxDetectionChange for a callback when |
|---|
| 548 | this status changes. |
|---|
| 549 | ****************************************************************************/ |
|---|
| 550 | NEXUS_Error NEXUS_VideoWindow_GetLetterBoxStatus( |
|---|
| 551 | NEXUS_VideoWindowHandle window, |
|---|
| 552 | NEXUS_VideoWindowLetterBoxStatus *pStatus /* [out] */ |
|---|
| 553 | ); |
|---|
| 554 | |
|---|
| 555 | /*************************************************************************** |
|---|
| 556 | Summary: |
|---|
| 557 | Settings used as input to the NEXUS_CalculateVideoWindowPosition helper function. |
|---|
| 558 | |
|---|
| 559 | Description: |
|---|
| 560 | horizontalClipping and verticalClipping are specified in terms of total clipping. |
|---|
| 561 | For instance, if you want to horizontal clip 3% from each side, you should specify clipping of 600 or 6%. |
|---|
| 562 | |
|---|
| 563 | If you want to perform panscan or nonlinear scaling, you should set manualAspectRatioCorrection to eFull (i.e. no manual aspect ratio correction), then set |
|---|
| 564 | NEXUS_VideoWindowSettings.contentMode to eFullNonLinear or ePanScan. |
|---|
| 565 | If you want VDC to perform automatic a/r correction, you should set manualAspectRatioCorrection to eFull (i.e. no manual aspect ratio correction), then set |
|---|
| 566 | NEXUS_VideoWindowSettings.contentMode to eBox or eZoom. |
|---|
| 567 | |
|---|
| 568 | There is no reference to source pixel dimensions (i.e. width or height). The only source attribute required is the |
|---|
| 569 | source aspect ratio if manualAspectRatioCorrection is being used. |
|---|
| 570 | |
|---|
| 571 | Clipping is applied first, then aspect ratio correction is applied to the clipped source. |
|---|
| 572 | ****************************************************************************/ |
|---|
| 573 | typedef struct NEXUS_CalculateVideoWindowPositionSettings { |
|---|
| 574 | unsigned horizontalClipping; /* total horizontal clipping in units of 1/100%. */ |
|---|
| 575 | unsigned verticalClipping; /* total vertical clipping in units of 1/100%. */ |
|---|
| 576 | |
|---|
| 577 | int horizontalPosition; /* position of source relative to the window. 0 is default. negative values are allowed and will result in clipping. */ |
|---|
| 578 | int verticalPosition; /* position of source relative to the window. 0 is default. negative values are allowed and will result in clipping. */ |
|---|
| 579 | |
|---|
| 580 | NEXUS_VideoWindowContentMode manualAspectRatioCorrection; /* manual aspect ratio correction performed by this function. |
|---|
| 581 | if eFull (default), no a/r correction will be performed. |
|---|
| 582 | if eBox or eZoom, NEXUS_VideoPosition_CalculateVideoWindowSettings will perform manual a/r correction |
|---|
| 583 | based on sourceAspectRatio. */ |
|---|
| 584 | NEXUS_AspectRatio sourceAspectRatio; /* aspect ratio of unclipped source. this is only used if manualAspectRatioCorrection is eBox or eZoom. |
|---|
| 585 | The caller is responsible for registering for a NEXUS_VideoInput.sourceChanged callback and recalling this function |
|---|
| 586 | and applying new results whenever the source's aspect ratio changes. */ |
|---|
| 587 | unsigned sourceWidth; /* only required if sourceAspectRatio is NEXUS_AspectRatio_eSar or eSquarePixel */ |
|---|
| 588 | unsigned sourceHeight; /* only required if sourceAspectRatio is NEXUS_AspectRatio_eSar or eSquarePixel */ |
|---|
| 589 | struct { |
|---|
| 590 | unsigned x, y; |
|---|
| 591 | } sampleAspectRatio; /* only required if sourceAspectRatio is NEXUS_AspectRatio_eSar */ |
|---|
| 592 | |
|---|
| 593 | NEXUS_Rect viewport; /* The desired window dimensions. No content will be displayed outside of this rectangle. |
|---|
| 594 | The viewport is a virtual window. Unlike the actual hardware VideoWindow, a viewport can have negative x/y coordinates and |
|---|
| 595 | x+width or y+height that extent past the display. */ |
|---|
| 596 | |
|---|
| 597 | NEXUS_DisplayAspectRatio displayAspectRatio; /* if eAuto (default), calculate from displayWidth/displayHeight. */ |
|---|
| 598 | unsigned displayWidth; /* width of the NEXUS_VideoFormat currently used in NEXUS_DisplaySettings for this window. |
|---|
| 599 | normally you will use NEXUS_VideoFormat_GetInfo(NEXUS_DisplaySettings.format, &info) to obtain displayWidth and displayHeight */ |
|---|
| 600 | unsigned displayHeight; /* height of the NEXUS_VideoFormat currently used in NEXUS_DisplaySettings for this window */ |
|---|
| 601 | } NEXUS_CalculateVideoWindowPositionSettings; |
|---|
| 602 | |
|---|
| 603 | /*************************************************************************** |
|---|
| 604 | Summary: |
|---|
| 605 | Get default settings |
|---|
| 606 | ****************************************************************************/ |
|---|
| 607 | void NEXUS_GetDefaultCalculateVideoWindowPositionSettings( |
|---|
| 608 | NEXUS_CalculateVideoWindowPositionSettings *pSettings /* [out] */ |
|---|
| 609 | ); |
|---|
| 610 | |
|---|
| 611 | /*************************************************************************** |
|---|
| 612 | Summary: |
|---|
| 613 | A helper function to determine NEXUS_VideoWindowSettings position and clipRect. |
|---|
| 614 | |
|---|
| 615 | Description: |
|---|
| 616 | You must populate pWindowSettings using NEXUS_VideoWindow_GetSettings. |
|---|
| 617 | pOutputWindowSettings will initialized with pWindowSettings, then the following members will be adjusted: |
|---|
| 618 | - position |
|---|
| 619 | - clipRect |
|---|
| 620 | - clipBase |
|---|
| 621 | - contentMode |
|---|
| 622 | |
|---|
| 623 | If you want to perform auto aspect ratio correction, you must set contentMode after calling this function. |
|---|
| 624 | |
|---|
| 625 | The function does not have a NEXUS_VideoWindowHandle; therefore it does not and cannot modify a VideoWindow's state. |
|---|
| 626 | You must call NEXUS_VideoWindow_SetSettings afterward to do that. |
|---|
| 627 | |
|---|
| 628 | Example: |
|---|
| 629 | |
|---|
| 630 | NEXUS_GetDefaultCalculateVideoWindowPositionSettings(&pos); |
|---|
| 631 | pos.viewport = your_rect; |
|---|
| 632 | pos.displayWidth = display_width; |
|---|
| 633 | pos.displayHeight = display_height; |
|---|
| 634 | NEXUS_VideoWindow_GetSettings(window, &windowSettings); |
|---|
| 635 | NEXUS_CalculateVideoWindowPosition(&pos, &windowSettings, &windowSettings); |
|---|
| 636 | NEXUS_VideoWindow_SetSettings(window, &windowSettings); |
|---|
| 637 | |
|---|
| 638 | ****************************************************************************/ |
|---|
| 639 | NEXUS_Error NEXUS_CalculateVideoWindowPosition( |
|---|
| 640 | const NEXUS_CalculateVideoWindowPositionSettings *pSettings, |
|---|
| 641 | const NEXUS_VideoWindowSettings *pInputWindowSettings, /* input window settings */ |
|---|
| 642 | NEXUS_VideoWindowSettings *pOutputWindowSettings /* [out] output window settings with adjustments applied */ |
|---|
| 643 | ); |
|---|
| 644 | |
|---|
| 645 | /*************************************************************************** |
|---|
| 646 | Summary: |
|---|
| 647 | Specifies various modes for handling AFD (Active Format Descriptor). |
|---|
| 648 | |
|---|
| 649 | Description: |
|---|
| 650 | This enumeration specifies different modes for handling AFD (Active |
|---|
| 651 | Format Descriptor). AFD is value transmitted in the stream's user data |
|---|
| 652 | that can be use to clip away unwanted content such as black vertical or |
|---|
| 653 | horizontal bars; or even non-important contents. The specification of |
|---|
| 654 | clipping is base on AFD specs. |
|---|
| 655 | ***************************************************************************/ |
|---|
| 656 | typedef enum NEXUS_AfdMode { |
|---|
| 657 | NEXUS_AfdMode_eDisabled = 0, /* No clipping will be performed even if the stream contains the AFD value. */ |
|---|
| 658 | NEXUS_AfdMode_eStream, /* Clipping will be performed if the stream contains the AFD value. */ |
|---|
| 659 | NEXUS_AfdMode_eUser, /* Clipping will be performed with NEXUS_VideoWindowAfdSettings.userValue. Any AFD value in the stream will be ignored. */ |
|---|
| 660 | NEXUS_AfdMode_eMax |
|---|
| 661 | } NEXUS_AfdMode; |
|---|
| 662 | |
|---|
| 663 | /*************************************************************************** |
|---|
| 664 | Summary: |
|---|
| 665 | Specifies various clipping modes to be use with AFD. |
|---|
| 666 | ***************************************************************************/ |
|---|
| 667 | typedef enum NEXUS_AfdClip |
|---|
| 668 | { |
|---|
| 669 | NEXUS_AfdClip_eNominal = 0, /* This mode clips nominal. This will clip away the black content in the stream base on AFD value. */ |
|---|
| 670 | NEXUS_AfdClip_eOptionalLevel1, /* This mode clips away the NEXUS_AfdClip_eNominal content + optional contents at level1. */ |
|---|
| 671 | NEXUS_AfdClip_eOptionalLevel2, /* This mode clips away the NEXUS_AfdClip_eNominal content + optional contents at level2. */ |
|---|
| 672 | NEXUS_AfdClip_eMax |
|---|
| 673 | } NEXUS_AfdClip; |
|---|
| 674 | |
|---|
| 675 | /*************************************************************************** |
|---|
| 676 | Summary: |
|---|
| 677 | Active Format Descriptor settings used in NEXUS_VideoWindow_SetAfdSettings |
|---|
| 678 | ***************************************************************************/ |
|---|
| 679 | typedef struct NEXUS_VideoWindowAfdSettings |
|---|
| 680 | { |
|---|
| 681 | NEXUS_AfdMode mode; |
|---|
| 682 | NEXUS_AfdClip clip; |
|---|
| 683 | uint32_t userValue; /* only used if mode = NEXUS_AfdMode_eUser */ |
|---|
| 684 | } NEXUS_VideoWindowAfdSettings; |
|---|
| 685 | |
|---|
| 686 | /*************************************************************************** |
|---|
| 687 | Summary: |
|---|
| 688 | Get current AFD settings |
|---|
| 689 | ***************************************************************************/ |
|---|
| 690 | void NEXUS_VideoWindow_GetAfdSettings( |
|---|
| 691 | NEXUS_VideoWindowHandle window, |
|---|
| 692 | NEXUS_VideoWindowAfdSettings *pSettings /* [out] */ |
|---|
| 693 | ); |
|---|
| 694 | |
|---|
| 695 | /*************************************************************************** |
|---|
| 696 | Summary: |
|---|
| 697 | Set new AFD settings |
|---|
| 698 | ***************************************************************************/ |
|---|
| 699 | NEXUS_Error NEXUS_VideoWindow_SetAfdSettings( |
|---|
| 700 | NEXUS_VideoWindowHandle window, |
|---|
| 701 | const NEXUS_VideoWindowAfdSettings *pSettings |
|---|
| 702 | ); |
|---|
| 703 | |
|---|
| 704 | #ifdef __cplusplus |
|---|
| 705 | } |
|---|
| 706 | #endif |
|---|
| 707 | |
|---|
| 708 | #endif /* NEXUS_VIDEO_WINDOW_H__ */ |
|---|
| 709 | |
|---|