libdvbpsi 0.2.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  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023  *
00024  *
00025  *****************************************************************************/
00026 
00040 #ifndef _DVBPSI_BAT_H_
00041 #define _DVBPSI_BAT_H_
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046 
00047 /*****************************************************************************
00048  * dvbpsi_bat_ts_t
00049  *****************************************************************************/
00061 typedef struct dvbpsi_bat_ts_s
00062 {
00063   uint16_t                      i_ts_id;                
00064   uint16_t                      i_orig_network_id;      
00066   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   uint16_t                  i_bouquet_id;            
00092   uint8_t                   i_version;          
00093   int                       b_current_next;     
00095   dvbpsi_descriptor_t *     p_first_descriptor; 
00097   dvbpsi_bat_ts_t *         p_first_ts;    
00100 } dvbpsi_bat_t;
00101 
00102 
00103 /*****************************************************************************
00104  * dvbpsi_bat_callback
00105  *****************************************************************************/
00111 typedef void (* dvbpsi_bat_callback)(void* p_cb_data, dvbpsi_bat_t* p_new_bat);
00112 
00113 
00114 /*****************************************************************************
00115  * dvbpsi_AttachBAT
00116  *****************************************************************************/
00129 __attribute__((deprecated))
00130 int dvbpsi_AttachBAT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
00131           uint16_t i_extension, dvbpsi_bat_callback pf_callback,
00132                                void* p_cb_data);
00133 
00134 
00135 /*****************************************************************************
00136  * dvbpsi_DetachBAT
00137  *****************************************************************************/
00147 __attribute__((deprecated))
00148 void dvbpsi_DetachBAT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
00149           uint16_t i_extension);
00150 
00151 
00152 /*****************************************************************************
00153  * dvbpsi_InitBAT/dvbpsi_NewBAT
00154  *****************************************************************************/
00166 __attribute__((deprecated))
00167 void dvbpsi_InitBAT(dvbpsi_bat_t *p_bat, uint16_t i_bouquet_id, uint8_t i_version,
00168                     int b_current_next);
00169 
00180 #define dvbpsi_NewBAT(p_bat, i_bouquet_id, i_version, b_current_next) \
00181 do {                                                                    \
00182   p_bat = (dvbpsi_bat_t*)malloc(sizeof(dvbpsi_bat_t));                  \
00183   if(p_bat != NULL)                                                     \
00184     dvbpsi_InitBAT(p_bat, i_bouquet_id, i_version, b_current_next); \
00185 } while(0);
00186 
00187 
00188 /*****************************************************************************
00189  * dvbpsi_EmptyBAT/dvbpsi_DeleteBAT
00190  *****************************************************************************/
00197 __attribute__((deprecated))
00198 void dvbpsi_EmptyBAT(dvbpsi_bat_t *p_bat);
00199 
00206 #define dvbpsi_DeleteBAT(p_bat)                                         \
00207 do {                                                                    \
00208   dvbpsi_EmptyBAT(p_bat);                                               \
00209   free(p_bat);                                                          \
00210 } while(0);
00211 
00212 /*****************************************************************************
00213  * dvbpsi_GenBATSections
00214  *****************************************************************************
00223 __attribute__((deprecated))
00224 dvbpsi_psi_section_t *dvbpsi_GenBATSections(dvbpsi_bat_t * p_bat);
00225 
00226 
00227 #ifdef __cplusplus
00228 };
00229 #endif
00230 
00231 #else
00232 #error "Multiple inclusions of bat.h"
00233 #endif
00234