source: svn/trunk/newcon3bcm2_21bu/dta/src/boot_settop.c @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 7.8 KB
Line 
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 "bsettop.h"
53#include "ministd.h"
54
55
56
57BDBG_MODULE(main);              /* Register software module with debug interface */
58#define B_MAX_FCC_NUM   3
59int console_main(void *data)
60{
61        bresult rc;
62        btuner_t tuner;
63        bdecode_t decode;
64        bdisplay_t display;
65        bdecode_window_t window;
66        bgraphics_t graphics;
67        btuner_qam_params qam;
68        bstream_t stream[B_MAX_FCC_NUM];
69        bstream_mpeg mpeg[B_MAX_FCC_NUM];
70        bband_t band;
71        bdisplay_settings display_settings;
72        boutput_hdmi_t hdmi;
73        bdecode_window_settings window_settings;
74        int cnt = 0;
75        int stream_idx = 0;
76        bdecode_settings decode_settings;
77
78        rc = bsettop_init(BSETTOP_VERSION);
79        BDBG_ASSERT(rc == b_ok);
80       
81        tuner = btuner_open(bconfig->resources.qam.objects[0]);
82        BDBG_ASSERT(tuner);
83
84        decode = bdecode_open(B_ID(0));
85        BDBG_ASSERT(tuner);
86        bdecode_get(decode, &decode_settings);
87        decode_settings.stop_mode = bdecode_stop_mode_last_picture;
88        bdecode_set(decode, &decode_settings);
89       
90        display = bdisplay_open(B_ID(0));
91        BDBG_ASSERT(display);
92        bdisplay_get(display,&display_settings);
93        display_settings.format = bvideo_format_1080i;
94        display_settings.content_mode = bdisplay_content_mode_full;
95        bdisplay_set(display,&display_settings);
96       
97        hdmi = boutput_hdmi_open(B_ID(0));
98        BDBG_ASSERT(hdmi);
99
100        window = bdecode_window_open(B_ID(0), display);
101        BDBG_ASSERT(window);
102       
103        bdecode_window_get(window,&window_settings);
104        window_settings.visible = true;
105        bdecode_window_set(window,&window_settings);
106
107        graphics = bgraphics_open(B_ID(0),display);
108        BDBG_ASSERT(graphics);
109
110        btuner_qam_params_init(&qam, tuner);
111        qam.symbol_rate = 5360537;
112        qam.mode = 256;
113
114// to test AVC FCC using the test stream iceage_trasnap_trail3_trail4_1.ts
115#define TEST_AVC_FCC
116
117        printf("Decoding from a QAM demod...\n");
118#ifdef TEST_AVC_FCC
119        //RLQ, my streamer's frequency */
120        band = btuner_tune_qam(tuner, 549000000, &qam);
121#else
122        band = btuner_tune_qam(tuner, 549000000, &qam);
123#endif
124
125        if (!band) goto error;
126
127#ifdef TEST_AVC_FCC
128        printf("Configure AVC programs...\n");
129        /* Open 3 streams to start processing three channels in the multiplex */
130        bstream_mpeg_init(&(mpeg[0]));
131        mpeg[0].video[0].pid = 0x1011;
132        mpeg[0].video[0].format = bvideo_codec_h264;
133        mpeg[0].audio[0].pid = 0x1012;
134        mpeg[0].audio[0].format = baudio_format_ac3;
135        mpeg[0].pcr_pid = 0x1011;
136        stream[0] = bstream_open(band, &(mpeg[0]));
137        if (!stream[0]) goto error;
138
139        bstream_mpeg_init(&(mpeg[1]));
140        mpeg[1].video[0].pid = 0x1021;
141        mpeg[1].video[0].format = bvideo_codec_h264;
142        mpeg[1].audio[0].pid = 0x1022;
143        mpeg[1].audio[0].format = baudio_format_ac3;
144        mpeg[1].pcr_pid = 0x1021;
145        stream[1] = bstream_open(band, &(mpeg[1]));
146        if (!stream[1]) goto error;
147
148        bstream_mpeg_init(&(mpeg[2]));
149        mpeg[2].video[0].pid = 0x1031;
150        mpeg[2].video[0].format = bvideo_codec_h264;
151        mpeg[2].audio[0].pid = 0x1032;
152        mpeg[2].audio[0].format = baudio_format_ac3;
153        mpeg[2].pcr_pid = 0x1031;
154        stream[2] = bstream_open(band, &(mpeg[2]));
155        if (!stream[2]) goto error;
156
157#else
158        /* Open 3 streams to start processing three channels in the multiplex */
159        bstream_mpeg_init(&(mpeg[0]));
160        mpeg[0].video[0].pid = 49;
161        mpeg[0].video[0].format = bvideo_codec_mpeg2;
162        mpeg[0].audio[0].pid = 52;
163        mpeg[0].audio[0].format = baudio_format_ac3;
164        mpeg[0].pcr_pid = 49;
165        stream[0] = bstream_open(band, &(mpeg[0]));
166        if (!stream[0]) goto error;
167
168        bstream_mpeg_init(&(mpeg[1]));
169        mpeg[1].video[0].pid = 17;
170        mpeg[1].video[0].format = bvideo_codec_mpeg2;
171        mpeg[1].audio[0].pid = 20;
172        mpeg[1].audio[0].format = baudio_format_ac3;
173        mpeg[1].pcr_pid = 17;
174        stream[1] = bstream_open(band, &(mpeg[1]));
175        if (!stream[1]) goto error;
176
177        bstream_mpeg_init(&(mpeg[2]));
178        mpeg[2].video[0].pid = 33;
179        mpeg[2].video[0].format = bvideo_codec_mpeg2;
180        mpeg[2].audio[0].pid = 36;
181        mpeg[2].audio[0].format = baudio_format_ac3;
182        mpeg[2].pcr_pid = 33;
183        stream[2] = bstream_open(band, &(mpeg[2]));
184        if (!stream[2]) goto error;
185#endif
186
187#if 0
188        /* JPF Need to set this after bdecode_start to get nexus to call VDC API  so this does work*/
189        bdisplay_get(display,&display_settings);
190        display_settings.format = bvideo_format_1080i;
191        display_settings.aspect_ratio = bdisplay_aspect_ratio_16x9;
192        display_settings.content_mode = bdisplay_content_mode_box;
193        bdisplay_set(display,&display_settings);
194#endif
195        BKNI_Sleep(100);
196
197        /* Switch between streams */
198        for (;;)
199        {
200                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__);
201                if (bdecode_start(decode, stream[stream_idx], window))
202                        goto error;
203
204                if (cnt == 0)
205                {
206                        cnt++;
207                        /* JPF Need to set this after bdecode_start to get nexus to call VDC API  so this doesn't work*/
208                        bdisplay_get(display,&display_settings);
209                        display_settings.format = bvideo_format_1080i;
210                        display_settings.aspect_ratio = bdisplay_aspect_ratio_16x9;
211                        display_settings.content_mode = bdisplay_content_mode_box;
212                        bdisplay_set(display,&display_settings);
213                }
214
215                stream_idx++;
216                if (stream_idx >= B_MAX_FCC_NUM)
217                {
218                        stream_idx = 0;
219                }
220                printf("Press enter to switch decoded streams to stream %d: ",stream_idx);
221                getchar(); /* press enter to stop decode */
222                bdecode_stop(decode);
223        }
224        return 0;
225error:
226        return 1;
227
228}
Note: See TracBrowser for help on using the repository browser.