/****************************************************************************** * (c)2008 Broadcom Corporation * * This program is the proprietary software of Broadcom Corporation and/or its licensors, * and may only be used, duplicated, modified or distributed pursuant to the terms and * conditions of a separate, written license agreement executed between you and Broadcom * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants * no license (express or implied), right to use, or waiver of any kind with respect to the * Software, and Broadcom expressly reserves all rights in and to the Software and all * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. * * Except as expressly set forth in the Authorized License, * * 1. This program, including its structure, sequence and organization, constitutes the valuable trade * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, * and to use this information only in connection with your use of Broadcom integrated circuit products. * * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF * USE OR PERFORMANCE OF THE SOFTWARE. * * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF * ANY LIMITED REMEDY. * * $brcm_Workfile: boot.c $ * $brcm_Revision: 2 $ * $brcm_Date: 7/18/08 11:31a $ * * Module Description: * * Revision History: * * $brcm_Log: /nexus/examples/boot.c $ * * 2 7/18/08 11:31a jgarrett * PR 44953: Removing -Wstrict-prototypes warnings * *****************************************************************************/ #include "bsettop.h" #include "ministd.h" BDBG_MODULE(main); /* Register software module with debug interface */ #define B_MAX_FCC_NUM 3 int console_main(void *data) { bresult rc; btuner_t tuner; bdecode_t decode; bdisplay_t display; bdecode_window_t window; bgraphics_t graphics; btuner_qam_params qam; bstream_t stream[B_MAX_FCC_NUM]; bstream_mpeg mpeg[B_MAX_FCC_NUM]; bband_t band; bdisplay_settings display_settings; boutput_hdmi_t hdmi; bdecode_window_settings window_settings; int cnt = 0; int stream_idx = 0; bdecode_settings decode_settings; rc = bsettop_init(BSETTOP_VERSION); BDBG_ASSERT(rc == b_ok); tuner = btuner_open(bconfig->resources.qam.objects[0]); BDBG_ASSERT(tuner); decode = bdecode_open(B_ID(0)); BDBG_ASSERT(tuner); bdecode_get(decode, &decode_settings); decode_settings.stop_mode = bdecode_stop_mode_last_picture; bdecode_set(decode, &decode_settings); display = bdisplay_open(B_ID(0)); BDBG_ASSERT(display); bdisplay_get(display,&display_settings); display_settings.format = bvideo_format_1080i; display_settings.content_mode = bdisplay_content_mode_full; bdisplay_set(display,&display_settings); hdmi = boutput_hdmi_open(B_ID(0)); BDBG_ASSERT(hdmi); window = bdecode_window_open(B_ID(0), display); BDBG_ASSERT(window); bdecode_window_get(window,&window_settings); window_settings.visible = true; bdecode_window_set(window,&window_settings); graphics = bgraphics_open(B_ID(0),display); BDBG_ASSERT(graphics); btuner_qam_params_init(&qam, tuner); qam.symbol_rate = 5360537; qam.mode = 256; // to test AVC FCC using the test stream iceage_trasnap_trail3_trail4_1.ts #define TEST_AVC_FCC printf("Decoding from a QAM demod...\n"); #ifdef TEST_AVC_FCC //RLQ, my streamer's frequency */ band = btuner_tune_qam(tuner, 549000000, &qam); #else band = btuner_tune_qam(tuner, 549000000, &qam); #endif if (!band) goto error; #ifdef TEST_AVC_FCC printf("Configure AVC programs...\n"); /* Open 3 streams to start processing three channels in the multiplex */ bstream_mpeg_init(&(mpeg[0])); mpeg[0].video[0].pid = 0x1011; mpeg[0].video[0].format = bvideo_codec_h264; mpeg[0].audio[0].pid = 0x1012; mpeg[0].audio[0].format = baudio_format_ac3; mpeg[0].pcr_pid = 0x1011; stream[0] = bstream_open(band, &(mpeg[0])); if (!stream[0]) goto error; bstream_mpeg_init(&(mpeg[1])); mpeg[1].video[0].pid = 0x1021; mpeg[1].video[0].format = bvideo_codec_h264; mpeg[1].audio[0].pid = 0x1022; mpeg[1].audio[0].format = baudio_format_ac3; mpeg[1].pcr_pid = 0x1021; stream[1] = bstream_open(band, &(mpeg[1])); if (!stream[1]) goto error; bstream_mpeg_init(&(mpeg[2])); mpeg[2].video[0].pid = 0x1031; mpeg[2].video[0].format = bvideo_codec_h264; mpeg[2].audio[0].pid = 0x1032; mpeg[2].audio[0].format = baudio_format_ac3; mpeg[2].pcr_pid = 0x1031; stream[2] = bstream_open(band, &(mpeg[2])); if (!stream[2]) goto error; #else /* Open 3 streams to start processing three channels in the multiplex */ bstream_mpeg_init(&(mpeg[0])); mpeg[0].video[0].pid = 49; mpeg[0].video[0].format = bvideo_codec_mpeg2; mpeg[0].audio[0].pid = 52; mpeg[0].audio[0].format = baudio_format_ac3; mpeg[0].pcr_pid = 49; stream[0] = bstream_open(band, &(mpeg[0])); if (!stream[0]) goto error; bstream_mpeg_init(&(mpeg[1])); mpeg[1].video[0].pid = 17; mpeg[1].video[0].format = bvideo_codec_mpeg2; mpeg[1].audio[0].pid = 20; mpeg[1].audio[0].format = baudio_format_ac3; mpeg[1].pcr_pid = 17; stream[1] = bstream_open(band, &(mpeg[1])); if (!stream[1]) goto error; bstream_mpeg_init(&(mpeg[2])); mpeg[2].video[0].pid = 33; mpeg[2].video[0].format = bvideo_codec_mpeg2; mpeg[2].audio[0].pid = 36; mpeg[2].audio[0].format = baudio_format_ac3; mpeg[2].pcr_pid = 33; stream[2] = bstream_open(band, &(mpeg[2])); if (!stream[2]) goto error; #endif #if 0 /* JPF Need to set this after bdecode_start to get nexus to call VDC API so this does work*/ bdisplay_get(display,&display_settings); display_settings.format = bvideo_format_1080i; display_settings.aspect_ratio = bdisplay_aspect_ratio_16x9; display_settings.content_mode = bdisplay_content_mode_box; bdisplay_set(display,&display_settings); #endif BKNI_Sleep(100); /* Switch between streams */ for (;;) { printf("\nStart Decode (%d,%d,%d)- %s\n",mpeg[stream_idx].video[0].pid,mpeg[stream_idx].audio[0].pid,mpeg[stream_idx].pcr_pid,__DATE__); if (bdecode_start(decode, stream[stream_idx], window)) goto error; if (cnt == 0) { cnt++; /* JPF Need to set this after bdecode_start to get nexus to call VDC API so this doesn't work*/ bdisplay_get(display,&display_settings); display_settings.format = bvideo_format_1080i; display_settings.aspect_ratio = bdisplay_aspect_ratio_16x9; display_settings.content_mode = bdisplay_content_mode_box; bdisplay_set(display,&display_settings); } stream_idx++; if (stream_idx >= B_MAX_FCC_NUM) { stream_idx = 0; } printf("Press enter to switch decoded streams to stream %d: ",stream_idx); getchar(); /* press enter to stop decode */ bdecode_stop(decode); } return 0; error: return 1; }