libdvbpsi 0.1.0

sdt.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * sdt.h
00003  * (c)2001-2002 VideoLAN
00004  * $Id: sdt.h 187 2009-11-18 07:26:10Z md $
00005  *
00006  * Authors: Johan Bilien <jobi@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_SDT_H_
00034 #define _DVBPSI_SDT_H_
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 
00041 /*****************************************************************************
00042  * dvbpsi_sdt_service_t
00043  *****************************************************************************/
00055 typedef struct dvbpsi_sdt_service_s
00056 {
00057   uint16_t                  i_service_id;           
00058   int                       b_eit_schedule;         
00059   int                       b_eit_present;          
00061   uint8_t                   i_running_status;       
00062   int                       b_free_ca;              
00063   uint16_t                  i_descriptors_length;   
00065   dvbpsi_descriptor_t *     p_first_descriptor;     
00069   struct dvbpsi_sdt_service_s * p_next;             
00072 } dvbpsi_sdt_service_t;
00073 
00074 
00075 /*****************************************************************************
00076  * dvbpsi_sdt_t
00077  *****************************************************************************/
00089 typedef struct dvbpsi_sdt_s
00090 {
00091   uint16_t                  i_ts_id;            
00092   uint8_t                   i_version;          
00093   int                       b_current_next;     
00094   uint16_t                  i_network_id;       
00096   dvbpsi_sdt_service_t *    p_first_service;    
00099 } dvbpsi_sdt_t;
00100 
00101 
00102 /*****************************************************************************
00103  * dvbpsi_sdt_callback
00104  *****************************************************************************/
00110 typedef void (* dvbpsi_sdt_callback)(void* p_cb_data, dvbpsi_sdt_t* p_new_sdt);
00111 
00112 
00113 /*****************************************************************************
00114  * dvbpsi_AttachSDT
00115  *****************************************************************************/
00128 int dvbpsi_AttachSDT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
00129           uint16_t i_extension, dvbpsi_sdt_callback pf_callback,
00130                                void* p_cb_data);
00131 
00132 
00133 /*****************************************************************************
00134  * dvbpsi_DetachSDT
00135  *****************************************************************************/
00145 void dvbpsi_DetachSDT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
00146           uint16_t i_extension);
00147 
00148 
00149 /*****************************************************************************
00150  * dvbpsi_InitSDT/dvbpsi_NewSDT
00151  *****************************************************************************/
00163 void dvbpsi_InitSDT(dvbpsi_sdt_t *p_sdt, uint16_t i_ts_id, uint8_t i_version,
00164                     int b_current_next, uint16_t i_network_id);
00165 
00176 #define dvbpsi_NewSDT(p_sdt, i_ts_id, i_version, b_current_next,i_network_id) \
00177 do {                                                                    \
00178   p_sdt = (dvbpsi_sdt_t*)malloc(sizeof(dvbpsi_sdt_t));                  \
00179   if(p_sdt != NULL)                                                     \
00180     dvbpsi_InitSDT(p_sdt, i_ts_id, i_version, b_current_next, i_network_id); \
00181 } while(0);
00182 
00183 
00184 /*****************************************************************************
00185  * dvbpsi_EmptySDT/dvbpsi_DeleteSDT
00186  *****************************************************************************/
00193 void dvbpsi_EmptySDT(dvbpsi_sdt_t *p_sdt);
00194 
00201 #define dvbpsi_DeleteSDT(p_sdt)                                         \
00202 do {                                                                    \
00203   dvbpsi_EmptySDT(p_sdt);                                               \
00204   free(p_sdt);                                                          \
00205 } while(0);
00206 
00207 
00208 /*****************************************************************************
00209  * dvbpsi_SDTAddService
00210  *****************************************************************************/
00227 dvbpsi_sdt_service_t *dvbpsi_SDTAddService(dvbpsi_sdt_t* p_sdt,
00228     uint16_t i_service_id, int b_eit_schedule, int b_eit_present,
00229     uint8_t i_running_status,int b_free_ca);
00230 
00231 
00232 /*****************************************************************************
00233  * dvbpsi_SDTServiceAddDescriptor
00234  *****************************************************************************/
00247 dvbpsi_descriptor_t *dvbpsi_SDTServiceAddDescriptor(
00248                                                dvbpsi_sdt_service_t *p_service,
00249                                                uint8_t i_tag, uint8_t i_length,
00250                                                uint8_t *p_data);
00251 
00252 
00253 /*****************************************************************************
00254  * dvbpsi_GenSDTSections
00255  *****************************************************************************
00256  * Generate SDT sections based on the dvbpsi_sdt_t structure.
00257  *****************************************************************************/
00258 dvbpsi_psi_section_t *dvbpsi_GenSDTSections(dvbpsi_sdt_t * p_sdt);
00259 
00260 #ifdef __cplusplus
00261 };
00262 #endif
00263 
00264 #else
00265 #error "Multiple inclusions of sdt.h"
00266 #endif
00267