| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2002, 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: bcmDccTransport.h $ |
|---|
| 11 | * $brcm_Revision: \main\SanJose_MSTV_Devel\1 $ |
|---|
| 12 | * $brcm_Date: 3/12/02 4:46p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: $ |
|---|
| 19 | * |
|---|
| 20 | * \main\SanJose_MSTV_Devel\1 3/12/02 4:46p erikg |
|---|
| 21 | * Merge from SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38 |
|---|
| 22 | * |
|---|
| 23 | * \main\SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38\1 3/6/02 11:29a erikg |
|---|
| 24 | * new include files |
|---|
| 25 | * |
|---|
| 26 | ***************************************************************************/ |
|---|
| 27 | |
|---|
| 28 | #ifndef BCMDCCTRANSPORT_H |
|---|
| 29 | #define BCMDCCTRANSPORT_H |
|---|
| 30 | |
|---|
| 31 | #ifdef __cplusplus |
|---|
| 32 | extern "C" { |
|---|
| 33 | #endif |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | /********************** |
|---|
| 38 | * |
|---|
| 39 | * INCLUDES |
|---|
| 40 | * |
|---|
| 41 | **********************/ |
|---|
| 42 | |
|---|
| 43 | #include "bcmDcc.h" |
|---|
| 44 | #include "bcmDccTransportMux.h" |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | /********************** |
|---|
| 49 | * |
|---|
| 50 | * DEFINES |
|---|
| 51 | * |
|---|
| 52 | **********************/ |
|---|
| 53 | |
|---|
| 54 | /* |
|---|
| 55 | * DCC_TYPE_XXX |
|---|
| 56 | * |
|---|
| 57 | * These are bitmasks used for DccTransport_QueryDetectedFormats |
|---|
| 58 | */ |
|---|
| 59 | #define DCC_TYPE_DVS157 1 |
|---|
| 60 | #define DCC_TYPE_A53_608 2 |
|---|
| 61 | #define DCC_TYPE_A53_DTVCC 4 |
|---|
| 62 | #define DCC_TYPE_UNKNOWN 8 |
|---|
| 63 | |
|---|
| 64 | /* |
|---|
| 65 | * Field Indicator, used for DccTransport_Process |
|---|
| 66 | */ |
|---|
| 67 | #define DCC_608_FIELD_TOP 1 |
|---|
| 68 | #define DCC_608_FIELD_BOTTOM 2 |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | /********************** |
|---|
| 73 | * |
|---|
| 74 | * TYPES |
|---|
| 75 | * |
|---|
| 76 | **********************/ |
|---|
| 77 | |
|---|
| 78 | /******************************************** |
|---|
| 79 | * |
|---|
| 80 | * Enum: DCC_CC608_TYPE |
|---|
| 81 | * |
|---|
| 82 | * Description: |
|---|
| 83 | * |
|---|
| 84 | * DCC_CC608_TYPE enumerates how the function |
|---|
| 85 | * DccTransport_Process is to choose which |
|---|
| 86 | * type of 608 to output. |
|---|
| 87 | * |
|---|
| 88 | ********************************************/ |
|---|
| 89 | typedef enum tagDCC_CC608_TYPE |
|---|
| 90 | { |
|---|
| 91 | CC608_A53 = 0, /* A53 only */ |
|---|
| 92 | CC608_DVS157 = 1, /* DVS157 only */ |
|---|
| 93 | CC608_A53Preferred = 2 /* A53 if present, else DVS157 */ |
|---|
| 94 | |
|---|
| 95 | } DCC_CC608_TYPE ; |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | /******************************************** |
|---|
| 99 | * |
|---|
| 100 | * Structure: DCC_TRANSPORT_OBJECT |
|---|
| 101 | * |
|---|
| 102 | * Description: |
|---|
| 103 | * |
|---|
| 104 | * The DCC_TRANSPORT_OBJECT structure holds the |
|---|
| 105 | * state for an MPEG Picture User Data parsing |
|---|
| 106 | * session. |
|---|
| 107 | * |
|---|
| 108 | ********************************************/ |
|---|
| 109 | typedef struct tagDCC_TRANSPORT_OBJECT |
|---|
| 110 | { |
|---|
| 111 | /* |
|---|
| 112 | * CC608Type |
|---|
| 113 | * |
|---|
| 114 | * The CC608Type enum specifies |
|---|
| 115 | * which type of 608 is to be output |
|---|
| 116 | * when DccTransport_Process is called. |
|---|
| 117 | */ |
|---|
| 118 | DCC_CC608_TYPE CC608Type ; |
|---|
| 119 | |
|---|
| 120 | /* |
|---|
| 121 | * CC608TypeStorage |
|---|
| 122 | * |
|---|
| 123 | * CC608TypeStorage is the state necessary |
|---|
| 124 | * for keeping track of which type of 608 |
|---|
| 125 | * CC data is present in a stream. |
|---|
| 126 | */ |
|---|
| 127 | DCC_CC608_MUX_STATE CC608MuxState ; |
|---|
| 128 | |
|---|
| 129 | } DCC_TRANSPORT_OBJECT ; |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | /********************** |
|---|
| 134 | * |
|---|
| 135 | * FUNCTIONS |
|---|
| 136 | * |
|---|
| 137 | **********************/ |
|---|
| 138 | |
|---|
| 139 | /************************************************************************** |
|---|
| 140 | * |
|---|
| 141 | * Function: DccTransport_Init |
|---|
| 142 | * |
|---|
| 143 | * Inputs: |
|---|
| 144 | * pObj - object to init |
|---|
| 145 | * OutputType - defines which 608 CC type to output |
|---|
| 146 | * |
|---|
| 147 | * Outputs: |
|---|
| 148 | * pObj - object state is modified |
|---|
| 149 | * |
|---|
| 150 | * Returns: dccSuccess or a standard DCCERR error code |
|---|
| 151 | * |
|---|
| 152 | * Description: |
|---|
| 153 | * |
|---|
| 154 | * This function initializes an MPEG CC transport session. |
|---|
| 155 | * |
|---|
| 156 | **************************************************************************/ |
|---|
| 157 | DCCERR |
|---|
| 158 | DccTransport_Init( |
|---|
| 159 | DCC_TRANSPORT_OBJECT * pObj, |
|---|
| 160 | DCC_CC608_TYPE OutputType) ; |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | /************************************************************************** |
|---|
| 164 | * |
|---|
| 165 | * Function: DccTransport_Fini |
|---|
| 166 | * |
|---|
| 167 | * Inputs: |
|---|
| 168 | * pObj - object, previously init'ed |
|---|
| 169 | * |
|---|
| 170 | * Outputs: |
|---|
| 171 | * <none> |
|---|
| 172 | * |
|---|
| 173 | * Returns: dccSuccess or a standard DCCERR error code |
|---|
| 174 | * |
|---|
| 175 | * Description: |
|---|
| 176 | * |
|---|
| 177 | * This function undoes the initialization done by DccTransport_Init. |
|---|
| 178 | * |
|---|
| 179 | **************************************************************************/ |
|---|
| 180 | DCCERR |
|---|
| 181 | DccTransport_Fini(DCC_TRANSPORT_OBJECT * pObj) ; |
|---|
| 182 | |
|---|
| 183 | |
|---|
| 184 | /************************************************************************** |
|---|
| 185 | * |
|---|
| 186 | * Function: DccTransport_Process |
|---|
| 187 | * |
|---|
| 188 | * Inputs: |
|---|
| 189 | * pObj - object, previously init'ed |
|---|
| 190 | * pInputBuf - input buffer, holds 1/more User Data |
|---|
| 191 | * InputBufSize - size in bytes of input buffer |
|---|
| 192 | * ulPicInfo - picture info from bcmMPIReadCCStatus |
|---|
| 193 | * |
|---|
| 194 | * Outputs: |
|---|
| 195 | * p608BufInfo - describes output buf for 608, or NULL |
|---|
| 196 | * pDTVCCBufInfo - describes output buf for DTVCC, or NULL |
|---|
| 197 | * |
|---|
| 198 | * Returns: dccSuccess or a standard DCCERR error code |
|---|
| 199 | * |
|---|
| 200 | * Description: |
|---|
| 201 | * |
|---|
| 202 | * Reads the input buffer and copies CC data to the output buffer(s). This |
|---|
| 203 | * function parses the looking for DTVCC Closed Captioning data or the type |
|---|
| 204 | * of 608 CC data specified in the DccTransport_Init function. This function |
|---|
| 205 | * scans up to InputBufSize bytes of the pInputBuf buffer. The parsing logic |
|---|
| 206 | * looks for Picture User Data start_codes, namely, the byte sequence 00 00 01 B2. |
|---|
| 207 | * |
|---|
| 208 | * If multiple Picture User Data areas are found, each will be processed in order, |
|---|
| 209 | * and the CC bytes extracted from each will be copied to the output buffer(s). If |
|---|
| 210 | * DTVCC Closed Captioning data is found and if pDTVCCBufInfo is not NULL, then |
|---|
| 211 | * DTVCC data is parsed and copied to pDTVCCBufInfo. |
|---|
| 212 | * |
|---|
| 213 | * If p608BufInfo is not NULL, then this function will copy 608 Closed Captioning |
|---|
| 214 | * data according to the OutputType argument in the DccTransport_Init( ) call: |
|---|
| 215 | * |
|---|
| 216 | * CC608_A53: Only valid CC bytes from ATSC A/53 will be output. |
|---|
| 217 | * CC608_DVS157: Only valid CC Bytes from DVS157 will be output. |
|---|
| 218 | * CC608_A53Preferred: This function will track the presence of both A53 |
|---|
| 219 | * and DVS157 formats. If only one format is detected, |
|---|
| 220 | * it will be output. If both formats are detected, A53 |
|---|
| 221 | * will be output. This algorithm uses a sliding window |
|---|
| 222 | * approach. |
|---|
| 223 | * |
|---|
| 224 | **************************************************************************/ |
|---|
| 225 | DCCERR |
|---|
| 226 | DccTransport_Process( |
|---|
| 227 | DCC_TRANSPORT_OBJECT * pObj, |
|---|
| 228 | unsigned char * pInputBuf, |
|---|
| 229 | unsigned int InputBufSize, |
|---|
| 230 | //unsigned long ulPicInfo, |
|---|
| 231 | DCC_OUTBUF_INFO * p608BufInfo, |
|---|
| 232 | DCC_OUTBUF_INFO * pDTVCCBufInfo) ; |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | /************************************************************************** |
|---|
| 236 | * |
|---|
| 237 | * Function: DccTransport_QueryDetectedFormats |
|---|
| 238 | * |
|---|
| 239 | * Inputs: |
|---|
| 240 | * pObj - object, previously init'ed |
|---|
| 241 | * |
|---|
| 242 | * Outputs: |
|---|
| 243 | * pDetectedFormats - bitmask, each bit reps one format |
|---|
| 244 | * DCC_TYPE_DVS157 |
|---|
| 245 | * DCC_TYPE_A53_608 |
|---|
| 246 | * DCC_TYPE_A53_DTVCC |
|---|
| 247 | * DCC_TYPE_UNKNOWN |
|---|
| 248 | * |
|---|
| 249 | * Returns: dccSuccess or a standard DCCERR error code |
|---|
| 250 | * |
|---|
| 251 | * Description: |
|---|
| 252 | * |
|---|
| 253 | * This function retrieves a bitmask representing which formats have been |
|---|
| 254 | * detected in the stream. This is useful because on any call to |
|---|
| 255 | * DccTransport_Process, the caller cannot merely look at the number of bytes |
|---|
| 256 | * output for each output buffer to determine the detected formats. |
|---|
| 257 | * |
|---|
| 258 | **************************************************************************/ |
|---|
| 259 | DCCERR |
|---|
| 260 | DccTransport_QueryDetectedFormats( |
|---|
| 261 | DCC_TRANSPORT_OBJECT * pObj, |
|---|
| 262 | unsigned int * pDetectedFormats) ; |
|---|
| 263 | |
|---|
| 264 | |
|---|
| 265 | |
|---|
| 266 | |
|---|
| 267 | |
|---|
| 268 | #ifdef __cplusplus |
|---|
| 269 | } |
|---|
| 270 | #endif |
|---|
| 271 | |
|---|
| 272 | #endif /* BCMDCCTRANSPORT_H */ |
|---|
| 273 | |
|---|
| 274 | |
|---|