source: svn/newcon3bcm2_21bu/BSEAV/api/src/nexus/bsettop_impl.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 38.1 KB
Line 
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_impl.h $
11 * $brcm_Revision: 136 $
12 * $brcm_Date: 7/14/10 12:01p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /BSEAV/api/src/nexus/bsettop_impl.h $
19 *
20 * 136   7/14/10 12:01p erickson
21 * SW7405-4621: change to nexus_base_os.h
22 *
23 * 135   6/10/10 4:57p erickson
24 * SWDEPRECATED-2726: implement bsettop_fileio_fifo
25 *
26 * 134   3/19/10 5:59p jgarrett
27 * SW7405-4040: Ensuring audio and video are on the same timebase
28 *
29 * 133   2/3/10 10:48a jgarrett
30 * SW7405-3858: Handling recursive audio display disable calls
31 *
32 * 132   1/28/10 4:24p mward
33 * SW7400-2650:  DTS passthru support for 7400.  Passthru only, no decode.
34 *
35 * 131   1/26/10 6:02p jgarrett
36 * SW7405-3635: Allowing fixed audio decode->display mapping to avoid re-
37 * attaching outputs on every bdecode_stop/bdecode_start
38 *
39 * 130   1/19/10 7:21p nitinb
40 * SW7550-193: Merge to main branch
41 *
42 * SW7550-193/1   1/19/10 3:42p chengli
43 * SW7550-193 : change #define B_N_SPDIF_OUTPUTS  1 to #define
44 * B_N_SPDIF_OUTPUTS NEXUS_NUM_SPDIF_OUTPUTS
45 *
46 * 129   12/11/09 4:30p mphillip
47 * SW7550-112: Merge 7550 changes to main branch
48 *
49 * 128   12/9/09 12:03p gmohile
50 * SW7408-1 : Add 7408 support
51 *
52 * 127   12/4/09 9:53p randyjew
53 * SW7468-6: Add 7468 support
54 *
55 * 126   12/3/09 2:45p jgarrett
56 * SW7405-3511: Adding compressed mute for outputs
57 *
58 * 125   12/2/09 7:32p katrep
59 * SW7405-3158:support for DTS certification app
60 *
61 * 124   11/19/09 8:02p jgarrett
62 * SW7405-3357: Adding audio output routing for decode and pcm playback
63 * prior to start
64 *
65 * 123   11/10/09 5:55p mward
66 * SW7400-2574: HD/SD sharpness optimizations incorporated in VDC,
67 * NEXUS_PictureCtrl_SetSharpnessValue() is no longer needed for simple
68 * sharpness setting.
69 *
70 * 122   11/10/09 4:59p mward
71 * SW7400-2574: When using the  NEXUS_PictureCtrl_SetSharpnessValue(), the
72 * quantity of sharpness must be set using lumaControlGain and
73 * chromaControlGain, the nPictureCtrlCommonSettings.sharpness is ignored
74 * by BVDC_Window_SetSharpness.
75 *
76 * 121   11/5/09 10:40a gmohile
77 * SW7408-1 : Add 7408 support
78 *
79 * SW7405-3158/1   10/7/09 7:03p mward
80 * SW7405-3158: Remember audio decoder start settings for restart which
81 * may be necessary changing DTS decoder settings. Extern audio decoder
82 * structure for test command access.
83 *
84 * 120   9/23/09 5:36p ahulse
85 * SW7405-2724: Switch MAD off when in playback pause to allow accurate
86 * frame stepping
87 *
88 * 119   9/11/09 10:05a jtna
89 * SWDEPRECATED-3910: add bdecode.primerStart
90 *
91 * 118   9/4/09 12:46p erickson
92 * SW7405-2885: add more extern's
93 *
94 * 117   8/25/09 12:51p jtna
95 * SWDEPRECATED-3910: video primer fast channel change feature
96 *
97 * 116   8/25/09 11:24a katrep
98 * SW7405-2934:add suppoort for audio capture to a file
99 *
100 * 115   8/20/09 6:46p mward
101 * PR55545: Adding 7125 platforms.
102 *
103 * 115   8/20/09 6:44p mward
104 * PR55545: Adding 7125 platforms.
105 *
106 * 114   8/19/09 11:34a mphillip
107 * PR57626: Add zorder support to shim
108 *
109 * 113   8/19/09 10:00a erickson
110 * PR55994: add missing #include
111 *
112 * 112   8/18/09 6:38p katrep
113 * PR56109: Use calllbacks instead of using events for callbacks to the
114 * app.
115 *
116 * 111   8/14/09 3:11p erickson
117 * PR55994: add missing #include
118 *
119 * 110   8/14/09 2:09p jrubio
120 * PR55232: add 7340/7342
121 *
122 * 109   7/31/09 5:25p gmohile
123 * PR 56512 : Add 7403 support
124 *
125 * 108   7/28/09 11:05a lwhite
126 * PR55693: Added DTCP/IP intialization
127 *
128 * 107   6/15/09 4:58p jtna
129 * PR43001: add support for TTS+encryption record/playback
130 *
131 * 106   6/5/09 2:06p vishk
132 * PR 55748: (NEXUS) Clipping problem with bsettop Nexus shim
133 *
134 * 105   4/27/09 8:50a katrep
135 * PR54586: astm support
136 *
137 * 104   4/15/09 3:39p jgarrett
138 * PR 53551: Adding non-os define
139 *
140 * 103   3/20/09 1:09p katrep
141 * PR52340: Support srs true volume and dolby volume through brutus ans
142 * settop api
143 *
144 * 102   3/4/09 7:47p jgarrett
145 * PR 52269: Adding XMP support
146 *
147 * 101   3/2/09 6:10p katrep
148 * PR52340: Add support srs_true_volume
149 *
150 * 100   2/26/09 2:53p erickson
151 * PR49584: add a dma-based memory bandwidth stress test feature
152 *
153 * 99   2/25/09 6:44p katrep
154 * PR52099: For decoder trickmodes need to mute audio outside of nexus
155 *
156 * Trinity_Xmp_Support/1   2/24/09 11:30a prasadv
157 * Add XMP support into user io. code cleanup
158 *
159 * 98   2/23/09 5:00p vle
160 * PR48785: Add cec support to shim layer
161 *
162 * 97   2/4/09 10:23a jrubio
163 * PR51629: add 7336 support
164 *
165 * 96   1/8/09 12:21p katrep
166 * PR50063: Add suppport dor Ac3 encode in Settop shim and burtus.
167 *
168 * 95   12/24/08 12:39p jgarrett
169 * PR 50703: Allowing for security module to be absesnt
170 *
171 * 94   12/16/08 6:58a erickson
172 * PR50222: remove #if B_HAS_IP
173 *
174 * 93   12/14/08 6:58p nickh
175 * PR50205: Adding 7420 support
176 *
177 * 92   11/6/08 8:38p katrep
178 * PR47230: reworked output port timebase logic
179 *
180 * 91   10/31/08 12:30p jjordan
181 * PR47230: Add TTS Pacing
182 *
183 * PR47230/1   10/28/08 10:37a jjordan
184 * PR47230: Port TTS Pacing to Nexus
185 *
186 * 90   9/17/08 6:20p katrep
187 * PR47061: Add support for DTS encode
188 *
189 * 89   9/15/08 5:31p jrubio
190 * PR46925:  fix PVR_SUPPORT=n compile issue
191 *
192 * 88   9/11/08 12:38p shyam
193 * PR46778 : Add support for AAC audio encode from I2S
194 *
195 * 87   9/2/08 7:44p katrep
196 * PR46457: Configure settop at run time, based on resources exposed by
197 * nexus platfrom.
198 *
199 * 86   8/22/08 7:49p erickson
200 * PR45959: StillDecoder is now normal part of VideoDecoder module
201 *
202 * 85   7/28/08 10:04a erickson
203 * PR43490: fix non-656/i2s platforms
204 *
205 * 84   7/22/08 2:59p erickson
206 * PR44874: allow static allocation of bstream for playback. this is
207 * required to support bstream_close after a bplayback_stop.
208 *
209 * 83   7/17/08 4:40p shyam
210 * PR43426 : Add 7043 656 Encode support
211 *
212 * 82   7/16/08 11:19a erickson
213 * PR44853: clean up -Wstrict-prototypes warnings
214 *
215 * 81   7/10/08 10:21p ssood
216 * PR42739: Adding support to absorb high jitter for Live IP Playback
217 *
218 * 80   7/9/08 4:10p katrep
219 * PR43490: Add support 656/i2s tuning using analog tune api.
220 *
221 * 79   7/3/08 6:09p erickson
222 * PR36068: impl vesa
223 *
224 * 78   7/2/08 5:10p vishk
225 * PR 40020: bsettop_stream (crypto, network decryption): Develop
226 * SettopAPI-to-Nexus shim layer
227 *
228 * 77   7/2/08 12:33p erickson
229 * PR36836: report has_index correctly
230 *
231 * 76   6/27/08 3:36p mphillip
232 * PR42901: Free PVR keyslot on close/stop
233 *
234 * 75   6/27/08 1:41p erickson
235 * PR44194: impl hold_last_picture in Settop API shim
236 *
237 * 74   6/27/08 9:30a erickson
238 * PR43653: add vesa support
239 *
240 * 73   6/26/08 6:21p mphillip
241 * PR42901: Encrypted PVR playback support
242 *
243 * 72   6/24/08 6:23p shyam
244 * PR43426 : Add 7043 Transcode support
245 *
246 * 73   6/24/08 7:29p ssood
247 * PR42739: Adding support to absorb high jitter for IPSTB
248 *
249 * 72   6/23/08 10:41a ssood
250 * PR42739: Adding support to absorb high jitter for IPSTB
251 *
252 * 71   6/18/08 10:13p erickson
253 * PR36068: add DTV panel support to shim (use component api)
254 *
255 * 70   6/17/08 3:44p erickson
256 * PR43489: remove dups
257 *
258 * 69   6/11/08 7:26p ssood
259 * PR42739: added virtual interface back to the playback module to allow
260 * ip implementation in addition to the regular playback implementation
261 *
262 * 68   6/11/08 11:53a jgarrett
263 * PR 43489: Adding brutus support for 93549/93556
264 *
265 * 67   5/29/08 8:48a erickson
266 * PR39453: 3548/3556 updates
267 *
268 * 66   5/20/08 4:27p erickson
269 * PR40034: support platforms with no smartcard
270 *
271 * 65   5/16/08 7:21p vishk
272 * PR 40034: Develop Nexus Smartcard Interface/Module.
273 * PR 40016: bsettop_smartcard: Develop SettopAPI-to-Nexus shim layer
274 *
275 * 64   5/6/08 11:36a erickson
276 * PR42365: impl playback callbacks
277 *
278 * 63   5/1/08 6:03p jrubio
279 * PR42353: add 7335 support
280 * PR42353: add 7335 support
281 *
282 * 62   5/1/08 4:08p erickson
283 * PR42339: properly connect and disconnect timeshifting
284 *
285 * 61   4/24/08 3:32p jrubio
286 * PR42054: add sds2nexus
287 *
288 * 60   4/24/08 2:59p jgarrett
289 * PR 42122: adding display handle to spdif
290 *
291 * 59   4/18/08 9:18p katrep
292 * PR41950: Added support for bdecode_get_audio
293 *
294 * 58   4/13/08 9:58p katrep
295 * PR40824: Apply the VDC settings after all the window settings are
296 * programmed,updated debug.
297 *
298 * 57   4/10/08 6:43p jgarrett
299 * PR 41565: Adding audio starting flag
300 *
301 * 56   4/10/08 10:07a erickson
302 * PR36068: coverity fix
303 *
304 * 55   4/9/08 5:54p jgarrett
305 * PR 41567: Adding playback video pid
306 *
307 * 54   4/9/08 9:16a erickson
308 * PR36068: fix 93563
309 *
310 * 53   4/8/08 3:56p katrep
311 * PR41122: Add support more display menu items
312 *
313 * 52   4/8/08 11:21a jgarrett
314 * PR 40024: Changing volume function prototype
315 *
316 * 51   4/7/08 5:02p erickson
317 * PR40024: impl bdecode_display_surface
318 *
319 * 50   4/7/08 4:11p erickson
320 * PR40024: impl bdecode_read_metadata
321 *
322 * 49   4/7/08 1:35p erickson
323 * PR40024: impl bdecode_set_audio_volume
324 *
325 * 48   4/7/08 10:40a jgarrett
326 * PR 41362: Revising pid channel management
327 *
328 * 47   4/4/08 10:43a jgarrett
329 * PR 41312: Synchronizing PVR
330 *
331 * 46   4/3/08 5:41p jgarrett
332 * PR 41312: Setting callback events
333 *
334 * 45   4/2/08 5:06p jgarrett
335 * PR 41233: Adding timer
336 *
337 * 44   4/2/08 3:50p jrubio
338 * PR41191: add uninit function for decode
339 *
340 * 43   4/1/08 6:02p katrep
341 * PR41191: Add various input/output shutdowns
342 *
343 * 42   3/31/08 6:04p jgarrett
344 * PR 40606: Adding display handle to hdmi
345 *
346 * 41   3/27/08 5:30p jrubio
347 * PR40919: add userio init and uninit calls
348 *
349 * 40   3/25/08 7:43p vsilyaev
350 * PR 40862: Use nexus configuration to set supported formats
351 *
352 * 39   3/25/08 12:52p erickson
353 * PR36068: added b_nexus2framerate
354 *
355 * 38   3/25/08 11:01a erickson
356 * PR36068: fix
357 *
358 * 37   3/25/08 10:55a katrep
359 * PR40839: Add support for HDMI capabilities
360 *
361 * 36   3/25/08 10:33a erickson
362 * PR36068: added analog tuner
363 *
364 * 35   3/25/08 10:13a jgarrett
365 * PR 40857: Adding thunk layer
366 *
367 * 34   3/21/08 8:39p katrep
368 * PR40824: Implemented support for PIP swapping.
369 *
370 * 33   3/19/08 9:23p erickson
371 * PR36068: convert bgraphics.surfaces to lst
372 *
373 * 32   3/19/08 3:10p jrubio
374 * PR40015: add hdmi video/audio support
375 *
376 * 31   3/19/08 1:23p erickson
377 * PR36068: fix non-StillDecoder platforms
378 *
379 * 30   3/18/08 4:03p erickson
380 * PR40307: implemented still decode
381 *
382 * 29   3/17/08 5:40p katrep
383 * PR40021:Proper indexing of tuners required to work with the bconfig
384 * interface
385 *
386 * 28   3/12/08 3:17p jgarrett
387 * PR 40017: Adding PCM support
388 *
389 * 27   3/11/08 4:58p jrubio
390 * PR40019: add pcr_status variable to bstream
391 *
392 * 26   3/11/08 11:10a erickson
393 * PR36068: impl vbi
394 *
395 * 25   3/10/08 5:51p erickson
396 * PR36068: added boutput_rf
397 *
398 * 24   3/10/08 4:55p katrep
399 * PR40019: Move the header files to bsettop_impl.h
400 *
401 * 23   3/6/08 4:23p jrubio
402 * PR40169: add 7325
403 *
404 * 22   3/4/08 5:54p jrubio
405 * PR40169: add 7325
406 *
407 * 21   2/25/08 9:23a erickson
408 * PR36068: impl more functions
409 *
410 * 20   1/2/08 9:55a erickson
411 * PR36068: Playback changes
412 *
413 * 19   12/20/07 10:28a erickson
414 * PR37590: add timeshifting
415 *
416 * 18   12/4/07 3:09p erickson
417 * PR36068: call NEXUS_PidChannel_Close
418 *
419 * 17   12/3/07 4:59p erickson
420 * PR36068: rework audio, defer playback start until after decode start
421 *
422 * 16   11/27/07 11:16p erickson
423 * PR36068: added g_settopModule to allow use of nexus timers
424 *
425 * 15   11/27/07 9:19a erickson
426 * PR37590: add 93563
427 *
428 * 14   11/19/07 1:21p erickson
429 * PR34925: rename demux to pid_channel
430 *
431 * 13   11/16/07 4:08p erickson
432 * PR36068: added #include
433 *
434 * 12   11/14/07 1:29p erickson
435 * PR36068: added record
436 *
437 * 11   11/13/07 11:58a erickson
438 * PR36068: trick modes working
439 *
440 * 10   11/13/07 10:25a erickson
441 * PR36068: check if video/audio started when stopping
442 *
443 * 9   11/12/07 3:57p erickson
444 * PR36068: update
445 *
446 * 8   11/12/07 2:34p erickson
447 * PR36068: update
448 *
449 * 7   11/2/07 1:25p erickson
450 * PR36633: update nexus enums
451 *
452 * 6   10/19/07 12:26p erickson
453 * PR36068: added blitter
454 *
455 * 5   10/17/07 9:45a erickson
456 * PR36068: there should be one bsurface_settings for framebuffers
457 *
458 * 4   10/16/07 2:30p erickson
459 * PR36068: added refcnt to parser_band for message filtering
460 *
461 * 3   10/16/07 12:35p erickson
462 * PR36068: brutus up over settop api/nexus
463 *
464 * 2   10/15/07 4:13p erickson
465 * PR36068: initial
466 *
467 * 1   10/15/07 2:36p erickson
468 * PR36068: initial
469 *
470 ***************************************************************************/
471#include "bstd.h"
472#include "bkni.h"
473#include "blst_list.h"
474#include "blst_queue.h"
475#ifndef BSETTOP_NO_API_THUNKS
476#include "bsettop_autogen_thunks.h"
477#endif
478#include "bsettop.h"
479#include "bsettop_os.h"
480
481#if BCHP_CHIP == 7401
482#include "bsettop_bsp_7401.h"
483#elif BCHP_CHIP == 7400
484#include "bsettop_bsp_7400.h"
485#elif BCHP_CHIP == 7405
486#include "bsettop_bsp_7405.h"
487#elif BCHP_CHIP == 7550
488#include "bsettop_bsp_7550.h"
489#elif BCHP_CHIP == 3563
490#include "bsettop_bsp_3563.h"
491#elif BCHP_CHIP == 3548
492#include "bsettop_bsp_3548.h"
493#elif BCHP_CHIP == 3556
494#include "bsettop_bsp_3556.h"
495#elif BCHP_CHIP == 7325
496#include "bsettop_bsp_7325.h"
497#elif BCHP_CHIP == 7335 || (BCHP_CHIP==7336)
498#include "bsettop_bsp_7335.h"
499#elif BCHP_CHIP == 7420
500#include "bsettop_bsp_7420.h"
501#elif BCHP_CHIP == 7403
502#include "bsettop_bsp_7403.h"
503#elif BCHP_CHIP == 7342
504#include "bsettop_bsp_7342.h"
505#elif BCHP_CHIP == 7340
506#include "bsettop_bsp_7340.h"
507#elif BCHP_CHIP == 7125
508#include "bsettop_bsp_7125.h"
509#elif BCHP_CHIP == 7408
510#include "bsettop_bsp_7408.h"
511#elif BCHP_CHIP == 7468
512#include "bsettop_bsp_7468.h"
513#endif
514#include "bsettop_fileio_fifo.h"
515
516#include "nexus_platform.h"
517#include "nexus_video_decoder.h"
518#include "nexus_video_decoder_primer.h"
519#include "nexus_video_image_input.h"
520#include "nexus_still_decoder.h"
521#if B_HAS_ANALOG
522#include "nexus_analog_video_decoder.h"
523#endif
524#include "nexus_audio_playback.h"
525#include "nexus_audio_decoder.h"
526#if NEXUS_NUM_AUDIO_CAPTURES
527#include "nexus_audio_capture.h"
528#endif
529#include "nexus_display.h"
530#if NEXUS_HAS_DMA
531#include "nexus_dma.h"
532#endif
533#include "nexus_video_window.h"
534#include "nexus_component_output.h"
535#include "nexus_composite_output.h"
536#include "nexus_svideo_output.h"
537#include "nexus_surface.h"
538#include "nexus_pid_channel.h"
539#include "nexus_playpump.h"
540#if NEXUS_HAS_PLAYBACK
541#include "nexus_playback.h"
542#endif
543#include "nexus_message.h"
544#include "nexus_stc_channel.h"
545#include "nexus_timebase.h"
546#include "nexus_audio_output.h"
547#include "nexus_audio_mixer.h"
548#include "nexus_audio_dac.h"
549#include "nexus_spdif_output.h"
550#include "nexus_i2s_output.h"
551#include "nexus_recpump.h"
552#include "nexus_audio_decoder_trick.h"
553#if NEXUS_HAS_RECORD
554#include "nexus_record.h"
555#include "nexus_file_fifo.h"
556#endif
557#include "nexus_parser_band.h"
558#include "nexus_video_input.h"
559#include "nexus_audio_input.h"
560#include "nexus_display_vbi.h"
561#include "nexus_video_adj.h"
562#include "nexus_picture_ctrl.h"
563#if NEXUS_HAS_FRONTEND
564#include "nexus_frontend.h"
565#endif
566#if B_HAS_EXTERNAL_ANALOG
567#include "nexus_ccir656_input.h"
568#include "nexus_i2s_input.h"
569#endif
570#include "nexus_video_input_crc.h"
571#if B_HAS_TRANSCODE
572#include "nexus_transcoder.h"
573#endif
574#if NEXUS_HAS_SMARTCARD
575#include "nexus_smartcard.h"
576#endif
577#if NEXUS_HAS_SYNC_CHANNEL
578#include "nexus_sync_channel.h"
579#endif
580#if NEXUS_HAS_ASTM
581#include "nexus_astm.h"
582#endif
583#if B_N_DVI_OUTPUTS
584#include "nexus_hdmi_output.h"
585#endif
586#if B_N_RF_OUTPUTS
587#include "nexus_rfm.h"
588#endif
589
590#if B_HAS_DTS_ENCODE
591#include "nexus_dts_encode.h"
592#endif
593
594#if B_HAS_AC3_ENCODE
595#include "nexus_ac3_encode.h"
596#endif
597
598#if B_HAS_SRS_TRUE_VOLUME
599#include "nexus_tru_volume.h"
600#endif
601
602#if B_HAS_DOLBY_VOLUME
603#include "nexus_dolby_volume.h"
604#endif
605
606#if NEXUS_HAS_SECURITY
607#include "nexus_security.h"
608#endif
609
610#ifndef _WIN32_WCE
611   #if !defined B_SYSTEM_linuxkernel && !defined B_SYSTEM_noos && !defined B_OS_UCOS_II
612     #include <sys/socket.h>
613     #include <netinet/in.h>
614     #include <arpa/inet.h>
615   #endif
616   #ifdef __vxworks
617     #include <sockLib.h>
618     #include <sysLib.h>
619#ifndef VXWORKS6
620     typedef int socklen_t;
621#endif
622       #endif
623#else
624       #include <winsock2.h>
625       #include <ws2tcpip.h>
626#endif
627
628#define BSETTOP_ERROR(err) (BDBG_ERR(("error: %d at %s: %d", err, __FILE__, __LINE__)), err)
629#define B_ID_GET_INDEX(id) (((int)(id))-1)
630
631#define B_N_SPDIF_OUTPUTS NEXUS_NUM_SPDIF_OUTPUTS
632#if BCHP_CHIP == 7325
633#define B_PVR_N_PLAYBACKS 2
634#else
635#define B_PVR_N_PLAYBACKS 4
636#endif
637
638#define BSETTOP_MAX_PIDS (BSETTOP_MAX_PROGRAMS*3+1) /* video, audio, other + pcr_pid */
639
640
641struct bvideo_decode {
642    NEXUS_VideoDecoderHandle nVideoDecoder;
643    NEXUS_VideoImageInputHandle nVideoImageInput;
644    NEXUS_PidChannelHandle nPidChannel;
645#if B_HAS_ANALOG
646    NEXUS_AnalogVideoDecoderHandle nAnalogVideoDecoder;
647#endif
648
649#if B_HAS_EXTERNAL_ANALOG
650    NEXUS_Ccir656InputHandle ccir656Input;
651#endif
652
653    bdecode_t decode;
654    bool started;
655    /* B_EventHandle sourceChangedEvent;
656    b_event_id_t sourceChangedEventId; */
657    b_calllback_id_t sourceChangedCallback;
658
659};
660
661struct baudio_decode {
662    NEXUS_AudioDecoderHandle nAudioDecoder;
663    NEXUS_PidChannelHandle nPidChannel;
664    NEXUS_PidChannelHandle nSecondaryPidChannel;
665    bdecode_t decode;
666    bdisplay_t display;
667    bool started;
668    bool busy;
669    /* B_EventHandle sourceChangedEvent;
670    b_event_id_t sourceChangedEventId; */
671    NEXUS_AudioDecoderStartSettings decoderStartSettings;
672    b_calllback_id_t sourceChangedCallback;
673    struct baudio_decode *secondary_audio_decode;    /* for secondary decoder this will be NULL */
674        NEXUS_AudioDecoderStartSettings restartSettings;
675#if B_HAS_EXTERNAL_ANALOG
676    NEXUS_I2sInputHandle i2sInput;
677#endif
678#if B_HAS_DTS_ENCODE
679    NEXUS_DtsEncodeHandle nDtsEncoder;
680#endif
681#if B_HAS_AC3_ENCODE
682    NEXUS_Ac3EncodeHandle nAc3Encoder;
683#endif
684#if B_HAS_SRS_TRUE_VOLUME
685    NEXUS_TruVolumeHandle nTrueVolume;
686#endif
687#if B_HAS_DOLBY_VOLUME
688    NEXUS_DolbyVolumeHandle nDolbyVolume;
689#endif
690#if NEXUS_NUM_AUDIO_CAPTURES
691    NEXUS_AudioCaptureHandle nAudioCapture;
692#endif
693#if (BCHP_CHIP==7400)
694        bool spdif_forced_compressed;
695        bool hdmi_forced_compressed;
696#endif
697};
698
699typedef enum {
700    BDECODE_STC_CHANNEL_CFG_TYPE_PARSER_BAND,
701    BDECODE_STC_CHANNEL_CFG_TYPE_TTS_PACING,
702    BDECODE_STC_CHANNEL_CFG_TYPE_PCR_PACING,
703    BDECODE_STC_CHANNEL_CFG_TYPE_IP_LIVE_PB,
704    BDECODE_STC_CHANNEL_CFG_TYPE_PVR_PB
705} bdecode_stc_channel_cfg_type;
706
707struct bdecode {
708    bvideo_decode_t video_decode; /* attached = !NULL */
709    baudio_decode_t audio_decode; /* attached = !NULL */
710    NEXUS_StcChannelHandle stcChannel;
711    bdecode_stc_channel_cfg_type cfg_type;
712    NEXUS_Timebase output_timebase;         /* timebase for outputs connected to this decoder */
713    NEXUS_PidChannelHandle pcrPidChannel;
714    bdecode_settings settings;
715
716    /* still decode */
717    NEXUS_StillDecoderHandle nStillDecoder;
718    NEXUS_PidChannelHandle nStillDecoderPid;
719    bstream_t stillStream;
720    /*B_EventHandle stillEvent;
721    b_event_id_t stillEventId;*/
722    b_calllback_id_t stillEventCallback;
723
724    unsigned video_program, audio_program;
725    bool started;
726    bool image_input_started;
727    bool tsm;
728    bool audio_disabled;
729    bdecode_window_t window; /* current decode */
730    bstream_t source; /* current decode */
731    baudio_volume volume;
732    NEXUS_VideoDecoderStartSettings primerStart;
733#if NEXUS_HAS_SYNC_CHANNEL
734    NEXUS_SyncChannelHandle nSyncChannel;    /* Nexus Sync channel associated with each decode */
735#endif
736#if NEXUS_HAS_ASTM
737    NEXUS_AstmHandle nAstm;
738#endif
739
740#if B_DECODE_CRC_CAPTURE || B_DECODE_USERDATA_CAPTURE
741    struct {
742/* for a convenient impl, make B_DECODE_CRC_CAPTURE_SIZE a multiple of the crc atom (which is 20 bytes) */
743#define B_DECODE_METADATA_CAPTURE_SIZE 8000
744        uint32_t data[B_DECODE_METADATA_CAPTURE_SIZE];
745        unsigned wptr, rptr;
746    } metadata;
747#endif
748};
749
750struct btuner_linein {
751    /* can be only one at a time */
752#if B_HAS_ANALOG
753    NEXUS_CompositeInputHandle composite;
754    NEXUS_ComponentInputHandle component;
755    NEXUS_SvideoInputHandle svideo;
756#else
757    int dummy;
758#endif
759
760#ifdef B_HAS_TRANSCODE
761    unsigned int vdec7043DeviceNo ;
762#endif
763
764};
765
766
767
768#if B_HAS_TRANSCODE
769struct btranscode
770{
771    NEXUS_Transcoder_OutputPortHandle hPortHandle ;
772    NEXUS_TranscoderHandle nexus_transcoder ;
773    btranscode_settings settings ;
774    NEXUS_RemuxHandle rmx[B_MAX_REMUXES];
775
776} ;
777
778struct bencode
779{
780    NEXUS_Transcoder_OutputPortHandle hPortHandle ;
781    NEXUS_TranscoderHandle nexus_encoder ;
782    NEXUS_TranscoderHandle nexus_audEncoder ;
783    bencode_settings settings ;
784} ;
785
786#endif
787
788struct boutput_rf {
789#if B_N_RF_OUTPUTS
790    NEXUS_RfmHandle handle;
791#endif
792    bdisplay_t master_display;
793    boutput_rf_settings desired, cfg;
794};
795
796struct boutput_hdmi {
797#if B_N_DVI_OUTPUTS
798    NEXUS_HdmiOutputHandle handle;
799#endif
800    bool connected;
801    bool compressed_mute;
802    bdisplay_t display;
803    boutput_hdmi_settings desired, cfg;
804    b_timer_t hdcpTimer;
805    b_calllback_id_t hotplugCallback;
806    b_calllback_id_t disconnectCalllback;
807    b_calllback_id_t hdcpCallback;
808    b_calllback_id_t cecCalllback;
809    B_EventHandle event;
810    b_event_id_t eventId;
811    B_EventHandle hdcpEvent;
812    b_event_id_t hdcpEventId;
813#if 0
814    B_EventHandle cecEvent;
815    b_event_id_t cecEventId;
816#endif
817};
818
819struct boutput_svideo {
820    NEXUS_SvideoOutputHandle handle;
821};
822
823struct boutput_component {
824    NEXUS_ComponentOutputHandle handle;
825    boutput_component_settings desired, cfg;
826    NEXUS_VideoOutput videoOutput;
827#if NEXUS_NUM_PANEL_OUTPUTS
828    NEXUS_PanelOutputHandle panelHandle;
829#endif
830};
831
832struct boutput_composite {
833    NEXUS_CompositeOutputHandle handle;
834};
835
836struct boutput_spdif {
837    NEXUS_SpdifOutputHandle handle;
838    bdisplay_t display;
839    boutput_spdif_settings desired, cfg;
840    baudio_volume volume;
841    bool compressed_mute;
842};
843
844struct boutput_audio_dac {
845    NEXUS_AudioDacHandle handle;
846};
847
848struct boutput_i2s {
849    NEXUS_I2sOutputHandle handle;
850};
851
852struct bdecode_window {
853    bdecode_window_settings settings;
854    NEXUS_VideoWindowHandle nWindow;
855    NEXUS_VideoInput currentVideoInput; /* which input is currently connected */
856    bdisplay_t display;
857    bdecode_window_t parent; /* clone parent */
858    bdecode_window_t clone; /* clone child */
859    bdecode_t decode;
860        bool playbackDeinterlacer;  /* true to turn off deinterlacer in playback pause */
861        int16_t sharpness;
862};
863
864struct zorder_item {
865    bdecode_window_t window;
866    unsigned zorder;
867};
868
869BDBG_OBJECT_ID_DECLARE(bpcm_play);
870typedef struct bpcm_play
871{
872    BDBG_OBJECT(bpcm_play)
873    bool opened;
874    bool disabled;
875    NEXUS_AudioPlaybackHandle nPlayback;
876    NEXUS_AudioPlaybackStartSettings nSettings;
877    bdisplay_t display;
878    B_EventHandle event;
879    b_event_id_t eventId;
880    bsettop_callback callback;
881    void *context;
882    bpcm_play_output_settings output_settings;
883} bpcm_play;
884
885BDBG_OBJECT_ID_DECLARE(bdisplay);
886struct bdisplay {
887    BDBG_OBJECT(bdisplay)
888    unsigned index;
889    bgraphics_t graphics;
890    bdisplay_settings settings;
891    struct bdecode_window window[B_N_WINDOWS];
892    unsigned  numWindowsSupported;
893
894    baudio_volume volume; /* DAC */
895    bool cgms_enabled, wss_enabled;
896
897    NEXUS_DisplayHandle nDisplay;
898    NEXUS_AudioMixerHandle nAudioMixer;
899    unsigned mixerInputsStarted;
900    unsigned audioDisableCount;
901    struct {
902        NEXUS_AudioDacHandle handle;
903    } audioDac;
904    /* mapping from virtual to physical (slot number) z-order */
905    struct zorder_item zorderList[B_N_WINDOWS]; /* number of windows */
906    bdecode_t masterDecode;
907    unsigned outputTimebase;
908};
909
910/* bparser_band is an internal structure */
911struct bparser_band {
912    bband_t band; /* current input band mapped to this parser band */
913    int refcnt; /* number of bstream_t's open on this parser band. */
914
915    NEXUS_ParserBand nParserBand;
916};
917
918/*
919* Maintain Conditional Access state inside the stream, necessary with HSM-related changes.
920* See bstream_set_encryption for the use of these variables.
921*/
922typedef struct b_ca_state {
923    uint16_t video_odd_key_config;
924    uint16_t video_even_key_config;
925    uint16_t audio_odd_key_config;
926    uint16_t audio_even_key_config;
927} b_ca_state;
928
929typedef struct b_ca_state *b_ca_state_t;
930
931typedef struct bsettop_p_fcc_t
932{
933        NEXUS_VideoDecoderHandle videoDecoder;
934        NEXUS_PidChannelHandle videoPidChannel;
935        NEXUS_PidChannelHandle pcrPidChannel;
936        NEXUS_PidChannelHandle audioPidChannel;
937        NEXUS_StcChannelHandle stcChannel;
938        NEXUS_VideoDecoderPrimerHandle primerHandle;
939        NEXUS_VideoDecoderStartSettings decodeSettings;
940        int index;
941}bsettop_p_fcc_t;
942
943BDBG_OBJECT_ID_DECLARE(bstream);
944struct bstream {
945    BDBG_OBJECT(bstream)
946    struct {
947        /* should be only one at a time */
948        bband_t band; /* live digital */
949        btuner_t tuner; /* live analog */
950        btuner_linein_t linein; /* live linein analog */
951        bplaypump_t playpump; /* pvr */
952        bplayback_t playback; /* pvr */
953#ifdef B_HAS_IP
954        bool is_playback_ip; /* true if stream is IP playback, false otherwise */
955        bool use_live_playback_mode; /* live playback operates like a live decode, but uses playback to send data to the decoders */
956        bool timestamp_active; /* use timestamps to dynamically control playback rate (pacing) */
957        bool timestamp_enabled;
958#endif
959                bsettop_p_fcc_t fcc;
960    } producer;
961    struct {
962        /* can be many at the same time */
963        bdecode_t decode, still;
964        brecpump_t recpump;
965        brecord_t record;
966        BLST_Q_HEAD(message_list, bmessage_struct) messageList;
967        /* TODO: Remux? */
968    } consumers;
969    b_ca_state ca_state;
970    bstream_pcr_status pcr_status;
971    bstream_mpeg mpeg;
972    struct bparser_band *parser_band;
973    bstream_vbi_settings vbi_settings;
974    b_timer_t cc_data_ready_timer;
975    NEXUS_PidChannelHandle nIndexPid;
976    bool static_alloc; /* set true if bstream_close should not dealloc the bstream */
977    bool video_primer;
978    struct {
979        uint16_t pid;
980        unsigned pidchannel;
981        NEXUS_KeySlotHandle KeySlotHandle;
982    } pids[BSETTOP_MAX_PIDS];
983};
984
985
986struct bband {
987    NEXUS_InputBand nInputBand;
988    bstream_mpeg_type mpeg_type;
989    btuner_t tuner;
990};
991#if NEXUS_NUM_INPUT_BANDS
992extern struct bband g_bands[B_MAX_INPUTS];
993#endif
994
995BDBG_OBJECT_ID_DECLARE(bmessage);
996struct bmessage_struct {
997    BDBG_OBJECT(bmessage)
998    NEXUS_MessageHandle nMessage;
999    NEXUS_PidChannelHandle nPidChannel;
1000    bmessage_stream_params params;
1001    bmessage_format format;
1002    bstream_t stream;
1003    /*B_EventHandle dataEvent;
1004    b_event_id_t dataEventId;*/
1005    b_calllback_id_t dataCallback;
1006    BLST_Q_ENTRY(bmessage_struct) streamNode;
1007};
1008
1009#if NEXUS_HAS_DMA
1010struct bdma {
1011    NEXUS_DmaHandle hDma;
1012};
1013extern struct bdma g_dma;
1014#endif
1015
1016BDBG_OBJECT_ID_DECLARE(bplaypump);
1017
1018struct bplaypump {
1019    BDBG_OBJECT(bplaypump)
1020    NEXUS_PlaypumpHandle nPlaypump;
1021    unsigned index;
1022    bplaypump_params params;
1023    bplaypump_settings settings;
1024    bstream_t stream;
1025    bplaypump_state state;
1026    bool forward;
1027    unsigned rate;
1028    B_EventHandle event;
1029    b_event_id_t eventId;
1030
1031    NEXUS_KeySlotHandle hKeySlot;
1032};
1033
1034
1035#if NEXUS_HAS_PLAYBACK
1036/* VMT (interface) table for a playback implementations, this interface shall be first member of the playback context(state) */
1037typedef struct {
1038    /* bool synchronized;  */ /* if true interface would call implmentation within b_lock/b_unlock brackets */
1039    /* documentation for methods could be found in the bsettop_pvr.h file */
1040    void (*params_init)(bplayback_params *params, bplayback_t playback);
1041    bstream_t (*start)(bplayback_t playback, bplaypump_t playpump, const bstream_mpeg *mpeg, bplayback_file_t source, const bplayback_params *params);
1042    bstream_t (*start_timeshifting)(bplayback_t playback, bplaypump_t playpump, const bstream_mpeg *mpeg, bplayback_file_t source,  const bplayback_params *params, brecord_t record );
1043    bresult (*stop_timeshifting)(bplayback_t playback);
1044    bresult (*stop)(bplayback_t playback);
1045    bresult (*get_status)(bplayback_t p, bplayback_status *status);
1046    bresult (*pause)(bplayback_t p);
1047    bresult (*catchup_record)(bplayback_t p);
1048    bresult (*play)(bplayback_t p);
1049    bresult (*frameadvance)(bplayback_t p, bplayback_player_mode playermode,    bool forward);
1050    bresult (*trickmode)(bplayback_t p, const bplayback_trickmode_params *trickmode);
1051    bresult (*get_trickmode_by_rate)(bplayback_t p, int rate, bplayback_trickmode_params *trickmode);
1052    long (*goto_index)(bplayback_t p, long index_offset, int whence);
1053    long (*goto_timestamp)(bplayback_t p, long timestamp, int whence);
1054    off_t (*goto_mpeg_file_offset)(bplayback_t p, off_t mpeg_file_offset, int whence);
1055    void (*close)(bplayback_t p);
1056}bplayback_iface;
1057
1058/* typedef struct bplayback_iface bplayback_iface_t;*/
1059void bplayback_iface_init(bplayback_iface *iface);
1060
1061struct bplayback {
1062    bplayback_iface iface; /* bplayback_iface shall be the first member in the structure */
1063    NEXUS_PlaybackHandle nPlayback;
1064    bplayback_trickmode_params trick_mode_params;
1065
1066    bplayback_params params;
1067    bstream_t stream;    /* this is set if playback is started */
1068    bstream_t stream_alloc; /* this is set at open time managing the "static" alloc of bplayback's bstream */
1069    bplayback_file_t source;
1070    brecord_t record;
1071
1072    B_EventHandle end_of_stream_event, beginning_of_stream_event, error_event;
1073    b_event_id_t end_of_stream_event_id, beginning_of_stream_event_id, error_event_id;
1074
1075    NEXUS_KeySlotHandle hKeySlot;
1076};
1077
1078struct bplayback_file {
1079    NEXUS_FilePlayHandle nFile;
1080    bool has_index;
1081    struct {
1082        int                     fd;
1083        struct sockaddr_in      local_addr;
1084        struct sockaddr_in      remote_addr;
1085        struct hostent *        he;
1086        socklen_t               addr_len;
1087    } socket;
1088};
1089#endif
1090
1091BDBG_OBJECT_ID_DECLARE(brecpump);
1092
1093struct brecpump {
1094    BDBG_OBJECT(brecpump)
1095    NEXUS_RecpumpHandle nRecpump;
1096    bstream_t stream;
1097    brecpump_params params;
1098    B_EventHandle dataEvent, indexEvent, overflowEvent;
1099    b_event_id_t dataEventId, indexEventId, overflowEventId;
1100    NEXUS_PidChannelHandle videoPid[BSETTOP_MAX_PROGRAMS];
1101    NEXUS_PidChannelHandle audioPid[BSETTOP_MAX_PROGRAMS];
1102    NEXUS_PidChannelHandle ancillaryPid[BSETTOP_MAX_PROGRAMS];
1103    NEXUS_PidChannelHandle pcrPid;
1104    NEXUS_KeySlotHandle hKeySlot;
1105};
1106
1107#if NEXUS_HAS_RECORD
1108struct brecord {
1109    NEXUS_RecordHandle nRecord;
1110    bplayback_t playback; /* cross linking */
1111    bool started;
1112    brecord_params params;
1113    bstream_t stream;
1114    int errorcode;
1115    B_EventHandle errorEvent, overflowEvent;
1116    b_event_id_t errorEventId, overflowEventId;
1117
1118    NEXUS_PidChannelHandle videoPid[BSETTOP_MAX_PROGRAMS];
1119    NEXUS_PidChannelHandle audioPid[BSETTOP_MAX_PROGRAMS];
1120    NEXUS_PidChannelHandle ancillaryPid[BSETTOP_MAX_PROGRAMS];
1121    NEXUS_PidChannelHandle pcrPid;
1122    NEXUS_KeySlotHandle hKeySlot;
1123};
1124
1125struct brecord_file {
1126    NEXUS_FileRecordHandle nFile;
1127    NEXUS_FifoRecordHandle nFileFifo;
1128};
1129
1130#endif
1131
1132/* 7400 & 7440 can use 2, otherwise default to 1.
1133set to 0 to test with cpu-only graphics. */
1134#ifndef B_N_GRC
1135#if B_HAS_SOFT_GFX
1136#define B_N_GRC 0
1137#else
1138#define B_N_GRC 1
1139#endif /* B_HAS_SOFT_GFX */
1140#endif /* B_N_GRC */
1141
1142BDBG_OBJECT_ID_DECLARE(bgraphics);
1143BDBG_OBJECT_ID_DECLARE(bsurface);
1144BDBG_OBJECT_ID_DECLARE(bstream);
1145
1146struct bsurface {
1147    BDBG_OBJECT(bsurface)
1148
1149    BLST_Q_ENTRY(bsurface) link; /* list of surfaces in bgraphics */
1150    bool in_list; /* true if this bsurface was added to bgraphics.surfaces */
1151
1152    NEXUS_SurfaceHandle nSurface;
1153    bsurface_memory mem;
1154    bsurface_settings settings;
1155    bsurface_create_settings create_settings;
1156    bgraphics_t graphics;
1157    bool is_fb; /* if true, this surface is in graphics->fb[] */
1158};
1159
1160#define MAX_GRAPHICS_FBS 3
1161
1162#if B_N_GRC
1163#include "nexus_graphics2d.h"
1164#endif
1165
1166#if B_HAS_SOFT_GFX
1167#include "b_softgfx_lib.h"
1168#endif /* B_HAS_SOFT_GFX */
1169
1170struct bgraphics {
1171    BDBG_OBJECT(bgraphics)
1172    unsigned index;
1173    bdisplay_t display;
1174    bool closing;
1175    bsurface_t fb[MAX_GRAPHICS_FBS];
1176    unsigned num_fbs; /* total in fb[] */
1177    unsigned cur_fb; /* index into fb[] for the currently displayed framebuffer. get_memory/blit/fill all operate on the next framebuffer. */
1178    bgraphics_settings settings;
1179    BLST_Q_HEAD(surfacelist, bsurface) surfaces; /* non-fb surfaces */
1180#if B_N_GRC
1181    NEXUS_Graphics2DHandle graphics2d;
1182    BKNI_EventHandle gEvent;
1183#endif
1184};
1185
1186void bstream_p_init(void);
1187void bdisplay_p_init(void);
1188void bdisplay_p_uninit(void);
1189void buserio_p_init(void);
1190void buserio_p_uninit(void);
1191void bdecode_p_init(void);
1192void bdecode_p_uninit(void);
1193void bconfig_p_init(void);
1194bresult b_event_init(void);
1195void btuner_p_init(void);
1196void bconfig_p_set_tuners(void);
1197void bdma_p_init(void);
1198void bdma_p_uninit(void);
1199void bdma_p_mem_stress(void);
1200#ifdef B_HAS_IP
1201void bplayback_ip_p_init(void);
1202void bplayback_ip_p_uninit(void);
1203#endif
1204void bstream_p_fcc_init(NEXUS_VideoDecoderHandle videoDecodeHandle);
1205
1206/* open a live or playback parser band */
1207bstream_t bstream_p_open(bband_t band, bplaypump_t playpump, bplayback_t playback, unsigned parser_band, const bstream_mpeg *mpeg);
1208bresult bstream_p_set(bstream_t stream, const bstream_mpeg *mpeg);
1209bstream_t bstream_p_open_message(bband_t band, const bstream_mpeg *mpeg);
1210bresult bplayback_p_start(bplayback_t playback);
1211brecord_file_t brecord_p_file_open(const char *mpeg_file_name, const char *index_file_name, bool fifo);
1212bplayback_file_t bplayback_p_file_open(const char *mpeg_file_name, const char *index_file_name, bfile_out_fifo_t writer);
1213
1214bresult bdecode_p_window_set_no_delay( bdecode_window_t window, bool noDelay );
1215
1216/* keyslot management functions for PVR */
1217NEXUS_KeySlotHandle b_keyslot_m2m_allocate(const bencryption_params *encryption, bool encrypt, bool timestamp);
1218void b_keyslot_m2m_free(NEXUS_KeySlotHandle);
1219
1220/* Hooks from display->audio */
1221void bdisplay_p_set_compressed_mute(bdisplay_t display, bool compressed_mute);
1222void bdisplay_p_enable_audio(bdisplay_t display, bool enabled);
1223void bdecode_p_enable_audio(bdecode_t decode, bool enabled);
1224void bpcm_play_p_enable(bdisplay_t display, bool enabled);
1225void bdisplay_p_decode_starting(bdisplay_t display, bdecode_window_t window, bdecode_t decode);
1226
1227extern struct bdecode g_decode[B_MAX_DECODES+B_MAX_STILL_DECODES];
1228extern struct bdisplay g_display[B_N_DISPLAYS];
1229#if B_N_DVI_OUTPUTS
1230extern struct boutput_hdmi g_hdmi[B_N_DVI_OUTPUTS];
1231#endif
1232#if BCHP_CHIP == 7400
1233extern struct baudio_decode g_audio_decode[B_MAX_DECODES];
1234#else
1235extern struct baudio_decode g_audio_decode[1];
1236#endif
1237
1238#if B_HAS_ANALOG
1239bresult btuner_p_set_analog_input(NEXUS_AnalogVideoDecoderHandle analogVideoDecoder, btuner_t tuner, btuner_linein_t linein);
1240#endif
1241
1242NEXUS_VideoCodec b_videocodec2nexus(bvideo_codec codec);
1243NEXUS_AudioCodec b_audiocodec2nexus(baudio_format format);
1244NEXUS_VideoFormat b_displayformat2nexus(bvideo_format settop_value, const bvideo_format_settings *vesa_settings);
1245NEXUS_DisplayAspectRatio b_displayaspectratio2nexus(bdisplay_aspect_ratio aspect_ratio);
1246NEXUS_PixelFormat b_graphicspixelformat2nexus(bgraphics_pixel_format pixel_format);
1247NEXUS_MessageFormat b_messageformat2nexus(bmessage_format message_format);
1248#if NEXUS_HAS_FRONTEND
1249NEXUS_FrontendSatelliteMode b_sdsmode2nexus(btuner_sds_mode mode);
1250#endif
1251unsigned b_get_parser_band(bband_t band);
1252NEXUS_TransportType b_mpegtype2nexus(bstream_mpeg_type);
1253#if NEXUS_HAS_PLAYBACK
1254NEXUS_VideoDecoderDecodeMode b_decodermode2nexus(bplaypump_decode_mode);
1255#endif
1256int b_volume2nexus(int settop_vol, bool decibel, int *out_volume);
1257const char *bsettop_get_config(const char *name);
1258
1259bvideo_codec b_nexus2videocodec(NEXUS_VideoCodec nexus_value);
1260baudio_format b_nexus2audiocodec(NEXUS_AudioCodec nexus_value);
1261bvideo_format b_nexus2displayformat(
1262    NEXUS_VideoFormat nexus_value,
1263    bvideo_format_settings *vesa_settings /* [out] optional */
1264    );
1265bvideo_frame_rate b_nexus2framerate(NEXUS_VideoFrameRate nexus_value);
1266
1267bresult bdecode_p_set_framemaster(bdecode_t decode, bdecode_window_t window);
1268bool b_window_is_full_screen(const bdisplay_settings *display_settings, const bsettop_rect *position);
1269
1270/* Close a stream from playback/playpump */
1271void bstream_p_close(bstream_t stream);
1272/* PidChannel management routines */
1273typedef enum bstream_pid_type
1274{
1275    bstream_pid_type_audio,
1276    bstream_pid_type_video,
1277    bstream_pid_type_pcr,
1278    bstream_pid_type_other
1279} bstream_pid_type;
1280
1281NEXUS_PidChannelHandle bstream_p_open_pid(bstream_t stream, uint16_t pid, bstream_pid_type type);
1282void bstream_p_close_pid(bstream_t stream, NEXUS_PidChannelHandle pidChannel);
1283/* Notify consumers of bstream_mpeg changes */
1284void brecpump_p_mpeg_change(brecpump_t recpump, const bstream_mpeg *new_settings);
1285void brecord_p_mpeg_change(brecord_t recpump, const bstream_mpeg *new_settings);
1286void bdecode_p_mpeg_change(bdecode_t decode, const bstream_mpeg *new_settings);
1287/* Have consumers release pid channels before a source is closed */
1288void bstream_p_stop_consumers(bstream_t stream);
1289
1290#define B_PVR_ATOM_SIZE ((188/4)*4096)
1291#define B_PVR_PLAYBACK_BUFFER (B_PVR_ATOM_SIZE*8) /* = 1540096 or 1504K or 1.5MB */
1292#define B_PVR_N_PLAYBACK_DESC 100
1293#define B_PVR_RECORD_BUFFER (B_PVR_ATOM_SIZE*12)*2  /* Need 4.4MB for network record */
1294#define B_PVR_N_RECORD_DESC 12
1295
1296#include "nexus_base_os.h"
1297#define NEXUS_MODULE_SELF g_settopModule
1298extern NEXUS_ModuleHandle g_settopModule;
1299
1300int b_strcmp(const char *s1, const char *s2);
1301bool is_panel_output(void);
1302
1303#if defined(XMP1_SUPPORT) || defined(XMP2_SUPPORT)
1304#include "nexus_ir_blaster.h"
1305/* The following have been added for the XMP Operation */
1306
1307/*
1308Summary:
1309    Handle returned by buser_xmp_input_open().
1310*/
1311typedef struct buser_input_xmp *buser_input_xmp_t;
1312
1313
1314/** Summary
1315 XMP Handle structure
1316 **/
1317struct buser_input_xmp {
1318    buser_input_xmp_settings xmp_settings;/* Settings for the XMP */
1319    buser_input_xmp_status xmp_status;/* Status for the XMP */
1320    B_EventHandle xmp_status_event; /* Event when status is received from the XMP */
1321    B_EventHandle xmp_response_event;/* Event when response is received from the XMP */
1322    B_EventHandle irb_event; /* Event when IR blaster is finished sending data */
1323    b_event_id_t xmp_response_event_id; /* event id for the response event */
1324    NEXUS_IrBlasterHandle irBlaster; /* IR Blaster Handle */
1325};
1326
1327
1328bresult buser_input_p_send_xmp(
1329    buser_input_xmp_t remote,
1330    const uint8_t *input_buffer, /* [out,size_is(length)] */
1331    size_t length
1332    );
1333
1334bresult buser_input_p_receive_xmp(
1335    buser_input_xmp_t remote,
1336    uint8_t *output_data, /* [out,size_is(length)] */
1337    size_t length,
1338    unsigned *output_size,
1339    uint32_t *data_packet
1340    );
1341
1342void bsettop_p_userio_xmp(buser_input_xmp_t ui_xmp, unsigned *code);
1343#endif
1344
Note: See TracBrowser for help on using the repository browser.