libdvbpsi 0.1.0

tot.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * tot.h
00003  * (c)2001-2008 VideoLAN
00004  * $Id: tot.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_TOT_H_
00036 #define _DVBPSI_TOT_H_
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 
00043 /*****************************************************************************
00044  * dvbpsi_tot_t
00045  *****************************************************************************/
00057 typedef struct dvbpsi_tot_s
00058 {
00059   uint64_t                  i_utc_time;         
00061   dvbpsi_descriptor_t *     p_first_descriptor; 
00063   uint32_t      i_crc;                          
00065 } dvbpsi_tot_t;
00066 
00067 
00068 /*****************************************************************************
00069  * dvbpsi_tot_callback
00070  *****************************************************************************/
00076 typedef void (* dvbpsi_tot_callback)(void* p_cb_data, dvbpsi_tot_t* p_new_tot);
00077 
00078 
00079 /*****************************************************************************
00080  * dvbpsi_AttachTOT
00081  *****************************************************************************/
00093 int dvbpsi_AttachTOT(dvbpsi_decoder_t * p_psi_decoder, uint8_t i_table_id,
00094                      uint16_t i_extension,
00095                      dvbpsi_tot_callback pf_callback, void* p_cb_data);
00096 
00097 
00098 /*****************************************************************************
00099  * dvbpsi_DetachTOT
00100  *****************************************************************************/
00109 void dvbpsi_DetachTOT(dvbpsi_demux_t * p_demux, uint8_t i_table_id,
00110                       uint16_t i_extension);
00111 
00112 
00113 /*****************************************************************************
00114  * dvbpsi_InitTOT/dvbpsi_NewTOT
00115  *****************************************************************************/
00123 void dvbpsi_InitTOT(dvbpsi_tot_t* p_tot, uint64_t i_utc_time);
00124 
00132 #define dvbpsi_NewTOT(p_tot, i_utc_time)                                \
00133 do {                                                                    \
00134   p_tot = (dvbpsi_tot_t*)malloc(sizeof(dvbpsi_tot_t));                  \
00135   if(p_tot != NULL)                                                     \
00136     dvbpsi_InitTOT(p_tot, i_utc_time);                                  \
00137 } while(0);
00138 
00139 
00140 /*****************************************************************************
00141  * dvbpsi_EmptyTOT/dvbpsi_DeleteTOT
00142  *****************************************************************************/
00149 void dvbpsi_EmptyTOT(dvbpsi_tot_t* p_tot);
00150 
00157 #define dvbpsi_DeleteTOT(p_tot)                                         \
00158 do {                                                                    \
00159   dvbpsi_EmptyTOT(p_tot);                                               \
00160   free(p_tot);                                                          \
00161 } while(0);
00162 
00163 
00164 /*****************************************************************************
00165  * dvbpsi_TOTAddDescriptor
00166  *****************************************************************************/
00179 dvbpsi_descriptor_t* dvbpsi_TOTAddDescriptor(dvbpsi_tot_t* p_tot,
00180                                              uint8_t i_tag, uint8_t i_length,
00181                                              uint8_t* p_data);
00182 
00183 
00184 /*****************************************************************************
00185  * dvbpsi_GenTOTSections
00186  *****************************************************************************/
00195 dvbpsi_psi_section_t* dvbpsi_GenTOTSections(dvbpsi_tot_t* p_tot);
00196 
00197 
00198 #ifdef __cplusplus
00199 };
00200 #endif
00201 
00202 #else
00203 #error "Multiple inclusions of tot.h"
00204 #endif
00205