| 1 | /** |
|---|
| 2 | @file |
|---|
| 3 | DLIB_PSI.h |
|---|
| 4 | |
|---|
| 5 | @brief |
|---|
| 6 | DLIB_PSI_Parser, DLIB_PSI_Monitor¿¡¼ »ç¿ëµÇ´Â ÀÚ·áÇü Á¤ÀÇ. |
|---|
| 7 | API¼±¾ð¿¡ »ç¿ëµÇ´Â °Í°ú ±¸ÇöºÎ¿¡¼¸¸ »ç¿ëµÇ´Â °ÍÀÌ È¥ÀçµÇ¾î ÀÖÀ½. |
|---|
| 8 | |
|---|
| 9 | */ |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | #ifndef __DLIB_PSI_H__ |
|---|
| 13 | #define __DLIB_PSI_H__ |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | #include "DHL_OSAL.h" |
|---|
| 17 | #include "DHL_MPEGTypes.h" |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | #ifdef __cplusplus |
|---|
| 22 | extern "C" { |
|---|
| 23 | #endif |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | #if COMMENT |
|---|
| 28 | ____Overview____(){} |
|---|
| 29 | #endif |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | #if COMMENT |
|---|
| 34 | ____Config____(){} |
|---|
| 35 | #endif |
|---|
| 36 | |
|---|
| 37 | #define MAX_SI_MPEG_DATA 1024 |
|---|
| 38 | #define MAX_SI_PRIVATE_DATA 4096 |
|---|
| 39 | #define MAX_SI_SECTIONS 256 |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | #if COMMENT |
|---|
| 43 | ____Types____(){} |
|---|
| 44 | #endif |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | #if COMMENT |
|---|
| 50 | ____Defines____(){} |
|---|
| 51 | #endif |
|---|
| 52 | |
|---|
| 53 | /******************************************************************************* |
|---|
| 54 | * MPEG_SI.h - MPEG System Information (SI) parsing definitions |
|---|
| 55 | * |
|---|
| 56 | * Copyright (c) 2004 Zoran, Corporation. All Rights Reserved Worldwide. |
|---|
| 57 | * |
|---|
| 58 | * THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO ZORAN, CORP. AND |
|---|
| 59 | * CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use, |
|---|
| 60 | * reproduction, modification, or disclosure of this program is strictly |
|---|
| 61 | * prohibited. Any use of this program by an authorized licensee is |
|---|
| 62 | * strictly subject to the terms and conditions, including |
|---|
| 63 | * confidentiality obligations, set forth in the applicable Software |
|---|
| 64 | * License Agreement between Zoran, Corp. and the licensee. |
|---|
| 65 | * |
|---|
| 66 | * $Id: //suprahd/releases/suprahd_239/suprahd_zTVApp660_239/include/MPEG_SI.h#1 $ |
|---|
| 67 | * $Revision: #1 $ |
|---|
| 68 | * $DateTime: 2006/06/05 14:53:58 $ |
|---|
| 69 | * $Change: 45890 $ |
|---|
| 70 | * $Author: catherine.lee $ |
|---|
| 71 | * |
|---|
| 72 | ******************************************************************************/ |
|---|
| 73 | |
|---|
| 74 | #define checkMemoryError(p) if (p == NULL) {err = DHL_FAIL_OUT_OF_MEMORY; goto ParseExit;} |
|---|
| 75 | |
|---|
| 76 | /**@name Assigned PID's |
|---|
| 77 | @{ |
|---|
| 78 | */ |
|---|
| 79 | #define PAT_PID 0x0000 |
|---|
| 80 | #define EIT_PID 0x0012 |
|---|
| 81 | #define DIT_PID 0x001E |
|---|
| 82 | #define SIT_PID 0x001F |
|---|
| 83 | /** @} */ |
|---|
| 84 | |
|---|
| 85 | /** @name Table ID's |
|---|
| 86 | @{ |
|---|
| 87 | */ |
|---|
| 88 | #define PROGRAM_ASSOCIATION_SECTION 0 |
|---|
| 89 | #define CA_SECTION 1 |
|---|
| 90 | #define TS_PROGRAM_MAP_SECTION 2 |
|---|
| 91 | #define DIT_SECTION 0x7E |
|---|
| 92 | #define SIT_SECTION 0x7F |
|---|
| 93 | /** @} */ |
|---|
| 94 | |
|---|
| 95 | /***************************** PAT ********************************/ |
|---|
| 96 | |
|---|
| 97 | /** @name MPEG descriptor types (Table 2-39) |
|---|
| 98 | @{ |
|---|
| 99 | */ |
|---|
| 100 | #define video_stream_tag 0x02 |
|---|
| 101 | #define audio_stream_tag 0x03 |
|---|
| 102 | #define hierarchy_tag 0x04 |
|---|
| 103 | #define registration_tag 0x05 |
|---|
| 104 | #define data_stream_alignment_tag 0x06 |
|---|
| 105 | #define target_background_grid_tag 0x07 |
|---|
| 106 | #define video_window_tag 0x08 |
|---|
| 107 | #define CA_tag 0x09 |
|---|
| 108 | #define ISO_639_language_tag 0x0A |
|---|
| 109 | #define system_clock_tag 0x0B |
|---|
| 110 | #define multiplex_buffer_utilization_tag 0x0C |
|---|
| 111 | #define copyright_tag 0x0D |
|---|
| 112 | #define maximum_bitrate_tag 0x0E |
|---|
| 113 | #define private_data_indicator_tag 0x0F |
|---|
| 114 | #define smoothing_buffer_tag 0x10 |
|---|
| 115 | #define STD_tag 0x11 |
|---|
| 116 | #define IBP_tag 0x12 |
|---|
| 117 | /** @} */ |
|---|
| 118 | |
|---|
| 119 | /** @name MPEG stream types in the PMT (Table 2-29) |
|---|
| 120 | @{ |
|---|
| 121 | NOT to be confused with stream ID's found in PES headers |
|---|
| 122 | */ |
|---|
| 123 | #define StreamType_MPEG1Video 1 |
|---|
| 124 | #define StreamType_MPEG2Video 2 |
|---|
| 125 | #define StreamType_MPEG1Audio 3 |
|---|
| 126 | #define StreamType_MPEG2Audio 4 |
|---|
| 127 | #define StreamType_MPEG2PrivateSection 5 |
|---|
| 128 | #define StreamType_MPEG2PESPrivateData 6 |
|---|
| 129 | #define StreamType_MHEG 7 |
|---|
| 130 | #define StreamType_AnnexADSMCC 8 |
|---|
| 131 | #define StreamType_H222_1 9 |
|---|
| 132 | #define StreamType_DSMCCTypeA 10 |
|---|
| 133 | #define StreamType_DSMCCTypeB 11 |
|---|
| 134 | #define StreamType_DSMCCTypeC 12 |
|---|
| 135 | #define StreamType_DSMCCTypeD 13 |
|---|
| 136 | #define StreamType_MPEG2Auxiliary 14 |
|---|
| 137 | #define StreamType_AACAudioADTS 15 /* 0x0F: AAC with ADTS transport syntax */ |
|---|
| 138 | #define StreamType_AACAudioLATM 17 /* 0x11: AAC with LATM/LOAS syntax */ |
|---|
| 139 | #define StreamType_H264 27 /* 0x1B */ |
|---|
| 140 | #define StreamType_DC2Video 0x80 |
|---|
| 141 | #define StreamType_AC3Audio 0x81 |
|---|
| 142 | #define StreamType_A97SDDS 11 /* 0x0B, DSMCC Carousel. */ |
|---|
| 143 | //BKTODO: AC3+(DolbyDigitalPlus) 0x84 |
|---|
| 144 | /** @} */ |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | /** |
|---|
| 148 | This represents one program within the Program Association Table |
|---|
| 149 | */ |
|---|
| 150 | typedef struct MPEG_PAT_program { |
|---|
| 151 | UINT16 program_number; |
|---|
| 152 | UINT16 program_map_PID; |
|---|
| 153 | } MPEG_PAT_program; |
|---|
| 154 | |
|---|
| 155 | /** |
|---|
| 156 | This contains all interesting fieldsin a Program Association Table. |
|---|
| 157 | All sections in a multi-section PAT are included in this one structure. |
|---|
| 158 | */ |
|---|
| 159 | typedef struct MPEG_PAT { |
|---|
| 160 | UINT16 transport_stream_id; |
|---|
| 161 | UINT8 version_number; |
|---|
| 162 | BOOLEAN current_next_indicator; |
|---|
| 163 | UINT8 section_number; |
|---|
| 164 | UINT8 last_section_number; |
|---|
| 165 | BOOLEAN isWholePAT; ///< FALSE if only a singe section of a PAT |
|---|
| 166 | UINT16 numPrograms; |
|---|
| 167 | BOOLEAN networkPIDPresent; ///< TRUE if network_pid is valid |
|---|
| 168 | UINT16 network_PID; |
|---|
| 169 | MPEG_PAT_program *programs; |
|---|
| 170 | } MPEG_PAT; |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | /***************************** PMT ********************************/ |
|---|
| 174 | |
|---|
| 175 | /** video_stream_descriptor */ |
|---|
| 176 | typedef struct VideoStreamDescriptor { |
|---|
| 177 | BOOLEAN multiple_frame_rate_flag; |
|---|
| 178 | MPEG_FRAME_RATE frame_rate_code; |
|---|
| 179 | BOOLEAN MPEG_1_only_flag; |
|---|
| 180 | BOOLEAN constrained_parameter_flag; |
|---|
| 181 | BOOLEAN still_picture_flag; |
|---|
| 182 | UINT8 profile_and_level_indication; |
|---|
| 183 | MPEG_CHROMA_FORMAT chroma_format; |
|---|
| 184 | BOOLEAN frame_rate_extension_flag; |
|---|
| 185 | } VideoStreamDescriptor; |
|---|
| 186 | |
|---|
| 187 | /** Video Decode Control Descriptor (ARIB only) */ |
|---|
| 188 | typedef struct VideoDecodeControlDescriptor { |
|---|
| 189 | BOOLEAN valid; ///< TRUE if this descriptor exists in PMT |
|---|
| 190 | BOOLEAN still_picture_flag; |
|---|
| 191 | BOOLEAN sequence_end_code_flag; |
|---|
| 192 | UINT8 video_decode_format; |
|---|
| 193 | } VideoDecodeControlDescriptor; |
|---|
| 194 | |
|---|
| 195 | /** PMT stream */ |
|---|
| 196 | typedef struct MPEG_PMT_stream { |
|---|
| 197 | UINT8 stream_type; |
|---|
| 198 | UINT16 elementary_PID; |
|---|
| 199 | UINT16 descriptor_length; |
|---|
| 200 | UINT8 *descriptors; |
|---|
| 201 | VideoStreamDescriptor *videoStreamDescriptor; ///< NULL if not present |
|---|
| 202 | VideoDecodeControlDescriptor videoDecodeControlDescriptor; ///< Not a pointer. Check valid flag |
|---|
| 203 | } MPEG_PMT_stream; |
|---|
| 204 | |
|---|
| 205 | /* |
|---|
| 206 | This contains all interesting fields in a Program Mapping Table |
|---|
| 207 | */ |
|---|
| 208 | #define DYNARRAY_PMTStream 32 /* Debugger thinks there's this many streams - Does not specify actual length of structure */ |
|---|
| 209 | /** MPEG PMT object */ |
|---|
| 210 | typedef struct MPEG_PMT { |
|---|
| 211 | UINT16 PID; |
|---|
| 212 | UINT16 program_number; |
|---|
| 213 | UINT8 version_number; |
|---|
| 214 | BOOLEAN current_next_indicator; |
|---|
| 215 | UINT16 PCR_PID; |
|---|
| 216 | UINT16 descriptor_length; |
|---|
| 217 | UINT8 *descriptors; ///< program descriptors |
|---|
| 218 | int numStreams; |
|---|
| 219 | MPEG_PMT_stream streams[DYNARRAY_PMTStream]; |
|---|
| 220 | } MPEG_PMT; |
|---|
| 221 | #define MPEG_PMTSize(nelem) (sizeof(MPEG_PMT) + \ |
|---|
| 222 | ((nelem)-DYNARRAY_PMTStream)*sizeof(MPEG_PMT_stream)) |
|---|
| 223 | |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | #if COMMENT |
|---|
| 230 | ____API____(){} |
|---|
| 231 | #endif |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | #if COMMENT |
|---|
| 236 | ____DEBUG____(){} |
|---|
| 237 | #endif |
|---|
| 238 | |
|---|
| 239 | #define DLIB_PSI_API_DEBUG 1 |
|---|
| 240 | |
|---|
| 241 | #if DLIB_PSI_API_DEBUG |
|---|
| 242 | /** |
|---|
| 243 | PrintPAT prints out a PAT to standard output |
|---|
| 244 | */ |
|---|
| 245 | void PrintPAT(const MPEG_PAT *pat); |
|---|
| 246 | #endif |
|---|
| 247 | |
|---|
| 248 | #if DLIB_PSI_API_DEBUG |
|---|
| 249 | /** |
|---|
| 250 | PrintPMT prints out a PMT to standard output |
|---|
| 251 | */ |
|---|
| 252 | void PrintPMT(const MPEG_PMT *pmt); |
|---|
| 253 | #endif |
|---|
| 254 | |
|---|
| 255 | |
|---|
| 256 | |
|---|
| 257 | #ifdef __cplusplus |
|---|
| 258 | } /* extern "C" */ |
|---|
| 259 | #endif |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | #endif /* __DLIB_PSI_H__ */ |
|---|
| 264 | |
|---|