| 1 | /* |
|---|
| 2 | DMW_ChannelDemux.h |
|---|
| 3 | |
|---|
| 4 | header file for ChannelDemux module |
|---|
| 5 | various advanced Table Reception API |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #ifndef __DMW_CHANNELDEMUX_H__ |
|---|
| 9 | #define __DMW_CHANNELDEMUX_H__ |
|---|
| 10 | |
|---|
| 11 | #ifndef __DMW_PLATFORM_H__ |
|---|
| 12 | #include "DMW_Platform.h" |
|---|
| 13 | #endif |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | #if (DHL_SUPPORTED==DHL_CB2) |
|---|
| 18 | #include "DLIB_PSI_Monitor.h" |
|---|
| 19 | #include "DLIB_PSIP_Monitor.h" |
|---|
| 20 | #include "DLIB_PSI_Parser.h" |
|---|
| 21 | #include "DLIB_PSIP_Parser.h" |
|---|
| 22 | |
|---|
| 23 | #else |
|---|
| 24 | #include "ATSC_PSIP.h" |
|---|
| 25 | |
|---|
| 26 | #endif |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | // cafrii 060306 add bytebuf I/O |
|---|
| 34 | |
|---|
| 35 | struct byteBuf |
|---|
| 36 | { |
|---|
| 37 | UINT8* buffer; |
|---|
| 38 | UINT32 bufSize; |
|---|
| 39 | UINT32 offset; |
|---|
| 40 | BOOLEAN overrunError; |
|---|
| 41 | }; |
|---|
| 42 | |
|---|
| 43 | typedef struct byteBuf byteBuf_t, *byteBufPtr_t; |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | void byteBufInit (byteBufPtr_t bt, UINT8 *buf, UINT32 bufSize); |
|---|
| 47 | void byteBufSetBytesBuf (byteBufPtr_t bt, UINT8 *buf, UINT16 nBytes); |
|---|
| 48 | void byteBufSetBytes (byteBufPtr_t bt, UINT32 data, UINT8 nBytes); |
|---|
| 49 | STATUS byteBufGetBytesBuf (byteBufPtr_t bt, UINT8 *buf, UINT16 nBytes); |
|---|
| 50 | UINT32 byteBufGetBytes (byteBufPtr_t bt, UINT8 nBytes); |
|---|
| 51 | void byteBufSkipBytes (byteBufPtr_t bt, UINT8 nBytes); |
|---|
| 52 | UINT32 byteBufGetOffset (byteBufPtr_t bt); |
|---|
| 53 | BOOL byteBufCheckError (byteBufPtr_t bt); |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | #define byteBufSet1Byte(bt,d) byteBufSetBytes((bt),(d),1) |
|---|
| 57 | #define byteBufSet2Byte(bt,d) byteBufSetBytes((bt),(d),2) |
|---|
| 58 | #define byteBufSet4Byte(bt,d) byteBufSetBytes((bt),(d),4) |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | //--------------------------------- |
|---|
| 62 | // cafrii 041126 add |
|---|
| 63 | // |
|---|
| 64 | /* |
|---|
| 65 | typedef struct xvctChannel |
|---|
| 66 | { |
|---|
| 67 | UINT16 short_name[7]; |
|---|
| 68 | UINT16 major_channel_number; |
|---|
| 69 | UINT16 minor_channel_number; |
|---|
| 70 | modulation_mode_k modulation_mode; |
|---|
| 71 | UINT32 carrier_frequency; |
|---|
| 72 | UINT16 channel_TSID; |
|---|
| 73 | UINT16 program_number; |
|---|
| 74 | ETM_location_k ETM_location; |
|---|
| 75 | BOOLEAN access_controlled; |
|---|
| 76 | BOOLEAN hidden; |
|---|
| 77 | |
|---|
| 78 | path_select_k path_select; // valid only when cvct |
|---|
| 79 | BOOLEAN out_of_band; // valid only when cvct |
|---|
| 80 | |
|---|
| 81 | BOOLEAN processed; |
|---|
| 82 | // ÀÌ bit´Â user¸¦ À§ÇØ reserve µÇ¾î ÀÖ´Ù. |
|---|
| 83 | // µðÆúÆ®·Î 0ÀÇ °ªÀ» °¡Áö¸ç, ÇÊ¿äÇÒ ¶§ »ç¿ëµÈ´Ù. |
|---|
| 84 | |
|---|
| 85 | BOOLEAN show_guide; |
|---|
| 86 | service_type_k service_type; |
|---|
| 87 | UINT16 source_id; |
|---|
| 88 | UINT16 descriptor_length; |
|---|
| 89 | UINT8* descriptors; // un-parsed descriptors |
|---|
| 90 | |
|---|
| 91 | } xvctChannel_t, *xvctChannelPtr_t; |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | typedef struct xvct |
|---|
| 95 | { |
|---|
| 96 | BOOLEAN is_cvct; // 041130, TRUE if cvct.. |
|---|
| 97 | |
|---|
| 98 | UINT16 transport_stream_id; |
|---|
| 99 | UINT8 version_number; |
|---|
| 100 | UINT8 numChannels; |
|---|
| 101 | xvctChannelPtr_t channel; |
|---|
| 102 | UINT16 additional_descriptor_length; |
|---|
| 103 | UINT8* additional_descriptors; // un-parsed descriptors |
|---|
| 104 | |
|---|
| 105 | } xvct_t, *xvctPtr_t; |
|---|
| 106 | */ |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | void PrintXvct(xvctPtr_t xvctPtr); |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | //--------------------------------- |
|---|
| 114 | // cafrii 041129 add |
|---|
| 115 | // |
|---|
| 116 | |
|---|
| 117 | typedef struct DmcMainTable_t |
|---|
| 118 | { |
|---|
| 119 | tvctPtr_t tvct; |
|---|
| 120 | cvctPtr_t cvct; |
|---|
| 121 | |
|---|
| 122 | MPEG_PAT *pat; |
|---|
| 123 | int num_programs; |
|---|
| 124 | // cafrii 041209 add comment |
|---|
| 125 | // pat->numPrograms ÀÇ °ªÀÇ »çº».. ¾Æ·¡ pmtList arrayÀÇ Å©±âÀÌ´Ù. |
|---|
| 126 | // ½ÇÁ¦·Î À̸¸ÅÀÇ PMT°¡ ´Ù Á¸ÀçÇÏÁö ¾ÊÀ» ¼öµµ ÀÖÀ¸¸ç, |
|---|
| 127 | // VCTÀÇ subchannel °¹¼öµµ ÀÌ¿Í ´Ù¸¦ ¼öµµ ÀÖ´Ù.. |
|---|
| 128 | |
|---|
| 129 | MPEG_PMT **pmtList; |
|---|
| 130 | |
|---|
| 131 | } DmcMainTables; |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | // advanced downloading APIs that can be cancelled |
|---|
| 139 | // these functions are variations of GetXxx(). |
|---|
| 140 | // these functions are designed to skip current process when command cancelled. |
|---|
| 141 | // |
|---|
| 142 | STATUS Dmc_GetPAT(tDHL_TSD tsd, MPEG_PAT **returnPat, int timeOut, BOOL (*ckfn)()); |
|---|
| 143 | STATUS Dmc_GetPMT(tDHL_TSD tsd, UINT16 pid, UINT16 program_number, MPEG_PMT **returnPmt, int timeOut, BOOL (*ckfn)()); |
|---|
| 144 | STATUS Dmc_GetMgtSection(tDHL_TSD tsd, mgtSectionPtr_t *mgtSectPtr, int timeOut, BOOL (*ckfn)()); |
|---|
| 145 | STATUS Dmc_GetSttSection(tDHL_TSD tsd, sttSectionPtr_t *sttSectPtr, int timeOut, BOOL (*ckfn)()); |
|---|
| 146 | STATUS Dmc_GetTvct(tDHL_TSD tsd, tvctPtr_t *tvctPtr, int timeOut, BOOL (*ckfn)()); |
|---|
| 147 | STATUS Dmc_GetCvct(tDHL_TSD tsd, cvctPtr_t *cvctPtr, int timeOut, BOOL (*ckfn)()); |
|---|
| 148 | |
|---|
| 149 | STATUS Dmc_GetEit(tDHL_TSD tsd, UINT16 PID, UINT16 source_id, eitPtr_t *eitPtr, int timeOut, BOOL (*ckfn)()); |
|---|
| 150 | STATUS Dmc_GetEttSection(tDHL_TSD tsd, UINT16 PID, UINT32 ETM_id, ettSectionPtr_t *ettSectPtr, int timeOut, BOOL (*ckfn)()); |
|---|
| 151 | STATUS Dmc_GetRrtSection(tDHL_TSD tsd, UINT8 region, rrtSectionPtr_t *rrtSectPtr, int timeOut, BOOL (*ckfn)()); |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | STATUS Dmc_MonitorRrt(tDHL_TSD tsd, tDHL_PSI_Update updateMode, tDHL_PSI_EventProc eventProc, |
|---|
| 155 | UINT32 userParam, tDHL_PSI_ControlHandle *psiCtl); |
|---|
| 156 | |
|---|
| 157 | STATUS Dmc_RestoreRrt(UINT8 *buffer, rrtSectionPtr_t *prrt); |
|---|
| 158 | // *prrt should be freeed using FreeAtscTable after use. |
|---|
| 159 | // |
|---|
| 160 | int Dmc_FlattenRrt(UINT8 *buffer, int bufsize, rrtSectionPtr_t rrt); |
|---|
| 161 | // returns total required byte size for flatten. |
|---|
| 162 | // if buffer is NULL, just calculate required buffer size. |
|---|
| 163 | |
|---|
| 164 | |
|---|
| 165 | |
|---|
| 166 | // Table de-allocation API that makes NULL pointer automatically. |
|---|
| 167 | // it cannot be used for PAT/PMT but FreePAT/FreePMT is recommended in that case.. |
|---|
| 168 | // ex: |
|---|
| 169 | // Dmc_GetTvct(tsd, &tvct, 0, NULL); |
|---|
| 170 | // Dmc_FreeAtscTable(&tvct); |
|---|
| 171 | // |
|---|
| 172 | void Dmc_FreeAtscTable(void *tablePtrPtr); |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | // Simultaneous downloading APIs.. |
|---|
| 176 | // |
|---|
| 177 | |
|---|
| 178 | // download (TVCT or CVCT) and PAT at the same time.. |
|---|
| 179 | // |
|---|
| 180 | //DHL_RESULT Dmc_GetVctAndPat(tDHL_TSD tsd, tvctPtr_t *tvctPtr, cvctPtr_t *cvctPtr, MPEG_PAT **mpatPtr, int timeOut, BOOL (*ckfn)(UINT32)); |
|---|
| 181 | |
|---|
| 182 | //BOOL (*chfn)()À¸·Î º¯°æÇÑ´Ù. caller¿¡¼ »ç¿ëÇϰí Àִµ¥°¡ ¾ø´Ù. probability |
|---|
| 183 | STATUS Dmc_GetVctAndPat(tDHL_TSD tsd, tvctPtr_t *tvctPtr, cvctPtr_t *cvctPtr, MPEG_PAT **mpatPtr, int timeOut, BOOL (*ckfn)()); |
|---|
| 184 | |
|---|
| 185 | // |
|---|
| 186 | // cafrii 041129 add |
|---|
| 187 | // |
|---|
| 188 | STATUS Dmc_GetMainChannelTables(tDHL_TSD tsd, DmcMainTables *tbls, int timeOut, BOOL (*ckfn)(UINT32)); |
|---|
| 189 | void Dmc_FreeMainChannelTables(DmcMainTables *tbls); |
|---|
| 190 | |
|---|
| 191 | |
|---|
| 192 | // |
|---|
| 193 | // cafrii 050624 add |
|---|
| 194 | // |
|---|
| 195 | STATUS Dmc_GetXvct(tDHL_TSD tsd, xvctPtr_t *xvctPtr, int timeOut, BOOL (*ckfn)(UINT32)); |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | // download EITs/ETTs at the same time.. |
|---|
| 199 | |
|---|
| 200 | // simple : array of pointer |
|---|
| 201 | STATUS Dmc_GetMultipleEITs(tDHL_TSD tsd, int nEit, UINT16 *aPID, UINT16 *aSourceID, eitPtr_t *aEitPtr, |
|---|
| 202 | int timeOut, BOOL (*ckfn)(UINT32, UINT32), UINT32 userparam, void (*lockfn)(BOOL)); |
|---|
| 203 | STATUS Dmc_GetMultipleETTs(tDHL_TSD tsd, int nETT, UINT16 *aEttPID, UINT32 *aETMID, ettSectionPtr_t *aEttSectPtr, |
|---|
| 204 | int timeOut, BOOL (*ckfn)(UINT32, UINT32), UINT32 userparam, void (*lockfn)(BOOL)); |
|---|
| 205 | |
|---|
| 206 | // complex : array of pointer of pointer |
|---|
| 207 | STATUS Dmc_GetMultipleEITsEx(tDHL_TSD tsd, int nEit, UINT16 *aPID, UINT16 *aSourceID, eitPtr_t **aEitPtrPtr, |
|---|
| 208 | int timeOut, BOOL (*ckfn)(UINT32, UINT32), UINT32 userparam, void (*lockfn)(BOOL)); |
|---|
| 209 | STATUS Dmc_GetMultipleETTsEx(tDHL_TSD tsd, int nETT, UINT16 *aEttPID, UINT32 *aETMID, ettSectionPtr_t **aEttPtrPtr, |
|---|
| 210 | int timeOut, BOOL (*ckfn)(UINT32, UINT32), UINT32 userparam, void (*lockfn)(BOOL)); |
|---|
| 211 | |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | // Relayed multiple Reception API |
|---|
| 215 | STATUS Dmc_GetRelayEITs(tDHL_TSD tsd, int nEit, UINT16 *aPID, UINT16 *aSourceID, eitPtr_t *aEitPtr, |
|---|
| 216 | int timeOut, BOOL (*chkfn)(UINT32, UINT32), UINT32 userparam, void (*lockfn)(BOOL)); |
|---|
| 217 | STATUS Dmc_GetRelayETTs(tDHL_TSD tsd, int nETT, UINT16 *aEttPID, UINT32 *aETMID, ettSectionPtr_t *aEttSectPtr, |
|---|
| 218 | int timeOut, BOOL (*ckfn)(UINT32, UINT32), UINT32 userparam, void (*lockfn)(BOOL)); |
|---|
| 219 | |
|---|
| 220 | STATUS Dmc_GetRelayEITsEx(tDHL_TSD tsd, int nEit, UINT16 *aPID, UINT16 *aSourceID, eitPtr_t **aEitPtrPtr, |
|---|
| 221 | int timeOut, BOOL (*chkfn)(UINT32, UINT32), UINT32 userparam, void (*lockfn)(BOOL)); |
|---|
| 222 | STATUS Dmc_GetRelayETTsEx(tDHL_TSD tsd, int nETT, UINT16 *aEttPID, UINT32 *aETMID, ettSectionPtr_t **aEttPtrPtr, |
|---|
| 223 | int timeOut, BOOL (*ckfn)(UINT32, UINT32), UINT32 userparam, void (*lockfn)(BOOL)); |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | // cafrii 041126 add |
|---|
| 228 | STATUS Dmc_TranslateCvct (cvctPtr_t cvctPtr, xvctPtr_t *xvctPtr); |
|---|
| 229 | STATUS Dmc_TranslateTvct (tvctPtr_t tvctPtr, xvctPtr_t *xvctPtr); |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | void Dmc_RegisterChannelDemuxSymbols(void); |
|---|
| 234 | |
|---|
| 235 | |
|---|
| 236 | |
|---|
| 237 | |
|---|
| 238 | #endif // __DMW_CHANNELDEMUX_H__ |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | /******************************************************************** |
|---|
| 242 | $Log: DMW_ChannelDemux.h,v $ |
|---|
| 243 | |
|---|
| 244 | 1.01 2004/11/30 is_cvct À§Ä¡ À̵¿ |
|---|
| 245 | 1.00 2004/11/29 History °ü¸® ½ÃÀÛ |
|---|
| 246 | |
|---|
| 247 | ********************************************************************/ |
|---|