| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2010, 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.c $ |
|---|
| 11 | * $brcm_Revision: 65 $ |
|---|
| 12 | * $brcm_Date: 5/27/10 3:49p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/api/src/nexus/bsettop.c $ |
|---|
| 19 | * |
|---|
| 20 | * 65 5/27/10 3:49p mward |
|---|
| 21 | * SW7400-2772: Eliminate error message about video format 38, not |
|---|
| 22 | * supported in Settop API. |
|---|
| 23 | * |
|---|
| 24 | * 64 4/19/10 3:25p nickh |
|---|
| 25 | * SW7420-709: Add DBS support and remove BCHP_CHIP |
|---|
| 26 | * |
|---|
| 27 | * 63 3/1/10 10:56a erickson |
|---|
| 28 | * SW7550-272: add bgraphics_pixel_format_a8_y8_cb8_cr8 |
|---|
| 29 | * |
|---|
| 30 | * 62 1/21/10 6:47p garetht |
|---|
| 31 | * SW7420-553: Add platform for 93380vms |
|---|
| 32 | * |
|---|
| 33 | * 61 12/29/09 2:48p erickson |
|---|
| 34 | * SW7420-515: remove unsupported pixel formats |
|---|
| 35 | * |
|---|
| 36 | * 60 12/9/09 12:03p gmohile |
|---|
| 37 | * SW7408-1 : Add 7408 support |
|---|
| 38 | * |
|---|
| 39 | * 59 12/8/09 2:05p rjain |
|---|
| 40 | * SW7550-112: Dont require this on a branch. Just make sure to use |
|---|
| 41 | * version 10 or above of /nexus/base/include/nexus_audio_types.h to |
|---|
| 42 | * build wiht DRA |
|---|
| 43 | * |
|---|
| 44 | * Refsw_7550/2 12/8/09 2:03p rjain |
|---|
| 45 | * SW7550-122: Dont require this on a branch. Just make sure to use |
|---|
| 46 | * version 10 or above of /nexus/base/include/nexus_audio_types.h to |
|---|
| 47 | * build wiht DRA |
|---|
| 48 | * |
|---|
| 49 | * Refsw_7550/1 11/5/09 11:25a nitinb |
|---|
| 50 | * sw7550-64: Initial brutus build for 7550 |
|---|
| 51 | * |
|---|
| 52 | * 58 10/8/09 6:04p jgarrett |
|---|
| 53 | * SW7405-3064: Adding DRA |
|---|
| 54 | * |
|---|
| 55 | * 57 9/15/09 12:09p jjordan |
|---|
| 56 | * SW7405-3011: add control of sync path swap capability from settop api |
|---|
| 57 | * environment variable |
|---|
| 58 | * |
|---|
| 59 | * 56 9/14/09 3:05p jgarrett |
|---|
| 60 | * SW7405-3011: Splitting sync control into precision and basic |
|---|
| 61 | * |
|---|
| 62 | * 55 9/14/09 10:37a jgarrett |
|---|
| 63 | * SW3548-2188: Adding AMR support |
|---|
| 64 | * |
|---|
| 65 | * 54 9/10/09 5:17p jgarrett |
|---|
| 66 | * SW7405-3011: Adding sync options to bsettop_init_settings |
|---|
| 67 | * |
|---|
| 68 | * 53 9/4/09 11:45a jgarrett |
|---|
| 69 | * SWDEPRECATED-3910: Exposing audio and video FIFO sizes |
|---|
| 70 | * |
|---|
| 71 | * 52 8/25/09 12:36p erickson |
|---|
| 72 | * SW7420-228: fix warnings |
|---|
| 73 | * |
|---|
| 74 | * 51 8/10/09 1:41p jgarrett |
|---|
| 75 | * PR 51648: Adding option to set band gap settings in API |
|---|
| 76 | * |
|---|
| 77 | * 50 7/30/09 6:46p vsilyaev |
|---|
| 78 | * PR 57220: Added 7.943 and 14.985 frame rates |
|---|
| 79 | * |
|---|
| 80 | * 49 7/30/09 6:01p mward |
|---|
| 81 | * PR56558: Don't init frontend more than once, may have been done by a |
|---|
| 82 | * different call to bsettop_init_frontend() (in DUAL_OUTPUT Brutus, for |
|---|
| 83 | * example), not just in bsettop_init(). |
|---|
| 84 | * |
|---|
| 85 | * 48 7/28/09 11:51a lwhite |
|---|
| 86 | * PR55693: Added DTCP/IP intialization |
|---|
| 87 | * |
|---|
| 88 | * 46 7/24/09 10:48a erickson |
|---|
| 89 | * PR51648: set NEXUS_DisplayModuleSettings.dacBandGapAdjust[] based on |
|---|
| 90 | * DACx_BAND_GAP env variable. |
|---|
| 91 | * |
|---|
| 92 | * 45 7/15/09 7:42p vsilyaev |
|---|
| 93 | * PR 55653: Added WAV format |
|---|
| 94 | * |
|---|
| 95 | * 44 7/10/09 7:29p agin |
|---|
| 96 | * PR56698: Return NULL for no-os for bsettop_get_config. |
|---|
| 97 | * |
|---|
| 98 | * 43 7/2/09 10:47a erickson |
|---|
| 99 | * PR56558: add bsettop_set_init_settings and bsettop_init_frontend |
|---|
| 100 | * |
|---|
| 101 | * 42 6/30/09 4:23p katrep |
|---|
| 102 | * PR55809: support for nexus_pcmwav for avi with pcm audio |
|---|
| 103 | * |
|---|
| 104 | * 41 6/25/09 3:34p katrep |
|---|
| 105 | * PR55809: Add support for PCM audio in AVI files |
|---|
| 106 | * |
|---|
| 107 | * 40 6/9/09 11:30a rjlewis |
|---|
| 108 | * PR55744: david says we can't always call base module functions -- only |
|---|
| 109 | * ok in vxworks. |
|---|
| 110 | * |
|---|
| 111 | * 39 6/5/09 7:18p rjlewis |
|---|
| 112 | * PR55749: use nexus version to fix environment issue in VxWorks. |
|---|
| 113 | * |
|---|
| 114 | * 38 3/18/09 12:31p erickson |
|---|
| 115 | * PR53340: add 1080p 50hz support |
|---|
| 116 | * |
|---|
| 117 | * 37 2/26/09 2:53p erickson |
|---|
| 118 | * PR49584: add a dma-based memory bandwidth stress test feature |
|---|
| 119 | * |
|---|
| 120 | * 36 2/11/09 3:32p vle |
|---|
| 121 | * PR 51414, PR 45656: Add 1080p/60Hz support in Brutus and enable for |
|---|
| 122 | * 7420 |
|---|
| 123 | * |
|---|
| 124 | * 35 11/14/08 6:19p agin |
|---|
| 125 | * PR48985: Support LDPC and Turbo at the same time. |
|---|
| 126 | * |
|---|
| 127 | * 34 9/15/08 5:24p jrubio |
|---|
| 128 | * PR46925: fix PVR_SUPPORT=n compile issue |
|---|
| 129 | * |
|---|
| 130 | * 33 8/7/08 4:51p vsilyaev |
|---|
| 131 | * PR 45137: Added slave mode support to the SettopApi shim |
|---|
| 132 | * |
|---|
| 133 | * 32 7/21/08 10:11a erickson |
|---|
| 134 | * PR36068: add debug |
|---|
| 135 | * |
|---|
| 136 | * 31 7/3/08 6:09p erickson |
|---|
| 137 | * PR36068: impl vesa |
|---|
| 138 | * |
|---|
| 139 | * 30 6/27/08 9:30a erickson |
|---|
| 140 | * PR43653: add vesa support |
|---|
| 141 | * |
|---|
| 142 | * 29 6/26/08 6:21p mphillip |
|---|
| 143 | * PR42901: Encrypted PVR playback support |
|---|
| 144 | * |
|---|
| 145 | * 28 6/18/08 10:13p erickson |
|---|
| 146 | * PR36068: add DTV panel support to shim (use component api) |
|---|
| 147 | * |
|---|
| 148 | * 27 5/22/08 3:46p erickson |
|---|
| 149 | * PR36068: remove bvideo_format ERR's for hdmi |
|---|
| 150 | * |
|---|
| 151 | * 26 5/20/08 5:03p vishk |
|---|
| 152 | * PR 42871: Unable to tune QAM64/QAM256/VSB using Brutus for |
|---|
| 153 | * nexus_latest. |
|---|
| 154 | * PR 42058: Can not tune to QAM256 using onboard 3510 tuner |
|---|
| 155 | * |
|---|
| 156 | * 25 5/14/08 7:25p jrubio |
|---|
| 157 | * PR42694: add TUNER_ENABLE_7335 flag as a workaround for streamer/tuner |
|---|
| 158 | * not working together |
|---|
| 159 | * |
|---|
| 160 | * 24 4/24/08 2:53p jrubio |
|---|
| 161 | * PR42054: add sds2nexus function |
|---|
| 162 | * |
|---|
| 163 | * 23 4/10/08 9:56a erickson |
|---|
| 164 | * PR36068: coverity fixes |
|---|
| 165 | * |
|---|
| 166 | * 22 4/2/08 3:49p jrubio |
|---|
| 167 | * PR41191: add uninit functions |
|---|
| 168 | * |
|---|
| 169 | * 21 3/31/08 6:04p jgarrett |
|---|
| 170 | * PR 40606: Adding b_os_init/uninit |
|---|
| 171 | * |
|---|
| 172 | * 20 3/27/08 5:33p jrubio |
|---|
| 173 | * PR40919: add userio init and uninit |
|---|
| 174 | * |
|---|
| 175 | * 19 3/27/08 2:28p erickson |
|---|
| 176 | * PR40928: fix bsettop_uninit |
|---|
| 177 | * |
|---|
| 178 | * 18 3/25/08 12:52p erickson |
|---|
| 179 | * PR36068: added b_nexus2framerate |
|---|
| 180 | * |
|---|
| 181 | * 17 3/25/08 12:35p erickson |
|---|
| 182 | * PR40744: standardized capitalization on enums |
|---|
| 183 | * |
|---|
| 184 | * 16 3/25/08 10:53a katrep |
|---|
| 185 | * PR40893: Add support for HDMI capabilities |
|---|
| 186 | * |
|---|
| 187 | * 15 3/25/08 10:13a jgarrett |
|---|
| 188 | * PR 40857: Adding memory routines |
|---|
| 189 | * |
|---|
| 190 | * 14 3/21/08 11:19a erickson |
|---|
| 191 | * PR36068: rework around vesa. still left TODO. |
|---|
| 192 | * |
|---|
| 193 | * 13 3/17/08 5:38p katrep |
|---|
| 194 | * PR40021:Adding call to tuner init |
|---|
| 195 | * |
|---|
| 196 | * 12 3/12/08 2:28p katrep |
|---|
| 197 | * PR40514:Add support for AVS codec |
|---|
| 198 | * |
|---|
| 199 | * 11 3/11/08 11:09a erickson |
|---|
| 200 | * PR36068: added b_timer_schedule support |
|---|
| 201 | * |
|---|
| 202 | * 10 3/3/08 3:36p vsilyaev |
|---|
| 203 | * PR 39818: Support of MKV format |
|---|
| 204 | * |
|---|
| 205 | * 9 2/4/08 10:00a erickson |
|---|
| 206 | * PR36068: update |
|---|
| 207 | * |
|---|
| 208 | * 8 1/2/08 9:55a erickson |
|---|
| 209 | * PR36068: Playback changes |
|---|
| 210 | * |
|---|
| 211 | * 7 12/20/07 10:28a erickson |
|---|
| 212 | * PR37590: fix warnings |
|---|
| 213 | * |
|---|
| 214 | * 6 11/27/07 11:16p erickson |
|---|
| 215 | * PR36068: added g_settopModule to allow use of nexus timers |
|---|
| 216 | * |
|---|
| 217 | * 5 11/13/07 10:24a erickson |
|---|
| 218 | * PR36068: added b_lock_init |
|---|
| 219 | * |
|---|
| 220 | * 4 11/2/07 1:24p erickson |
|---|
| 221 | * PR36633: update nexus enums |
|---|
| 222 | * |
|---|
| 223 | * 3 10/16/07 12:35p erickson |
|---|
| 224 | * PR36068: brutus up over settop api/nexus |
|---|
| 225 | * |
|---|
| 226 | * 2 10/15/07 4:13p erickson |
|---|
| 227 | * PR36068: initial |
|---|
| 228 | * |
|---|
| 229 | * 1 10/15/07 2:35p erickson |
|---|
| 230 | * PR36068: initial |
|---|
| 231 | * |
|---|
| 232 | ***************************************************************************/ |
|---|
| 233 | #include <stdio.h> |
|---|
| 234 | #include <stdlib.h> |
|---|
| 235 | #include <string.h> |
|---|
| 236 | #include "bsettop_impl.h" |
|---|
| 237 | #include "nexus_memory.h" |
|---|
| 238 | #if NEXUS_DTV_PLATFORM |
|---|
| 239 | #include "nexus_platform_boardcfg.h" |
|---|
| 240 | #endif |
|---|
| 241 | |
|---|
| 242 | BDBG_MODULE(settop); |
|---|
| 243 | |
|---|
| 244 | static void bsettop_p_monitor(void *data) |
|---|
| 245 | { |
|---|
| 246 | unsigned i; |
|---|
| 247 | BSTD_UNUSED(data); |
|---|
| 248 | for (i=0;i<B_MAX_DECODES;i++) { |
|---|
| 249 | bdecode_t decode = &g_decode[i]; |
|---|
| 250 | if (decode->started) { |
|---|
| 251 | bdecode_status status; |
|---|
| 252 | bdecode_get_status(decode, &status); |
|---|
| 253 | BKNI_Printf("decode[%d]: pts 0x%08x, stc 0x%08x, diff %d, fifo %d%%\n", |
|---|
| 254 | i, |
|---|
| 255 | status.video_pts, status.video_stc, status.video_stc - status.video_pts, |
|---|
| 256 | status.video_fifo_size ? status.video_fifo_depth * 100 / status.video_fifo_size : 0 |
|---|
| 257 | ); |
|---|
| 258 | BKNI_Printf(" audio0: pts 0x%08x, stc 0x%08x, diff %d, fifo %d%%\n", |
|---|
| 259 | status.audio_pts, status.audio_stc, status.audio_stc - status.audio_pts, |
|---|
| 260 | status.audio_fifo_size ? status.audio_fifo_depth * 100 / status.audio_fifo_size : 0 |
|---|
| 261 | ); |
|---|
| 262 | } |
|---|
| 263 | } |
|---|
| 264 | |
|---|
| 265 | b_timer_schedule(1000, bsettop_p_monitor, NULL); |
|---|
| 266 | } |
|---|
| 267 | |
|---|
| 268 | static bsettop_init_settings g_bsettop_init_settings; |
|---|
| 269 | |
|---|
| 270 | static bool g_bsettop_frontend_opened = false; |
|---|
| 271 | static bool g_init_settings_initialized = false; |
|---|
| 272 | |
|---|
| 273 | static void bsettop_p_init_settings(void) |
|---|
| 274 | { |
|---|
| 275 | if ( !g_init_settings_initialized ) |
|---|
| 276 | { |
|---|
| 277 | NEXUS_PlatformSettings platformSettings; |
|---|
| 278 | |
|---|
| 279 | NEXUS_Platform_GetDefaultSettings(&platformSettings); |
|---|
| 280 | BDBG_CASSERT(BSETTOP_MAX_VIDEO_DACS == NEXUS_MAX_VIDEO_DACS); |
|---|
| 281 | BKNI_Memcpy(g_bsettop_init_settings.video_dac_band_gap, |
|---|
| 282 | platformSettings.displayModuleSettings.dacBandGapAdjust, |
|---|
| 283 | sizeof(g_bsettop_init_settings.video_dac_band_gap)); |
|---|
| 284 | g_bsettop_init_settings.open_frontend = true; |
|---|
| 285 | g_bsettop_init_settings.lipsync_mode = bsettop_lipsync_mode_tsm; |
|---|
| 286 | //g_bsettop_init_settings.lipsync_mode = bsettop_lipsync_mode_precision; |
|---|
| 287 | g_bsettop_init_settings.sync_path_swap = bsettop_get_config("sync_path_swap")?true:false; |
|---|
| 288 | |
|---|
| 289 | if ( bsettop_get_config("force_vsync") ) |
|---|
| 290 | { |
|---|
| 291 | g_bsettop_init_settings.lipsync_mode = bsettop_lipsync_mode_disabled; |
|---|
| 292 | } |
|---|
| 293 | else if ( bsettop_get_config("sync_disabled") ) |
|---|
| 294 | { |
|---|
| 295 | g_bsettop_init_settings.lipsync_mode = bsettop_lipsync_mode_tsm; |
|---|
| 296 | } |
|---|
| 297 | else if ( bsettop_get_config("precision_sync_disabled") ) |
|---|
| 298 | { |
|---|
| 299 | g_bsettop_init_settings.lipsync_mode = bsettop_lipsync_mode_basic; |
|---|
| 300 | } |
|---|
| 301 | |
|---|
| 302 | #ifdef B_HAS_IP |
|---|
| 303 | /* Increase the CDB for IP builds: video CDB is used as the dejitter buffer */ |
|---|
| 304 | g_bsettop_init_settings.video_fifo_size = 3 * 1024 * 1024; |
|---|
| 305 | #endif |
|---|
| 306 | |
|---|
| 307 | g_init_settings_initialized = true; |
|---|
| 308 | } |
|---|
| 309 | } |
|---|
| 310 | |
|---|
| 311 | void bsettop_get_init_settings( bsettop_init_settings *settings ) |
|---|
| 312 | { |
|---|
| 313 | bsettop_p_init_settings(); |
|---|
| 314 | *settings = g_bsettop_init_settings; |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | int bsettop_set_init_settings( const bsettop_init_settings *settings ) |
|---|
| 318 | { |
|---|
| 319 | g_bsettop_init_settings = *settings; |
|---|
| 320 | return 0; |
|---|
| 321 | } |
|---|
| 322 | |
|---|
| 323 | bresult bsettop_init(bsettop_version version) |
|---|
| 324 | { |
|---|
| 325 | NEXUS_Error rc; |
|---|
| 326 | NEXUS_PlatformSettings platformSettings; |
|---|
| 327 | const char *max_hd_display_format = bsettop_get_config("max_hd_display_format"); |
|---|
| 328 | |
|---|
| 329 | if (version != BSETTOP_VERSION) { |
|---|
| 330 | fprintf((int *)stderr, "BSETTOP_VERSION is out of date! Expected %d, got %d\n", BSETTOP_VERSION, version); |
|---|
| 331 | return BSETTOP_ERROR(berr_invalid_parameter); |
|---|
| 332 | } |
|---|
| 333 | |
|---|
| 334 | bsettop_p_init_settings(); |
|---|
| 335 | |
|---|
| 336 | if(bsettop_get_config("mode_slave")==NULL) { |
|---|
| 337 | unsigned i; |
|---|
| 338 | |
|---|
| 339 | /* Bring up all modules for a platform in a default configuraiton for this platform */ |
|---|
| 340 | NEXUS_Platform_GetDefaultSettings(&platformSettings); |
|---|
| 341 | |
|---|
| 342 | platformSettings.openFrontend = g_bsettop_init_settings.open_frontend; |
|---|
| 343 | g_bsettop_frontend_opened = false; |
|---|
| 344 | BKNI_Memcpy(platformSettings.displayModuleSettings.dacBandGapAdjust, |
|---|
| 345 | g_bsettop_init_settings.video_dac_band_gap, |
|---|
| 346 | sizeof(g_bsettop_init_settings.video_dac_band_gap)); |
|---|
| 347 | |
|---|
| 348 | if (max_hd_display_format) { |
|---|
| 349 | if (!strcasecmp(max_hd_display_format, "1080p")) { |
|---|
| 350 | platformSettings.displayModuleSettings.fullHdBuffers.format = NEXUS_VideoFormat_e1080p; |
|---|
| 351 | } |
|---|
| 352 | } |
|---|
| 353 | |
|---|
| 354 | for (i=0;i<NEXUS_MAX_VIDEO_DACS;i++) { |
|---|
| 355 | char buf[32]; |
|---|
| 356 | BKNI_Snprintf(buf, 32, "DAC%d_BAND_GAP", i); |
|---|
| 357 | if (NEXUS_GetEnv(buf)) { |
|---|
| 358 | platformSettings.displayModuleSettings.dacBandGapAdjust[i] = NEXUS_atoi(NEXUS_GetEnv(buf)); |
|---|
| 359 | } |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | rc = NEXUS_Platform_Init(&platformSettings); |
|---|
| 363 | if (rc) { |
|---|
| 364 | fprintf((int *)stderr, "Failed to initialize NEXUS\n"); |
|---|
| 365 | return BSETTOP_ERROR(berr_external_error); |
|---|
| 366 | } |
|---|
| 367 | } else { |
|---|
| 368 | rc = NEXUS_Platform_Join(); |
|---|
| 369 | if (rc) { |
|---|
| 370 | fprintf((int *)stderr, "Failed to join NEXUS\n"); |
|---|
| 371 | return BSETTOP_ERROR(berr_external_error); |
|---|
| 372 | } |
|---|
| 373 | } |
|---|
| 374 | |
|---|
| 375 | b_os_init(); |
|---|
| 376 | bconfig_p_init(); |
|---|
| 377 | bstream_p_init(); |
|---|
| 378 | bdisplay_p_init(); |
|---|
| 379 | bdecode_p_init(); |
|---|
| 380 | btuner_p_init(); |
|---|
| 381 | buserio_p_init(); |
|---|
| 382 | bdma_p_init(); |
|---|
| 383 | #ifdef B_HAS_IP |
|---|
| 384 | bplayback_ip_p_init(); |
|---|
| 385 | #endif |
|---|
| 386 | |
|---|
| 387 | #if NEXUS_DTV_PLATFORM |
|---|
| 388 | if (is_panel_output()) { |
|---|
| 389 | rc = NEXUS_BoardCfg_ConfigurePanel(true, true, true); |
|---|
| 390 | BDBG_ASSERT(!rc); |
|---|
| 391 | BDBG_WRN(("Panel output ready")); |
|---|
| 392 | } |
|---|
| 393 | #endif |
|---|
| 394 | |
|---|
| 395 | if (NEXUS_GetEnv("monitor")) { |
|---|
| 396 | b_timer_schedule(1000, bsettop_p_monitor, NULL); |
|---|
| 397 | } |
|---|
| 398 | |
|---|
| 399 | #if NEXUS_HAS_DMA |
|---|
| 400 | if (NEXUS_GetEnv("mem_stress")) { |
|---|
| 401 | bdma_p_mem_stress(); |
|---|
| 402 | } |
|---|
| 403 | #endif |
|---|
| 404 | |
|---|
| 405 | return 0; |
|---|
| 406 | } |
|---|
| 407 | |
|---|
| 408 | int bsettop_init_frontend(void) |
|---|
| 409 | { |
|---|
| 410 | NEXUS_Error rc; |
|---|
| 411 | |
|---|
| 412 | if (g_bsettop_frontend_opened) { |
|---|
| 413 | /* already opened */ |
|---|
| 414 | return 0; |
|---|
| 415 | } |
|---|
| 416 | |
|---|
| 417 | #if NEXUS_HAS_FRONTEND |
|---|
| 418 | rc = NEXUS_Platform_InitFrontend(); |
|---|
| 419 | if (rc) return BERR_TRACE(rc); |
|---|
| 420 | |
|---|
| 421 | /* it's ok to call this a second time */ |
|---|
| 422 | bconfig_p_set_tuners(); |
|---|
| 423 | g_bsettop_frontend_opened = true; |
|---|
| 424 | #endif |
|---|
| 425 | return rc; |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | void bsettop_uninit(void) |
|---|
| 429 | { |
|---|
| 430 | #ifdef B_HAS_IP |
|---|
| 431 | bplayback_ip_p_uninit(); |
|---|
| 432 | #endif |
|---|
| 433 | bdecode_p_uninit(); |
|---|
| 434 | bdisplay_p_uninit(); |
|---|
| 435 | buserio_p_uninit(); |
|---|
| 436 | b_os_uninit(); |
|---|
| 437 | NEXUS_Platform_Uninit(); |
|---|
| 438 | } |
|---|
| 439 | |
|---|
| 440 | void bsettop_get_power_state(bsettop_power_state *state) |
|---|
| 441 | { |
|---|
| 442 | /* TODO */ |
|---|
| 443 | state->av_outputs = true; |
|---|
| 444 | BSTD_UNUSED(state); |
|---|
| 445 | } |
|---|
| 446 | |
|---|
| 447 | bresult bsettop_set_power_state(const bsettop_power_state *state) |
|---|
| 448 | { |
|---|
| 449 | BSTD_UNUSED(state); |
|---|
| 450 | /* TODO */ |
|---|
| 451 | return 0; |
|---|
| 452 | } |
|---|
| 453 | |
|---|
| 454 | struct { |
|---|
| 455 | NEXUS_VideoCodec nexus; |
|---|
| 456 | bvideo_codec settop; |
|---|
| 457 | } g_videoCodec[] = { |
|---|
| 458 | {NEXUS_VideoCodec_eUnknown, bvideo_codec_none}, |
|---|
| 459 | {NEXUS_VideoCodec_eUnknown, bvideo_codec_unknown}, |
|---|
| 460 | {NEXUS_VideoCodec_eMpeg1, bvideo_codec_mpeg1}, |
|---|
| 461 | {NEXUS_VideoCodec_eMpeg2, bvideo_codec_mpeg2}, |
|---|
| 462 | {NEXUS_VideoCodec_eMpeg4Part2, bvideo_codec_mpeg4_part2}, |
|---|
| 463 | {NEXUS_VideoCodec_eH263, bvideo_codec_h263}, |
|---|
| 464 | {NEXUS_VideoCodec_eH264, bvideo_codec_h264}, |
|---|
| 465 | {NEXUS_VideoCodec_eVc1, bvideo_codec_vc1}, |
|---|
| 466 | {NEXUS_VideoCodec_eVc1SimpleMain, bvideo_codec_vc1_sm}, |
|---|
| 467 | {NEXUS_VideoCodec_eDivx311, bvideo_codec_divx_311}, |
|---|
| 468 | {NEXUS_VideoCodec_eAvs, bvideo_codec_avs} |
|---|
| 469 | }; |
|---|
| 470 | |
|---|
| 471 | struct { |
|---|
| 472 | NEXUS_AudioCodec nexus; |
|---|
| 473 | baudio_format settop; |
|---|
| 474 | } g_audioCodec[] = { |
|---|
| 475 | {NEXUS_AudioCodec_eUnknown, baudio_format_unknown}, |
|---|
| 476 | {NEXUS_AudioCodec_eMpeg, baudio_format_mpeg}, |
|---|
| 477 | {NEXUS_AudioCodec_eMp3, baudio_format_mp3}, |
|---|
| 478 | {NEXUS_AudioCodec_eAac, baudio_format_aac}, |
|---|
| 479 | {NEXUS_AudioCodec_eAacPlus, baudio_format_aac_plus}, |
|---|
| 480 | {NEXUS_AudioCodec_eAacPlusAdts, baudio_format_aac_plus_adts}, |
|---|
| 481 | {NEXUS_AudioCodec_eAacPlusLoas, baudio_format_aac_plus_loas}, |
|---|
| 482 | {NEXUS_AudioCodec_eAc3, baudio_format_ac3}, |
|---|
| 483 | {NEXUS_AudioCodec_eAc3Plus, baudio_format_ac3_plus}, |
|---|
| 484 | {NEXUS_AudioCodec_eDts, baudio_format_dts}, |
|---|
| 485 | {NEXUS_AudioCodec_eLpcmHdDvd, baudio_format_lpcm_hddvd}, |
|---|
| 486 | {NEXUS_AudioCodec_eLpcmBluRay, baudio_format_lpcm_bluray}, |
|---|
| 487 | {NEXUS_AudioCodec_eDtsHd, baudio_format_dts_hd}, |
|---|
| 488 | {NEXUS_AudioCodec_eWmaStd, baudio_format_wma_std}, |
|---|
| 489 | {NEXUS_AudioCodec_eWmaPro, baudio_format_wma_pro}, |
|---|
| 490 | {NEXUS_AudioCodec_eLpcmDvd, baudio_format_lpcm_dvd}, |
|---|
| 491 | {NEXUS_AudioCodec_eAvs, baudio_format_avs}, |
|---|
| 492 | {NEXUS_AudioCodec_eAmr, baudio_format_amr}, |
|---|
| 493 | {NEXUS_AudioCodec_eDra, baudio_format_dra}, |
|---|
| 494 | {NEXUS_AudioCodec_ePcmWav, baudio_format_pcm} |
|---|
| 495 | }; |
|---|
| 496 | |
|---|
| 497 | struct { |
|---|
| 498 | NEXUS_VideoFormat nexus; |
|---|
| 499 | bvideo_format settop; |
|---|
| 500 | } g_videoFormat[] = { |
|---|
| 501 | {NEXUS_VideoFormat_eNtsc, bvideo_format_ntsc}, |
|---|
| 502 | {NEXUS_VideoFormat_eNtscJapan, bvideo_format_ntsc_japan}, |
|---|
| 503 | {NEXUS_VideoFormat_ePalM, bvideo_format_pal_m}, |
|---|
| 504 | {NEXUS_VideoFormat_ePalN, bvideo_format_pal_n}, |
|---|
| 505 | {NEXUS_VideoFormat_ePalNc, bvideo_format_pal_nc}, |
|---|
| 506 | {NEXUS_VideoFormat_ePalB, bvideo_format_pal_b}, |
|---|
| 507 | {NEXUS_VideoFormat_ePalB1, bvideo_format_pal_b1}, |
|---|
| 508 | {NEXUS_VideoFormat_ePalD, bvideo_format_pal_d}, |
|---|
| 509 | {NEXUS_VideoFormat_ePalD1, bvideo_format_pal_d1}, |
|---|
| 510 | {NEXUS_VideoFormat_ePalG, bvideo_format_pal_g}, |
|---|
| 511 | {NEXUS_VideoFormat_ePal, bvideo_format_pal}, |
|---|
| 512 | {NEXUS_VideoFormat_ePalH, bvideo_format_pal_h}, |
|---|
| 513 | {NEXUS_VideoFormat_ePalK, bvideo_format_pal_k}, |
|---|
| 514 | {NEXUS_VideoFormat_ePalI, bvideo_format_pal_i}, |
|---|
| 515 | {NEXUS_VideoFormat_eSecam, bvideo_format_secam}, |
|---|
| 516 | {NEXUS_VideoFormat_e480p, bvideo_format_480p}, |
|---|
| 517 | {NEXUS_VideoFormat_e576p, bvideo_format_576p}, |
|---|
| 518 | {NEXUS_VideoFormat_e1080i, bvideo_format_1080i}, |
|---|
| 519 | {NEXUS_VideoFormat_e1080i50hz, bvideo_format_1080i_50hz}, |
|---|
| 520 | {NEXUS_VideoFormat_e1080p, bvideo_format_1080p}, |
|---|
| 521 | {NEXUS_VideoFormat_e1080p24hz, bvideo_format_1080p_24hz}, |
|---|
| 522 | {NEXUS_VideoFormat_e1080p25hz, bvideo_format_1080p_25hz}, |
|---|
| 523 | {NEXUS_VideoFormat_e1080p30hz, bvideo_format_1080p_30hz}, |
|---|
| 524 | {NEXUS_VideoFormat_e1080p50hz, bvideo_format_1080p_50hz}, |
|---|
| 525 | {NEXUS_VideoFormat_e1250i50hz, bvideo_format_1250i_50hz}, |
|---|
| 526 | {NEXUS_VideoFormat_e720p, bvideo_format_720p}, |
|---|
| 527 | {NEXUS_VideoFormat_e720p50hz, bvideo_format_720p_50hz}, |
|---|
| 528 | {NEXUS_VideoFormat_e720p24hz, bvideo_format_720p_24hz}, |
|---|
| 529 | {NEXUS_VideoFormat_eCustom0, bvideo_format_1080i}, /* TODO */ |
|---|
| 530 | |
|---|
| 531 | /* the following do not map, but we don't need ERR messages on the console */ |
|---|
| 532 | {NEXUS_VideoFormat_eNtsc443, bvideo_format_ntsc}, /* does not map */ |
|---|
| 533 | {NEXUS_VideoFormat_ePal60hz, bvideo_format_ntsc}, /* does not map */ |
|---|
| 534 | {NEXUS_VideoFormat_eSecamB, bvideo_format_ntsc}, /* does not map */ |
|---|
| 535 | {NEXUS_VideoFormat_eSecamG, bvideo_format_ntsc}, /* does not map */ |
|---|
| 536 | {NEXUS_VideoFormat_eSecamD, bvideo_format_ntsc}, /* does not map */ |
|---|
| 537 | {NEXUS_VideoFormat_eSecamK, bvideo_format_ntsc}, /* does not map */ |
|---|
| 538 | {NEXUS_VideoFormat_eSecamH, bvideo_format_ntsc}, /* does not map */ |
|---|
| 539 | {NEXUS_VideoFormat_e1080p60hz, bvideo_format_ntsc}, /* does not map */ |
|---|
| 540 | {NEXUS_VideoFormat_e1080p50hz, bvideo_format_ntsc}, /* does not map */ |
|---|
| 541 | {NEXUS_VideoFormat_e720p30hz, bvideo_format_ntsc} /* does not map */ |
|---|
| 542 | }; |
|---|
| 543 | |
|---|
| 544 | struct { |
|---|
| 545 | NEXUS_DisplayAspectRatio nexus; |
|---|
| 546 | unsigned settop; |
|---|
| 547 | } g_aspectRatio[] = { |
|---|
| 548 | {NEXUS_DisplayAspectRatio_e4x3, bdisplay_aspect_ratio_4x3}, |
|---|
| 549 | {NEXUS_DisplayAspectRatio_e16x9, bdisplay_aspect_ratio_16x9} |
|---|
| 550 | }; |
|---|
| 551 | |
|---|
| 552 | struct { |
|---|
| 553 | NEXUS_PixelFormat nexus; |
|---|
| 554 | unsigned settop; |
|---|
| 555 | } g_pixelFormat[] = { |
|---|
| 556 | {NEXUS_PixelFormat_eR5_G6_B5, bgraphics_pixel_format_r5_g6_b5}, |
|---|
| 557 | {NEXUS_PixelFormat_eA1_R5_G5_B5, bgraphics_pixel_format_a1_r5_g5_b5}, |
|---|
| 558 | {NEXUS_PixelFormat_eR5_G5_B5_A1, bgraphics_pixel_format_r5_g5_b5_a1}, |
|---|
| 559 | {NEXUS_PixelFormat_eA4_R4_G4_B4, bgraphics_pixel_format_a4_r4_g4_b4}, |
|---|
| 560 | {NEXUS_PixelFormat_eR4_G4_B4_A4, bgraphics_pixel_format_r4_g4_b4_a4}, |
|---|
| 561 | {NEXUS_PixelFormat_eA8_R8_G8_B8, bgraphics_pixel_format_a8_r8_g8_b8}, |
|---|
| 562 | {NEXUS_PixelFormat_ePalette8, bgraphics_pixel_format_palette8}, |
|---|
| 563 | {NEXUS_PixelFormat_eA8_Palette8, bgraphics_pixel_format_a8_palette8}, |
|---|
| 564 | {NEXUS_PixelFormat_eA8, bgraphics_pixel_format_a8}, |
|---|
| 565 | {NEXUS_PixelFormat_eY08_Cb8_Y18_Cr8, bgraphics_pixel_format_y08_cb8_y18_cr8}, |
|---|
| 566 | {NEXUS_PixelFormat_eCr8_Y18_Cb8_Y08, bgraphics_pixel_format_cr8_y18_cb8_y08}, |
|---|
| 567 | {NEXUS_PixelFormat_eA8_Y8_Cb8_Cr8, bgraphics_pixel_format_a8_y8_cb8_cr8}, |
|---|
| 568 | {NEXUS_PixelFormat_ePalette2, bgraphics_pixel_format_palette2}, |
|---|
| 569 | {NEXUS_PixelFormat_ePalette4, bgraphics_pixel_format_palette4} |
|---|
| 570 | }; |
|---|
| 571 | |
|---|
| 572 | struct { |
|---|
| 573 | NEXUS_MessageFormat nexus; |
|---|
| 574 | unsigned settop; |
|---|
| 575 | } g_messageFormat[] = { |
|---|
| 576 | {NEXUS_MessageFormat_eTs, bmessage_format_ts}, |
|---|
| 577 | {NEXUS_MessageFormat_ePes, bmessage_format_pes}, |
|---|
| 578 | {NEXUS_MessageFormat_ePsi, bmessage_format_psi} |
|---|
| 579 | }; |
|---|
| 580 | |
|---|
| 581 | #if NEXUS_HAS_FRONTEND |
|---|
| 582 | struct { |
|---|
| 583 | NEXUS_FrontendSatelliteMode nexus; |
|---|
| 584 | unsigned settop; |
|---|
| 585 | } g_sdsMode[] = { |
|---|
| 586 | { NEXUS_FrontendSatelliteMode_eDvb, btuner_sds_mode_qpsk_dvb}, |
|---|
| 587 | { NEXUS_FrontendSatelliteMode_eDss, btuner_sds_mode_qpsk_dss}, |
|---|
| 588 | { NEXUS_FrontendSatelliteMode_eDcii, btuner_sds_mode_qpsk_dcii}, |
|---|
| 589 | { NEXUS_FrontendSatelliteMode_eQpskLdpc, btuner_sds_mode_qpsk_ldpc }, |
|---|
| 590 | { NEXUS_FrontendSatelliteMode_e8pskLdpc, btuner_sds_mode_8psk_ldpc }, |
|---|
| 591 | { NEXUS_FrontendSatelliteMode_eLdpc, btuner_sds_mode_ldpc }, |
|---|
| 592 | { NEXUS_FrontendSatelliteMode_eQpskTurbo, btuner_sds_mode_qpsk_turbo }, |
|---|
| 593 | { NEXUS_FrontendSatelliteMode_e8pskTurbo, btuner_sds_mode_8psk_turbo }, |
|---|
| 594 | { NEXUS_FrontendSatelliteMode_eTurbo, btuner_sds_mode_turbo } |
|---|
| 595 | }; |
|---|
| 596 | #endif |
|---|
| 597 | |
|---|
| 598 | struct { |
|---|
| 599 | NEXUS_VideoFrameRate nexus; |
|---|
| 600 | bvideo_frame_rate settop; |
|---|
| 601 | } g_videoFrameRate[] = { |
|---|
| 602 | {NEXUS_VideoFrameRate_eUnknown, bvideo_frame_rate_unknown}, |
|---|
| 603 | {NEXUS_VideoFrameRate_e7_943, bvideo_frame_rate_7_943}, |
|---|
| 604 | {NEXUS_VideoFrameRate_e14_985, bvideo_frame_rate_14_985}, |
|---|
| 605 | {NEXUS_VideoFrameRate_e23_976, bvideo_frame_rate_23_976}, |
|---|
| 606 | {NEXUS_VideoFrameRate_e24, bvideo_frame_rate_24}, |
|---|
| 607 | {NEXUS_VideoFrameRate_e25, bvideo_frame_rate_25}, |
|---|
| 608 | {NEXUS_VideoFrameRate_e29_97, bvideo_frame_rate_29_97}, |
|---|
| 609 | {NEXUS_VideoFrameRate_e30, bvideo_frame_rate_30}, |
|---|
| 610 | {NEXUS_VideoFrameRate_e50, bvideo_frame_rate_50}, |
|---|
| 611 | {NEXUS_VideoFrameRate_e59_94, bvideo_frame_rate_59_94}, |
|---|
| 612 | {NEXUS_VideoFrameRate_e60, bvideo_frame_rate_60} |
|---|
| 613 | }; |
|---|
| 614 | |
|---|
| 615 | #define CONVERT(g_struct) \ |
|---|
| 616 | unsigned i; \ |
|---|
| 617 | for (i=0;i<sizeof(g_struct)/sizeof(g_struct[0]);i++) { \ |
|---|
| 618 | if (g_struct[i].settop == settop_value) { \ |
|---|
| 619 | return g_struct[i].nexus; \ |
|---|
| 620 | } \ |
|---|
| 621 | } \ |
|---|
| 622 | BDBG_ERR(("unable to find Settop API value %d in %s", settop_value, #g_struct)); \ |
|---|
| 623 | return g_struct[0].nexus |
|---|
| 624 | |
|---|
| 625 | #define CONVERT_NEXUS(g_struct) \ |
|---|
| 626 | unsigned i; \ |
|---|
| 627 | for (i=0;i<sizeof(g_struct)/sizeof(g_struct[0]);i++) { \ |
|---|
| 628 | if (g_struct[i].nexus == nexus_value) { \ |
|---|
| 629 | return g_struct[i].settop; \ |
|---|
| 630 | } \ |
|---|
| 631 | } \ |
|---|
| 632 | BDBG_ERR(("unable to find Nexus value %d in %s", nexus_value, #g_struct)); \ |
|---|
| 633 | return g_struct[0].settop |
|---|
| 634 | |
|---|
| 635 | NEXUS_VideoCodec b_videocodec2nexus(bvideo_codec settop_value) |
|---|
| 636 | { |
|---|
| 637 | CONVERT(g_videoCodec); |
|---|
| 638 | } |
|---|
| 639 | |
|---|
| 640 | bvideo_codec b_nexus2videocodec(NEXUS_VideoCodec nexus_value) |
|---|
| 641 | { |
|---|
| 642 | CONVERT_NEXUS(g_videoCodec); |
|---|
| 643 | } |
|---|
| 644 | |
|---|
| 645 | NEXUS_AudioCodec b_audiocodec2nexus(baudio_format settop_value) |
|---|
| 646 | { |
|---|
| 647 | CONVERT(g_audioCodec); |
|---|
| 648 | } |
|---|
| 649 | |
|---|
| 650 | baudio_format b_nexus2audiocodec(NEXUS_AudioCodec nexus_value) |
|---|
| 651 | { |
|---|
| 652 | CONVERT_NEXUS(g_audioCodec); |
|---|
| 653 | } |
|---|
| 654 | |
|---|
| 655 | bvideo_frame_rate b_nexus2framerate(NEXUS_VideoFrameRate nexus_value) |
|---|
| 656 | { |
|---|
| 657 | CONVERT_NEXUS(g_videoFrameRate); |
|---|
| 658 | } |
|---|
| 659 | |
|---|
| 660 | struct { |
|---|
| 661 | NEXUS_VideoFormat vesaFormat; |
|---|
| 662 | unsigned width; |
|---|
| 663 | unsigned height; |
|---|
| 664 | unsigned refresh_rate; |
|---|
| 665 | } g_vesaFormats[] = { |
|---|
| 666 | {NEXUS_VideoFormat_eVesa640x480p60hz, 640, 480, 60}, |
|---|
| 667 | {NEXUS_VideoFormat_eVesa800x600p60hz, 800, 600, 60}, |
|---|
| 668 | {NEXUS_VideoFormat_eVesa1024x768p60hz, 1024, 768, 60}, |
|---|
| 669 | {NEXUS_VideoFormat_eVesa1280x768p60hz, 1280, 768, 60}, |
|---|
| 670 | {NEXUS_VideoFormat_eVesa1280x768p60hzRed, 1280, 768, 60}, |
|---|
| 671 | {NEXUS_VideoFormat_eVesa1280x720p50hz, 1280, 720, 50}, |
|---|
| 672 | {NEXUS_VideoFormat_eVesa1280x720p60hz, 1280, 720, 60}, |
|---|
| 673 | {NEXUS_VideoFormat_eVesa1280x720pReducedBlank, 1280, 720, 60}, |
|---|
| 674 | {NEXUS_VideoFormat_eVesa640x350p60hz, 640, 350, 60}, |
|---|
| 675 | {NEXUS_VideoFormat_eVesa640x350p70hz, 640, 350, 70}, |
|---|
| 676 | {NEXUS_VideoFormat_eVesa640x350p72hz, 640, 350, 72}, |
|---|
| 677 | {NEXUS_VideoFormat_eVesa640x350p75hz, 640, 350, 75}, |
|---|
| 678 | {NEXUS_VideoFormat_eVesa640x350p85hz, 640, 350, 85}, |
|---|
| 679 | {NEXUS_VideoFormat_eVesa640x400p60hz, 640, 400, 60}, |
|---|
| 680 | {NEXUS_VideoFormat_eVesa640x400p70hz, 640, 400, 70}, |
|---|
| 681 | {NEXUS_VideoFormat_eVesa640x400p72hz, 640, 400, 72}, |
|---|
| 682 | {NEXUS_VideoFormat_eVesa640x400p75hz, 640, 400, 75}, |
|---|
| 683 | {NEXUS_VideoFormat_eVesa640x400p85hz, 640, 400, 85}, |
|---|
| 684 | {NEXUS_VideoFormat_eVesa640x480p70hz, 640, 480, 70}, |
|---|
| 685 | {NEXUS_VideoFormat_eVesa640x480p72hz, 640, 480, 72}, |
|---|
| 686 | {NEXUS_VideoFormat_eVesa640x480p75hz, 640, 480, 75}, |
|---|
| 687 | {NEXUS_VideoFormat_eVesa640x480p85hz, 640, 480, 85}, |
|---|
| 688 | |
|---|
| 689 | {NEXUS_VideoFormat_eVesa720x400p60hz, 720, 400, 60}, |
|---|
| 690 | {NEXUS_VideoFormat_eVesa720x400p70hz, 720, 400, 70}, |
|---|
| 691 | {NEXUS_VideoFormat_eVesa720x400p72hz, 720, 400, 72}, |
|---|
| 692 | {NEXUS_VideoFormat_eVesa720x400p75hz, 720, 400, 75}, |
|---|
| 693 | {NEXUS_VideoFormat_eVesa720x400p85hz, 720, 400, 85}, |
|---|
| 694 | {NEXUS_VideoFormat_eVesa800x600p56hz, 800, 600, 56}, |
|---|
| 695 | {NEXUS_VideoFormat_eVesa800x600p70hz, 800, 600, 70}, |
|---|
| 696 | {NEXUS_VideoFormat_eVesa800x600p72hz, 800, 600, 72}, |
|---|
| 697 | {NEXUS_VideoFormat_eVesa800x600p75hz, 800, 600, 75}, |
|---|
| 698 | {NEXUS_VideoFormat_eVesa800x600p85hz, 800, 600, 85}, |
|---|
| 699 | {NEXUS_VideoFormat_eVesa1024x768p70hz, 1024, 768, 70}, |
|---|
| 700 | {NEXUS_VideoFormat_eVesa1024x768p72hz, 1024, 768, 72}, |
|---|
| 701 | {NEXUS_VideoFormat_eVesa1024x768p75hz, 1024, 768, 75}, |
|---|
| 702 | {NEXUS_VideoFormat_eVesa1024x768p85hz, 1024, 768, 85}, |
|---|
| 703 | {NEXUS_VideoFormat_eVesa1280x720p70hz, 1280, 720, 70}, |
|---|
| 704 | {NEXUS_VideoFormat_eVesa1280x720p72hz, 1280, 720, 72}, |
|---|
| 705 | {NEXUS_VideoFormat_eVesa1280x720p75hz, 1280, 720, 75}, |
|---|
| 706 | {NEXUS_VideoFormat_eVesa1280x720p85hz, 1280, 720, 85}, |
|---|
| 707 | {NEXUS_VideoFormat_eVesa1024x768i87hz, 1024, 768, 87}, |
|---|
| 708 | {NEXUS_VideoFormat_eVesa1152x864p75hz, 1152, 864, 75}, |
|---|
| 709 | {NEXUS_VideoFormat_eVesa1280x768p75hz, 1280, 768, 75}, |
|---|
| 710 | {NEXUS_VideoFormat_eVesa1280x768p85hz, 1280, 768, 85}, |
|---|
| 711 | {NEXUS_VideoFormat_eVesa1280x960p60hz, 1280, 960, 60}, |
|---|
| 712 | {NEXUS_VideoFormat_eVesa1280x960p85hz, 1280, 960, 85}, |
|---|
| 713 | {NEXUS_VideoFormat_eVesa1280x1024p60hz, 1280, 1024, 60}, |
|---|
| 714 | {NEXUS_VideoFormat_eVesa1280x1024p75hz, 1280, 1024, 75}, |
|---|
| 715 | {NEXUS_VideoFormat_eVesa1280x1024p85hz, 1280, 1024, 85}, |
|---|
| 716 | {NEXUS_VideoFormat_eVesa832x624p75hz, 832, 624, 75}, |
|---|
| 717 | {NEXUS_VideoFormat_eVesa1360x768p60hz, 1360, 768, 60}, |
|---|
| 718 | {NEXUS_VideoFormat_eVesa1366x768p60hz, 1366, 768, 60}, |
|---|
| 719 | {NEXUS_VideoFormat_eVesa1400x1050p60hz, 1400, 1050, 60}, |
|---|
| 720 | {NEXUS_VideoFormat_eVesa1400x1050p60hzReducedBlank, 1400, 1050, 60}, |
|---|
| 721 | {NEXUS_VideoFormat_eVesa1400x1050p75hz, 1400, 1050, 75}, |
|---|
| 722 | {NEXUS_VideoFormat_eVesa1600x1200p60hz, 1600, 1200, 60}, |
|---|
| 723 | {NEXUS_VideoFormat_eVesa1920x1080p60hzReducedBlank, 1920, 1080, 60}, |
|---|
| 724 | }; |
|---|
| 725 | |
|---|
| 726 | NEXUS_VideoFormat b_displayformat2nexus(bvideo_format settop_value, const bvideo_format_settings *vesa_settings) |
|---|
| 727 | { |
|---|
| 728 | if (settop_value == bvideo_format_vesa) { |
|---|
| 729 | unsigned i; |
|---|
| 730 | BDBG_ASSERT(vesa_settings); |
|---|
| 731 | for (i=0;i<sizeof(g_vesaFormats)/sizeof(g_vesaFormats[0]);i++) { |
|---|
| 732 | if (vesa_settings->width == g_vesaFormats[i].width && |
|---|
| 733 | vesa_settings->height == g_vesaFormats[i].height && |
|---|
| 734 | vesa_settings->refresh_rate == g_vesaFormats[i].refresh_rate) |
|---|
| 735 | { |
|---|
| 736 | return g_vesaFormats[i].vesaFormat; |
|---|
| 737 | } |
|---|
| 738 | } |
|---|
| 739 | /* unknown */ |
|---|
| 740 | return NEXUS_VideoFormat_eVesa640x480p60hz; |
|---|
| 741 | } |
|---|
| 742 | else { |
|---|
| 743 | CONVERT(g_videoFormat); |
|---|
| 744 | } |
|---|
| 745 | } |
|---|
| 746 | |
|---|
| 747 | bvideo_format b_nexus2displayformat(NEXUS_VideoFormat nexus_value, bvideo_format_settings *vesa_settings) |
|---|
| 748 | { |
|---|
| 749 | if (nexus_value >= NEXUS_VideoFormat_eVesa640x480p60hz && nexus_value <= NEXUS_VideoFormat_eVesa1920x1080p60hzReducedBlank ) |
|---|
| 750 | { |
|---|
| 751 | if (vesa_settings) { |
|---|
| 752 | unsigned i; |
|---|
| 753 | BKNI_Memset(vesa_settings, 0, sizeof(*vesa_settings)); |
|---|
| 754 | for (i=0;i<sizeof(g_vesaFormats)/sizeof(g_vesaFormats[0]);i++) { |
|---|
| 755 | if (nexus_value == g_vesaFormats[i].vesaFormat) { |
|---|
| 756 | vesa_settings->width = g_vesaFormats[i].width; |
|---|
| 757 | vesa_settings->height = g_vesaFormats[i].height; |
|---|
| 758 | vesa_settings->refresh_rate = g_vesaFormats[i].refresh_rate; |
|---|
| 759 | vesa_settings->frame_rate = g_vesaFormats[i].refresh_rate * 100; |
|---|
| 760 | vesa_settings->interlaced = false; |
|---|
| 761 | } |
|---|
| 762 | } |
|---|
| 763 | } |
|---|
| 764 | return bvideo_format_vesa; |
|---|
| 765 | } |
|---|
| 766 | else |
|---|
| 767 | { |
|---|
| 768 | CONVERT_NEXUS(g_videoFormat); |
|---|
| 769 | } |
|---|
| 770 | } |
|---|
| 771 | |
|---|
| 772 | NEXUS_DisplayAspectRatio b_displayaspectratio2nexus(bdisplay_aspect_ratio settop_value) |
|---|
| 773 | { |
|---|
| 774 | CONVERT(g_aspectRatio); |
|---|
| 775 | } |
|---|
| 776 | |
|---|
| 777 | NEXUS_PixelFormat b_graphicspixelformat2nexus(bgraphics_pixel_format settop_value) |
|---|
| 778 | { |
|---|
| 779 | CONVERT(g_pixelFormat); |
|---|
| 780 | } |
|---|
| 781 | |
|---|
| 782 | NEXUS_MessageFormat b_messageformat2nexus(bmessage_format settop_value) |
|---|
| 783 | { |
|---|
| 784 | CONVERT(g_messageFormat); |
|---|
| 785 | } |
|---|
| 786 | |
|---|
| 787 | #if NEXUS_HAS_FRONTEND |
|---|
| 788 | NEXUS_FrontendSatelliteMode b_sdsmode2nexus(btuner_sds_mode settop_value) |
|---|
| 789 | { |
|---|
| 790 | CONVERT(g_sdsMode); |
|---|
| 791 | } |
|---|
| 792 | #endif |
|---|
| 793 | |
|---|
| 794 | struct { |
|---|
| 795 | NEXUS_TransportType nexus; |
|---|
| 796 | unsigned settop; |
|---|
| 797 | } g_mpegType[] = { |
|---|
| 798 | {NEXUS_TransportType_eTs, bstream_mpeg_type_unknown}, |
|---|
| 799 | {NEXUS_TransportType_eEs, bstream_mpeg_type_es}, |
|---|
| 800 | {NEXUS_TransportType_eTs, bstream_mpeg_type_bes}, |
|---|
| 801 | {NEXUS_TransportType_eMpeg2Pes, bstream_mpeg_type_pes}, |
|---|
| 802 | {NEXUS_TransportType_eTs, bstream_mpeg_type_ts}, |
|---|
| 803 | {NEXUS_TransportType_eDssEs, bstream_mpeg_type_dss_es}, |
|---|
| 804 | {NEXUS_TransportType_eDssPes, bstream_mpeg_type_dss_pes}, |
|---|
| 805 | {NEXUS_TransportType_eVob, bstream_mpeg_type_vob}, |
|---|
| 806 | {NEXUS_TransportType_eAsf, bstream_mpeg_type_asf}, |
|---|
| 807 | {NEXUS_TransportType_eAvi, bstream_mpeg_type_avi}, |
|---|
| 808 | {NEXUS_TransportType_eMpeg1Ps, bstream_mpeg_type_mpeg1}, |
|---|
| 809 | {NEXUS_TransportType_eMp4, bstream_mpeg_type_mp4}, |
|---|
| 810 | {NEXUS_TransportType_eMkv, bstream_mpeg_type_mkv}, |
|---|
| 811 | {NEXUS_TransportType_eWav, bstream_mpeg_type_wav}, |
|---|
| 812 | {NEXUS_TransportType_eFlv, bstream_mpeg_type_flv} |
|---|
| 813 | }; |
|---|
| 814 | |
|---|
| 815 | NEXUS_TransportType b_mpegtype2nexus(bstream_mpeg_type settop_value) |
|---|
| 816 | { |
|---|
| 817 | CONVERT(g_mpegType); |
|---|
| 818 | } |
|---|
| 819 | |
|---|
| 820 | #if NEXUS_HAS_PLAYBACK |
|---|
| 821 | NEXUS_VideoDecoderDecodeMode b_decodermode2nexus(bplaypump_decode_mode settop_value) |
|---|
| 822 | { |
|---|
| 823 | return (NEXUS_VideoDecoderDecodeMode)settop_value; |
|---|
| 824 | } |
|---|
| 825 | #endif |
|---|
| 826 | |
|---|
| 827 | /* |
|---|
| 828 | Summary: |
|---|
| 829 | Cached memory allocation function |
|---|
| 830 | Description: |
|---|
| 831 | This allocates a buffer on the current heap and in cached memory for use elsewhere. |
|---|
| 832 | */ |
|---|
| 833 | bmem_ptr bmem_alloc( |
|---|
| 834 | size_t buffer_length |
|---|
| 835 | ) |
|---|
| 836 | { |
|---|
| 837 | bresult rc; |
|---|
| 838 | void *pMemory; |
|---|
| 839 | NEXUS_Error errCode; |
|---|
| 840 | NEXUS_MemoryAllocationSettings allocSettings; |
|---|
| 841 | NEXUS_Memory_GetDefaultAllocationSettings(&allocSettings); |
|---|
| 842 | errCode = NEXUS_Memory_Allocate(buffer_length, &allocSettings, &pMemory); |
|---|
| 843 | if ( errCode ) |
|---|
| 844 | { |
|---|
| 845 | rc = BSETTOP_ERROR(berr_external_error); |
|---|
| 846 | return NULL; |
|---|
| 847 | } |
|---|
| 848 | return pMemory; |
|---|
| 849 | } |
|---|
| 850 | |
|---|
| 851 | /* |
|---|
| 852 | Summary: |
|---|
| 853 | Memory de-allocation for external use |
|---|
| 854 | Description: |
|---|
| 855 | This frees a buffer allocated with bsettop_mem_alloc() |
|---|
| 856 | */ |
|---|
| 857 | void bmem_free( |
|---|
| 858 | void *buffer |
|---|
| 859 | ) |
|---|
| 860 | { |
|---|
| 861 | BDBG_ASSERT(NULL != buffer); |
|---|
| 862 | NEXUS_Memory_Free(buffer); |
|---|
| 863 | } |
|---|
| 864 | |
|---|
| 865 | const char *bsettop_get_config(const char *name) |
|---|
| 866 | { |
|---|
| 867 | #ifdef __vxworks |
|---|
| 868 | return NEXUS_GetEnv(name); |
|---|
| 869 | #elif defined(NO_OS) |
|---|
| 870 | return NULL; |
|---|
| 871 | #else |
|---|
| 872 | return getenv(name); |
|---|
| 873 | #endif |
|---|
| 874 | } |
|---|
| 875 | |
|---|
| 876 | int b_strcmp(const char *s1, const char *s2) |
|---|
| 877 | { |
|---|
| 878 | return strcmp(s1, s2); |
|---|
| 879 | } |
|---|
| 880 | |
|---|