libdvbpsi 0.1.0
|
00001 /***************************************************************************** 00002 * pmt.h 00003 * (c)2001-2002 VideoLAN 00004 * $Id: pmt.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_PMT_H_ 00034 #define _DVBPSI_PMT_H_ 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 00041 /***************************************************************************** 00042 * dvbpsi_pmt_es_t 00043 *****************************************************************************/ 00055 typedef struct dvbpsi_pmt_es_s 00056 { 00057 uint8_t i_type; 00058 uint16_t i_pid; 00060 dvbpsi_descriptor_t * p_first_descriptor; 00062 struct dvbpsi_pmt_es_s * p_next; 00065 } dvbpsi_pmt_es_t; 00066 00067 00068 /***************************************************************************** 00069 * dvbpsi_pmt_t 00070 *****************************************************************************/ 00082 typedef struct dvbpsi_pmt_s 00083 { 00084 uint16_t i_program_number; 00085 uint8_t i_version; 00086 int b_current_next; 00088 uint16_t i_pcr_pid; 00090 dvbpsi_descriptor_t * p_first_descriptor; 00092 dvbpsi_pmt_es_t * p_first_es; 00094 } dvbpsi_pmt_t; 00095 00096 00097 /***************************************************************************** 00098 * dvbpsi_pmt_callback 00099 *****************************************************************************/ 00105 typedef void (* dvbpsi_pmt_callback)(void* p_cb_data, dvbpsi_pmt_t* p_new_pmt); 00106 00107 00108 /***************************************************************************** 00109 * dvbpsi_AttachPMT 00110 *****************************************************************************/ 00121 dvbpsi_handle dvbpsi_AttachPMT(uint16_t i_program_number, 00122 dvbpsi_pmt_callback pf_callback, 00123 void* p_cb_data); 00124 00125 00126 /***************************************************************************** 00127 * dvbpsi_DetachPMT 00128 *****************************************************************************/ 00137 void dvbpsi_DetachPMT(dvbpsi_handle h_dvbpsi); 00138 00139 00140 /***************************************************************************** 00141 * dvbpsi_InitPMT/dvbpsi_NewPMT 00142 *****************************************************************************/ 00155 void dvbpsi_InitPMT(dvbpsi_pmt_t* p_pmt, uint16_t i_program_number, 00156 uint8_t i_version, int b_current_next, uint16_t i_pcr_pid); 00157 00169 #define dvbpsi_NewPMT(p_pmt, i_program_number, \ 00170 i_version, b_current_next, i_pcr_pid) \ 00171 do { \ 00172 p_pmt = (dvbpsi_pmt_t*)malloc(sizeof(dvbpsi_pmt_t)); \ 00173 if(p_pmt != NULL) \ 00174 dvbpsi_InitPMT(p_pmt, i_program_number, i_version, b_current_next, \ 00175 i_pcr_pid); \ 00176 } while(0); 00177 00178 00179 /***************************************************************************** 00180 * dvbpsi_EmptyPMT/dvbpsi_DeletePMT 00181 *****************************************************************************/ 00188 void dvbpsi_EmptyPMT(dvbpsi_pmt_t* p_pmt); 00189 00196 #define dvbpsi_DeletePMT(p_pmt) \ 00197 do { \ 00198 dvbpsi_EmptyPMT(p_pmt); \ 00199 free(p_pmt); \ 00200 } while(0); 00201 00202 00203 /***************************************************************************** 00204 * dvbpsi_PMTAddDescriptor 00205 *****************************************************************************/ 00218 dvbpsi_descriptor_t* dvbpsi_PMTAddDescriptor(dvbpsi_pmt_t* p_pmt, 00219 uint8_t i_tag, uint8_t i_length, 00220 uint8_t* p_data); 00221 00222 00223 /***************************************************************************** 00224 * dvbpsi_PMTAddES 00225 *****************************************************************************/ 00235 dvbpsi_pmt_es_t* dvbpsi_PMTAddES(dvbpsi_pmt_t* p_pmt, 00236 uint8_t i_type, uint16_t i_pid); 00237 00238 00239 /***************************************************************************** 00240 * dvbpsi_PMTESAddDescriptor 00241 *****************************************************************************/ 00254 dvbpsi_descriptor_t* dvbpsi_PMTESAddDescriptor(dvbpsi_pmt_es_t* p_es, 00255 uint8_t i_tag, uint8_t i_length, 00256 uint8_t* p_data); 00257 00258 00259 /***************************************************************************** 00260 * dvbpsi_GenPMTSections 00261 *****************************************************************************/ 00270 dvbpsi_psi_section_t* dvbpsi_GenPMTSections(dvbpsi_pmt_t* p_pmt); 00271 00272 00273 #ifdef __cplusplus 00274 }; 00275 #endif 00276 00277 #else 00278 #error "Multiple inclusions of pmt.h" 00279 #endif 00280