00001 /***************************************************************************** 00002 * sdt.h 00003 * (c)2001-2002 VideoLAN 00004 * $Id: sdt.h 118 2005-09-14 19:16:53Z massiot $ 00005 * 00006 * Authors: Johan Bilien <jobi@via.ecp.fr> 00007 * 00008 * This program is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU General Public License 00010 * as published by the Free Software Foundation; either version 2 00011 * of the License, or (at your option) any later version. 00012 * 00013 * This program 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 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00021 * 00022 *****************************************************************************/ 00023 00036 #ifndef _DVBPSI_SDT_H_ 00037 #define _DVBPSI_SDT_H_ 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00043 00044 /***************************************************************************** 00045 * dvbpsi_sdt_service_t 00046 *****************************************************************************/ 00058 typedef struct dvbpsi_sdt_service_s 00059 { 00060 uint16_t i_service_id; 00061 int b_eit_schedule; 00062 int b_eit_present; 00064 uint8_t i_running_status; 00065 int b_free_ca; 00066 uint16_t i_descriptors_length; 00068 dvbpsi_descriptor_t * p_first_descriptor; 00072 struct dvbpsi_sdt_service_s * p_next; 00075 } dvbpsi_sdt_service_t; 00076 00077 00078 /***************************************************************************** 00079 * dvbpsi_sdt_t 00080 *****************************************************************************/ 00092 typedef struct dvbpsi_sdt_s 00093 { 00094 uint16_t i_ts_id; 00095 uint8_t i_version; 00096 int b_current_next; 00097 uint16_t i_network_id; 00099 dvbpsi_sdt_service_t * p_first_service; 00102 } dvbpsi_sdt_t; 00103 00104 00105 /***************************************************************************** 00106 * dvbpsi_sdt_callback 00107 *****************************************************************************/ 00113 typedef void (* dvbpsi_sdt_callback)(void* p_cb_data, dvbpsi_sdt_t* p_new_sdt); 00114 00115 00116 /***************************************************************************** 00117 * dvbpsi_AttachSDT 00118 *****************************************************************************/ 00131 int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id, 00132 uint16_t i_extension, dvbpsi_sdt_callback pf_callback, 00133 void* p_cb_data); 00134 00135 00136 /***************************************************************************** 00137 * dvbpsi_DetachSDT 00138 *****************************************************************************/ 00148 void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id, 00149 uint16_t i_extension); 00150 00151 00152 /***************************************************************************** 00153 * dvbpsi_InitSDT/dvbpsi_NewSDT 00154 *****************************************************************************/ 00166 void dvbpsi_InitSDT(dvbpsi_sdt_t *p_sdt, uint16_t i_ts_id, uint8_t i_version, 00167 int b_current_next, uint16_t i_network_id); 00168 00179 #define dvbpsi_NewSDT(p_sdt, i_ts_id, i_version, b_current_next,i_network_id) \ 00180 do { \ 00181 p_sdt = (dvbpsi_sdt_t*)malloc(sizeof(dvbpsi_sdt_t)); \ 00182 if(p_sdt != NULL) \ 00183 dvbpsi_InitSDT(p_sdt, i_ts_id, i_version, b_current_next, i_network_id); \ 00184 } while(0); 00185 00186 00187 /***************************************************************************** 00188 * dvbpsi_EmptySDT/dvbpsi_DeleteSDT 00189 *****************************************************************************/ 00196 void dvbpsi_EmptySDT(dvbpsi_sdt_t *p_sdt); 00197 00204 #define dvbpsi_DeleteSDT(p_sdt) \ 00205 do { \ 00206 dvbpsi_EmptySDT(p_sdt); \ 00207 free(p_sdt); \ 00208 } while(0); 00209 00210 00211 /***************************************************************************** 00212 * dvbpsi_SDTAddService 00213 *****************************************************************************/ 00230 dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt, 00231 uint16_t i_service_id, int b_eit_schedule, int b_eit_present, 00232 uint8_t i_running_status,int b_free_ca); 00233 00234 00235 /***************************************************************************** 00236 * dvbpsi_SDTServiceAddDescriptor 00237 *****************************************************************************/ 00250 dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor( 00251 dvbpsi_sdt_service_t *p_service, 00252 uint8_t i_tag, uint8_t i_length, 00253 uint8_t *p_data); 00254 00255 00256 /***************************************************************************** 00257 * dvbpsi_GenSDTSections 00258 ***************************************************************************** 00259 * Generate SDT sections based on the dvbpsi_sdt_t structure. 00260 *****************************************************************************/ 00261 dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_sdt_t * p_sdt); 00262 00263 #ifdef __cplusplus 00264 }; 00265 #endif 00266 00267 #else 00268 #error "Multiple inclusions of sdt.h" 00269 #endif 00270