libdvbpsi 0.1.0

cat.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * cat.h
00003  * (c)2001-2007 VideoLAN
00004  * $Id: cat.h 187 2009-11-18 07:26:10Z md $
00005  *
00006  * Authors: Johann Hanne
00007  *          heavily based on pmt.h 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_CAT_H_
00036 #define _DVBPSI_CAT_H_
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 
00043 /*****************************************************************************
00044  * dvbpsi_cat_t
00045  *****************************************************************************/
00057 typedef struct dvbpsi_cat_s
00058 {
00059   uint8_t                   i_version;          
00060   int                       b_current_next;     
00062   dvbpsi_descriptor_t *     p_first_descriptor; 
00064 } dvbpsi_cat_t;
00065 
00066 
00067 /*****************************************************************************
00068  * dvbpsi_cat_callback
00069  *****************************************************************************/
00075 typedef void (* dvbpsi_cat_callback)(void* p_cb_data, dvbpsi_cat_t* p_new_cat);
00076 
00077 
00078 /*****************************************************************************
00079  * dvbpsi_AttachCAT
00080  *****************************************************************************/
00089 dvbpsi_handle dvbpsi_AttachCAT(dvbpsi_cat_callback pf_callback,
00090                                void* p_cb_data);
00091 
00092 
00093 /*****************************************************************************
00094  * dvbpsi_DetachCAT
00095  *****************************************************************************/
00104 void dvbpsi_DetachCAT(dvbpsi_handle h_dvbpsi);
00105 
00106 
00107 /*****************************************************************************
00108  * dvbpsi_InitCAT/dvbpsi_NewCAT
00109  *****************************************************************************/
00119 void dvbpsi_InitCAT(dvbpsi_cat_t* p_cat,
00120                     uint8_t i_version, int b_current_next);
00121 
00131 #define dvbpsi_NewCAT(p_cat,                                            \
00132                       i_version, b_current_next)                        \
00133 do {                                                                    \
00134   p_cat = (dvbpsi_cat_t*)malloc(sizeof(dvbpsi_cat_t));                  \
00135   if(p_cat != NULL)                                                     \
00136     dvbpsi_InitCAT(p_cat, i_version, b_current_next);                   \
00137 } while(0);
00138 
00139 
00140 /*****************************************************************************
00141  * dvbpsi_EmptyCAT/dvbpsi_DeleteCAT
00142  *****************************************************************************/
00149 void dvbpsi_EmptyCAT(dvbpsi_cat_t* p_cat);
00150 
00157 #define dvbpsi_DeleteCAT(p_cat)                                         \
00158 do {                                                                    \
00159   dvbpsi_EmptyCAT(p_cat);                                               \
00160   free(p_cat);                                                          \
00161 } while(0);
00162 
00163 
00164 /*****************************************************************************
00165  * dvbpsi_CATAddDescriptor
00166  *****************************************************************************/
00179 dvbpsi_descriptor_t* dvbpsi_CATAddDescriptor(dvbpsi_cat_t* p_cat,
00180                                              uint8_t i_tag, uint8_t i_length,
00181                                              uint8_t* p_data);
00182 
00183 
00184 /*****************************************************************************
00185  * dvbpsi_GenCATSections
00186  *****************************************************************************/
00195 dvbpsi_psi_section_t* dvbpsi_GenCATSections(dvbpsi_cat_t* p_cat);
00196 
00197 
00198 #ifdef __cplusplus
00199 };
00200 #endif
00201 
00202 #else
00203 #error "Multiple inclusions of cat.h"
00204 #endif
00205