libdvbpsi 0.1.0

nit.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * nit.h
00003  * (c)2001-2008 VideoLAN
00004  * $Id: nit.h 187 2009-11-18 07:26:10Z md $
00005  *
00006  * Authors: Johann Hanne
00007  *          heavily based on pmt.c which was written by
00008  *          Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU General Public License
00012  * as published by the Free Software Foundation; either version 2
00013  * of the License, or (at your option) any later version.
00014  *
00015  * This program 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
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023  *
00024  *****************************************************************************/
00025 
00035 #ifndef _DVBPSI_NIT_H_
00036 #define _DVBPSI_NIT_H_
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 
00043 /*****************************************************************************
00044  * dvbpsi_nit_ts_t
00045  *****************************************************************************/
00057 typedef struct dvbpsi_nit_ts_s
00058 {
00059   uint16_t                      i_ts_id;                
00060   uint16_t                      i_orig_network_id;      
00062   dvbpsi_descriptor_t *         p_first_descriptor;     
00064   struct dvbpsi_nit_ts_s *      p_next;                 
00067 } dvbpsi_nit_ts_t;
00068 
00069 
00070 /*****************************************************************************
00071  * dvbpsi_nit_t
00072  *****************************************************************************/
00084 typedef struct dvbpsi_nit_s
00085 {
00086   uint16_t                  i_network_id;       
00087   uint8_t                   i_version;          
00088   int                       b_current_next;     
00090   dvbpsi_descriptor_t *     p_first_descriptor; 
00092   dvbpsi_nit_ts_t *         p_first_ts;         
00094 } dvbpsi_nit_t;
00095 
00096 
00097 /*****************************************************************************
00098  * dvbpsi_nit_callback
00099  *****************************************************************************/
00105 typedef void (* dvbpsi_nit_callback)(void* p_cb_data, dvbpsi_nit_t* p_new_nit);
00106 
00107 
00108 /*****************************************************************************
00109  * dvbpsi_AttachNIT
00110  *****************************************************************************/
00123 int dvbpsi_AttachNIT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
00124                      uint16_t i_extension, dvbpsi_nit_callback pf_callback,
00125                      void* p_cb_data);
00126 
00127 
00128 /*****************************************************************************
00129  * dvbpsi_DetachNIT
00130  *****************************************************************************/
00140 void dvbpsi_DetachNIT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
00141                       uint16_t i_extension);
00142 
00143 
00144 /*****************************************************************************
00145  * dvbpsi_InitNIT/dvbpsi_NewNIT
00146  *****************************************************************************/
00157 void dvbpsi_InitNIT(dvbpsi_nit_t* p_nit, uint16_t i_network_id,
00158                     uint8_t i_version, int b_current_next);
00159 
00171 #define dvbpsi_NewNIT(p_nit, i_network_id,                              \
00172                       i_version, b_current_next)                        \
00173 do {                                                                    \
00174   p_nit = (dvbpsi_nit_t*)malloc(sizeof(dvbpsi_nit_t));                  \
00175   if(p_nit != NULL)                                                     \
00176     dvbpsi_InitNIT(p_nit, i_network_id, i_version, b_current_next);     \
00177 } while(0);
00178 
00179 
00180 /*****************************************************************************
00181  * dvbpsi_EmptyNIT/dvbpsi_DeleteNIT
00182  *****************************************************************************/
00189 void dvbpsi_EmptyNIT(dvbpsi_nit_t* p_nit);
00190 
00197 #define dvbpsi_DeleteNIT(p_nit)                                         \
00198 do {                                                                    \
00199   dvbpsi_EmptyNIT(p_nit);                                               \
00200   free(p_nit);                                                          \
00201 } while(0);
00202 
00203 
00204 /*****************************************************************************
00205  * dvbpsi_NITAddDescriptor
00206  *****************************************************************************/
00219 dvbpsi_descriptor_t* dvbpsi_NITAddDescriptor(dvbpsi_nit_t* p_nit,
00220                                              uint8_t i_tag, uint8_t i_length,
00221                                              uint8_t* p_data);
00222 
00223 
00224 /*****************************************************************************
00225  * dvbpsi_NITAddTS
00226  *****************************************************************************/
00236 dvbpsi_nit_ts_t* dvbpsi_NITAddTS(dvbpsi_nit_t* p_nit,
00237                                  uint16_t i_ts_id, uint16_t i_orig_network_id);
00238 
00239 
00240 /*****************************************************************************
00241  * dvbpsi_NITTSAddDescriptor
00242  *****************************************************************************/
00255 dvbpsi_descriptor_t* dvbpsi_NITTSAddDescriptor(dvbpsi_nit_ts_t* p_ts,
00256                                                uint8_t i_tag, uint8_t i_length,
00257                                                uint8_t* p_data);
00258 
00259 
00260 /*****************************************************************************
00261  * dvbpsi_GenNITSections
00262  *****************************************************************************/
00273 dvbpsi_psi_section_t* dvbpsi_GenNITSections(dvbpsi_nit_t* p_nit,
00274                                             uint8_t i_table_id);
00275 
00276 
00277 #ifdef __cplusplus
00278 };
00279 #endif
00280 
00281 #else
00282 #error "Multiple inclusions of nit.h"
00283 #endif
00284