1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
/*****************************************************************************
* psi.h
* (c)2001-2002 VideoLAN
* $Id: psi.h 88 2004-02-24 14:31:18Z sam $
*
* Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*****************************************************************************/
/*!
* \file <psi.h>
* \author Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
* \brief Common PSI tools.
*
* PSI section structure and its Manipulation tools.
*/
#ifndef _DVBPSI_PSI_H_
#define _DVBPSI_PSI_H_
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* dvbpsi_psi_section_t
*****************************************************************************/
/*!
* \struct dvbpsi_psi_section_s
* \brief PSI section structure.
*
* This structure is used to store a PSI section. The common information are
* decoded (ISO/IEC 13818-1 section 2.4.4.10).
*
* dvbpsi_psi_section_s::p_data stores the complete section including the
* header.
*
* When dvbpsi_psi_section_s::b_syntax_indicator == 0,
* dvbpsi_psi_section_s::p_payload_start points immediately after the
* section_length field and dvbpsi_psi_section_s::p_payload_end points
* immediately after the end of the section (don't try to access this byte).
*
* When dvbpsi_psi_section_s::b_syntax_indicator != 0,
* dvbpsi_psi_section_s::p_payload_start points immediately after the
* last_section_number field and dvbpsi_psi_section_s::p_payload_end points to
* the first byte of the CRC_32 field.
*
* When dvbpsi_psi_section_s::b_syntax_indicator == 0
* dvbpsi_psi_section_s::i_extension, dvbpsi_psi_section_s::i_version,
* dvbpsi_psi_section_s::b_current_next, dvbpsi_psi_section_s::i_number,
* dvbpsi_psi_section_s::i_last_number, and dvbpsi_psi_section_s::i_crc are
* undefined.
*/
struct dvbpsi_psi_section_s
{
/* non-specific section data */
uint8_t i_table_id; /*!< table_id */
int b_syntax_indicator; /*!< section_syntax_indicator */
int b_private_indicator; /*!< private_indicator */
uint16_t i_length; /*!< section_length */
/* used if b_syntax_indicator is true */
uint16_t i_extension; /*!< table_id_extension */
/*!< transport_stream_id for a
PAT section */
uint8_t i_version; /*!< version_number */
int b_current_next; /*!< current_next_indicator */
uint8_t i_number; /*!< section_number */
uint8_t i_last_number; /*!< last_section_number */
/* non-specific section data */
/* the content is table-specific */
uint8_t * p_data; /*!< complete section */
uint8_t * p_payload_start; /*!< payload start */
uint8_t * p_payload_end; /*!< payload end */
/* used if b_syntax_indicator is true */
uint32_t i_crc; /*!< CRC_32 */
/* for reusing this section */
uint32_t i_max_size; /*!< maximum size of p_data */
/* list handling */
struct dvbpsi_psi_section_s * p_next; /*!< next element of
the list */
};
/*****************************************************************************
* dvbpsi_ClaimPSISection
*****************************************************************************/
/*!
* \fn dvbpsi_psi_section_t * dvbpsi_ClaimPSISection(int i_max_size)
* \brief Return a previously released section if one is available or create a new one.
* \param h_dvbpsi Handle to retrieve the currently unused section from.
* \param i_max_size max size in bytes of the section
* \return a pointer to the new PSI section structure.
*/
dvbpsi_psi_section_t * dvbpsi_ClaimPSISection(dvbpsi_handle h_dvbpsi, int i_max_size);
/*****************************************************************************
* dvbpsi_ReleasePSISections
*****************************************************************************/
/*!
* \fn void dvbpsi_ReleasePSISections(dvbpsi_psi_section_t * p_section)
* \brief Release a section so it can be reused.
* \param h_dvbpsi Handle to store the unused sections in.
* \param p_section pointer to the first PSI section structure
* \return nothing.
*/
void dvbpsi_ReleasePSISections(dvbpsi_handle h_dvbpsi, dvbpsi_psi_section_t * p_section);
/*****************************************************************************
* dvbpsi_ClonePSISection
*****************************************************************************/
/*!
* \fn void dvbpsi_ClonePSISection(dvbpsi_handle h_dvbpsi, dvbpsi_psi_section_t * p_section)
* \brief Release a section so it can be reused.
* \param h_dvbpsi Handle to retrieve the currently unused section from.
* \param p_section pointer to the PSI section structure to clone.
* \return a pointer to the new PSI section structure.
*/
dvbpsi_psi_section_t * dvbpsi_ClonePSISection(dvbpsi_handle h_dvbpsi, dvbpsi_psi_section_t * p_section);
/*****************************************************************************
* dvbpsi_NewPSISection
*****************************************************************************/
/*!
* \fn dvbpsi_psi_section_t * dvbpsi_NewPSISection(int i_max_size)
* \brief Creation of a new dvbpsi_psi_section_t structure.
* \param i_max_size max size in bytes of the section
* \return a pointer to the new PSI section structure.
*/
dvbpsi_psi_section_t * dvbpsi_NewPSISection(int i_max_size);
/*****************************************************************************
* dvbpsi_DeletePSISections
*****************************************************************************/
/*!
* \fn void dvbpsi_DeletePSISections(dvbpsi_psi_section_t * p_section)
* \brief Destruction of a dvbpsi_psi_section_t structure.
* \param p_section pointer to the first PSI section structure
* \return nothing.
*/
void dvbpsi_DeletePSISections(dvbpsi_psi_section_t * p_section);
/*****************************************************************************
* dvbpsi_ValidPSISection
*****************************************************************************/
/*!
* \fn int dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section)
* \brief Validity check of a PSI section.
* \param p_section pointer to the PSI section structure
* \return boolean value (0 if the section is not valid).
*
* Check the CRC_32 if the section has b_syntax_indicator set.
*/
int dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section);
/*****************************************************************************
* dvbpsi_BuildPSISection
*****************************************************************************/
/*!
* \fn void dvbpsi_BuildPSISection(dvbpsi_psi_section_t* p_section)
* \brief Build a valid section based on the information in the structure.
* \param p_section pointer to the PSI section structure
* \return nothing.
*/
void dvbpsi_BuildPSISection(dvbpsi_psi_section_t* p_section);
#ifdef __cplusplus
};
#endif
#endif
|