00001 /***************************************************************************** 00002 * pat.h 00003 * (c)2001-2002 VideoLAN 00004 * $Id: pat.h 187 2009-11-18 07:26:10Z md $ 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 00033 #ifndef _DVBPSI_PAT_H_ 00034 #define _DVBPSI_PAT_H_ 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 00041 /***************************************************************************** 00042 * dvbpsi_pat_program_t 00043 *****************************************************************************/ 00055 typedef struct dvbpsi_pat_program_s 00056 { 00057 uint16_t i_number; 00058 uint16_t i_pid; 00060 struct dvbpsi_pat_program_s * p_next; 00063 } dvbpsi_pat_program_t; 00064 00065 00066 /***************************************************************************** 00067 * dvbpsi_pat_t 00068 *****************************************************************************/ 00080 typedef struct dvbpsi_pat_s 00081 { 00082 uint16_t i_ts_id; 00083 uint8_t i_version; 00084 int b_current_next; 00086 dvbpsi_pat_program_t * p_first_program; 00088 } dvbpsi_pat_t; 00089 00090 00091 /***************************************************************************** 00092 * dvbpsi_pat_callback 00093 *****************************************************************************/ 00099 typedef void (* dvbpsi_pat_callback)(void* p_cb_data, dvbpsi_pat_t* p_new_pat); 00100 00101 00102 /***************************************************************************** 00103 * dvbpsi_AttachPAT 00104 *****************************************************************************/ 00113 dvbpsi_handle dvbpsi_AttachPAT(dvbpsi_pat_callback pf_callback, 00114 void* p_cb_data); 00115 00116 00117 /***************************************************************************** 00118 * dvbpsi_DetachPAT 00119 *****************************************************************************/ 00128 void dvbpsi_DetachPAT(dvbpsi_handle h_dvbpsi); 00129 00130 00131 /***************************************************************************** 00132 * dvbpsi_InitPAT/dvbpsi_NewPAT 00133 *****************************************************************************/ 00144 void dvbpsi_InitPAT(dvbpsi_pat_t* p_pat, uint16_t i_ts_id, uint8_t i_version, 00145 int b_current_next); 00146 00156 #define dvbpsi_NewPAT(p_pat, i_ts_id, i_version, b_current_next) \ 00157 do { \ 00158 p_pat = (dvbpsi_pat_t*)malloc(sizeof(dvbpsi_pat_t)); \ 00159 if(p_pat != NULL) \ 00160 dvbpsi_InitPAT(p_pat, i_ts_id, i_version, b_current_next); \ 00161 } while(0); 00162 00163 00164 /***************************************************************************** 00165 * dvbpsi_EmptyPAT/dvbpsi_DeletePAT 00166 *****************************************************************************/ 00173 void dvbpsi_EmptyPAT(dvbpsi_pat_t* p_pat); 00174 00181 #define dvbpsi_DeletePAT(p_pat) \ 00182 do { \ 00183 dvbpsi_EmptyPAT(p_pat); \ 00184 free(p_pat); \ 00185 } while(0); 00186 00187 00188 /***************************************************************************** 00189 * dvbpsi_PATAddProgram 00190 *****************************************************************************/ 00201 dvbpsi_pat_program_t* dvbpsi_PATAddProgram(dvbpsi_pat_t* p_pat, 00202 uint16_t i_number, uint16_t i_pid); 00203 00204 /***************************************************************************** 00205 * dvbpsi_GenPATSections 00206 *****************************************************************************/ 00218 dvbpsi_psi_section_t* dvbpsi_GenPATSections(dvbpsi_pat_t* p_pat, 00219 int i_max_pps); 00220 00221 00222 #ifdef __cplusplus 00223 }; 00224 #endif 00225 00226 #else 00227 #error "Multiple inclusions of pat.h" 00228 #endif 00229