1 /*****************************************************************************
2 * mpeg_system.h: structures of the input used to parse MPEG-1, MPEG-2 PS
4 *****************************************************************************
5 * Copyright (C) 1999, 2000 VideoLAN
6 * $Id: mpeg_system.h,v 1.1 2001/02/08 04:43:27 sam Exp $
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #define TS_PACKET_SIZE 188 /* Size of a TS packet */
29 #define PSI_SECTION_SIZE 4096 /* Maximum size of a PSI section */
32 /*****************************************************************************
34 *****************************************************************************
35 * Describes a PSI section. Beware, it doesn't contain pointers to the TS
36 * packets that contain it as for a PES, but the data themselves
37 *****************************************************************************/
38 typedef struct psi_section_s
40 byte_t buffer[PSI_SECTION_SIZE];
42 /* Is there a section being decoded ? */
43 boolean_t b_running_section;
46 u16 i_current_position;
49 /*****************************************************************************
50 * es_ts_data_t: extension of es_descriptor_t
51 *****************************************************************************/
52 typedef struct es_ts_data_s
54 boolean_t b_psi; /* Does the stream have to be handled by
55 * the PSI decoder ? */
56 psi_section_t * p_psi_section; /* PSI packets */
59 int i_continuity_counter;
62 /*****************************************************************************
63 * pgrm_ts_data_t: extension of pgrm_descriptor_t
64 *****************************************************************************/
65 typedef struct pgrm_ts_data_s
67 u16 i_pcr_pid; /* PCR ES, for TS streams */
70 /*****************************************************************************
71 * stream_ts_data_t: extension of stream_descriptor_t
72 *****************************************************************************/
73 typedef struct stream_ts_data_s
75 /* Program Association Table status */
76 u8 i_PAT_version; /* version number */
77 boolean_t b_is_PAT_complete; /* Is the PAT complete ? */
78 u8 i_known_PAT_sections;
79 /* Number of section we received so far */
80 byte_t a_known_PAT_sections[32];
81 /* Already received sections */
83 /* Program Map Table status */
84 boolean_t b_is_PMT_complete; /* Is the PMT complete ? */
85 u8 i_known_PMT_sections;
86 /* Number of section we received so far */
87 byte_t a_known_PMT_sections[32];
88 /* Already received sections */
90 /* Service Description Table status */
91 u8 i_SDT_version; /* version number */
92 boolean_t b_is_SDT_complete; /* Is the SDT complete ? */
93 u8 i_known_SDT_sections;
94 /* Number of section we received so far */
95 byte_t a_known_SDT_sections[32];
96 /* Already received sections */
99 /*****************************************************************************
100 * stream_ps_data_t: extension of stream_descriptor_t
101 *****************************************************************************/
102 typedef struct stream_ps_data_s
104 boolean_t b_has_PSM; /* very rare, in fact */
109 /* PSM version is 5 bits, so -1 is not a valid value */
110 #define EMPTY_PSM_VERSION -1
113 /*****************************************************************************
115 *****************************************************************************/
116 void input_ParsePES( struct input_thread_s *, struct es_descriptor_s * );
117 void input_GatherPES( struct input_thread_s *, struct data_packet_s *,
118 struct es_descriptor_s *, boolean_t, boolean_t );
119 es_descriptor_t * input_ParsePS( struct input_thread_s *,
120 struct data_packet_s * );
121 void input_DemuxPS( struct input_thread_s *, struct data_packet_s * );
122 void input_DemuxTS( struct input_thread_s *, struct data_packet_s * );