libdvbpsi  1.3.0
bat.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  * bat.h
00003  * Copyright (C) 2001-2011 VideoLAN
00004  * $Id: bat.h  $
00005  *
00006  * Authors: Zhu zhenglu <zhuzlu@gmail.com>
00007  *          heavily based on nit.h which was written by
00008  *          Johann Hanne
00009  *          Jean-Paul Saman <jpsaman@videolan.org>
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Lesser General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2.1 of the License, or (at your option) any later version.
00015  *
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this library; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00024  *
00025  *
00026  *****************************************************************************/
00027 
00041 #ifndef _DVBPSI_BAT_H_
00042 #define _DVBPSI_BAT_H_
00043 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00048 /*****************************************************************************
00049  * dvbpsi_bat_ts_t
00050  *****************************************************************************/
00062 typedef struct dvbpsi_bat_ts_s
00063 {
00064     uint16_t                i_ts_id;            
00065     uint16_t                i_orig_network_id;  
00067     dvbpsi_descriptor_t    *p_first_descriptor; 
00069     struct dvbpsi_bat_ts_s *p_next;             
00072 } dvbpsi_bat_ts_t;
00073 
00074 
00075 /*****************************************************************************
00076  * dvbpsi_bat_t
00077  *****************************************************************************/
00089 typedef struct dvbpsi_bat_s
00090 {
00091     uint8_t                 i_table_id;         
00092     uint16_t                i_extension;        
00094     uint8_t                 i_version;          
00095     bool                    b_current_next;     
00097     dvbpsi_descriptor_t *   p_first_descriptor; 
00099     dvbpsi_bat_ts_t *       p_first_ts;         
00102 } dvbpsi_bat_t;
00103 
00104 /*****************************************************************************
00105  * dvbpsi_bat_callback
00106  *****************************************************************************/
00112 typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat);
00113 
00114 /*****************************************************************************
00115  * dvbpsi_bat_attach
00116  *****************************************************************************/
00128 bool dvbpsi_bat_attach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension,
00129                        dvbpsi_bat_callback pf_callback, void* p_cb_data);
00130 
00131 /*****************************************************************************
00132  * dvbpsi_bat_detach
00133  *****************************************************************************/
00143 void dvbpsi_bat_detach(dvbpsi_t *p_dvbpsi, uint8_t i_table_id, uint16_t i_extension);
00144 
00145 /*****************************************************************************
00146  * dvbpsi_bat_init/dvbpsi_bat_new
00147  *****************************************************************************/
00159 void dvbpsi_bat_init(dvbpsi_bat_t *p_bat, uint8_t i_table_id, uint16_t i_extension,
00160                      uint8_t i_version, bool b_current_next);
00161 
00172 dvbpsi_bat_t *dvbpsi_bat_new(uint8_t i_table_id, uint16_t i_extension,
00173                              uint8_t i_version, bool b_current_next);
00174 
00175 /*****************************************************************************
00176  * dvbpsi_bat_empty/dvbpsi_bat_delete
00177  *****************************************************************************/
00184 void dvbpsi_bat_empty(dvbpsi_bat_t *p_bat);
00185 
00192 void dvbpsi_bat_delete(dvbpsi_bat_t *p_bat);
00193 
00194 /*****************************************************************************
00195  * dvbpsi_bat_descriptor_add
00196  *****************************************************************************/
00209 dvbpsi_descriptor_t* dvbpsi_bat_bouquet_descriptor_add(dvbpsi_bat_t* p_bat,
00210                                                        uint8_t i_tag, uint8_t i_length,
00211                                                        uint8_t* p_data);
00212 
00213 /*****************************************************************************
00214  * dvbpsi_bat_ts_add
00215  *****************************************************************************/
00227 dvbpsi_bat_ts_t *dvbpsi_bat_ts_add(dvbpsi_bat_t* p_bat,
00228                                  uint16_t i_ts_id, uint16_t i_orig_network_id);
00229 
00230 /*****************************************************************************
00231  * dvbpsi_bat_ts_descriptor_add
00232  *****************************************************************************/
00245 dvbpsi_descriptor_t *dvbpsi_bat_ts_descriptor_add(dvbpsi_bat_ts_t *p_bat,
00246                                                uint8_t i_tag, uint8_t i_length,
00247                                                uint8_t *p_data);
00248 
00249 /*****************************************************************************
00250  * dvbpsi_bat_sections_generate
00251  *****************************************************************************/
00261 dvbpsi_psi_section_t *dvbpsi_bat_sections_generate(dvbpsi_t *p_dvbpsi, dvbpsi_bat_t * p_bat);
00262 
00263 #ifdef __cplusplus
00264 };
00265 #endif
00266 
00267 #else
00268 #error "Multiple inclusions of bat.h"
00269 #endif