00001 /***************************************************************************** 00002 * pmt.h 00003 * (c)2001-2002 VideoLAN 00004 * $Id: pmt.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_PMT_H_ 00037 #define _DVBPSI_PMT_H_ 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00043 00044 /***************************************************************************** 00045 * dvbpsi_pmt_es_t 00046 *****************************************************************************/ 00058 typedef struct dvbpsi_pmt_es_s 00059 { 00060 uint8_t i_type; 00061 uint16_t i_pid; 00063 dvbpsi_descriptor_t * p_first_descriptor; 00065 struct dvbpsi_pmt_es_s * p_next; 00068 } dvbpsi_pmt_es_t; 00069 00070 00071 /***************************************************************************** 00072 * dvbpsi_pmt_t 00073 *****************************************************************************/ 00085 typedef struct dvbpsi_pmt_s 00086 { 00087 uint16_t i_program_number; 00088 uint8_t i_version; 00089 int b_current_next; 00091 uint16_t i_pcr_pid; 00093 dvbpsi_descriptor_t * p_first_descriptor; 00095 dvbpsi_pmt_es_t * p_first_es; 00097 } dvbpsi_pmt_t; 00098 00099 00100 /***************************************************************************** 00101 * dvbpsi_pmt_callback 00102 *****************************************************************************/ 00108 typedef void (* dvbpsi_pmt_callback)(void* p_cb_data, dvbpsi_pmt_t* p_new_pmt); 00109 00110 00111 /***************************************************************************** 00112 * dvbpsi_AttachPMT 00113 *****************************************************************************/ 00124 dvbpsi_handle dvbpsi_AttachPMT(uint16_t i_program_number, 00125 dvbpsi_pmt_callback pf_callback, 00126 void* p_cb_data); 00127 00128 00129 /***************************************************************************** 00130 * dvbpsi_DetachPMT 00131 *****************************************************************************/ 00140 void dvbpsi_DetachPMT(dvbpsi_handle h_dvbpsi); 00141 00142 00143 /***************************************************************************** 00144 * dvbpsi_InitPMT/dvbpsi_NewPMT 00145 *****************************************************************************/ 00158 void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number, 00159 uint8_t i_version, int b_current_next, uint16_t i_pcr_pid); 00160 00172 #define dvbpsi_NewPMT(p_pmt, i_program_number, \ 00173 i_version, b_current_next, i_pcr_pid) \ 00174 do { \ 00175 p_pmt = (dvbpsi_pmt_t*)malloc(sizeof(dvbpsi_pmt_t)); \ 00176 if(p_pmt != NULL) \ 00177 dvbpsi_InitPMT(p_pmt, i_program_number, i_version, b_current_next, \ 00178 i_pcr_pid); \ 00179 } while(0); 00180 00181 00182 /***************************************************************************** 00183 * dvbpsi_EmptyPMT/dvbpsi_DeletePMT 00184 *****************************************************************************/ 00191 void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt); 00192 00199 #define dvbpsi_DeletePMT(p_pmt) \ 00200 do { \ 00201 dvbpsi_EmptyPMT(p_pmt); \ 00202 free(p_pmt); \ 00203 } while(0); 00204 00205 00206 /***************************************************************************** 00207 * dvbpsi_PMTAddDescriptor 00208 *****************************************************************************/ 00221 dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt, 00222 uint8_t i_tag, uint8_t i_length, 00223 uint8_t* p_data); 00224 00225 00226 /***************************************************************************** 00227 * dvbpsi_PMTAddES 00228 *****************************************************************************/ 00238 dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt, 00239 uint8_t i_type, uint16_t i_pid); 00240 00241 00242 /***************************************************************************** 00243 * dvbpsi_PMTESAddDescriptor 00244 *****************************************************************************/ 00257 dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es, 00258 uint8_t i_tag, uint8_t i_length, 00259 uint8_t* p_data); 00260 00261 00262 /***************************************************************************** 00263 * dvbpsi_GenPMTSections 00264 *****************************************************************************/ 00273 dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_pmt_t* p_pmt); 00274 00275 00276 #ifdef __cplusplus 00277 }; 00278 #endif 00279 00280 #else 00281 #error "Multiple inclusions of pmt.h" 00282 #endif 00283