| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2007, 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: bvbilib_priv.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/7 $ |
|---|
| 12 | * $brcm_Date: 10/26/07 10:51a $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/syslib/vbilib/bvbilib_priv.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/7 10/26/07 10:51a ptimariu |
|---|
| 21 | * PR36451: closing bracket, __cplusplus |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/7 10/25/07 6:32p ptimariu |
|---|
| 24 | * PR36451: closing bracket, __cplusplus |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/6 1/18/07 3:13p darnstein |
|---|
| 27 | * PR26464: correctly handle teletext output to multiple VECs |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/5 10/21/05 7:46p darnstein |
|---|
| 30 | * PR17732: Gemstar encoder can output a waveform, but I can't make it |
|---|
| 31 | * change yet. |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/4 3/22/05 11:11a darnstein |
|---|
| 34 | * PR 14477: Measure encode queue depth. For diagnostic purposes. |
|---|
| 35 | * |
|---|
| 36 | * Hydra_Software_Devel/3 1/27/04 6:24p darnstein |
|---|
| 37 | * PR 9080: Don't check for overrun errors on encoding. It is only |
|---|
| 38 | * possible for closed caption encoding, anyway. |
|---|
| 39 | * |
|---|
| 40 | * Hydra_Software_Devel/2 1/8/04 7:27p darnstein |
|---|
| 41 | * PR 9080: Add capability to query for encoding errors from field |
|---|
| 42 | * |
|---|
| 43 | * Hydra_Software_Devel/1 10/14/03 11:32a darnstein |
|---|
| 44 | * Initial version |
|---|
| 45 | * |
|---|
| 46 | ***************************************************************************/ |
|---|
| 47 | #ifndef BVBILIB_PRIV_H__ |
|---|
| 48 | #define BVBILIB_PRIV_H__ |
|---|
| 49 | |
|---|
| 50 | #include "bvbilib.h" |
|---|
| 51 | #include "blst_queue.h" |
|---|
| 52 | |
|---|
| 53 | #ifdef __cplusplus |
|---|
| 54 | extern "C" { |
|---|
| 55 | #endif |
|---|
| 56 | |
|---|
| 57 | /* |
|---|
| 58 | * This macro take the check for a validity of a handle, and |
|---|
| 59 | * cast to context pointer. |
|---|
| 60 | */ |
|---|
| 61 | #define BVBILIB_P_GENERIC_GET_CONTEXT(handle, context, structname) \ |
|---|
| 62 | do { \ |
|---|
| 63 | if(!(handle) || \ |
|---|
| 64 | (((structname*)(handle))->ulBlackMagic != \ |
|---|
| 65 | sizeof(structname))) \ |
|---|
| 66 | { \ |
|---|
| 67 | BDBG_ERR(("Corrupted context handle\n")); \ |
|---|
| 68 | (context) = NULL; \ |
|---|
| 69 | } \ |
|---|
| 70 | else \ |
|---|
| 71 | { \ |
|---|
| 72 | (context) = (structname*)(handle); \ |
|---|
| 73 | } \ |
|---|
| 74 | } while (0) |
|---|
| 75 | |
|---|
| 76 | /* Applications of the above macro */ |
|---|
| 77 | #define BVBILIB_P_GET_CONTEXT(handle, context) \ |
|---|
| 78 | BVBILIB_P_GENERIC_GET_CONTEXT(handle, context, BVBIlib_P_Handle) |
|---|
| 79 | #define BVBILIB_P_GET_LIST_CONTEXT(handle, context) \ |
|---|
| 80 | BVBILIB_P_GENERIC_GET_CONTEXT(handle, context, BVBIlib_P_List_Handle) |
|---|
| 81 | #define BVBILIB_P_GET_DECODE_CONTEXT(handle, context) \ |
|---|
| 82 | BVBILIB_P_GENERIC_GET_CONTEXT(handle, context, BVBIlib_P_Decode_Handle) |
|---|
| 83 | #define BVBILIB_P_GET_ENCODE_CONTEXT(handle, context) \ |
|---|
| 84 | BVBILIB_P_GENERIC_GET_CONTEXT(handle, context, BVBIlib_P_Encode_Handle) |
|---|
| 85 | |
|---|
| 86 | /*************************************************************************** |
|---|
| 87 | * VBI internal enumerations and constants |
|---|
| 88 | ***************************************************************************/ |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | /*************************************************************************** |
|---|
| 92 | * VBI Internal data structures |
|---|
| 93 | ***************************************************************************/ |
|---|
| 94 | |
|---|
| 95 | /* Linked list support: define decode_head, encode_head, field_head. */ |
|---|
| 96 | typedef struct decode_head decode_head; |
|---|
| 97 | BLST_Q_HEAD(decode_head, BVBIlib_P_Decode_Handle); |
|---|
| 98 | typedef struct encode_head encode_head; |
|---|
| 99 | BLST_Q_HEAD(encode_head, BVBIlib_P_Encode_Handle); |
|---|
| 100 | typedef struct field_head field_head; |
|---|
| 101 | BLST_Q_HEAD(field_head, BVBIlib_P_FieldHanger); |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | typedef struct BVBIlib_P_FieldHanger |
|---|
| 105 | { |
|---|
| 106 | /* The field handle itself */ |
|---|
| 107 | BVBI_Field_Handle hField; |
|---|
| 108 | |
|---|
| 109 | /* Linked list membership */ |
|---|
| 110 | BLST_Q_ENTRY(BVBIlib_P_FieldHanger) link; |
|---|
| 111 | |
|---|
| 112 | } BVBIlib_P_FieldHanger; |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | typedef struct BVBIlib_P_Handle |
|---|
| 116 | { |
|---|
| 117 | /* Black magic */ |
|---|
| 118 | uint32_t ulBlackMagic; |
|---|
| 119 | |
|---|
| 120 | /* handed down from app. */ |
|---|
| 121 | BVBI_Handle hBvbi; |
|---|
| 122 | |
|---|
| 123 | /* List of decode contexts */ |
|---|
| 124 | decode_head decode_contexts; |
|---|
| 125 | |
|---|
| 126 | /* List of encode contexts */ |
|---|
| 127 | encode_head encode_contexts; |
|---|
| 128 | |
|---|
| 129 | } BVBIlib_P_Handle; |
|---|
| 130 | |
|---|
| 131 | |
|---|
| 132 | typedef struct BVBIlib_P_List_Handle |
|---|
| 133 | { |
|---|
| 134 | /* Black magic */ |
|---|
| 135 | uint32_t ulBlackMagic; |
|---|
| 136 | |
|---|
| 137 | /* Main VBI context, for creating field handles */ |
|---|
| 138 | BVBI_Handle hVbi; |
|---|
| 139 | |
|---|
| 140 | /* Number of BVBI_Field_Handle entries allocated at creation */ |
|---|
| 141 | int nAllocated; |
|---|
| 142 | |
|---|
| 143 | /* Number of BVBI_Field_Handle entries handed out. |
|---|
| 144 | For debugging, mainly. */ |
|---|
| 145 | int nInUse; |
|---|
| 146 | |
|---|
| 147 | /* Free list of field handles */ |
|---|
| 148 | field_head field_contexts; |
|---|
| 149 | |
|---|
| 150 | /* Field handle hangers with no associated field handles */ |
|---|
| 151 | field_head empty_hangers; |
|---|
| 152 | |
|---|
| 153 | /* Other settings */ |
|---|
| 154 | BVBIlib_List_Settings settings; |
|---|
| 155 | |
|---|
| 156 | } BVBIlib_P_List_Handle; |
|---|
| 157 | |
|---|
| 158 | |
|---|
| 159 | typedef struct BVBIlib_P_Decode_Handle |
|---|
| 160 | { |
|---|
| 161 | /* Black magic */ |
|---|
| 162 | uint32_t ulBlackMagic; |
|---|
| 163 | |
|---|
| 164 | /* Back pointer to the BVBIlib context */ |
|---|
| 165 | BVBIlib_P_Handle *pVbilib; |
|---|
| 166 | |
|---|
| 167 | /* The subordinate BVBI_Decode handle */ |
|---|
| 168 | BVBI_Decode_Handle hVbiDec; |
|---|
| 169 | |
|---|
| 170 | /* Source of empty BVBI_Field_Handles to decode into */ |
|---|
| 171 | BVBIlib_List_Handle hVbill; |
|---|
| 172 | |
|---|
| 173 | /* Linked list membership */ |
|---|
| 174 | BLST_Q_ENTRY(BVBIlib_P_Decode_Handle) link; |
|---|
| 175 | |
|---|
| 176 | } BVBIlib_P_Decode_Handle; |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | typedef struct BVBIlib_P_Encode_Handle |
|---|
| 180 | { |
|---|
| 181 | /* Black magic */ |
|---|
| 182 | uint32_t ulBlackMagic; |
|---|
| 183 | |
|---|
| 184 | /* Back pointer to the VBI context */ |
|---|
| 185 | BVBIlib_P_Handle *pVbilib; |
|---|
| 186 | |
|---|
| 187 | /* The subordinate BVBI_Encode handle */ |
|---|
| 188 | BVBI_Encode_Handle hVbiEnc; |
|---|
| 189 | |
|---|
| 190 | /* Maximum number of BVBI_Field_Handles to queue for encoding */ |
|---|
| 191 | int nMaxQueue; |
|---|
| 192 | |
|---|
| 193 | /* Input queue of field handles to encode */ |
|---|
| 194 | field_head encode_queue; |
|---|
| 195 | |
|---|
| 196 | /* Size of above queue */ |
|---|
| 197 | int encode_queue_length; |
|---|
| 198 | |
|---|
| 199 | /* Field handle hangers with no associated field handles */ |
|---|
| 200 | field_head empty_hangers; |
|---|
| 201 | |
|---|
| 202 | /* List of BVBI_Field_Handles to recycle to after use */ |
|---|
| 203 | BVBIlib_List_Handle hVbill; |
|---|
| 204 | |
|---|
| 205 | /* Linked list membership */ |
|---|
| 206 | BLST_Q_ENTRY(BVBIlib_P_Encode_Handle) link; |
|---|
| 207 | |
|---|
| 208 | } BVBIlib_P_Encode_Handle; |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | /*************************************************************************** |
|---|
| 212 | * VBI private functions |
|---|
| 213 | ***************************************************************************/ |
|---|
| 214 | |
|---|
| 215 | #ifdef __cplusplus |
|---|
| 216 | } |
|---|
| 217 | #endif |
|---|
| 218 | |
|---|
| 219 | #endif /* BVBILIB_PRIV_H__ */ |
|---|