00001 /***************************************************************************** 00002 * psi.h 00003 * Copyright (C) 2001-2011 VideoLAN 00004 * $Id: psi.h,v 1.6 2002/04/02 17:55:30 bozo Exp $ 00005 * 00006 * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 * 00022 *****************************************************************************/ 00023 00032 #ifndef _DVBPSI_PSI_H_ 00033 #define _DVBPSI_PSI_H_ 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 /***************************************************************************** 00040 * dvbpsi_psi_section_t 00041 *****************************************************************************/ 00068 struct dvbpsi_psi_section_s 00069 { 00070 /* non-specific section data */ 00071 uint8_t i_table_id; 00072 bool b_syntax_indicator; 00073 bool b_private_indicator; 00074 uint16_t i_length; 00076 /* used if b_syntax_indicator is true */ 00077 uint16_t i_extension; 00080 uint8_t i_version; 00081 bool b_current_next; 00082 uint8_t i_number; 00083 uint8_t i_last_number; 00085 /* non-specific section data */ 00086 /* the content is table-specific */ 00087 uint8_t * p_data; 00088 uint8_t * p_payload_start; 00089 uint8_t * p_payload_end; 00091 /* used if b_syntax_indicator is true */ 00092 uint32_t i_crc; 00094 /* list handling */ 00095 struct dvbpsi_psi_section_s * p_next; 00097 }; 00098 00099 /***************************************************************************** 00100 * dvbpsi_NewPSISection 00101 *****************************************************************************/ 00108 dvbpsi_psi_section_t * dvbpsi_NewPSISection(int i_max_size); 00109 00110 /***************************************************************************** 00111 * dvbpsi_DeletePSISections 00112 *****************************************************************************/ 00119 void dvbpsi_DeletePSISections(dvbpsi_psi_section_t * p_section); 00120 00121 /***************************************************************************** 00122 * dvbpsi_CheckPSISection 00123 *****************************************************************************/ 00135 bool dvbpsi_CheckPSISection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section, 00136 const uint8_t table_id, const char *psz_table_name); 00137 00138 /***************************************************************************** 00139 * dvbpsi_ValidPSISection 00140 *****************************************************************************/ 00150 bool dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section); 00151 00152 /***************************************************************************** 00153 * dvbpsi_BuildPSISection 00154 *****************************************************************************/ 00162 void dvbpsi_BuildPSISection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section); 00163 00164 /***************************************************************************** 00165 * dvbpsi_CalculateCRC32 00166 *****************************************************************************/ 00175 void dvbpsi_CalculateCRC32(dvbpsi_psi_section_t *p_section); 00176 00177 /***************************************************************************** 00178 * dvbpsi_has_CRC32 00179 *****************************************************************************/ 00188 static inline bool dvbpsi_has_CRC32(dvbpsi_psi_section_t *p_section) 00189 { 00190 if ((p_section->i_table_id == (uint8_t) 0x70) /* TDT (has no CRC 32) */ || 00191 (p_section->i_table_id == (uint8_t) 0x71) /* RST (has no CRC 32) */ || 00192 (p_section->i_table_id == (uint8_t) 0x72) /* ST (has no CRC 32) */ || 00193 (p_section->i_table_id == (uint8_t) 0x7E))/* DIT (has no CRC 32) */ 00194 return false; 00195 00196 return (p_section->b_syntax_indicator || (p_section->i_table_id == 0x73)); 00197 } 00198 00199 #ifdef __cplusplus 00200 }; 00201 #endif 00202 00203 #else 00204 #error "Multiple inclusions of psi.h" 00205 #endif 00206