| 1 | /****************************************************************************** |
|---|
| 2 | * (c)2008 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: boot.c $ |
|---|
| 39 | * $brcm_Revision: 2 $ |
|---|
| 40 | * $brcm_Date: 7/18/08 11:31a $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /nexus/examples/boot.c $ |
|---|
| 47 | * |
|---|
| 48 | * 2 7/18/08 11:31a jgarrett |
|---|
| 49 | * PR 44953: Removing -Wstrict-prototypes warnings |
|---|
| 50 | * |
|---|
| 51 | *****************************************************************************/ |
|---|
| 52 | #include "ministd.h" |
|---|
| 53 | #include "nexus_types.h" |
|---|
| 54 | #include "nexus_platform.h" |
|---|
| 55 | #include "nexus_pid_channel.h" |
|---|
| 56 | #include "nexus_parser_band.h" |
|---|
| 57 | #include "nexus_video_decoder.h" |
|---|
| 58 | #include "nexus_stc_channel.h" |
|---|
| 59 | #include "nexus_display.h" |
|---|
| 60 | #include "nexus_video_window.h" |
|---|
| 61 | #include "nexus_video_input.h" |
|---|
| 62 | #include "nexus_audio_dac.h" |
|---|
| 63 | #include "nexus_audio_decoder.h" |
|---|
| 64 | #include "nexus_audio_output.h" |
|---|
| 65 | #include "nexus_audio_input.h" |
|---|
| 66 | #include "nexus_spdif_output.h" |
|---|
| 67 | #include "nexus_composite_output.h" |
|---|
| 68 | #include "nexus_component_output.h" |
|---|
| 69 | #include "nexus_hdmi_output_hdcp.h" |
|---|
| 70 | |
|---|
| 71 | #include "nexus_security.h" |
|---|
| 72 | #include "nexus_msg.h" |
|---|
| 73 | |
|---|
| 74 | BDBG_MODULE(boot_nexus); /* Register software module with debug interface */ |
|---|
| 75 | |
|---|
| 76 | //RLQ |
|---|
| 77 | #ifdef DESCRABLER_TEST |
|---|
| 78 | void Descrmbler_Dvbcsa_SwKey(NEXUS_VideoDecoderStartSettings *pVideoProgram, NEXUS_AudioDecoderStartSettings *pAudioProgram ); |
|---|
| 79 | #endif |
|---|
| 80 | |
|---|
| 81 | #if 0 |
|---|
| 82 | int main(void) |
|---|
| 83 | { |
|---|
| 84 | NEXUS_Error errCode; |
|---|
| 85 | |
|---|
| 86 | while (1) { |
|---|
| 87 | printf( "Ready to initialize\n"); |
|---|
| 88 | |
|---|
| 89 | errCode = NEXUS_Platform_Init(NULL); |
|---|
| 90 | |
|---|
| 91 | if ( errCode ) |
|---|
| 92 | { |
|---|
| 93 | printf( "Unable to initialize nexus, err %d\n", errCode); |
|---|
| 94 | return -1; |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | printf( "Initialization complete, press enter to uninit\n"); |
|---|
| 98 | getchar(); |
|---|
| 99 | |
|---|
| 100 | NEXUS_Platform_Uninit(); |
|---|
| 101 | |
|---|
| 102 | printf( "Uninit complete, press enter to init again\n"); |
|---|
| 103 | getchar(); |
|---|
| 104 | } |
|---|
| 105 | |
|---|
| 106 | return 0; |
|---|
| 107 | } |
|---|
| 108 | #else |
|---|
| 109 | static void bapp_hdcp_callback(void *pParam, int iParam) |
|---|
| 110 | { |
|---|
| 111 | NEXUS_HdmiOutputHandle hdmi = pParam; |
|---|
| 112 | NEXUS_DisplayHandle display = (NEXUS_DisplayHandle)iParam; |
|---|
| 113 | NEXUS_HdmiOutputHdcpStatus hdcpStatus; |
|---|
| 114 | NEXUS_DisplaySettings displaySettings; |
|---|
| 115 | NEXUS_HdmiOutputSettings hdmiOutputSettings; |
|---|
| 116 | |
|---|
| 117 | BDBG_ASSERT(pParam); |
|---|
| 118 | BDBG_ASSERT(iParam); |
|---|
| 119 | |
|---|
| 120 | BDBG_MSG(("HDCP status change")); |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | NEXUS_HdmiOutput_GetHdcpStatus(hdmi, &hdcpStatus); |
|---|
| 124 | |
|---|
| 125 | switch ( hdcpStatus.hdcpState ) |
|---|
| 126 | { |
|---|
| 127 | case NEXUS_HdmiOutputHdcpState_eUnauthenticated: |
|---|
| 128 | /* Display bluescreen and mute audio unless user disable this feature */ |
|---|
| 129 | if (1 /*!hdmi->desired.hdcp_disable_blue_screen */) |
|---|
| 130 | { |
|---|
| 131 | NEXUS_Display_GetSettings(display, &displaySettings); |
|---|
| 132 | displaySettings.background = 0xff0000ff; /* blue */ |
|---|
| 133 | NEXUS_Display_SetSettings(display, &displaySettings); |
|---|
| 134 | |
|---|
| 135 | NEXUS_HdmiOutput_GetSettings(hdmi, &hdmiOutputSettings); |
|---|
| 136 | hdmiOutputSettings.syncOnly = true; |
|---|
| 137 | NEXUS_HdmiOutput_SetSettings(hdmi, &hdmiOutputSettings); |
|---|
| 138 | |
|---|
| 139 | //boutput_hdmi_audio_mute(hdmi, true); |
|---|
| 140 | } |
|---|
| 141 | break; |
|---|
| 142 | |
|---|
| 143 | case NEXUS_HdmiOutputHdcpState_eR0LinkFailure: |
|---|
| 144 | case NEXUS_HdmiOutputHdcpState_ePjLinkIntegrityFailure: |
|---|
| 145 | case NEXUS_HdmiOutputHdcpState_eRiLinkIntegrityFailure: |
|---|
| 146 | case NEXUS_HdmiOutputHdcpState_eRepeaterAuthenticationFailure: |
|---|
| 147 | |
|---|
| 148 | /* Display bluescreen and mute audio unless user disable this feature */ |
|---|
| 149 | if (1 /*!hdmi->desired.hdcp_disable_blue_screen*/) |
|---|
| 150 | { |
|---|
| 151 | NEXUS_Display_GetSettings(display, &displaySettings); |
|---|
| 152 | displaySettings.background = 0xff0000ff; /* blue */ |
|---|
| 153 | NEXUS_Display_SetSettings(display, &displaySettings); |
|---|
| 154 | |
|---|
| 155 | NEXUS_HdmiOutput_GetSettings(hdmi, &hdmiOutputSettings); |
|---|
| 156 | hdmiOutputSettings.syncOnly = true; |
|---|
| 157 | NEXUS_HdmiOutput_SetSettings(hdmi, &hdmiOutputSettings); |
|---|
| 158 | |
|---|
| 159 | // boutput_hdmi_audio_mute(hdmi, true); |
|---|
| 160 | } |
|---|
| 161 | #if 0 |
|---|
| 162 | /* Retry auth if requested */ |
|---|
| 163 | if ( hdmi->desired.hdcp_failure_retry_delay > 0 ) |
|---|
| 164 | { |
|---|
| 165 | if ( NULL != hdmi->hdcpTimer ) |
|---|
| 166 | { |
|---|
| 167 | b_timer_cancel(hdmi->hdcpTimer); |
|---|
| 168 | } |
|---|
| 169 | b_timer_schedule(hdmi->desired.hdcp_failure_retry_delay, bdisplay_p_hdcp_retry, hdmi); |
|---|
| 170 | } |
|---|
| 171 | #endif |
|---|
| 172 | break; |
|---|
| 173 | |
|---|
| 174 | case NEXUS_HdmiOutputHdcpState_eLinkAuthenticated: |
|---|
| 175 | case NEXUS_HdmiOutputHdcpState_eEncryptionEnabled: |
|---|
| 176 | /* clear bluescreen */ |
|---|
| 177 | if (1 /*!hdmi->desired.hdcp_disable_blue_screen*/) |
|---|
| 178 | { |
|---|
| 179 | NEXUS_Display_GetSettings(display, &displaySettings); |
|---|
| 180 | displaySettings.background = 0xff000000; /* clear blue screen*/ |
|---|
| 181 | NEXUS_Display_SetSettings(display, &displaySettings); |
|---|
| 182 | |
|---|
| 183 | NEXUS_HdmiOutput_GetSettings(hdmi, &hdmiOutputSettings); |
|---|
| 184 | hdmiOutputSettings.syncOnly = false; |
|---|
| 185 | NEXUS_HdmiOutput_SetSettings(hdmi, &hdmiOutputSettings); |
|---|
| 186 | |
|---|
| 187 | // boutput_hdmi_audio_mute(hdmi, false); |
|---|
| 188 | } |
|---|
| 189 | break; |
|---|
| 190 | |
|---|
| 191 | default: |
|---|
| 192 | break; |
|---|
| 193 | } |
|---|
| 194 | |
|---|
| 195 | } |
|---|
| 196 | |
|---|
| 197 | void bapp_hdmi_hotplug_callback(void *pParam, int iParam) |
|---|
| 198 | { |
|---|
| 199 | NEXUS_HdmiOutputStatus status; |
|---|
| 200 | NEXUS_HdmiOutputHandle hdmi = pParam; |
|---|
| 201 | NEXUS_DisplayHandle display = (NEXUS_DisplayHandle)iParam; |
|---|
| 202 | |
|---|
| 203 | NEXUS_HdmiOutput_GetStatus(hdmi, &status); |
|---|
| 204 | printf("HDMI hotplug event: %s\n", status.connected?"connected":"not connected"); |
|---|
| 205 | |
|---|
| 206 | /* the app can choose to switch to the preferred format, but it's not required. */ |
|---|
| 207 | if ( status.connected ) |
|---|
| 208 | { |
|---|
| 209 | NEXUS_DisplaySettings displaySettings; |
|---|
| 210 | NEXUS_Display_GetSettings(display, &displaySettings); |
|---|
| 211 | if ( !status.videoFormatSupported[displaySettings.format] ) |
|---|
| 212 | { |
|---|
| 213 | printf("\nCurrent format not supported by attached monitor. Switching to preferred format %d\n", status.preferredVideoFormat); |
|---|
| 214 | displaySettings.format = status.preferredVideoFormat; |
|---|
| 215 | NEXUS_Display_SetSettings(display, &displaySettings); |
|---|
| 216 | } |
|---|
| 217 | NEXUS_HdmiOutput_StartHdcpAuthentication(hdmi); |
|---|
| 218 | } |
|---|
| 219 | } |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | static void lock_callback(void *context, int param) |
|---|
| 223 | { |
|---|
| 224 | NEXUS_FrontendHandle frontend = (NEXUS_FrontendHandle)context; |
|---|
| 225 | NEXUS_FrontendQamStatus qamStatus; |
|---|
| 226 | |
|---|
| 227 | BSTD_UNUSED(param); |
|---|
| 228 | |
|---|
| 229 | printf("Lock callback, frontend 0x%08x\n", (unsigned)frontend); |
|---|
| 230 | |
|---|
| 231 | NEXUS_Frontend_GetQamStatus(frontend, &qamStatus); |
|---|
| 232 | printf("QAM Lock callback, frontend 0x%08x - lock status %d, %d\n", (unsigned)frontend, |
|---|
| 233 | qamStatus.fecLock, qamStatus.receiverLock); |
|---|
| 234 | } |
|---|
| 235 | |
|---|
| 236 | static unsigned char ibuffer[0x100]; |
|---|
| 237 | |
|---|
| 238 | unsigned input_number(void) |
|---|
| 239 | { |
|---|
| 240 | unsigned number; |
|---|
| 241 | gets(ibuffer); |
|---|
| 242 | if('0' ==ibuffer[0]){ |
|---|
| 243 | switch(ibuffer[1]){ |
|---|
| 244 | case 'x': |
|---|
| 245 | sscanf(&ibuffer[2], "%x", &number); |
|---|
| 246 | break; |
|---|
| 247 | case 'X': |
|---|
| 248 | sscanf(&ibuffer[2], "%x", &number); |
|---|
| 249 | break; |
|---|
| 250 | default: |
|---|
| 251 | sscanf(ibuffer, "%d", &number); |
|---|
| 252 | break; |
|---|
| 253 | } |
|---|
| 254 | }else{ |
|---|
| 255 | sscanf(ibuffer, "%d", &number); |
|---|
| 256 | } |
|---|
| 257 | printf(" %d %x", number, number); |
|---|
| 258 | return number; |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | int console_main(void *data) |
|---|
| 262 | { |
|---|
| 263 | NEXUS_PlatformSettings platformSettings; |
|---|
| 264 | NEXUS_PlatformConfiguration platformConfig; |
|---|
| 265 | NEXUS_ParserBand parserBand; |
|---|
| 266 | NEXUS_ParserBandSettings parserBandSettings; |
|---|
| 267 | NEXUS_StcChannelHandle stcChannel; |
|---|
| 268 | NEXUS_StcChannelSettings stcSettings; |
|---|
| 269 | NEXUS_PidChannelHandle videoPidChannel, audioPidChannel; |
|---|
| 270 | NEXUS_DisplayHandle display; |
|---|
| 271 | NEXUS_DisplaySettings displaySettings; |
|---|
| 272 | NEXUS_VideoWindowHandle window; |
|---|
| 273 | NEXUS_VideoDecoderHandle vdecode; |
|---|
| 274 | NEXUS_AudioDecoderHandle pcmDecoder, compressedDecoder; |
|---|
| 275 | NEXUS_VideoDecoderStartSettings videoProgram; |
|---|
| 276 | NEXUS_AudioDecoderStartSettings audioProgram; |
|---|
| 277 | NEXUS_HdmiOutputSettings hdmiSettings; |
|---|
| 278 | NEXUS_FrontendUserParameters userParams; |
|---|
| 279 | NEXUS_FrontendHandle frontend=NULL; |
|---|
| 280 | NEXUS_FrontendQamSettings qamSettings; |
|---|
| 281 | NEXUS_VideoWindowSettings windowSettings; |
|---|
| 282 | NEXUS_CalculateVideoWindowPositionSettings calcSettings; |
|---|
| 283 | NEXUS_HdmiOutputHdcpSettings hdcpSettings; |
|---|
| 284 | NEXUS_VideoWindowSettings vwSettings; |
|---|
| 285 | NEXUS_VideoDecoderSettings vdSettings; |
|---|
| 286 | NEXUS_Error rc; |
|---|
| 287 | |
|---|
| 288 | // unsigned freq = 765; /* 777 qam256*/ |
|---|
| 289 | unsigned freq = 567; /* 777 qam256*/ |
|---|
| 290 | NEXUS_FrontendQamMode qamMode = NEXUS_FrontendQamMode_e256; |
|---|
| 291 | //NEXUS_FrontendQamMode qamMode = NEXUS_FrontendQamMode_e64; |
|---|
| 292 | int i; |
|---|
| 293 | |
|---|
| 294 | /* Bring up all modules for a platform in a default configuration for this platform */ |
|---|
| 295 | NEXUS_Platform_GetDefaultSettings(&platformSettings); |
|---|
| 296 | platformSettings.openFrontend = true; |
|---|
| 297 | NEXUS_Platform_Init(&platformSettings); |
|---|
| 298 | |
|---|
| 299 | //btnr_7550_utils,bads_7550_acquire |
|---|
| 300 | #if 0 |
|---|
| 301 | BDBG_SetModuleLevel("bads_7550",BDBG_eTrace); |
|---|
| 302 | BDBG_SetModuleLevel("btnr_7550_status",BDBG_eTrace); |
|---|
| 303 | BDBG_SetModuleLevel("bads_75xx_priv",BDBG_eTrace); |
|---|
| 304 | BDBG_SetModuleLevel("btnr_7550_utils",BDBG_eTrace); |
|---|
| 305 | BDBG_SetModuleLevel("bads_7550_acquire",BDBG_eTrace); |
|---|
| 306 | BDBG_SetModuleLevel("bads_7550_utils",BDBG_eTrace); |
|---|
| 307 | #endif |
|---|
| 308 | #ifdef DESCRABLER_TEST |
|---|
| 309 | BDBG_SetModuleLevel("BHSM",BDBG_eTrace); |
|---|
| 310 | BDBG_SetModuleLevel("BHDM",BDBG_eTrace); |
|---|
| 311 | BDBG_SetModuleLevel("BHDM_HDCP",BDBG_eTrace); |
|---|
| 312 | #endif |
|---|
| 313 | |
|---|
| 314 | NEXUS_Platform_GetConfiguration(&platformConfig); |
|---|
| 315 | |
|---|
| 316 | for ( i = 0; i < NEXUS_MAX_FRONTENDS; i++ ) |
|---|
| 317 | { |
|---|
| 318 | NEXUS_FrontendCapabilities capabilities; |
|---|
| 319 | frontend = platformConfig.frontend[i]; |
|---|
| 320 | if (frontend) { |
|---|
| 321 | NEXUS_Frontend_GetCapabilities(frontend, &capabilities); |
|---|
| 322 | /* Does this frontend support qam? */ |
|---|
| 323 | if ( capabilities.qam ) |
|---|
| 324 | { |
|---|
| 325 | break; |
|---|
| 326 | } |
|---|
| 327 | } |
|---|
| 328 | } |
|---|
| 329 | |
|---|
| 330 | if (NULL == frontend ) |
|---|
| 331 | { |
|---|
| 332 | printf("Unable to find QAM-capable frontend\n"); |
|---|
| 333 | return 0; |
|---|
| 334 | } |
|---|
| 335 | |
|---|
| 336 | //RLQ, for TUNE only test, comment it if want to tune and start AV decoder |
|---|
| 337 | //#define TUNE_ONLY |
|---|
| 338 | |
|---|
| 339 | #ifdef TUNE_ONLY |
|---|
| 340 | while(1) |
|---|
| 341 | { |
|---|
| 342 | printf("Input frequency (MHz, e.g. 549 for 549MHz): "); |
|---|
| 343 | freq = input_number(); |
|---|
| 344 | printf("\n"); |
|---|
| 345 | if (freq < 40 || freq > 999) { |
|---|
| 346 | printf("Freq out of range, retry\n"); |
|---|
| 347 | continue; |
|---|
| 348 | } |
|---|
| 349 | #endif |
|---|
| 350 | NEXUS_Frontend_GetDefaultQamSettings(&qamSettings); |
|---|
| 351 | qamSettings.frequency = freq * 1000000; |
|---|
| 352 | qamSettings.mode = qamMode; |
|---|
| 353 | qamSettings.symbolRate = 5056900; |
|---|
| 354 | qamSettings.annex = NEXUS_FrontendQamAnnex_eB; |
|---|
| 355 | qamSettings.bandwidth = NEXUS_FrontendQamBandwidth_e6Mhz; |
|---|
| 356 | qamSettings.lockCallback.callback = lock_callback; |
|---|
| 357 | qamSettings.lockCallback.context = frontend; |
|---|
| 358 | NEXUS_Frontend_GetUserParameters(frontend, &userParams); |
|---|
| 359 | |
|---|
| 360 | parserBand = NEXUS_ParserBand_e0; |
|---|
| 361 | NEXUS_ParserBand_GetSettings(parserBand, &parserBandSettings); |
|---|
| 362 | parserBandSettings.sourceType = NEXUS_ParserBandSourceType_eInputBand; |
|---|
| 363 | parserBandSettings.sourceTypeSettings.inputBand = userParams.param1; |
|---|
| 364 | parserBandSettings.transportType = NEXUS_TransportType_eTs; |
|---|
| 365 | NEXUS_ParserBand_SetSettings(parserBand, &parserBandSettings); |
|---|
| 366 | |
|---|
| 367 | // bos_sleep(5000); |
|---|
| 368 | printf("Tune freq=%d\n",qamSettings.frequency); |
|---|
| 369 | NEXUS_Frontend_TuneQam(frontend, &qamSettings); |
|---|
| 370 | // bos_sleep(500); |
|---|
| 371 | #ifdef TUNE_ONLY |
|---|
| 372 | while (1) |
|---|
| 373 | { |
|---|
| 374 | NEXUS_FrontendQamStatus qamStatus; |
|---|
| 375 | bos_sleep(1000); |
|---|
| 376 | if (NEXUS_Frontend_GetQamStatus(frontend,&qamStatus) == NEXUS_SUCCESS) |
|---|
| 377 | { |
|---|
| 378 | printf("receiverLock = %d, fecLock = %d\n",qamStatus.receiverLock,qamStatus.fecLock); |
|---|
| 379 | } |
|---|
| 380 | printf("Input 9 to try new frequency "); |
|---|
| 381 | freq = input_number(); |
|---|
| 382 | printf("\n"); |
|---|
| 383 | if (freq == 9) |
|---|
| 384 | break; |
|---|
| 385 | } |
|---|
| 386 | } |
|---|
| 387 | #endif |
|---|
| 388 | { |
|---|
| 389 | NEXUS_FrontendQamStatus qamStatus; |
|---|
| 390 | bos_sleep(1000); |
|---|
| 391 | if (NEXUS_Frontend_GetQamStatus(frontend,&qamStatus) == NEXUS_SUCCESS) |
|---|
| 392 | { |
|---|
| 393 | printf("receiverLock = %d, fecLock = %d\n",qamStatus.receiverLock,qamStatus.fecLock); |
|---|
| 394 | } |
|---|
| 395 | } |
|---|
| 396 | /* Open the audio and video pid channels */ |
|---|
| 397 | videoPidChannel = NEXUS_PidChannel_Open(parserBand, 49, NULL); |
|---|
| 398 | audioPidChannel = NEXUS_PidChannel_Open(parserBand, 52, NULL); |
|---|
| 399 | |
|---|
| 400 | //nexus_msg_start(0); |
|---|
| 401 | //nexus_msg_start(1); |
|---|
| 402 | |
|---|
| 403 | /* Open the StcChannel to do lipsync with the PCR */ |
|---|
| 404 | NEXUS_StcChannel_GetDefaultSettings(0, &stcSettings); |
|---|
| 405 | stcSettings.timebase = NEXUS_Timebase_e0; |
|---|
| 406 | stcSettings.mode = NEXUS_StcChannelMode_ePcr; /* live */ |
|---|
| 407 | stcSettings.modeSettings.pcr.pidChannel = videoPidChannel; /* PCR happens to be on video pid */ |
|---|
| 408 | stcChannel = NEXUS_StcChannel_Open(0, &stcSettings); |
|---|
| 409 | |
|---|
| 410 | /* Set up decoder Start structures now. We need to know the audio codec to properly set up |
|---|
| 411 | the audio outputs. */ |
|---|
| 412 | NEXUS_VideoDecoder_GetDefaultStartSettings(&videoProgram); |
|---|
| 413 | videoProgram.codec = NEXUS_VideoCodec_eMpeg2; |
|---|
| 414 | videoProgram.pidChannel = videoPidChannel; |
|---|
| 415 | videoProgram.stcChannel = stcChannel; |
|---|
| 416 | NEXUS_AudioDecoder_GetDefaultStartSettings(&audioProgram); |
|---|
| 417 | audioProgram.codec = NEXUS_AudioCodec_eAc3; |
|---|
| 418 | audioProgram.pidChannel = audioPidChannel; |
|---|
| 419 | audioProgram.stcChannel = stcChannel; |
|---|
| 420 | |
|---|
| 421 | /* Bring up audio decoders and outputs */ |
|---|
| 422 | pcmDecoder = NEXUS_AudioDecoder_Open(0, NULL); |
|---|
| 423 | compressedDecoder = NEXUS_AudioDecoder_Open(1, NULL); |
|---|
| 424 | NEXUS_AudioOutput_AddInput( |
|---|
| 425 | NEXUS_AudioDac_GetConnector(platformConfig.outputs.audioDacs[0]), |
|---|
| 426 | NEXUS_AudioDecoder_GetConnector(pcmDecoder, NEXUS_AudioDecoderConnectorType_eStereo)); |
|---|
| 427 | if ( audioProgram.codec == NEXUS_AudioCodec_eAc3 ) |
|---|
| 428 | { |
|---|
| 429 | /* Only pass through AC3 */ |
|---|
| 430 | NEXUS_AudioOutput_AddInput( |
|---|
| 431 | NEXUS_SpdifOutput_GetConnector(platformConfig.outputs.spdif[0]), |
|---|
| 432 | NEXUS_AudioDecoder_GetConnector(compressedDecoder, NEXUS_AudioDecoderConnectorType_eCompressed)); |
|---|
| 433 | } |
|---|
| 434 | else |
|---|
| 435 | { |
|---|
| 436 | NEXUS_AudioOutput_AddInput( |
|---|
| 437 | NEXUS_SpdifOutput_GetConnector(platformConfig.outputs.spdif[0]), |
|---|
| 438 | NEXUS_AudioDecoder_GetConnector(pcmDecoder, NEXUS_AudioDecoderConnectorType_eStereo)); |
|---|
| 439 | } |
|---|
| 440 | NEXUS_AudioOutput_AddInput(NEXUS_HdmiOutput_GetAudioConnector(platformConfig.outputs.hdmi[0]), |
|---|
| 441 | NEXUS_AudioDecoder_GetConnector(pcmDecoder, NEXUS_AudioDecoderConnectorType_eStereo)); |
|---|
| 442 | |
|---|
| 443 | /* Bring up display and outputs */ |
|---|
| 444 | NEXUS_Display_GetDefaultSettings(&displaySettings); |
|---|
| 445 | displaySettings.format = NEXUS_VideoFormat_e720p; |
|---|
| 446 | displaySettings.displayType = NEXUS_DisplayType_eAuto; |
|---|
| 447 | //displaySettings.background = 0xffff0000; |
|---|
| 448 | display = NEXUS_Display_Open(0, &displaySettings); |
|---|
| 449 | BDBG_ASSERT(display); |
|---|
| 450 | NEXUS_Display_AddOutput(display, NEXUS_HdmiOutput_GetVideoConnector(platformConfig.outputs.hdmi[0])); |
|---|
| 451 | #if 0 |
|---|
| 452 | NEXUS_Display_AddOutput(display, NEXUS_CompositeOutput_GetConnector(platformConfig.outputs.composite[0])); |
|---|
| 453 | #endif |
|---|
| 454 | |
|---|
| 455 | window = NEXUS_VideoWindow_Open(display, 0); |
|---|
| 456 | |
|---|
| 457 | /* Install hotplug callback -- video only for now */ |
|---|
| 458 | NEXUS_HdmiOutput_GetSettings(platformConfig.outputs.hdmi[0], &hdmiSettings); |
|---|
| 459 | hdmiSettings.hotplugCallback.callback = bapp_hdmi_hotplug_callback; |
|---|
| 460 | hdmiSettings.hotplugCallback.context = platformConfig.outputs.hdmi[0]; |
|---|
| 461 | hdmiSettings.hotplugCallback.param = (int)display; |
|---|
| 462 | NEXUS_HdmiOutput_SetSettings(platformConfig.outputs.hdmi[0], &hdmiSettings); |
|---|
| 463 | #if 0 |
|---|
| 464 | /* Initialize/install HDCP callback to notify app */ |
|---|
| 465 | NEXUS_HdmiOutput_GetHdcpSettings(platformConfig.outputs.hdmi[0], &hdcpSettings); |
|---|
| 466 | hdcpSettings.stateChangedCallback.callback = bapp_hdcp_callback; |
|---|
| 467 | hdcpSettings.stateChangedCallback.context = platformConfig.outputs.hdmi[0]; |
|---|
| 468 | hdcpSettings.stateChangedCallback.param = (int)display; |
|---|
| 469 | hdcpSettings.failureCallback.callback = bapp_hdcp_callback; |
|---|
| 470 | hdcpSettings.failureCallback.context = platformConfig.outputs.hdmi[0]; |
|---|
| 471 | hdcpSettings.failureCallback.param = (int)display; |
|---|
| 472 | /* TO DO: Add successCallback */ |
|---|
| 473 | rc = NEXUS_HdmiOutput_SetHdcpSettings(platformConfig.outputs.hdmi[0], &hdcpSettings); |
|---|
| 474 | if (rc != NEXUS_SUCCESS) |
|---|
| 475 | BDBG_ERR(("Error initializing hdmi_output_hdcp settings")); |
|---|
| 476 | #endif |
|---|
| 477 | NEXUS_HdmiOutput_StartHdcpAuthentication(platformConfig.outputs.hdmi[0]); |
|---|
| 478 | |
|---|
| 479 | /* bring up decoder and connect to display */ |
|---|
| 480 | vdecode = NEXUS_VideoDecoder_Open(0, NULL); /* take default capabilities */ |
|---|
| 481 | NEXUS_VideoDecoder_GetSettings(vdecode,&vdSettings); |
|---|
| 482 | vdSettings.channelChangeMode = NEXUS_VideoDecoder_ChannelChangeMode_eHoldUntilFirstPicture; |
|---|
| 483 | NEXUS_VideoDecoder_SetSettings(vdecode,&vdSettings); |
|---|
| 484 | NEXUS_VideoWindow_AddInput(window, NEXUS_VideoDecoder_GetConnector(vdecode)); |
|---|
| 485 | |
|---|
| 486 | NEXUS_VideoWindow_GetSettings(window,&vwSettings ); |
|---|
| 487 | vwSettings.visible = true; |
|---|
| 488 | NEXUS_VideoWindow_SetSettings(window,&vwSettings ); |
|---|
| 489 | |
|---|
| 490 | /* Start Decoders */ |
|---|
| 491 | NEXUS_VideoDecoder_Start(vdecode, &videoProgram); |
|---|
| 492 | NEXUS_AudioDecoder_Start(pcmDecoder, &audioProgram); |
|---|
| 493 | if ( audioProgram.codec == NEXUS_AudioCodec_eAc3 ) |
|---|
| 494 | { |
|---|
| 495 | /* Only pass through AC3 */ |
|---|
| 496 | NEXUS_AudioDecoder_Start(compressedDecoder, &audioProgram); |
|---|
| 497 | } |
|---|
| 498 | #if 0 |
|---|
| 499 | NEXUS_VideoWindow_GetSettings(window,&windowSettings); |
|---|
| 500 | windowSettings.contentMode = NEXUS_VideoWindowContentMode_eBox; |
|---|
| 501 | #if 0 |
|---|
| 502 | NEXUS_GetDefaultCalculateVideoWindowPositionSettings(&calcSettings); |
|---|
| 503 | calcSettings.manualAspectRatioCorrection = NEXUS_VideoWindowContentMode_eBox; |
|---|
| 504 | |
|---|
| 505 | NEXUS_CalculateVideoWindowPosition(&calcSettings,&windowSettings); |
|---|
| 506 | #endif |
|---|
| 507 | NEXUS_VideoWindow_SetSettings(window,&windowSettings); |
|---|
| 508 | #endif |
|---|
| 509 | |
|---|
| 510 | #ifdef DESCRABLER_TEST |
|---|
| 511 | Descrmbler_Dvbcsa_SwKey(&videoProgram , &audioProgram); |
|---|
| 512 | #endif |
|---|
| 513 | |
|---|
| 514 | |
|---|
| 515 | #if 1 |
|---|
| 516 | /* Print status while decoding */ |
|---|
| 517 | for (;;) { |
|---|
| 518 | NEXUS_VideoDecoderStatus status; |
|---|
| 519 | NEXUS_AudioDecoderStatus audioStatus; |
|---|
| 520 | uint32_t stc; |
|---|
| 521 | b_cpu_load load; |
|---|
| 522 | |
|---|
| 523 | NEXUS_VideoDecoder_GetStatus(vdecode, &status); |
|---|
| 524 | NEXUS_StcChannel_GetStc(videoProgram.stcChannel, &stc); |
|---|
| 525 | printf("decode %.4dx%.4d, pts %#x, stc %#x (diff %d) fifo=%d%%\n", |
|---|
| 526 | status.source.width, status.source.height, status.pts, stc, status.pts - stc, status.fifoSize?(status.fifoDepth*100)/status.fifoSize:0); |
|---|
| 527 | NEXUS_AudioDecoder_GetStatus(pcmDecoder, &audioStatus); |
|---|
| 528 | printf("audio0 pts %#x, stc %#x (diff %d) fifo=%d%%\n", |
|---|
| 529 | audioStatus.pts, stc, audioStatus.pts - stc, audioStatus.fifoSize?(audioStatus.fifoDepth*100)/audioStatus.fifoSize:0); |
|---|
| 530 | NEXUS_AudioDecoder_GetStatus(compressedDecoder, &audioStatus); |
|---|
| 531 | if ( audioStatus.started ) |
|---|
| 532 | { |
|---|
| 533 | printf("audio1 pts %#x, stc %#x (diff %d) fifo=%d%%\n", |
|---|
| 534 | audioStatus.pts, stc, audioStatus.pts - stc, audioStatus.fifoSize?(audioStatus.fifoDepth*100)/audioStatus.fifoSize:0); |
|---|
| 535 | } |
|---|
| 536 | #if 0 |
|---|
| 537 | printf("-------- TASKINFO --------\n"); |
|---|
| 538 | bos_print_taskinfo(); |
|---|
| 539 | bos_getload(&load); |
|---|
| 540 | printf("LOAD: %u ms IDLE:%u ISR:%u:%u %u us CSW:%u\n", load.duration, load.idle, load.isr_rate, load.isr, load.isr_us, load.ctxsw_rate); |
|---|
| 541 | #endif |
|---|
| 542 | BKNI_Sleep(1000); |
|---|
| 543 | } |
|---|
| 544 | #else |
|---|
| 545 | printf("Press ENTER to stop decode\n"); |
|---|
| 546 | getchar(); |
|---|
| 547 | |
|---|
| 548 | /* example shutdown */ |
|---|
| 549 | NEXUS_AudioDecoder_Stop(pcmDecoder); |
|---|
| 550 | if ( audioProgram.codec == NEXUS_AudioCodec_eAc3 ) |
|---|
| 551 | { |
|---|
| 552 | NEXUS_AudioDecoder_Stop(compressedDecoder); |
|---|
| 553 | } |
|---|
| 554 | NEXUS_AudioOutput_RemoveAllInputs(NEXUS_AudioDac_GetConnector(platformConfig.outputs.audioDacs[0])); |
|---|
| 555 | NEXUS_AudioOutput_RemoveAllInputs(NEXUS_SpdifOutput_GetConnector(platformConfig.outputs.spdif[0])); |
|---|
| 556 | NEXUS_AudioInput_Shutdown(NEXUS_AudioDecoder_GetConnector(pcmDecoder, NEXUS_AudioDecoderConnectorType_eStereo)); |
|---|
| 557 | NEXUS_AudioInput_Shutdown(NEXUS_AudioDecoder_GetConnector(compressedDecoder, NEXUS_AudioDecoderConnectorType_eCompressed)); |
|---|
| 558 | NEXUS_AudioDecoder_Close(pcmDecoder); |
|---|
| 559 | NEXUS_AudioDecoder_Close(compressedDecoder); |
|---|
| 560 | NEXUS_VideoDecoder_Stop(vdecode); |
|---|
| 561 | NEXUS_VideoWindow_RemoveAllInputs(window); |
|---|
| 562 | NEXUS_VideoInput_Shutdown(NEXUS_VideoDecoder_GetConnector(vdecode)); |
|---|
| 563 | NEXUS_VideoWindow_Close(window); |
|---|
| 564 | NEXUS_Display_Close(display); |
|---|
| 565 | NEXUS_VideoDecoder_Close(vdecode); |
|---|
| 566 | NEXUS_StcChannel_Close(stcChannel); |
|---|
| 567 | NEXUS_PidChannel_Close(videoPidChannel); |
|---|
| 568 | NEXUS_PidChannel_Close(audioPidChannel); |
|---|
| 569 | NEXUS_Platform_Uninit(); |
|---|
| 570 | #endif |
|---|
| 571 | |
|---|
| 572 | return 0; |
|---|
| 573 | } |
|---|
| 574 | |
|---|
| 575 | |
|---|
| 576 | void Descrmbler_Dvbcsa_SwKey(NEXUS_VideoDecoderStartSettings *pVideoProgram, NEXUS_AudioDecoderStartSettings *pAudioProgram ) |
|---|
| 577 | { |
|---|
| 578 | NEXUS_KeySlotHandle videoKeyHandle = NULL; |
|---|
| 579 | NEXUS_KeySlotHandle audioKeyHandle = NULL; |
|---|
| 580 | NEXUS_SecurityAlgorithmSettings AlgConfig; |
|---|
| 581 | NEXUS_SecurityClearKey key; |
|---|
| 582 | NEXUS_PidChannelStatus pidStatus; |
|---|
| 583 | NEXUS_SecurityKeySlotSettings keySlotSettings; |
|---|
| 584 | |
|---|
| 585 | unsigned char cwAudioEven[8] = { |
|---|
| 586 | 0xd3,0x94,0xdd,0x44,0x13,0xd5,0xd1,0xb9, |
|---|
| 587 | }; |
|---|
| 588 | |
|---|
| 589 | unsigned char cwAudioOdd[8] = { |
|---|
| 590 | 0xd6,0x91,0xd8,0x3f,0x13,0xd0,0xd4,0xb7, |
|---|
| 591 | |
|---|
| 592 | }; |
|---|
| 593 | |
|---|
| 594 | unsigned char cwVideoEven[8] = { |
|---|
| 595 | 0xbe,0xf9,0xb0,0x67,0x13,0xb8,0xbc,0x87, |
|---|
| 596 | }; |
|---|
| 597 | |
|---|
| 598 | unsigned char cwVideoOdd[8] = { |
|---|
| 599 | 0xbc,0xfb,0xb2,0x69,0x13,0xba,0xbe,0x8b, |
|---|
| 600 | }; |
|---|
| 601 | |
|---|
| 602 | |
|---|
| 603 | /* Allocate CA video keyslot */ |
|---|
| 604 | printf("Allocate CA video keyslot\n"); |
|---|
| 605 | NEXUS_Security_GetDefaultKeySlotSettings(&keySlotSettings); |
|---|
| 606 | keySlotSettings.keySlotEngine = NEXUS_SecurityEngine_eCa; |
|---|
| 607 | videoKeyHandle = NEXUS_Security_AllocateKeySlot(&keySlotSettings); |
|---|
| 608 | if ( !videoKeyHandle) |
|---|
| 609 | { |
|---|
| 610 | printf("\nAllocate CA video keyslot failed \n"); |
|---|
| 611 | return ; |
|---|
| 612 | } |
|---|
| 613 | |
|---|
| 614 | /* Add video PID channel to keyslot */ |
|---|
| 615 | printf("Add video PID channel to keyslot \n"); |
|---|
| 616 | NEXUS_PidChannel_GetStatus (pVideoProgram->pidChannel, &pidStatus); |
|---|
| 617 | if ( NEXUS_Security_AddPidChannelToKeySlot(videoKeyHandle, pidStatus.pidChannelIndex)!= 0 ) |
|---|
| 618 | { |
|---|
| 619 | printf("\nAdd video PID channel to keyslot failed \n"); |
|---|
| 620 | return ; |
|---|
| 621 | } |
|---|
| 622 | |
|---|
| 623 | /* Config video CA Algorithm for both even and odd*/ |
|---|
| 624 | printf("Configure video CA Algorithm for both even and odd \n"); |
|---|
| 625 | NEXUS_Security_GetDefaultAlgorithmSettings(&AlgConfig); |
|---|
| 626 | AlgConfig.algorithm = NEXUS_SecurityAlgorithm_eDvb; |
|---|
| 627 | AlgConfig.algorithmVar = NEXUS_SecurityAlgorithmVariant_eXpt; |
|---|
| 628 | |
|---|
| 629 | if ( NEXUS_Security_ConfigAlgorithm (videoKeyHandle, &AlgConfig) != 0 ) |
|---|
| 630 | { |
|---|
| 631 | printf("\nConfigure Video CA Algorithm Even failed \n"); |
|---|
| 632 | return ; |
|---|
| 633 | } |
|---|
| 634 | |
|---|
| 635 | /* Load Video keys */ |
|---|
| 636 | printf("Load video Odd key \n"); |
|---|
| 637 | key.keySize = 8; |
|---|
| 638 | key.keyEntryType = NEXUS_SecurityKeyType_eOdd; |
|---|
| 639 | BKNI_Memcpy(key.keyData,cwVideoOdd,sizeof(cwVideoOdd)); |
|---|
| 640 | if ( NEXUS_Security_LoadClearKey (videoKeyHandle, &key) != 0 ) |
|---|
| 641 | { |
|---|
| 642 | printf("\nLoad Video Odd key failed \n"); |
|---|
| 643 | return ; |
|---|
| 644 | } |
|---|
| 645 | |
|---|
| 646 | printf("Load video ODD key \n"); |
|---|
| 647 | key.keyEntryType = NEXUS_SecurityKeyType_eEven; |
|---|
| 648 | BKNI_Memcpy(key.keyData,cwVideoEven,sizeof(cwVideoEven)); |
|---|
| 649 | if ( NEXUS_Security_LoadClearKey (videoKeyHandle, &key) != 0 ) |
|---|
| 650 | { |
|---|
| 651 | printf("\nLoad Video Even key failed \n"); |
|---|
| 652 | return ; |
|---|
| 653 | } |
|---|
| 654 | |
|---|
| 655 | /* Allocate CA Audio keyslot */ |
|---|
| 656 | printf("Allocate CA Audio keyslot\n"); |
|---|
| 657 | NEXUS_Security_GetDefaultKeySlotSettings(&keySlotSettings); |
|---|
| 658 | keySlotSettings.keySlotEngine = NEXUS_SecurityEngine_eCa; |
|---|
| 659 | audioKeyHandle = NEXUS_Security_AllocateKeySlot(&keySlotSettings); |
|---|
| 660 | if ( !audioKeyHandle) |
|---|
| 661 | { |
|---|
| 662 | printf("\nAllocate CA Audio Keyslot failed \n"); |
|---|
| 663 | return ; |
|---|
| 664 | } |
|---|
| 665 | |
|---|
| 666 | /* Add Audio PID channel to keyslot */ |
|---|
| 667 | printf("Add Audio PID channel to keyslot \n"); |
|---|
| 668 | NEXUS_PidChannel_GetStatus (pAudioProgram->pidChannel, &pidStatus); |
|---|
| 669 | |
|---|
| 670 | if ( NEXUS_Security_AddPidChannelToKeySlot(audioKeyHandle, pidStatus.pidChannelIndex)!= 0 ) |
|---|
| 671 | { |
|---|
| 672 | printf("\nAdd Audio PID channel to keyslot failed \n"); |
|---|
| 673 | return ; |
|---|
| 674 | } |
|---|
| 675 | |
|---|
| 676 | /* Configure Audio CA Algorithm for both even and odd */ |
|---|
| 677 | printf("Configure Audio CA Algorithm for both even and odd \n"); |
|---|
| 678 | NEXUS_Security_GetDefaultAlgorithmSettings(&AlgConfig); |
|---|
| 679 | AlgConfig.algorithm = NEXUS_SecurityAlgorithm_eDvb; |
|---|
| 680 | AlgConfig.algorithmVar = NEXUS_SecurityAlgorithmVariant_eXpt; |
|---|
| 681 | |
|---|
| 682 | if ( NEXUS_Security_ConfigAlgorithm (audioKeyHandle, &AlgConfig) != 0 ) |
|---|
| 683 | { |
|---|
| 684 | printf("\nConfigure Audio CA Algorithm failed \n"); |
|---|
| 685 | return ; |
|---|
| 686 | } |
|---|
| 687 | |
|---|
| 688 | /* Load AV keys */ |
|---|
| 689 | printf("Load Audio Odd key \n"); |
|---|
| 690 | key.keySize = 8; |
|---|
| 691 | key.keyEntryType = NEXUS_SecurityKeyType_eOdd; |
|---|
| 692 | BKNI_Memcpy(key.keyData,cwAudioOdd,sizeof(cwAudioOdd)); |
|---|
| 693 | if ( NEXUS_Security_LoadClearKey (audioKeyHandle, &key) != 0 ) |
|---|
| 694 | { |
|---|
| 695 | printf("\nLoad Audio Odd key failed \n"); |
|---|
| 696 | return ; |
|---|
| 697 | } |
|---|
| 698 | |
|---|
| 699 | printf("Load Audio Even key \n"); |
|---|
| 700 | key.keyEntryType = NEXUS_SecurityKeyType_eEven; |
|---|
| 701 | BKNI_Memcpy(key.keyData,cwAudioEven,sizeof(cwAudioEven)); |
|---|
| 702 | if ( NEXUS_Security_LoadClearKey (audioKeyHandle, &key) != 0 ) |
|---|
| 703 | { |
|---|
| 704 | printf("\nLoad Audio Even Key failed \n"); |
|---|
| 705 | return ; |
|---|
| 706 | } |
|---|
| 707 | |
|---|
| 708 | printf ("\nSecurity Configure OK\n"); |
|---|
| 709 | #if 1 |
|---|
| 710 | return; |
|---|
| 711 | |
|---|
| 712 | #endif |
|---|
| 713 | printf("Press ENTER to stop decode\n"); |
|---|
| 714 | getchar(); |
|---|
| 715 | |
|---|
| 716 | |
|---|
| 717 | /* Remove Audio PID channel from keyslot */ |
|---|
| 718 | printf("Remove Audio PID channel from keyslot \n"); |
|---|
| 719 | NEXUS_PidChannel_GetStatus (pAudioProgram->pidChannel, &pidStatus); |
|---|
| 720 | if ( NEXUS_Security_RemovePidChannelFromKeySlot(audioKeyHandle, pidStatus.pidChannelIndex)!= 0 ) |
|---|
| 721 | { |
|---|
| 722 | printf("\nRemove video PID channel from keyslot failed \n"); |
|---|
| 723 | return ; |
|---|
| 724 | } |
|---|
| 725 | |
|---|
| 726 | /* Free CA Audio keyslot */ |
|---|
| 727 | printf("Free CA Audio keyslot\n"); |
|---|
| 728 | NEXUS_Security_FreeKeySlot(audioKeyHandle); |
|---|
| 729 | |
|---|
| 730 | /* Remove Video PID channel from keyslot */ |
|---|
| 731 | printf("Remove Video PID channel from keyslot \n"); |
|---|
| 732 | NEXUS_PidChannel_GetStatus (pVideoProgram->pidChannel, &pidStatus); |
|---|
| 733 | if ( NEXUS_Security_RemovePidChannelFromKeySlot(videoKeyHandle, pidStatus.pidChannelIndex)!= 0 ) |
|---|
| 734 | { |
|---|
| 735 | printf("\nRemove Video PID channel from keyslot failed \n"); |
|---|
| 736 | return ; |
|---|
| 737 | } |
|---|
| 738 | |
|---|
| 739 | /* Free CA Video keyslot */ |
|---|
| 740 | printf("Free CA Video keyslot\n"); |
|---|
| 741 | NEXUS_Security_FreeKeySlot(videoKeyHandle); |
|---|
| 742 | |
|---|
| 743 | printf ("\nFree Keyslot OK\n"); |
|---|
| 744 | |
|---|
| 745 | } |
|---|
| 746 | |
|---|
| 747 | #endif |
|---|