00001 /***************************************************************************** 00002 * cat.h 00003 * (c)2001-2007 VideoLAN 00004 * $Id: cat.h 145 2007-10-05 17:53:35Z jpsaman $ 00005 * 00006 * Authors: Johann Hanne 00007 * heavily based on pmt.h which was written by 00008 * Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr> 00009 * 00010 * This program is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU General Public License 00012 * as published by the Free Software Foundation; either version 2 00013 * of the License, or (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 * 00024 *****************************************************************************/ 00025 00038 #ifndef _DVBPSI_CAT_H_ 00039 #define _DVBPSI_CAT_H_ 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif 00044 00045 00046 /***************************************************************************** 00047 * dvbpsi_cat_t 00048 *****************************************************************************/ 00060 typedef struct dvbpsi_cat_s 00061 { 00062 uint8_t i_version; 00063 int b_current_next; 00065 dvbpsi_descriptor_t * p_first_descriptor; 00067 } dvbpsi_cat_t; 00068 00069 00070 /***************************************************************************** 00071 * dvbpsi_cat_callback 00072 *****************************************************************************/ 00078 typedef void (* dvbpsi_cat_callback)(void* p_cb_data, dvbpsi_cat_t* p_new_cat); 00079 00080 00081 /***************************************************************************** 00082 * dvbpsi_AttachCAT 00083 *****************************************************************************/ 00092 dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback, 00093 void* p_cb_data); 00094 00095 00096 /***************************************************************************** 00097 * dvbpsi_DetachCAT 00098 *****************************************************************************/ 00107 void dvbpsi_DetachCAT(dvbpsi_handle h_dvbpsi); 00108 00109 00110 /***************************************************************************** 00111 * dvbpsi_InitCAT/dvbpsi_NewCAT 00112 *****************************************************************************/ 00122 void dvbpsi_InitCAT(dvbpsi_cat_t* p_cat, 00123 uint8_t i_version, int b_current_next); 00124 00134 #define dvbpsi_NewCAT(p_cat, \ 00135 i_version, b_current_next) \ 00136 do { \ 00137 p_cat = (dvbpsi_cat_t*)malloc(sizeof(dvbpsi_cat_t)); \ 00138 if(p_cat != NULL) \ 00139 dvbpsi_InitCAT(p_cat, i_version, b_current_next); \ 00140 } while(0); 00141 00142 00143 /***************************************************************************** 00144 * dvbpsi_EmptyCAT/dvbpsi_DeleteCAT 00145 *****************************************************************************/ 00152 void dvbpsi_EmptyCAT(dvbpsi_cat_t* p_cat); 00153 00160 #define dvbpsi_DeleteCAT(p_cat) \ 00161 do { \ 00162 dvbpsi_EmptyCAT(p_cat); \ 00163 free(p_cat); \ 00164 } while(0); 00165 00166 00167 /***************************************************************************** 00168 * dvbpsi_CATAddDescriptor 00169 *****************************************************************************/ 00182 dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat, 00183 uint8_t i_tag, uint8_t i_length, 00184 uint8_t* p_data); 00185 00186 00187 /***************************************************************************** 00188 * dvbpsi_GenCATSections 00189 *****************************************************************************/ 00198 dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_cat_t* p_cat); 00199 00200 00201 #ifdef __cplusplus 00202 }; 00203 #endif 00204 00205 #else 00206 #error "Multiple inclusions of cat.h" 00207 #endif 00208