00001 /***************************************************************************** 00002 * pat.h 00003 * (c)2001-2002 VideoLAN 00004 * $Id: pat.h 103 2005-01-21 14:34:51Z massiot $ 00005 * 00006 * Authors: Arnaud de Bossoreille de Ribou <bozo@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_PAT_H_ 00037 #define _DVBPSI_PAT_H_ 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00043 00044 /***************************************************************************** 00045 * dvbpsi_pat_program_t 00046 *****************************************************************************/ 00058 typedef struct dvbpsi_pat_program_s 00059 { 00060 uint16_t i_number; 00061 uint16_t i_pid; 00063 struct dvbpsi_pat_program_s * p_next; 00066 } dvbpsi_pat_program_t; 00067 00068 00069 /***************************************************************************** 00070 * dvbpsi_pat_t 00071 *****************************************************************************/ 00083 typedef struct dvbpsi_pat_s 00084 { 00085 uint16_t i_ts_id; 00086 uint8_t i_version; 00087 int b_current_next; 00089 dvbpsi_pat_program_t * p_first_program; 00091 } dvbpsi_pat_t; 00092 00093 00094 /***************************************************************************** 00095 * dvbpsi_pat_callback 00096 *****************************************************************************/ 00102 typedef void (* dvbpsi_pat_callback)(void* p_cb_data, dvbpsi_pat_t* p_new_pat); 00103 00104 00105 /***************************************************************************** 00106 * dvbpsi_AttachPAT 00107 *****************************************************************************/ 00116 dvbpsi_handle dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback, 00117 void* p_cb_data); 00118 00119 00120 /***************************************************************************** 00121 * dvbpsi_DetachPAT 00122 *****************************************************************************/ 00131 void dvbpsi_DetachPAT(dvbpsi_handle h_dvbpsi); 00132 00133 00134 /***************************************************************************** 00135 * dvbpsi_InitPAT/dvbpsi_NewPAT 00136 *****************************************************************************/ 00147 void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version, 00148 int b_current_next); 00149 00159 #define dvbpsi_NewPAT(p_pat, i_ts_id, i_version, b_current_next) \ 00160 do { \ 00161 p_pat = (dvbpsi_pat_t*)malloc(sizeof(dvbpsi_pat_t)); \ 00162 if(p_pat != NULL) \ 00163 dvbpsi_InitPAT(p_pat, i_ts_id, i_version, b_current_next); \ 00164 } while(0); 00165 00166 00167 /***************************************************************************** 00168 * dvbpsi_EmptyPAT/dvbpsi_DeletePAT 00169 *****************************************************************************/ 00176 void dvbpsi_EmptyPAT(dvbpsi_pat_t* p_pat); 00177 00184 #define dvbpsi_DeletePAT(p_pat) \ 00185 do { \ 00186 dvbpsi_EmptyPAT(p_pat); \ 00187 free(p_pat); \ 00188 } while(0); 00189 00190 00191 /***************************************************************************** 00192 * dvbpsi_PATAddProgram 00193 *****************************************************************************/ 00204 dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat, 00205 uint16_t i_number, uint16_t i_pid); 00206 00207 /***************************************************************************** 00208 * dvbpsi_GenPATSections 00209 *****************************************************************************/ 00221 dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_pat_t* p_pat, 00222 int i_max_pps); 00223 00224 00225 #ifdef __cplusplus 00226 }; 00227 #endif 00228 00229 #else 00230 #error "Multiple inclusions of pat.h" 00231 #endif 00232