| 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: bcmDccTransportMux.h $ |
|---|
| 11 | * $brcm_Revision: \main\SanJose_MSTV_Devel\1 $ |
|---|
| 12 | * $brcm_Date: 3/12/02 4:45p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: $ |
|---|
| 19 | * |
|---|
| 20 | * \main\SanJose_MSTV_Devel\1 3/12/02 4:45p 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\3 3/12/02 3:58p erikg |
|---|
| 24 | * removed the winner function |
|---|
| 25 | * |
|---|
| 26 | * \main\SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38\2 3/7/02 4:21p erikg |
|---|
| 27 | * more fleshing out |
|---|
| 28 | * |
|---|
| 29 | * \main\SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38\1 3/6/02 11:29a erikg |
|---|
| 30 | * new include files |
|---|
| 31 | * |
|---|
| 32 | ***************************************************************************/ |
|---|
| 33 | |
|---|
| 34 | /*************************************************************************** |
|---|
| 35 | * Theory of Operation |
|---|
| 36 | * -------------------- |
|---|
| 37 | * |
|---|
| 38 | * This module is used to detect which 608 CC data formats are |
|---|
| 39 | * present in an MPEG stream. It does this by maintaining an |
|---|
| 40 | * accumulation count for each type. When each 608 data type |
|---|
| 41 | * is encountered in the stream, its corresponding count is |
|---|
| 42 | * incremented. These counts continue to accumulate up to a |
|---|
| 43 | * maximum. The maximum can be thought of as a clip value. In |
|---|
| 44 | * a basic sense, those types whose counts are at the maximum |
|---|
| 45 | * are present. |
|---|
| 46 | * |
|---|
| 47 | * To handle the case when a type is disappears from the stream, |
|---|
| 48 | * we periodically subtract from each count. We chose the increment |
|---|
| 49 | * value and decrement value such that if a type is present, its |
|---|
| 50 | * count will increment eventhough its count is also periodically |
|---|
| 51 | * decremented. For example, the increment may be 3 while the |
|---|
| 52 | * decrement may be 1. |
|---|
| 53 | * |
|---|
| 54 | * Finally, we define some threshhold, which is below the maximum, |
|---|
| 55 | * above which we consider the type to be present in the stream. |
|---|
| 56 | * |
|---|
| 57 | ***************************************************************************/ |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | #ifndef BCMDCCTRANSPORTMUX_H |
|---|
| 62 | #define BCMDCCTRANSPORTMUX_H |
|---|
| 63 | |
|---|
| 64 | #ifdef __cplusplus |
|---|
| 65 | extern "C" { |
|---|
| 66 | #endif |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | /********************** |
|---|
| 70 | * |
|---|
| 71 | * TYPES |
|---|
| 72 | * |
|---|
| 73 | **********************/ |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | /******************************************** |
|---|
| 77 | * |
|---|
| 78 | * Enum: CCMUX_TYPES |
|---|
| 79 | * |
|---|
| 80 | * Description: |
|---|
| 81 | * |
|---|
| 82 | * CCMUX_TYPES enumerates the possible |
|---|
| 83 | * 608 CC data types detectable by the |
|---|
| 84 | * parser. |
|---|
| 85 | * |
|---|
| 86 | ********************************************/ |
|---|
| 87 | typedef enum tagCCMUX_TYPES |
|---|
| 88 | { |
|---|
| 89 | cctDVS157 = 0, |
|---|
| 90 | cctA053_608 = 1, |
|---|
| 91 | cctA053_DTVCC = 2, |
|---|
| 92 | cctUnknown = 3, |
|---|
| 93 | NUM_CCTYPE = 4, |
|---|
| 94 | NoMatch = 9 |
|---|
| 95 | |
|---|
| 96 | } CCMUX_TYPES ; |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | /******************************************** |
|---|
| 100 | * |
|---|
| 101 | * Structure: DCC_CC608_MUX_STATE |
|---|
| 102 | * |
|---|
| 103 | * Description: |
|---|
| 104 | * |
|---|
| 105 | * The DCC_CC608_MUX_STATE structure holds the |
|---|
| 106 | * state for multiplexing 608 CC data output. |
|---|
| 107 | * The state consists of a 'leaky' accumulation |
|---|
| 108 | * count for each 608 CC type. |
|---|
| 109 | * |
|---|
| 110 | ********************************************/ |
|---|
| 111 | typedef struct tagDCC_CC608_MUX_STATE |
|---|
| 112 | { |
|---|
| 113 | /* |
|---|
| 114 | * aCCTypeLeakyCount |
|---|
| 115 | * |
|---|
| 116 | * This array holds a leaky accumulation |
|---|
| 117 | * count for each of the possible 608 |
|---|
| 118 | * CC data types. For those types that |
|---|
| 119 | * are detected in the stream, the corresponding |
|---|
| 120 | * count will accumulate to a maximum value. |
|---|
| 121 | * For those types that do not appear, their |
|---|
| 122 | * counts will decrease (leak) over time to |
|---|
| 123 | * zero. |
|---|
| 124 | */ |
|---|
| 125 | int aCCTypeLeakyCount[NUM_CCTYPE] ; |
|---|
| 126 | |
|---|
| 127 | } DCC_CC608_MUX_STATE ; |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | /********************** |
|---|
| 132 | * |
|---|
| 133 | * FUNCTIONS |
|---|
| 134 | * |
|---|
| 135 | **********************/ |
|---|
| 136 | |
|---|
| 137 | /************************************************************************** |
|---|
| 138 | * |
|---|
| 139 | * Function: CC608Mux_Init |
|---|
| 140 | * |
|---|
| 141 | * Inputs: |
|---|
| 142 | * pState - state to init |
|---|
| 143 | * |
|---|
| 144 | * Outputs: |
|---|
| 145 | * pState - state is modified |
|---|
| 146 | * |
|---|
| 147 | * Returns: <void> |
|---|
| 148 | * |
|---|
| 149 | * Description: |
|---|
| 150 | * |
|---|
| 151 | * This function initializes the count array to all zeros. |
|---|
| 152 | * |
|---|
| 153 | **************************************************************************/ |
|---|
| 154 | void CC608Mux_Init(DCC_CC608_MUX_STATE * pState) ; |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | /************************************************************************** |
|---|
| 158 | * |
|---|
| 159 | * Function: CC608Mux_LeakAll |
|---|
| 160 | * |
|---|
| 161 | * Inputs: |
|---|
| 162 | * pState - state, previously init'ed |
|---|
| 163 | * |
|---|
| 164 | * Outputs: |
|---|
| 165 | * pState - state is modified |
|---|
| 166 | * |
|---|
| 167 | * Returns: <void> |
|---|
| 168 | * |
|---|
| 169 | * Description: |
|---|
| 170 | * |
|---|
| 171 | * This function subtracts CC608_LEAK_VAL from all counts, ensuring |
|---|
| 172 | * that no count falls below zero. |
|---|
| 173 | * |
|---|
| 174 | **************************************************************************/ |
|---|
| 175 | void CC608Mux_LeakAll(DCC_CC608_MUX_STATE * pState) ; |
|---|
| 176 | |
|---|
| 177 | /************************************************************************** |
|---|
| 178 | * |
|---|
| 179 | * Function: CC608Mux_Accumulate |
|---|
| 180 | * |
|---|
| 181 | * Inputs: |
|---|
| 182 | * pState - state, previously init'ed |
|---|
| 183 | * ccType - type to accumulate |
|---|
| 184 | * |
|---|
| 185 | * Outputs: |
|---|
| 186 | * pState - state is modified |
|---|
| 187 | * |
|---|
| 188 | * Returns: void |
|---|
| 189 | * |
|---|
| 190 | * Description: |
|---|
| 191 | * |
|---|
| 192 | * This function adds CC608_ACCUMULATE_VAL to all counts, ensuring |
|---|
| 193 | * that no count rises greater than CC608_CLIP_VAL. |
|---|
| 194 | * |
|---|
| 195 | **************************************************************************/ |
|---|
| 196 | void CC608Mux_Accumulate(DCC_CC608_MUX_STATE * pState, CCMUX_TYPES ccType) ; |
|---|
| 197 | |
|---|
| 198 | /************************************************************************** |
|---|
| 199 | * |
|---|
| 200 | * Function: CC608Mux_IsDetected |
|---|
| 201 | * |
|---|
| 202 | * Inputs: |
|---|
| 203 | * pState - state, previously init'ed |
|---|
| 204 | * cct - type |
|---|
| 205 | * |
|---|
| 206 | * Outputs: |
|---|
| 207 | * <none> |
|---|
| 208 | * |
|---|
| 209 | * Returns: 1 iff the given type (cct) is detected. |
|---|
| 210 | * |
|---|
| 211 | * Description: |
|---|
| 212 | * |
|---|
| 213 | * This function compares the accumulated count against the threshhold |
|---|
| 214 | * value. If greater or equal, this function returns 1, else 0. |
|---|
| 215 | * |
|---|
| 216 | **************************************************************************/ |
|---|
| 217 | int CC608Mux_IsDetected(DCC_CC608_MUX_STATE * pState, CCMUX_TYPES cct) ; |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | #ifdef __cplusplus |
|---|
| 222 | } |
|---|
| 223 | #endif |
|---|
| 224 | |
|---|
| 225 | #endif /* BCMDCCTRANSPORTMUX_H */ |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | |
|---|