| 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_vbi.h $ |
|---|
| 11 | * $brcm_Revision: 6 $ |
|---|
| 12 | * $brcm_Date: 3/20/08 5:12p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/api/include/bsettop_vbi.h $ |
|---|
| 19 | * |
|---|
| 20 | * 6 3/20/08 5:12p vsilyaev |
|---|
| 21 | * PR 40468: Updated description of the bdisplay_vbi_tt_write |
|---|
| 22 | * |
|---|
| 23 | * PR8365/1 2/15/06 8:29p shyam |
|---|
| 24 | * PR 8365 : Put in CC708 changes for efficiently handling cc708 and demux |
|---|
| 25 | * 608 data and 708 data |
|---|
| 26 | * |
|---|
| 27 | * 4 2/13/06 3:35p katrep |
|---|
| 28 | * PR18943: added bdisplay_vbi_tt_write and bstream_vbi_tt_read (not |
|---|
| 29 | * implemented) |
|---|
| 30 | * |
|---|
| 31 | * 3 10/28/05 7:55p rjlewis |
|---|
| 32 | * PR17043: Added ability to disable CGMS and WSS output. |
|---|
| 33 | * Added ability to determine if CGMS & WSS output is enabled. |
|---|
| 34 | * |
|---|
| 35 | * 2 3/21/05 9:06a erickson |
|---|
| 36 | * PR13306: added cgms and wss set functions |
|---|
| 37 | * |
|---|
| 38 | * 1 2/7/05 7:07p dlwin |
|---|
| 39 | * Merge down for release 2005_REFSW_MERGETOMAIN: |
|---|
| 40 | * |
|---|
| 41 | * Irvine_BSEAVSW_Devel/5 2/3/05 12:59p erickson |
|---|
| 42 | * PR13305: added bdisplay_vbi_cc_write api |
|---|
| 43 | * |
|---|
| 44 | * Irvine_BSEAVSW_Devel/4 11/16/04 1:01p shyam |
|---|
| 45 | * PR 8365 : Changed for supporting CC708 |
|---|
| 46 | * |
|---|
| 47 | * Irvine_BSEAVSW_Devel/3 7/6/04 3:54p erickson |
|---|
| 48 | * PR11771: settop api dataflow redesign |
|---|
| 49 | * |
|---|
| 50 | * Irvine_BSEAVSW_Devel/2 6/29/04 11:28a erickson |
|---|
| 51 | * PR11135: updated deprecation notices for settop api |
|---|
| 52 | * |
|---|
| 53 | * Irvine_BSEAVSW_Devel/1 11/14/03 2:10p erickson |
|---|
| 54 | * PR8612: added vbi support to settop api |
|---|
| 55 | * |
|---|
| 56 | ***************************************************************************/ |
|---|
| 57 | #ifndef BSETTOP_VBI_H__ |
|---|
| 58 | #define BSETTOP_VBI_H__ |
|---|
| 59 | |
|---|
| 60 | #ifdef __cplusplus |
|---|
| 61 | extern "C" { |
|---|
| 62 | #endif |
|---|
| 63 | |
|---|
| 64 | /*=**************************************** |
|---|
| 65 | The vbi api supports close captioning, teletext and other formats. |
|---|
| 66 | You can decode and capture vbi from an analog or digital stream. |
|---|
| 67 | You can route the vbi information out to certain analog displays (e.g. composite and |
|---|
| 68 | svideo) |
|---|
| 69 | or capture it as data for use by the application. |
|---|
| 70 | |
|---|
| 71 | After getting a new stream (either from btuner_tune_XXX or from bstream_open), all |
|---|
| 72 | vbi outputs default to off. You must explicitly turn each output by assigning |
|---|
| 73 | display handles to the bstream_vbi_settings structure. |
|---|
| 74 | |
|---|
| 75 | The reason we default vbi to off is that the settop api cannot guess the correct |
|---|
| 76 | output in certain configurations. Consider a PIP system. You have two decodes and |
|---|
| 77 | only one can output vbi at a time. The application must decide. |
|---|
| 78 | *******************************************/ |
|---|
| 79 | |
|---|
| 80 | /* |
|---|
| 81 | Summary: |
|---|
| 82 | Settings structure to control decoding, capture and routing of VBI to displays. |
|---|
| 83 | */ |
|---|
| 84 | typedef struct bstream_vbi_settings { |
|---|
| 85 | struct { |
|---|
| 86 | bdisplay_t display; /* if NULL, then disabled */ |
|---|
| 87 | unsigned line; /* only applies to PAL */ |
|---|
| 88 | } cc; |
|---|
| 89 | struct { |
|---|
| 90 | bdisplay_t display; /* if NULL, then disabled */ |
|---|
| 91 | unsigned lines[10]; |
|---|
| 92 | } tt; |
|---|
| 93 | struct { |
|---|
| 94 | bdisplay_t display; /* if NULL, then disabled */ |
|---|
| 95 | } cgms; |
|---|
| 96 | struct { |
|---|
| 97 | bdisplay_t display; /* if NULL, then disabled */ |
|---|
| 98 | } wss; |
|---|
| 99 | |
|---|
| 100 | bsettop_callback cc_data_ready_callback; /* Callback when notifies the user |
|---|
| 101 | when data is available in the bstream_vbi_cc_read function. |
|---|
| 102 | It is permissible to call bstream_vbi_cc_read from inside the callback. */ |
|---|
| 103 | void *callback_context; /* User defined context which is passed to |
|---|
| 104 | the above callback. */ |
|---|
| 105 | } bstream_vbi_settings; |
|---|
| 106 | |
|---|
| 107 | /* |
|---|
| 108 | Summary: |
|---|
| 109 | Get current vbi settings. |
|---|
| 110 | */ |
|---|
| 111 | void bstream_vbi_get_settings( |
|---|
| 112 | bstream_t stream, /* analog or digital stream */ |
|---|
| 113 | bstream_vbi_settings *settings /* [out] */ |
|---|
| 114 | ); |
|---|
| 115 | |
|---|
| 116 | /* |
|---|
| 117 | Summary: |
|---|
| 118 | Set new vbi settings. |
|---|
| 119 | */ |
|---|
| 120 | bresult bstream_vbi_set_settings( |
|---|
| 121 | bstream_t stream, /* analog or digital stream */ |
|---|
| 122 | const bstream_vbi_settings *settings /* new settings */ |
|---|
| 123 | ); |
|---|
| 124 | |
|---|
| 125 | /* |
|---|
| 126 | Summary: |
|---|
| 127 | VBI closed captioning data atom |
|---|
| 128 | */ |
|---|
| 129 | typedef struct bstream_vbi_cc { |
|---|
| 130 | uint8_t data[2]; |
|---|
| 131 | int field; /* 0 is top, 1 is bottom */ |
|---|
| 132 | int cc_type; /* 0/1 means 608, 2/3 means 708 */ |
|---|
| 133 | } bstream_vbi_cc; |
|---|
| 134 | |
|---|
| 135 | /* |
|---|
| 136 | Summary: |
|---|
| 137 | Read vbi closed caption data from a stream. |
|---|
| 138 | |
|---|
| 139 | Description: |
|---|
| 140 | This function never blocks. Use the bstream_vbi_settings.cc_data_ready_callback |
|---|
| 141 | callback to know when data is available. |
|---|
| 142 | */ |
|---|
| 143 | bresult bstream_vbi_cc_read( |
|---|
| 144 | bstream_t stream, /* analog or digital stream */ |
|---|
| 145 | bstream_vbi_cc *data, /* [out,size_is(length)] */ |
|---|
| 146 | size_t length, /* # of bstream_vbi_cc's pointed to by data param */ |
|---|
| 147 | size_t *length_read /* [out] actual number of bstream_vbi_cc's read into data buffer */ |
|---|
| 148 | ); |
|---|
| 149 | |
|---|
| 150 | /* |
|---|
| 151 | Summary: |
|---|
| 152 | CC708 VBI closed captioning data atom |
|---|
| 153 | */ |
|---|
| 154 | typedef struct bstream_cc_708 { |
|---|
| 155 | uint8_t cc_type; /* 0/1 means 608, 2/3 means 708 */ |
|---|
| 156 | uint8_t data[2]; |
|---|
| 157 | } bstream_cc_708; |
|---|
| 158 | |
|---|
| 159 | /* |
|---|
| 160 | Summary: |
|---|
| 161 | Read CC708 vbi closed caption data from a stream. |
|---|
| 162 | |
|---|
| 163 | Description: |
|---|
| 164 | This function never blocks. Use the bstream_vbi_settings.cc_data_ready_callback |
|---|
| 165 | callback to know when data is available. |
|---|
| 166 | */ |
|---|
| 167 | bresult bstream_vbi_cc708_read( |
|---|
| 168 | bstream_t stream, /* analog or digital stream */ |
|---|
| 169 | bstream_cc_708 *data, /* [out,size_is(length)] */ |
|---|
| 170 | size_t length, /* # of bstream_vbi_cc's pointed to by data param */ |
|---|
| 171 | size_t *length_read /* [out] actual number of bstream_vbi_cc's read into data buffer */ |
|---|
| 172 | ); |
|---|
| 173 | |
|---|
| 174 | /* |
|---|
| 175 | Summary: |
|---|
| 176 | Write vbi closed caption data for output to the VEC |
|---|
| 177 | |
|---|
| 178 | Description: |
|---|
| 179 | This function never blocks. There is no callback to know when space |
|---|
| 180 | is available, but in general one data item is consumed every field. |
|---|
| 181 | */ |
|---|
| 182 | bresult bdisplay_vbi_cc_write( |
|---|
| 183 | bdisplay_t display, /* display (must be SD format) */ |
|---|
| 184 | const bstream_vbi_cc *data, /* [size_is(length)] */ |
|---|
| 185 | size_t length, /* # of bstream_vbi_cc's pointed to by data param */ |
|---|
| 186 | size_t *length_written /* The actual number of bstream_vbi_cc's writen |
|---|
| 187 | into the display queue. This is used for flow |
|---|
| 188 | control. */ |
|---|
| 189 | ); |
|---|
| 190 | |
|---|
| 191 | /* |
|---|
| 192 | Summary |
|---|
| 193 | VBI teletext data |
|---|
| 194 | */ |
|---|
| 195 | typedef struct bstream_vbi_tt { |
|---|
| 196 | uint8_t framingCode; |
|---|
| 197 | uint8_t data[42]; |
|---|
| 198 | }bstream_vbi_tt; |
|---|
| 199 | |
|---|
| 200 | /* |
|---|
| 201 | Summary: |
|---|
| 202 | Read vbi teletext data from a stream. |
|---|
| 203 | |
|---|
| 204 | Description: |
|---|
| 205 | This function never blocks. |
|---|
| 206 | */ |
|---|
| 207 | bresult bstream_vbi_tt_read( |
|---|
| 208 | bstream_t stream, /* analog or digital stream */ |
|---|
| 209 | bstream_vbi_tt *data, /* [out,size_is(length)] */ |
|---|
| 210 | size_t length, /* # of bstream_vbi_cc's pointed to by data param */ |
|---|
| 211 | size_t *length_read /* [out] actual number of bstream_vbi_cc's read into data buffer */ |
|---|
| 212 | ); |
|---|
| 213 | |
|---|
| 214 | /* |
|---|
| 215 | Summary: |
|---|
| 216 | Write vbi teletext data for output to the VEC |
|---|
| 217 | |
|---|
| 218 | Description: |
|---|
| 219 | This function never blocks. There is no callback to know when space |
|---|
| 220 | is available, but in general one data item is consumed every field. But, |
|---|
| 221 | if the function returns an error, for flowcontrol, the line is not consumed |
|---|
| 222 | and the user should retry. |
|---|
| 223 | */ |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | bresult bdisplay_vbi_tt_write( |
|---|
| 227 | bdisplay_t display, /* display (must be SD format) */ |
|---|
| 228 | const bstream_vbi_tt *data, /* [size_is(length)] */ |
|---|
| 229 | size_t length, /* # of bstream_vbi_cc's pointed to by data param */ |
|---|
| 230 | uint8_t polarity /* 0 = bottom , 1= top field */ |
|---|
| 231 | ); |
|---|
| 232 | |
|---|
| 233 | #define BDISPLAY_VBI_INVALID_CGMS (0xffffffff) /* use to disable CGMS output */ |
|---|
| 234 | |
|---|
| 235 | /** |
|---|
| 236 | Summary: |
|---|
| 237 | Set the CGMS value to be encoded into display. |
|---|
| 238 | |
|---|
| 239 | Description: |
|---|
| 240 | This only works if the display is SD and has the VBI encoder. |
|---|
| 241 | On dual output systems, this is usually the SD-only output. |
|---|
| 242 | |
|---|
| 243 | This requires that bstream_vbi_settings.cgms.display is false. Otherwise |
|---|
| 244 | the value will be overwritten by the stream input. Use cgms_value of |
|---|
| 245 | BDISPLAY_VBI_INVALID_CGMS to disable CGMS output. |
|---|
| 246 | **/ |
|---|
| 247 | bresult bdisplay_vbi_set_cgms( |
|---|
| 248 | bdisplay_t display, /* display (must be SD format) */ |
|---|
| 249 | uint32_t cgms_value /* CGMS value to pass out VBI */ |
|---|
| 250 | ); |
|---|
| 251 | |
|---|
| 252 | #define BDISPLAY_VBI_INVALID_WSS (0xffff) /* use to disable WSS output */ |
|---|
| 253 | |
|---|
| 254 | /** |
|---|
| 255 | Summary: |
|---|
| 256 | Set the WSS value to be encoded into display. |
|---|
| 257 | |
|---|
| 258 | Description: |
|---|
| 259 | This only works if the display is SD and has the VBI encoder. |
|---|
| 260 | On dual output systems, this is usually the SD-only output. |
|---|
| 261 | |
|---|
| 262 | This requires that bstream_vbi_settings.wss.display is false. Otherwise |
|---|
| 263 | the value will be overwritten by the stream input. Use wss_value of |
|---|
| 264 | BDISPLAY_VBI_INVALID_WSS to disable WSS output. |
|---|
| 265 | **/ |
|---|
| 266 | bresult bdisplay_vbi_set_wss( |
|---|
| 267 | bdisplay_t display, /* display (must be SD format) */ |
|---|
| 268 | uint16_t wss_value /* WSS value to pass out VBI */ |
|---|
| 269 | ); |
|---|
| 270 | |
|---|
| 271 | /** |
|---|
| 272 | Summary: |
|---|
| 273 | Determine if the CGMS value is being encoded into display. |
|---|
| 274 | |
|---|
| 275 | Description: |
|---|
| 276 | This only works if the display is SD and has the VBI encoder. |
|---|
| 277 | On dual output systems, this is usually the SD-only output. |
|---|
| 278 | |
|---|
| 279 | This requires that bstream_vbi_settings.cgms.display is false. |
|---|
| 280 | **/ |
|---|
| 281 | bresult bdisplay_vbi_get_cgms( |
|---|
| 282 | bdisplay_t display, /* display (must be SD format) */ |
|---|
| 283 | bool *enabled |
|---|
| 284 | ); |
|---|
| 285 | |
|---|
| 286 | /** |
|---|
| 287 | Summary: |
|---|
| 288 | Determine if WSS value is being encoded into display. |
|---|
| 289 | |
|---|
| 290 | Description: |
|---|
| 291 | This only works if the display is SD and has the VBI encoder. |
|---|
| 292 | On dual output systems, this is usually the SD-only output. |
|---|
| 293 | |
|---|
| 294 | This requires that bstream_vbi_settings.wss.display is false. |
|---|
| 295 | **/ |
|---|
| 296 | bresult bdisplay_vbi_get_wss( |
|---|
| 297 | bdisplay_t display, /* display (must be SD format) */ |
|---|
| 298 | bool *enabled |
|---|
| 299 | ); |
|---|
| 300 | |
|---|
| 301 | #ifdef __cplusplus |
|---|
| 302 | } |
|---|
| 303 | #endif |
|---|
| 304 | |
|---|
| 305 | #endif /* BSETTOP_VBI_H__ */ |
|---|