source: svn/newcon3bcm2_21bu/BSEAV/api/include/bsettop_decode.h @ 46

Last change on this file since 46 was 46, checked in by megakiss, 11 years ago

459Mhz로 OTC 주파수 변경

  • Property svn:executable set to *
File size: 36.9 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_decode.h $
11 * $brcm_Revision: 49 $
12 * $brcm_Date: 2/16/10 5:09p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /BSEAV/api/include/bsettop_decode.h $
19 *
20 * 49   2/16/10 5:09p vsilyaev
21 * SW3556-1051: Added bdecode_timestamp_order
22 *
23 * 48   1/27/10 10:01a jgarrett
24 * SW7550-213: Fixing name of stereo dual mono mode
25 *
26 * 47   12/1/09 6:08p vsilyaev
27 * SW7405-3515: Added left/right AAC downmix
28 *
29 * 46   11/19/09 8:02p jgarrett
30 * SW7405-3357: Adding audio output routing for decode and pcm playback
31 * prior to start
32 *
33 * 45   9/29/09 11:48a jgarrett
34 * SW7405-3100: Adding display underflows and display drops to video
35 * decode status
36 *
37 * 44   6/30/09 10:47a jgarrett
38 * PR 52051: Add a dialog normalization enable / disable to
39 * dolby_settings.
40 *
41 * 43   5/15/09 3:21p jgarrett
42 * PR52687: Add method to set AAC downmix type
43 *
44 * PR52687/2   5/14/09 2:14p jjordan
45 * PR52687: improve AAC downmix API
46 *
47 * PR52687/1   5/12/09 3:12p jjordan
48 * PR52687: Add method to set audio downmix type
49 *
50 * 42   5/6/09 4:11p jgarrett
51 * PR 50291: Adding wide GA mode
52 *
53 * PR50291/1   5/6/09 3:17p jjordan
54 * PR50291: add Wide GA mode (config from brutus.cfg)
55 *
56 * 41   3/30/09 1:17p vsilyaev
57 * PR 52736: Added preroll_rate to the video decoder settings
58 *
59 * SanDiego_Mot_DSR/PR52051/3   6/23/09 6:44p mward
60 * PR 52051: Update.
61 *
62 * 43   5/15/09 3:21p jgarrett
63 * PR52687: Add method to set AAC downmix type
64 *
65 * PR52687/2   5/14/09 2:14p jjordan
66 * PR52687: improve AAC downmix API
67 *
68 * PR52687/1   5/12/09 3:12p jjordan
69 * PR52687: Add method to set audio downmix type
70 *
71 * 42   5/6/09 4:11p jgarrett
72 * PR 50291: Adding wide GA mode
73 *
74 * PR50291/1   5/6/09 3:17p jjordan
75 * PR50291: add Wide GA mode (config from brutus.cfg)
76 *
77 * 41   3/30/09 1:17p vsilyaev
78 * PR 52736: Added preroll_rate to the video decoder settings
79 *
80 * SanDiego_Mot_DSR/PR52051/2   3/27/09 3:26p mward
81 * PR52051:  Branch for testing dialog normalization switch with new RAP
82 * release.
83 *
84 * 40   3/13/09 3:13p jgarrett
85 * PR 49827: Merge to main branch
86 *
87 * PR49827/4   2/25/09 12:17p mward
88 * PR52490: Change name of SRS VIQ to SRS TrueVolume
89 *
90 * PR49827/3   1/13/09 5:11p mward
91 * PR50613: Add support for SRS Volume IQ.
92 *
93 * PR49827/2   12/5/08 2:40p mward
94 * PR49827: Separate Dolby post-processing and codec settings.
95 *
96 * PR49827/1   12/1/08 12:14p mward
97 * PR49827: Support for Dolby volume post-processing.
98 *
99 * 39   6/9/08 5:44p vsilyaev
100 * PR 32994: Added dual-mono audio settings
101 *
102 * 38   3/31/08 6:26p jgarrett
103 * PR 40987: Updating documentation on set audio program
104 *
105 * 37   12/20/07 5:51p vsilyaev
106 * PR38004: PR38004: Add video decoder freeze/resume API
107 *
108 * PR38004/2   12/20/07 5:21p jtna
109 * PR38004: Add video decoder freeze/resume API
110 *
111 * PR38004/1   12/18/07 5:53p jtna
112 * PR38004: Add video decoder freeze/resume API
113 *
114 * 36   10/25/07 9:20a jgarrett
115 * PR 28004: Duplicate structure member in bvideo_decode_status for Pan-
116 * Scan status.
117 *
118 * PR28004/2   9/20/07 4:11p mward
119 * PR 28004: Duplicate structure member in bvideo_decode_status for Pan-
120 * Scan status.
121 *
122 * 35   9/10/07 5:59p vsilyaev
123 * PR33851:  Adding audio master mode
124 *
125 * 33   8/22/07 5:29p jgarrett
126 * PR 32044: Merging to main branch
127 *
128 * 7405_pip_support/1   8/21/07 2:38p katrep
129 * PR34204: Added mosaic mode support for 7405.
130 *
131 * 32   7/23/07 6:09p vsilyaev
132 * PR 33340: Added audio/video pts_error_cnt
133 *
134 * 31   6/27/07 5:42p vsilyaev
135 * PR 32282: Added number of queued compressed auduo frames
136 *
137 * 30   6/26/07 6:08p vsilyaev
138 * PR 24848: Added configuration for boost/cut audio postprocessing
139 *
140 * PR32044/1   6/26/07 5:54p jgarrett
141 * PR 32044: Adding Mosaic Mode APIs
142 *
143 * 29   6/7/07 1:54p jgarrett
144 * PR 31914: Adding audio/video source changed callbacks.
145 *
146 * 28   4/13/07 3:51p vsilyaev
147 * PR 29840: Added API to render graphics surface as the decoder output
148 *
149 * 27   1/26/07 6:18p vsilyaev
150 * PR 26400: Use dedicated functions and structured for video and audio
151 * status
152 *
153 * 26   1/19/07 7:20p vsilyaev
154 * PR 27245: Moved audio/video status into related file
155 *
156 * 25   12/8/06 1:56p erickson
157 * PR26128: added bdecode_settings.audio.secondary_audio_program. This is
158 * temporary.
159 *
160 * 24   11/22/06 10:20a erickson
161 * PR25519: added bdecode_status.video_picture_queue
162 *
163 * 23   11/15/06 7:36p bandrews
164 * PR25456: Added passthrough audio status, and cleaned up status design
165 * (maintaining bw compat)
166 *
167 * 22   10/18/06 6:33p bandrews
168 * PR24848: Updated with fixed nested param structure in settings and
169 * retrieval of rap handle does not require decode to be started
170 *
171 * 21   10/17/06 5:53p bandrews
172 * PR24848: Added Dolby config params
173 *
174 * 20   10/2/06 4:27p vsilyaev
175 * PR 23826: Added functions to allow user control STC
176 *
177 * 19   6/29/06 7:00p erickson
178 * PR21721: added bdecode_stop_mode to bdecode_settings
179 *
180 * 18   6/23/06 9:51a erickson
181 * PR21510: add baudio_downmix to bdecode_settings
182 *
183 * 17   6/12/06 11:18a erickson
184 * PR21646: added bvideo_frame_rate
185 *
186 * 16   3/31/06 3:58p jgarrett
187 * PR 20236: Adding graphics context to bdecode_acquire_capture_buffer
188 *
189 * 15   3/14/06 6:53p dlwin
190 * PR 20206: Removed B_HAS_IP use.  Now it always incude
191 *
192 * 14   3/10/06 10:48a erickson
193 * PR17108: fix prototypes for proxy build
194 *
195 * 13   3/2/06 12:26p dlwin
196 * PR15200: Merge to main-line, rework STC steering for 97398
197 *
198 * PROD_IPSTB_REFSW_Devel/1   3/2/06 11:27a jjordan
199 * PR15200 - rework STC steering for 97398
200 *
201 * 12   2/1/06 4:07p vle
202 * PR 18538: add feature to indicate PTS type when call
203 * bdecode_get_status()
204 *
205 * 11   1/6/06 2:52p erickson
206 * PR17108: added bool *top_field param to bdecode_acquire_capture_buffer
207 *
208 * 10   12/15/05 9:55a erickson
209 * PR18616: added still picture code for 7401
210 *
211 * 9   12/13/05 4:52p erickson
212 * PR18439: added bdecode_acquire_capture_buffer et al to return capture
213 * buffer to application
214 *
215 * 8   11/14/05 2:59p vsilyaev
216 * PR 17727: Fixed typo
217 *
218 * 7   10/17/05 2:11p erickson
219 * PR17650: added bdecode_read_metadata
220 *
221 * 6   10/12/05 4:05p erickson
222 * PR15251: added interlaced and video_codec to bdecode_status
223 *
224 * 5   8/24/05 5:15p erickson
225 * PR16819: added audio_program and video_program to decode status
226 *
227 * 4   5/12/05 7:08p dlwin
228 * PR 15253: Remove conditional compile for NOOS
229 *
230 * 3   5/9/05 8:44p agin
231 * PR15253: video format auto detection for non-os.
232 *
233 * 2   2/12/05 11:06a dlwin
234 * Merge down for release 2005_REFSW_MERGETOMAIN:
235 *
236 * Irvine_BSEAVSW_Devel/25   2/8/05 9:45a jjordan
237 * PR13959: Initial checkin of IP STB
238 *
239 * Irvine_BSEAVSW_Devel/24   1/28/05 6:03p mphillip
240 * PR13967: Changed const char * to char[16], changed the matching
241 * assignments
242 *
243 * Irvine_BSEAVSW_Devel/23   12/14/04 5:17p marcusk
244 * PR13528: Added additional audio status, stream type, number of
245 * channels, downmix mode, and sample rate.
246 *
247 * Irvine_BSEAVSW_Devel/22   9/21/04 3:53p erickson
248 * PR12728: fixed -pedantic warnings
249 *
250 * Irvine_BSEAVSW_Devel/21   8/4/04 4:03p vsilyaev
251 * PR 11472 : Added timecode filed into the status structure
252 *
253 * Irvine_BSEAVSW_Devel/20   6/25/04 9:15a erickson
254 * PR11135: updated comments
255 *
256 * Irvine_BSEAVSW_Devel/19   5/27/04 4:19p dlwin
257 * PR 10864:  Added code to return the MPEG decoder Pan/Scan status.
258 * This status is based on decoding Pan/Scan vectors and using it.
259 *
260 * Irvine_BSEAVSW_Devel/18   5/7/04 12:19p vsilyaev
261 * PR 10864:  Added field video_aspect_ratio.
262 *
263 * Irvine_BSEAVSW_Devel/17   11/7/03 4:28p erickson
264 * PR8583: removing, fixing or implementing TODO's
265 *
266 * Irvine_BSEAVSW_Devel/16   11/4/03 2:42p erickson
267 * documentation changes
268 *
269 * Irvine_BSEAVSW_Devel/15   10/31/03 11:58a erickson
270 * settop api changes after internal review
271 *
272 * Irvine_BSEAVSW_Devel/14   10/30/03 9:47a erickson
273 * Copied dbg interface so that we can compile out BRCM_DBG_MSG
274 *
275 * Irvine_BSEAVSW_Devel/13   10/28/03 11:26a erickson
276 * settop api reworks after internal design view
277 *
278 * Irvine_BSEAVSW_Devel/12   10/22/03 11:22a erickson
279 * settop api pass-through type conversion
280 *
281 * Irvine_BSEAVSW_Devel/11   9/30/03 1:13a erickson
282 * updated docjet documentation
283 *
284 * Irvine_BSEAVSW_Devel/10   9/17/03 5:04p erickson
285 * updated documentation for DocJet
286 *
287 * Irvine_BSEAVSW_Devel/9   8/19/03 2:48p erickson
288 * implemented attach/detach audio
289 *
290 * Irvine_BSEAVSW_Devel/8   8/18/03 11:01a erickson
291 * initial bringup for brutus 7320, still in progress
292 *
293 * Irvine_BSEAVSW_Devel/7   8/13/03 11:37a erickson
294 * added more examples
295 *
296 * Irvine_BSEAVSW_Devel/6   8/12/03 9:42a erickson
297 * changes after pre-review meeting
298 *
299 * Irvine_BSEAVSW_Devel/5   7/30/03 2:08p erickson
300 * removed all return value comments because we're standardized and they
301 * add nothing
302 *
303 * Irvine_BSEAVSW_Devel/4   7/29/03 6:02p erickson
304 * more rework
305 *
306 * Irvine_BSEAVSW_Devel/3   7/25/03 4:22p erickson
307 * in the middle of rework, does not compile
308 *
309 * Irvine_BSEAVSW_Devel/2   7/9/03 5:19p erickson
310 * rework for new bband_t model
311 *
312 * Irvine_BSEAVSW_Devel/1   6/13/03 3:09p vsilyaev
313 * SetTop reference API.
314 *
315 *
316 ***************************************************************************/
317#ifndef BSETTOP_DECODE_H__
318#define BSETTOP_DECODE_H__
319
320#ifdef __cplusplus
321extern "C"
322{
323#endif
324
325/*=*************************
326The decode interface is used to decode both digital and analog
327streams. It controls both video and audio decode.
328
329The source for a decode is a stream (bstream_t). Streams can generated either from a tuner (btuner_t),
330a playback engine (bplayback_t) or streamer (bstreamer_t).
331The destination of a decode is a decode window (bdecode_window_t) which is connected to a
332display (bdisplay_t).
333
334For PIP or dual output systems, there are two decoders. Otherwise there is only one
335decoder.
336****************************/
337
338/*
339Summary:
340    Open a decode engine.
341Description:
342*/
343bdecode_t bdecode_open(
344    bobject_t decode_id /* decode object id */
345    );
346
347/*
348Summary:
349    Settings for a mosaic decoder.
350Description:
351*/
352typedef struct bdecode_mosaic_settings {
353        unsigned width;      /* Maximum width of a stream to be decoded by this channel */
354        unsigned height;     /* Maximum height of a stream to be decoded by this channel */
355        unsigned num_codecs; /* Number of entries in the video_codecs_supported array */
356        bvideo_codec video_codecs_supported[BSETTOP_MAX_VIDEO_CODECS]; /* Array of codecs to be supported by this channel.
357                                                                          This will be initialized to match your primary
358                                                                          decoder settings by default.  */
359} bdecode_mosaic_settings;
360
361/*
362Summary:
363    Initialize mosaic settings to defaults.
364Description:
365*/
366void bdecode_mosaic_settings_init(
367    bdecode_t parent,                 /* Parent video decoder */
368    bdecode_mosaic_settings *settings /* Settings for this mosaic channel */
369    );
370
371/*
372Summary:
373    Open a mosaic decode engine.
374Description:
375*/
376bdecode_t bdecode_open_mosaic(
377    bdecode_t parent,                       /* Parent video decoder.  Decoder must be stopped for this call to succeed. */
378    bobject_t decode_id,                    /* mosaic object id, this must be unique across all mosaics. */
379    const bdecode_mosaic_settings *settings /* Settings for this mosaic channel. */
380    );
381
382/*
383Summary:
384    Close a decode engine.
385Description:
386    The decode should be stopped before closing.
387    After closing, the bdecode_t handle is invalid.
388*/
389void bdecode_close(
390    bdecode_t decode /* handle returned by bdecode_open */
391    );
392
393/*
394Summary:
395Dynamic Range Compression Mode
396
397Description:
398This corresponds to the eCompMode field of BRAP_DSPCHN_Ac3*ConfigParams.  The
399original is an enum with four possibilities: Custom A, Custom D, Rf, and Line. 
400All four values can cause changes in the output volume level.  The most
401noticeable change is the difference between Line and Rf.  With the compression
402mode set to Rf, input PCM samples are scaled up by 12 dB.  In Line mode, input
403PCM samples are not scaled up at all.  The two most commonly used modes are line
404and Rf, in that order.  Thus this enum offers only those two modes.
405*/
406typedef enum baudio_dolby_drc_mode
407{
408    baudio_dolby_drc_mode_line,
409    baudio_dolby_drc_mode_rf
410} baudio_dolby_drc_mode;
411
412/*
413Summary:
414Stereo Downmix Mode
415
416Description:
417This enum represents the formulas available for doing stereo downmixing.  It
418only applies when the downmix mode is stereo.  The enum corresponds to the
419eStereoMode field of BRAP_DSPCHN_Ac3*ConfigParams.  It is an enum with three
420possibilities: Automatic, LtRt, and LoRo.  LoRo is the standard stereo downmix
421formula.  LtRt is a Dolby Surround compatible stereo downmix formula.  Automatic
422means that which stereo downmix formula chosen is determined by parameters
423in the stream (as specified by Annex D of the AC-3 specification).
424*/
425typedef enum baudio_dolby_stereo_downmix_mode
426{
427    baudio_dolby_stereo_downmix_mode_automatic,
428    baudio_dolby_stereo_downmix_mode_dolby_surround_compatible,
429    baudio_dolby_stereo_downmix_mode_standard
430} baudio_dolby_stereo_downmix_mode;
431
432/*
433Summary:
434Dolby audio decoder settings
435
436Description:
437These settings control the parameters involved in the decode of Dolby-based
438streams.  They only apply when the audio type is Dolby Digital (AC3) or Dolby
439Digital Plus (AC3Plus). The variable "cut" determines the percentage cut of
440louder sounds from the normal value. The variable "boost" determines the
441percentage boost of quiter sounds from the normal value.
442*/
443
444typedef struct baudio_dolby_settings
445{
446    baudio_dolby_drc_mode drc_mode;
447    baudio_dolby_stereo_downmix_mode stereo_downmix_mode;
448    unsigned short cut;
449    unsigned short boost;
450    bool lfe;
451    bool dialog_norm; /* This should be true for normal operation */
452} baudio_dolby_settings;
453
454/*
455Summary:
456Dolby audio post-processing settings
457
458Description:
459These settings control the parameters involved in the post-processing of Dolby-based
460streams.  They only apply when the audio type is Dolby Digital (AC3) or Dolby
461Digital Plus (AC3Plus).
462*/
463
464typedef struct baudio_dolby_postproc_settings
465{
466    bool volume_proc_enable;
467} baudio_dolby_postproc_settings;
468
469/*
470Summary:
471SRS audio post-processing settings
472
473Description:
474These settings control the parameters involved in the SRS TruVolume post-processing. 
475*/
476
477typedef struct baudio_srs_postproc_settings
478{
479    bool tru_volume_enable;
480} baudio_srs_postproc_settings;
481
482/*
483Summary:
484Audio downmix modes
485
486Description:
487These modes are all "if applicable." The actual audio downmixing and output depend on the number of
488source channels and the capabilities of the hardware for each platform.
489
490Changes are only guaranteed to be applied when restarting audio decode. This can be done with
491either bdecode_stop/start or bdecode_detach/attach_audio. Some changes can be made
492on-the-fly (without restarting audio decode), but exact behavior may vary by platform.
493*/
494typedef enum baudio_downmix {
495    baudio_downmix_stereo, /* If applicable, down mix source to stereo output [default]. */
496    baudio_downmix_multichannel, /* Output decoded data as-is. If number of channels exceeds HW capabilities,
497        downmix to match maximum number of output channels. No audio will be lost. */
498    baudio_downmix_none, /* Output decoded data as-is. If number of channels exceeds HW capabilities,
499        additional audio channels will be lost. */
500    baudio_downmix_left, /* Take left channel and duplicate to left/right outputs. */
501    baudio_downmix_right, /* Take right channel and duplicate to left/right outputs. */
502    baudio_downmix_monomix  /* Mix left and right channels and output result to left/right outputs. This only applies if the stream
503        is a dual mono stream. If not, it will be equivalent to baudio_downmix_stereo. */
504} baudio_downmix;
505
506/**
507Summary:
508Control behavior of decoder when stopping decode.
509**/
510typedef enum bdecode_stop_mode {
511    bdecode_stop_mode_mute, /* mute the picture when stopped. decode window will be black. */
512    bdecode_stop_mode_last_picture /* display last decoded picture when stopped. */
513} bdecode_stop_mode;
514
515/**
516Summary:
517Controls behavior of decoder when using timestamps from the decoded stream.
518**/
519typedef enum bdecode_timestamp_order {
520    bdecode_timestamp_order_display, /* Timestamps in display order (default) */
521    bdecode_timestamp_order_decode   /* Timestamps in decode order */
522} bdecode_timestamp_order;
523
524/*
525Summary:
526
527Dual Mono channel select modes
528*/
529typedef enum baudio_dualmono {
530    baudio_dualmono_left,   /* Selects left source channel of dual mono audio */
531    baudio_dualmono_right,  /* Selects right source channel of dual mono audio */
532    baudio_dualmono_stereo, /* Pass-Thru */   
533    baudio_dualmono_monomix /* Mixes left and right channels */
534} baudio_dualmono;
535/*
536Summary:
537Controls how the tsm in the decoders will work
538*/
539typedef enum bdecode_tsm_mode
540{
541    bdecode_tsm_mode_auto,                  /* system will attempt to pick the best sync mode for the best robustness, error handling, and quality given the current stream */
542    bdecode_tsm_mode_stc_master,            /* STC is seeded with either the video or audio PTS in playback mode, depending on which decoder makes an STC request first.  In live mode, the PCR is used to seed the STC. */
543    bdecode_tsm_mode_video_master,          /* STC is seeded with the video PTS */
544    bdecode_tsm_mode_audio_master,          /* STC is seeded with the audio PTS, audio frames are played out if within sync limit */
545    bdecode_tsm_mode_output_master          /* TSM is not performed.  Data is pulled through the decoder by the output clocks. (also called VSYNC mode) */
546} bdecode_tsm_mode;
547
548
549/*
550Summary:
551Controls the downmix type used by the AAC audio decoder
552*/
553typedef enum baudio_aac_downmix
554{
555    baudio_aac_downmix_matrix,  /* BRCM-style downmix */
556    baudio_aac_downmix_arib,     /* ARIB-style downmix */
557    baudio_aac_downmix_ltrt      /* left right downmix */
558} baudio_aac_downmix;
559
560/*
561Summary:
562AAC audio decoder settings
563
564Description:
565These settings control the parameters involved in the decode of AAC-based
566streams.  They only apply when the audio type is AAC or AACPlus. The variable
567"downmix" determines the downmix coefficients that are used.
568*/
569typedef struct baudio_aac_settings
570{
571    baudio_aac_downmix downmix;
572} baudio_aac_settings;
573
574typedef struct bdecode_settings {
575    struct {
576        baudio_downmix downmix;
577        baudio_dualmono dualmono;
578        struct {
579            baudio_dolby_settings dolby;
580            baudio_aac_settings aac;
581        } codec;
582        int secondary_audio_program; /* If not -1, then perform simultaneous decode of one program and passthrough of
583            another program. This requires the following settings which are not automatically coordinated:
584            1) bsettop_mpeg.audio[audio_program] will be decoded.
585            2) bsettop_mpeg.audio[secondary_audio_program] will be passed through as compressed.
586            3) You must set either SPDIF or HDMI to compressed (!pcm) using boutput_spdif_set or boutput_dvi_set. If you
587                do not, it will fail.
588            Also, this API is temporary. It is likely to be changed in the near future.
589            */
590        bsettop_callback source_changed; /* Source change includes sample rate, channel encoding (i.e. stereo, mono, etc.) */
591        struct {
592            baudio_dolby_postproc_settings dolby;
593            baudio_srs_postproc_settings srs;
594        } postproc;
595        bdisplay_t display;           /* The display that will receive audio from this bdecode_t.  On some chips, audio input/output
596                                         mapping cannot be changed while audio is started, setting this variable prior to start will
597                                         associate the audio decoder with the proper display.  Optional, pass NULL to use the display from
598                                         bdecode_start()'s window instead. */
599    } audio;
600    struct {
601        bool freeze;    /* Flag to indicate whether video decode is in freeze state. Applicable only after decoder has been started. Auto-reset to false on decoder stop. */
602        bsettop_callback source_changed; /* Source change includes size, frame rate, interlaced/progressive */
603        unsigned preroll_rate;           /* Slow motion rate (in units of BPLAYPUMP_NORMALPLAY_SPEED) to be applied until decoded picture passes the TSM test */
604    } video;
605    bdecode_stop_mode stop_mode;         /* Behavior of the decoder when stopped (i.e. mute, hold last picture)*/
606    bsettop_callback still_picture_done; /* called when still picture decode is complete */
607    void *callback_context;              /* Context passed to source_changed callbacks and still_picture_done */
608    struct
609    {
610        bdecode_tsm_mode mode;          /* the way tsm will be handled */
611        unsigned sync_limit;                    /* the limit under which the tsm mode will be applied */
612        bool wga_mode_enable;              /* increase the GA threshold to avoid audio dropout due to errored PTS value (up to 1x AAU period error) */
613    } tsm;
614} bdecode_settings;
615
616/**
617Summary:
618Get current decode settings
619**/
620void bdecode_get(
621    bdecode_t decode, 
622    bdecode_settings *settings /* [out] */
623    );
624
625/**
626Summary:
627Set new decode settings
628**/
629bresult bdecode_set(
630    bdecode_t decode, 
631    const bdecode_settings *settings
632    );
633
634/*
635Summary:
636    Start display a surface through video buffer.
637*/
638
639bresult bdecode_display_surface(
640    bdecode_t decode, 
641    bsurface_t surface,
642    bdecode_window_t window
643    );
644
645/*
646Summary:
647    Start decoding a stream.
648*/
649bresult bdecode_start(
650    bdecode_t decode, /* handle returned by bdecode_open */
651    bstream_t source, /* source for the decode, either analog or digital */
652    bdecode_window_t window /* window to render decode */
653    );
654
655/*
656Summary:
657    Stop decoding a stream.
658Description:
659    The stream remains valid after decode is stopped. Decode could be restarted
660    without retuning or restarting playback.
661*/
662void bdecode_stop(
663    bdecode_t decode /* handle returned by bdecode_open */
664    );
665
666/*
667Summary:
668    Stop the audio decode and detach it so that it can be reconfigured or
669    assigned to another decode.
670
671Description:
672    This is used to switch a single audio decoder between main and PIP decodes.
673
674    It's also used to switch the MPEG program being decoded while not stopping
675    video decode. This could be used to support alternative digital audio programs.
676*/
677baudio_decode_t bdecode_detach_audio(
678    bdecode_t decode /* handle returned by bdecode_open */
679    );
680
681
682/*
683Summary:
684    Attach an audio decode to a decoder.
685
686Description:
687    If the decode object has been started, audio decode will start immediately.
688
689    After calling bdecode_attach_audio, the baudio_decode_t can no longer be used.
690    Therefore, you can only attach a baudio_decode_t to one decoder object.
691*/
692bresult bdecode_attach_audio(
693    bdecode_t decode, /* handle returned by bdecode_open */
694    baudio_decode_t audio /* handle returned by bdecode_detach_audio */
695    );
696
697/*
698Summary:
699   Set the bstream_mpeg program index for audio decode.
700
701Description:
702The new program index will be applied immediately.
703
704This should not be used for channel change. This is only used when changing the audio
705stream without changing the video stream. If you want to change channel, you need
706to stop decode, get a new stream by using a new bstream_mpeg structure, and
707start decode again.
708*/
709bresult bdecode_set_audio_program(
710    bdecode_t decode, /* handle returned by bdecode_open */
711    unsigned index /* index into bstream_mpeg.audio[] */
712    );
713
714/*
715Summary:
716    Returns audio decoder connected the decode
717
718Description:
719    This is used to obtain audio decoder connected to a decoder. Then
720    audio decoder could be used to  obtain decoder status. During this operation
721    state of the deocder wouldn't change or otherwise disturbed.
722
723    It's possible that more than one audio decoder is connected to a single decoder.
724    For example dedicated decoder could be used for compressed SPDIF output.
725*/
726baudio_decode_t bdecode_get_audio(
727    bdecode_t decode, /* handle returned by bdecode_open */
728    bobject_t audio_id /* audio_decode object id */
729    );
730
731/*
732Summary:
733    Stop the video decode and detach it so that it can be reconfigured or
734    assigned to another decode.
735
736Description:
737    This is used to switch the MPEG program being decoded while not stopping
738    audio decode. This could be used to support multiple viewing angles or
739    SD / HD switches.
740*/
741bvideo_decode_t bdecode_detach_video(
742        bdecode_t decode /* handle returned by bdecode_open */
743    );
744
745/*
746Summary:
747    Attach a video decode and start decoding.
748
749Description:
750    If the decode object has been started, video decode will start immediately.
751
752    After calling bdecode_attach_video, the bvideo_decode_t can no longer be used.
753    Therefore, you can only attach a bvideo_decode_t to one decoder object.     
754*/
755bresult bdecode_attach_video(
756        bdecode_t decode, /* handle returned by bdecode_open */
757        bvideo_decode_t video /* handle returned by bdecode_detach_video */
758    );
759
760/*
761Summary:
762   Set the bstream_mpeg program index for video decode.
763
764Description:
765The new program index will only get applied on the next bdecode_start or
766bdecode_attach_video.
767
768This should not be used for channel change. This is only used when changing the video
769stream without changing the audio stream. If you want to change channel, you need
770to stop decode, get a new stream by using a new bstream_mpeg structure, and
771start decode again.
772*/
773bresult bdecode_set_video_program(
774        bdecode_t decode, /* handle returned by bdecode_open */
775        unsigned index /* index into bstream_mpeg.video[] */
776    );
777
778/*
779Summary:
780    Returns video decoder connected the decode
781
782Description:
783    This is used to obtain video decoder connected to a decoder. Then
784    audio decoder could be used to  obtain decoder status. During this operation
785    state of the deocder wouldn't change or otherwise disturbed.
786
787    It's possible that more than one video decoder is connected to a single decoder.
788*/
789bvideo_decode_t bdecode_get_video(
790    bdecode_t decode, /* handle returned by bdecode_open */
791    bobject_t video_id /* video_decode object id */
792    );
793
794
795/*
796Summary:
797    Information of the current pan/scan mode of decoder.
798Description:
799    Describes if decoder is decoding pan/scan vector.  Decoder is consider
800    to be decoding pan/scan vectors when decoder is enabled to decode pan/scan
801    and MPEG stream contains pan/scan vectors.
802*/
803typedef enum bdecode_panscan_status {
804   bdecode_panscan_status_unknown,      /* decoder panscan status is unknown
805                                           (decoder doesn't report panscan status) */
806   bdecode_panscan_status_enabled,      /* decoder panscan status is enabled
807                                           (decoder is using stream's panscan information) */
808   bdecode_panscan_status_disabled      /* decoder panscan status is disabled */
809} bdecode_panscan_status;
810
811/*
812Summary:
813   Information of the last GOP time code found in the MPEG stream
814Description:
815   Mpeg stream could carry time code in the GOP stream, this structure would
816   contain last time code found in the stream or all members would be 0 if timecode
817   wasn't found in the stream
818*/
819typedef struct bdecode_time_code {
820    unsigned short hours; /* ISO 13818-2 time_code_hours field */
821    unsigned short minutes;/* ISO 13818-2 time_code_minutes field */
822    unsigned short seconds; /* ISO 13818-2 time_code_seconds field */
823    unsigned short pictures; /* ISO 13818-2 time_code_pictures field */
824} bdecode_time_code;
825
826/*
827Summary:
828   Information of the pts type
829Description:
830   Describes the validity of PTS
831*/
832typedef enum bdecode_pts_type   {
833    bdecode_pts_type_invalid=0,
834    bdecode_pts_type_interpolated,
835    bdecode_pts_type_coded
836}   bdecode_pts_type;
837
838/*
839Summary:
840    Common codec status returned by baudio_decode_get_status and bvideo_decode_get_status
841*/
842typedef struct bcodec_status {
843    unsigned fifo_depth; /* depth in bytes of the compressed buffer */
844    unsigned fifo_size; /* size in bytes of the compressed buffer */
845    uint32_t pts; /* current PTS of the audio decoder */
846    bdecode_pts_type pts_type;  /* current PTS type of the codec */
847    uint32_t stc; /* current STC used by the codec */
848    unsigned short program; /* current program being decoded. see bdecode_set_audio_program. */
849    bool    started; /* true if codec was started */
850    unsigned pts_error_cnt; /* counter for number of PTS errors since start of decode */ 
851} bcodec_status;
852
853
854/*
855Summary:
856    Audio decode status returned by baudio_decode_get_status
857*/
858typedef struct baudio_decode_status {
859    bcodec_status common; /* codec status */
860    baudio_format codec; /* audio stream format */
861    unsigned sample_rate; /* sample rate in hz */
862    unsigned short bitrate; /* in Kbps */
863    unsigned short frame_queue; /* number of audio frames accumulated in the compressed decoder buffer */
864    bool compressed_spdif_output; /* true = compressed spdif output, false = pcm or disabled */
865    char channels[16]; /* number of discrete audio source channels (x.x format) */
866    char downmix_mode[16]; /* downmix mode string */
867    char layer[16]; /* audio layer mode string */
868} baudio_decode_status;
869
870/*
871Summary:
872    Video decode status returned by bvideo_decode_get_status
873*/
874typedef struct bvideo_decode_status {
875    bcodec_status common; /* codec status */
876    bvideo_codec codec; /* if bvideo_codec_none, it is analog or other external source */
877    bvideo_frame_rate frame_rate;
878    bdecode_panscan_status panscan_status; /* current video panscan status of decoder */
879    unsigned short source_width;    /* width in pixels of the source video */
880    unsigned short source_height;   /* height in pixels of the source video */
881    unsigned short picture_queue; /* return the number of decoded pictures ready to be displayed */
882    bool interlaced;
883    unsigned aspect_ratio; /* value of aspect_ratio_information field from decoded MPEG stream (see ISO/IEC 13818-2) */
884    bdecode_time_code time_code;
885    unsigned display_drops; /* Number of video display drops since start of decode */
886    unsigned display_underflows;  /* Number of video display underflows since start of decode */
887} bvideo_decode_status;
888
889
890/*
891Summary:
892    Decode status returned by bdecode_get_status
893*/
894typedef struct bdecode_status {
895    unsigned int source_width;  /* width in pixels of the source video */
896    unsigned int source_height; /* height in pixels of the source video */
897    bool interlaced;
898    bvideo_codec video_codec; /* if bvideo_codec_none, it is analog or other external source */
899    bvideo_frame_rate video_frame_rate;
900   
901    unsigned long video_fifo_depth; /* depth in bytes of the compressed video buffer (VBV) */
902    unsigned long video_fifo_size; /* size in bytes of the compressed video buffer (VBV) */
903    unsigned long video_pts; /* current PTS of the video decoder */
904    bdecode_pts_type video_pts_type;    /* current PTS type of the video decoder    */
905    unsigned long video_stc; /* current STC used by the video decoder */
906    unsigned video_aspect_ratio; /* value of aspect_ratio_information field from decoded MPEG stream (see ISO/IEC 13818-2) */
907    unsigned video_program; /* current video program being decoded. see bdecode_set_video_program. */
908    unsigned video_picture_queue; /* return the number of decoded pictures ready to be displayed */
909    unsigned video_pts_error_cnt; /* counter for number of PTS errors since start of decode */
910    unsigned video_display_drops; /* Number of video display drops since start of decode */
911    unsigned video_display_underflows;  /* Number of video display underflows since start of decode */
912   
913    unsigned long audio_fifo_depth; /* depth in bytes of the compressed audio buffer */
914    unsigned long audio_fifo_size; /* size in bytes of the compressed audio buffer */
915    unsigned long audio_pts; /* current PTS of the audio decoder */
916    bdecode_pts_type audio_pts_type;    /* current PTS type of the audio decoder */
917    unsigned long audio_stc; /* current STC used by the audio decoder */
918    unsigned audio_program; /* current audio program being decoded. see bdecode_set_audio_program. */
919    baudio_format audio_format; /* audio stream format */
920    unsigned int audio_sample_rate; /* sample rate in hz */
921    char audio_channels[16]; /* number of discrete audio source channels (x.x format) */
922    char audio_downmix_mode[16]; /* downmix mode string */
923    char audio_layer[16]; /* audio layer mode string */
924    bool audio_compressed_spdif_output; /* true = compressed spdif output, false = pcm or disabled */
925    unsigned short audio_frame_queue; /* number of audio frames accumulated in the compressed decoder buffer */
926    bdecode_panscan_status video_panscan_status; /* current video panscan status of decoder */
927    bdecode_time_code time_code;
928    bool disco_event; /* indicates a discontinuity has occured since the last time bdecode_get_status() was called */
929    bool underflow_event; /* indicates an underflow has occured since the last time bdecode_get_status() was called */
930    unsigned long audio_bitrate; /* in Kbps */
931    /* PR25456 20061115 bandrews - Added for audio passthrough status and better design, should deprecate other stati */
932    unsigned audio_pts_error_cnt; /* counter for number of PTS errors since start of decode */
933} bdecode_status;
934
935/*
936Summary:
937    Get the status of the audio decoder
938*/
939void baudio_decode_get_status(
940    baudio_decode_t audio, /* audio decoder handle */
941    baudio_decode_status *status /* [out] status to be populated */
942    );
943
944/*
945Summary:
946    Get the status of the video decoder
947*/
948void bvideo_decode_get_status(
949    bvideo_decode_t video, /* video decoder handle */
950    bvideo_decode_status *status/* [out] status to be populated */
951    );
952
953/*
954Summary:
955    Get the status of the decoder and current source.
956*/
957bresult bdecode_get_status(
958    bdecode_t decode,  /* handle returned by bdecode_open */
959    bdecode_status *status  /* [out] status to be populated */
960    );
961
962/*
963Summary:
964    Set ADP (mpegaudio decoder) volume.
965*/
966bresult bdecode_set_audio_volume(
967    bdecode_t decode,
968    const baudio_volume *volume
969    );
970
971/*
972Summary:
973    Get ADP (mpegaudio decoder) volume.
974*/
975bresult bdecode_get_audio_volume(
976    bdecode_t decode,
977    baudio_volume *volume   /* [out] */
978    );
979
980/*
981Summary:
982   This function is used to retriece current value of the System Time Counter (STC)
983   associated with the decoder channel
984*/
985bresult bdecode_get_stc(bdecode_t decode, uint32_t *stc);
986
987/*
988Summary:
989   This function is used to set the System Time Counter (STC)
990   for the decoder channel
991*/
992bresult bdecode_set_stc(bdecode_t decode, uint32_t stc);
993
994/*
995Summary:
996    Slow the clock to ensure buffer is filling
997*/
998void bdecode_slow_clock(
999    bdecode_t decode,
1000    bool slow
1001    );
1002
1003/**
1004Summary:
1005Read raw data from decoder for debug or external processing.
1006
1007Description:
1008This is used for capturing CRC data for decode verification.
1009It may also be used in the future for capturing raw userdata or other data.
1010
1011The bytestream returned has a format of a header and sized payload. This allows for multiplexing of different data
1012along with future-proofing for new types. Applications should only parse the types they understand and
1013skip all other types. The format is:
1014
1015  uint32_t type;
1016  uint32_t payload_size;
1017  uint8_t  payload[payload_size];
1018 
1019Each call to bdecode_read_metadata is not guaranteed to start with the type field. You can do partial
1020reads of blocks. All data is in host endianness.
1021
1022For CRC data, type is 0. The payload is a stream of the following format:
1023
1024  uint32_t luma;
1025  uint32_t chroma;
1026
1027**/
1028bresult bdecode_read_metadata(
1029    bdecode_t decode,
1030    void *buffer, /* [size_is(size)] memory buffer where metadata will be read into */
1031    unsigned size, /* size of buffer */
1032    unsigned *amount_read /* [out] amount of data read into buffer */
1033    );
1034
1035/**
1036Summary:
1037Have display path allocate an extra capture buffer so that the app can call bdecode_get_capture_buffer.
1038**/
1039bresult bdecode_allocate_capture_buffers(
1040    bdecode_t decode, 
1041    unsigned count /* 0 is disabled, otherwise it's the number of user capture buffers that are allowable at a time. */
1042    );
1043
1044/**
1045Summary:
1046Return a current capture buffer to an application.
1047Description:
1048You can capture up to a certain number of buffers, specified by the count passed into bdecode_allocate_capture_buffer.
1049Every buffer you capture, you must return with bdecode_return_capture_buffer.
1050**/
1051bsurface_t bdecode_acquire_capture_buffer(
1052    bdecode_t decode,
1053    bgraphics_t graphics,
1054    bool *top_field /* [out] returns true if bsurface_t is for a top field of an interlaced source. */
1055    );
1056 
1057/**
1058Summary:
1059Return a bsurface_t capture buffer which was received from bdecode_get_capture_buffer.
1060**/
1061bresult bdecode_release_capture_buffer(
1062    bdecode_t decode, 
1063    bsurface_t surface
1064    );
1065   
1066/* End of Decode API  */
1067
1068#ifdef __cplusplus
1069}
1070#endif
1071
1072
1073#endif /* BSETTOP_DECODE_H__ */
Note: See TracBrowser for help on using the repository browser.