source: svn/newcon3bcm2_21bu/BSEAV/api/include/bsettop_message.h @ 76

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

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

  • Property svn:executable set to *
File size: 11.5 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2008, 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_message.h $
11 * $brcm_Revision: 9 $
12 * $brcm_Date: 2/27/08 5:38p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /BSEAV/api/include/bsettop_message.h $
19 *
20 * 9   2/27/08 5:38p vsilyaev
21 * PR 32470: clarified use of bmessage_format_pes
22 *
23 * 8   1/18/07 11:36a vsilyaev
24 * PR 27186: Differentiate between parser and input bands. AKA, fixing
25 * bmessage from playback source
26 *
27 * 7   11/20/06 3:12p ahulse
28 * PR25212: Add psf_crc_disabled to bmessage_stream_params, so crc
29 * checking can be en/disabled on Private short form sections
30 *
31 * 6   8/12/05 3:30p erickson
32 * PR16659: added bmessage_stream_params.filter_group and reworked
33 * bmessage to handle wrapping correctly. now I'm copying a whole message
34 * into a intermediate buffer. this greatly simplifies the logic and
35 * removes the possibility of overwrite.
36 *
37 * 5   7/11/05 3:00p erickson
38 * PR15064: added bmessage_stream_params.psi_crc_disabled, which defaults
39 * false
40 *
41 * 4   7/11/05 2:27p erickson
42 * PR16044: updated documentation for bmessage
43 *
44 * 3   3/15/05 2:53p erickson
45 * PR13415: added notes on bmessage_format types
46 *
47 * 2   3/11/05 6:19p erickson
48 * PR13415: added support for multiple bmessage_stream_t's on the same
49 * band/pid using FilterGroups
50 *
51 * 1   2/7/05 7:05p dlwin
52 * Merge down for release 2005_REFSW_MERGETOMAIN:
53 *
54 * Irvine_BSEAVSW_Devel/32   8/10/04 4:23p erickson
55 * PR12152: added buffer_size
56 *
57 * Irvine_BSEAVSW_Devel/31   7/27/04 3:11p erickson
58 * PR11771: doc changes
59 *
60 * Irvine_BSEAVSW_Devel/30   7/9/04 1:34p erickson
61 * PR11771: removed size_is hint because it's not an array
62 *
63 * Irvine_BSEAVSW_Devel/29   7/6/04 3:53p erickson
64 * PR11771: settop api dataflow redesign
65 *
66 * Irvine_BSEAVSW_Devel/28   6/29/04 11:28a erickson
67 * PR11135: updated deprecation notices for settop api
68 *
69 * Irvine_BSEAVSW_Devel/27   5/25/04 11:43a erickson
70 * PR11135: clarified usage of bmessage_Read
71 *
72 * Irvine_BSEAVSW_Devel/26   12/9/03 12:14p erickson
73 * PR8892: added a bit more clarification
74 *
75 * Irvine_BSEAVSW_Devel/25   12/8/03 5:18p marcusk
76 * PR 8892: Furthur clarified documentation.
77 *
78 * Irvine_BSEAVSW_Devel/24   12/8/03 5:06p marcusk
79 * PR 8892: Updated documention regarding bmessage_filter usage.
80 *
81 * Irvine_BSEAVSW_Devel/23   11/7/03 4:28p erickson
82 * PR8583: removing, fixing or implementing TODO's
83 *
84 * Irvine_BSEAVSW_Devel/22   11/5/03 5:07p erickson
85 * PR8560: moved dss code back. this isn't the right solution.
86 *
87 ***************************************************************************/
88#ifndef BSETTOP_MESSAGE_H__
89#define BSETTOP_MESSAGE_H__
90
91#ifdef __cplusplus
92extern "C" {
93#endif
94
95/*=****************************
96The message api allows you to collect transport messages from a variety of
97data sources, including MPEG2 transport streams.
98
99We provide higher level libraries to parse PSI or PSIP message
100formats. Please refer to BSEAV/lib/mpeg2_ts_parse and BSEAV/linux/lib/tspsi.
101*******************************/
102
103/*
104Summary:
105        Handle returned by bmessage_open which represents one PID parser channel.
106*/
107typedef struct bmessage_struct *bmessage_stream_t;
108
109/*
110Summary:
111Format of data which you're parsing.
112Description:
113This maps to eSingleChannelRecordType in bcmtranshw.h.
114*/
115typedef enum bmessage_format {
116        bmessage_format_ts,  /* capture all transport packets in the pid, no filtering. transport header are captured. */
117        bmessage_format_pes, /* capture all PES packets (i.e. all transport payload) in the pid, no filtering. transport headers are stripped. */
118        bmessage_format_psi, /* capture PSI message using filter */
119        bmessage_format_dss_mpt, /* capture DSS MPT messages using filter */
120        bmessage_format_dss_aux, /* capture DSS AUX messages using filter */
121        bmessage_format_dss_regular /* capture DSS packets, no filtering (?) */
122} bmessage_format;
123
124/*
125Summary:
126Open a message stream for a particular format of data.
127
128Description:
129Message data does not start being collected until you call bmessage_start.
130*/
131bmessage_stream_t bmessage_open(
132        bmessage_format format
133        );
134
135/*
136Summary:
137PID filtering structure passed to bmessage_open.
138Description:
139All filtering is done using bit by bit comparisons.
140
141There are two types of masks that are used in conjuntion with the coefs.
142
143inclusion mask (mask) - for all inclusion mask bits that are unmasked
144                (set to 0) ALL of the corresponding bits in the
145                message must match the bits specified by the coef in order to
146                                be included. If one bit differs, it will be excluded.
147
148exclusion mask (excl) - for all exclusion mask bits that are unmasked
149                (set to 0) at least one of the corresponding bits
150                in the message must NOT match the bits specified
151                by the coef in order to be included. If all of the bits
152                                match, it will be excluded.
153
154Results from both comparisons are AND'd together to form the final pass/fail decision.
155
156Exception: Currently for MPEG2 streams, byte 2 (i.e. the message length field)
157of the filter and the MPEG2 message data is ignored.
158*/
159typedef struct bmessage_filter {
160        uint8_t mask[16];       /* Bits to be ignored. See Description. */
161        uint8_t coef[16];       /* Bits to be included. See Description. */
162        uint8_t excl[16];       /* Bits to be excluded. Doesn't apply to Venom2 platforms. See Description. */
163} bmessage_filter;
164
165/**
166Summary:
167Parameters for bmessage_start
168**/
169typedef struct bmessage_stream_params {
170        bband_t band;                           /* The input band used to filter. Filtering actually happens on the parser band, but
171                                                                        this is mapped internally.
172                                                                        This setting is mutually exclusive with bmessage_stream_params.stream. */
173        bstream_t stream; /* This is the playback stream to filter. It is required that the playback already be routed
174                                        to a parser band, otherwise this function will fail. On RAVE systems, playback always has a
175                                        dedicated parser band. On non-RAVE systems, you must set
176                                                bplayback_params.route_through_parser_band = true.
177                                        This setting is mutually exclusive with bmessage_stream_params.bnd. */
178        uint16_t pid;                           /* the pid to filter */
179        bmessage_filter filter;         /* the filter to apply */
180        int buffer_size;                        /* In kilobytes. Default is 4K. Ranges between
181                                                                        1K and 512K in powers of 2. */
182        bool filter_group;                      /* Defaults to false.
183                You can expand the number of message filters you use by using filter groups.
184                A filter group is a set of filters that share the same band and pid. All filters in the group
185                share the same pid channel. The downside is that all messages for a pid channel arrive in the
186                same buffer, and an additional software filter compare must be used to sort out who is gets the message.
187                Also, messages that wrap around the end of the buffer must be copied into an intermediate buffer.
188                If a filter group is not enabled, you will get higher throughput from bmessage because there
189                will be no copies or software filter comparisons, but you will be limited by the number of pid channels available. */
190
191        /* NOTE: psi_crc_disabled and psf_crc_disabled and can be used in the following  */
192        /* combinations to give the following functionality :                            */
193        /*                                                                               */
194        /* AUTO Mode  : CRC check is determined by the short/long form private section   */
195        /*              if short form (section_syntax_indicator=0) no crc is checked     */
196        /*              if long form  (section_syntax_indicator=1) crc is needed         */
197        /* enable CRC : CRC enabled  for both short and long form private section.       */
198        /* disable CRC: CRC disabled for both short and long form private section.       */
199        /*                                                                               */
200        /* AUTO       : psf_crc_disabled = true , psi_crc_disabled = false               */
201        /* enable CRC : psf_crc_disabled = false, psi_crc_disabled = false               */
202        /* disable CRC: psf_crc_disabled = true,  psi_crc_disabled = true                */
203
204        bool psi_crc_disabled;          /* disable CRC check of PSI message data */
205        bsettop_callback data_ready_callback;   /* Optional callback to notify the application
206                when bmessage_stream_get_buffer will return more data to be read.
207                When you get a callback, additional callbacks will be disabled until you
208                call bmessage_get_buffer.
209               
210                If you are using multiple bmessage_streams on the same band & pid,
211                then the behavior will change slightly. You may receive callbacks
212                and yet get no data when calling bmessage_get_buffer. This still falls
213                within specified behavior, and is necessary to make the internal
214                algorithm work.
215                */
216        bsettop_callback overflow;      /* Optional callback to notify the user when
217                                                                        an overflow has occured. */
218        void *callback_context;         /* User defined context which will be passed to
219                                                                        the above callback functions. */
220        bool psf_crc_disabled;          /* disable Private Short Form CRC check of PSI data */
221} bmessage_stream_params;
222
223void bmessage_stream_params_init(
224        bmessage_stream_params *params,
225        bmessage_stream_t stream);
226
227/*
228Summary:
229Start filtering a message stream for a particular band and pid.
230
231Description:
232You can have multiple message streams started at the same time for the same band.
233This technique makes message processing faster. The limit of message streams
234depends on hardware.
235*/
236bresult bmessage_start(
237        bmessage_stream_t message_stream,
238        const bmessage_stream_params *params
239        );
240
241/*
242Summary:
243Get pointer to data available to be read from the transport message buffer.
244
245Description:
246The data in the buffer is raw and unparsed.
247Depending on your buffer sizes and the amount of data captured, subsequent reads may
248return data that starts in the middle of a message. It's up to the application
249to join multiple reads together and parse the data.
250
251The transport hardware will return messages with a trailing pad to ensure
2524 byte alignment. You'll need to skip over these bytes in your app, however you
253must include these bytes in your count for the bmessage_read_complete.
254
255This function is always non-blocking.
256*/
257bresult bmessage_get_buffer(
258        bmessage_stream_t message_stream, /* message stream handle returned by bmessage_open */
259        const void ** p_bfr,                    /* [out] memory to read into */
260        size_t *length
261        );
262
263/**
264Summary:
265After processing bmessage_get_buffer, use this function to report back how much
266data was consumed.
267
268Description:
269You should never call bmessage_read_complete twice in a row without calling
270bmessage_get_buffer again.
271
272The amount_consumed can never be greater than the length last returned by
273bmessage_get_buffer.
274**/
275bresult bmessage_read_complete(
276        bmessage_stream_t message_stream, /* message stream handle returned by bmessage_open */
277        size_t amount_consumed
278        );
279
280/*
281Summary:
282Stop any more data from being filtered.
283
284Description:
285You cannot call bmessage_get_buffer after this.
286You can call bmessage_start to start again, or bmessage_close to clean up.
287*/
288void bmessage_stop(
289        bmessage_stream_t message_stream /* message stream handle returned by bmessage_open */
290        );
291
292/*
293Summary:
294Close a message stream.
295
296Description:
297If the message stream was not already stopped, it will be.
298The bmessage_stream_t handle is no longer valid.
299*/
300void bmessage_close(
301        bmessage_stream_t message_stream /* message stream handle returned by bmessage_open */
302        );
303
304#ifdef __cplusplus
305}
306#endif
307
308#endif /* BSETTOP_MESSAGE_H__ */
Note: See TracBrowser for help on using the repository browser.