| 1 | /** |
|---|
| 2 | @file |
|---|
| 3 | DLIB_PSI_Parser.h |
|---|
| 4 | |
|---|
| 5 | @brief |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | #ifndef __DLIB_PSI_PARSER_H__ |
|---|
| 12 | #define __DLIB_PSI_PARSER_H__ |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | #include "DHL_PSI.h" |
|---|
| 16 | |
|---|
| 17 | #include "DLIB_PSI.h" |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | #ifdef __cplusplus |
|---|
| 21 | extern "C" { |
|---|
| 22 | #endif |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | #if COMMENT |
|---|
| 27 | ____Overview____(){} |
|---|
| 28 | #endif |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | #if COMMENT |
|---|
| 33 | ____Config____(){} |
|---|
| 34 | #endif |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | #if COMMENT |
|---|
| 39 | ____Types____(){} |
|---|
| 40 | #endif |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | #if COMMENT |
|---|
| 46 | ____Defines____(){} |
|---|
| 47 | #endif |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | #if COMMENT |
|---|
| 55 | ____API____(){} |
|---|
| 56 | #endif |
|---|
| 57 | |
|---|
| 58 | /** |
|---|
| 59 | ParsePAT will parse a PAT, given a PSI descriptor. It should |
|---|
| 60 | be called in response to a psiDataReceived event. |
|---|
| 61 | */ |
|---|
| 62 | DHL_RESULT ParsePAT(const tDHL_PSI_DataArray *desc, MPEG_PAT **returnPat); |
|---|
| 63 | |
|---|
| 64 | /** |
|---|
| 65 | ParsePMT will parse a PMT, given a PSI descriptor. It should |
|---|
| 66 | be called in response to a psiDataReceived event. |
|---|
| 67 | */ |
|---|
| 68 | DHL_RESULT ParsePMT(const tDHL_PSI_DataArray *desc, MPEG_PMT **returnPmt); |
|---|
| 69 | |
|---|
| 70 | /** |
|---|
| 71 | FlattenPMT creates an MPEG program map section from a PMT structure |
|---|
| 72 | */ |
|---|
| 73 | DHL_RESULT FlattenPMT(const MPEG_PMT *pmt, UINT32 *pmtSectionLength, UINT8 **pmtSection); |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | /** @brief Parses an PAT section and returns the decoded section via the provided handle. |
|---|
| 77 | |
|---|
| 78 | @param[in] section Pointer to the first byte of the section. |
|---|
| 79 | @param[out] patSectionPtr Return pointer to a parsed PAT section. |
|---|
| 80 | |
|---|
| 81 | @return |
|---|
| 82 | */ |
|---|
| 83 | DHL_RESULT ParsePatSection (UINT8 *section, MPEG_PAT * *patSectionPtr); |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | /** @brief Attempts to retrieve a descriptor of the specified type from a list of |
|---|
| 87 | unparsed descriptors. The instance parameter allows searching for more |
|---|
| 88 | than one descriptor instance of the same type. |
|---|
| 89 | |
|---|
| 90 | @param[in] descriptors Pointer to the un-parsed descriptors. |
|---|
| 91 | @param[in] len Length in bytes of the un-parsed descriptors. |
|---|
| 92 | @param[in] tag descriptor_tag to be searched for. |
|---|
| 93 | @param[in] instance The instance of the descriptor to be returned. |
|---|
| 94 | @param[out] descriptor Returned Pointer to the start of the descriptor. |
|---|
| 95 | |
|---|
| 96 | @return |
|---|
| 97 | |
|---|
| 98 | */ |
|---|
| 99 | DHL_RESULT GetMpegDescriptor (UINT8 *descriptors, UINT16 len, UINT8 tag, |
|---|
| 100 | UINT16 instance, UINT8 **descriptor); |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | /** @brief Frees the memory associated with a parsed descriptor. |
|---|
| 104 | |
|---|
| 105 | @param[in] descriptorPtr Pointer to a parsed descriptor. |
|---|
| 106 | */ |
|---|
| 107 | void FreeMpegDescriptor (void *descriptorPtr); |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | /** |
|---|
| 111 | This is an alternative, synchronous function for receiving PAT's when on-going |
|---|
| 112 | event monitoring is not desired. The timeout parameter specifies the number |
|---|
| 113 | of ticks to wait for a PAT, or 0 to wait indefinitely. |
|---|
| 114 | */ |
|---|
| 115 | DHL_RESULT GetPAT(tDHL_TSD *tsd, MPEG_PAT **returnPat, int timeOut); |
|---|
| 116 | |
|---|
| 117 | /** |
|---|
| 118 | FreePAT will delete a PAT returned by ParsePAT or GetPAT |
|---|
| 119 | */ |
|---|
| 120 | void FreePAT(MPEG_PAT *pat); |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | /** |
|---|
| 124 | This is an alternative, synchronous function for receiving the current PMT |
|---|
| 125 | at the given PID and program_number when on-going event monitoring is not desired. |
|---|
| 126 | The timeout parameter specifies the number of ticks to wait for a PMT, or 0 to wait |
|---|
| 127 | indefinitely. |
|---|
| 128 | */ |
|---|
| 129 | DHL_RESULT GetPMT(tDHL_TSD *tsd, |
|---|
| 130 | UINT16 pid, |
|---|
| 131 | UINT16 program_number, |
|---|
| 132 | MPEG_PMT **returnPmt, |
|---|
| 133 | int timeOut ); |
|---|
| 134 | |
|---|
| 135 | /** |
|---|
| 136 | FreePMT will delete a PMT returned by ParsePMT or GetPMT |
|---|
| 137 | */ |
|---|
| 138 | void FreePMT(MPEG_PMT *pmt); |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | /** |
|---|
| 142 | MonitorDIT will set up a PSI monitor waiting for a Discontinuity |
|---|
| 143 | Indicator Table (DIT). |
|---|
| 144 | The eventProc will be called after the first DIT received, and |
|---|
| 145 | then again depending on updateMode until CancelPSIPidMonitor |
|---|
| 146 | is called. |
|---|
| 147 | */ |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | |
|---|
| 152 | #ifdef __cplusplus |
|---|
| 153 | } /* extern "C" */ |
|---|
| 154 | #endif |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | |
|---|
| 158 | #endif /* __DLIB_PSI_PARSER_H__ */ |
|---|
| 159 | |
|---|