libdvbpsi  2.0.0-git
MPEG Transport Stream PSI table parser
psi.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * psi.h
3  * Copyright (C) 2001-2011 VideoLAN
4  * $Id: psi.h,v 1.6 2002/04/02 17:55:30 bozo Exp $
5  *
6  * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  *****************************************************************************/
23 
32 #ifndef _DVBPSI_PSI_H_
33 #define _DVBPSI_PSI_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /*****************************************************************************
40  * dvbpsi_psi_section_t
41  *****************************************************************************/
69 {
70  /* non-specific section data */
71  uint8_t i_table_id;
74  uint16_t i_length;
76  /* used if b_syntax_indicator is true */
77  uint16_t i_extension;
80  uint8_t i_version;
82  uint8_t i_number;
83  uint8_t i_last_number;
85  /* non-specific section data */
86  /* the content is table-specific */
87  uint8_t * p_data;
88  uint8_t * p_payload_start;
89  uint8_t * p_payload_end;
91  /* used if b_syntax_indicator is true */
92  uint32_t i_crc;
94  /* list handling */
97 };
98 
99 /*****************************************************************************
100  * dvbpsi_NewPSISection
101  *****************************************************************************/
109 
110 /*****************************************************************************
111  * dvbpsi_DeletePSISections
112  *****************************************************************************/
120 
121 /*****************************************************************************
122  * dvbpsi_CheckPSISection
123  *****************************************************************************/
136  const uint8_t table_id, const char *psz_table_name);
137 
138 /*****************************************************************************
139  * dvbpsi_ValidPSISection
140  *****************************************************************************/
151 
152 /*****************************************************************************
153  * dvbpsi_BuildPSISection
154  *****************************************************************************/
162 void dvbpsi_BuildPSISection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t* p_section);
163 
164 /*****************************************************************************
165  * dvbpsi_CalculateCRC32
166  *****************************************************************************/
176 
177 /*****************************************************************************
178  * dvbpsi_has_CRC32
179  *****************************************************************************/
188 static inline bool dvbpsi_has_CRC32(dvbpsi_psi_section_t *p_section)
189 {
190  if ((p_section->i_table_id == (uint8_t) 0x70) /* TDT (has no CRC 32) */ ||
191  (p_section->i_table_id == (uint8_t) 0x71) /* RST (has no CRC 32) */ ||
192  (p_section->i_table_id == (uint8_t) 0x72) /* ST (has no CRC 32) */ ||
193  (p_section->i_table_id == (uint8_t) 0x7E))/* DIT (has no CRC 32) */
194  return false;
195 
196  return (p_section->b_syntax_indicator || (p_section->i_table_id == 0x73));
197 }
198 
199 #ifdef __cplusplus
200 };
201 #endif
202 
203 #else
204 #error "Multiple inclusions of psi.h"
205 #endif
206 
void dvbpsi_CalculateCRC32(dvbpsi_psi_section_t *p_section)
Calculate the CRC32 field accourding to ISO/IEC 13818-1, ITU-T Rec H.222.0 or ETSI EN 300 468 v1....
void dvbpsi_DeletePSISections(dvbpsi_psi_section_t *p_section)
Destruction of a dvbpsi_psi_section_t structure.
dvbpsi_psi_section_t * dvbpsi_NewPSISection(int i_max_size)
Creation of a new dvbpsi_psi_section_t structure.
bool dvbpsi_ValidPSISection(dvbpsi_psi_section_t *p_section)
Validity check of a PSI section, make sure to call this function on tables that have a CRC32 (.
bool dvbpsi_CheckPSISection(dvbpsi_t *p_dvbpsi, dvbpsi_psi_section_t *p_section, const uint8_t table_id, const char *psz_table_name)
Check if PSI section has the expected table_id. Call this function only for PSI sections that have a ...
PSI section structure.
Definition: psi.h:69
uint8_t * p_payload_end
Definition: psi.h:89
uint16_t i_extension
Definition: psi.h:77
uint8_t i_last_number
Definition: psi.h:83
uint8_t * p_data
Definition: psi.h:87
bool b_syntax_indicator
Definition: psi.h:72
uint8_t i_number
Definition: psi.h:82
struct dvbpsi_psi_section_s * p_next
Definition: psi.h:95
uint16_t i_length
Definition: psi.h:74
uint8_t i_table_id
Definition: psi.h:71
uint8_t i_version
Definition: psi.h:80
uint32_t i_crc
Definition: psi.h:92
uint8_t * p_payload_start
Definition: psi.h:88
bool b_current_next
Definition: psi.h:81
bool b_private_indicator
Definition: psi.h:73
DVBPSI handle structure.
Definition: dvbpsi.h:143