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.3 2001/03/21 13:42:33 sam Exp $
8 * Authors: Christophe Massiot <massiot@via.ecp.fr>
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 */
31 #define PAT_UNINITIALIZED (1 << 6)
32 #define PMT_UNINITIALIZED (1 << 6)
34 #define PSI_IS_PAT 0x00
35 #define PSI_IS_PMT 0x01
36 #define UNKNOWN_PSI 0xff
38 /*****************************************************************************
40 *****************************************************************************
41 * Describes a PSI section. Beware, it doesn't contain pointers to the TS
42 * packets that contain it as for a PES, but the data themselves
43 *****************************************************************************/
44 typedef struct psi_section_s
46 byte_t buffer[PSI_SECTION_SIZE];
49 u8 i_last_section_number;
52 u16 i_read_in_section;
54 /* the PSI is complete */
55 boolean_t b_is_complete;
57 /* packet missed up ? */
61 boolean_t b_section_complete;
63 /* where are we currently ? */
68 /*****************************************************************************
69 * es_ts_data_t: extension of es_descriptor_t
70 *****************************************************************************/
71 typedef struct es_ts_data_s
73 boolean_t b_psi; /* Does the stream have to be handled by
74 * the PSI decoder ? */
76 int i_psi_type; /* There are different types of PSI */
78 psi_section_t * p_psi_section; /* PSI packets */
81 int i_continuity_counter;
84 /*****************************************************************************
85 * pgrm_ts_data_t: extension of pgrm_descriptor_t
86 *****************************************************************************/
87 typedef struct pgrm_ts_data_s
89 u16 i_pcr_pid; /* PCR ES, for TS streams */
93 /*****************************************************************************
94 * stream_ts_data_t: extension of stream_descriptor_t
95 *****************************************************************************/
96 typedef struct stream_ts_data_s
98 int i_pat_version; /* Current version of the PAT */
101 /*****************************************************************************
102 * stream_ps_data_t: extension of stream_descriptor_t
103 *****************************************************************************/
104 typedef struct stream_ps_data_s
106 boolean_t b_has_PSM; /* very rare, in fact */
111 /* PSM version is 5 bits, so -1 is not a valid value */
112 #define EMPTY_PSM_VERSION -1
115 /*****************************************************************************
117 *****************************************************************************/
118 void input_ParsePES( struct input_thread_s *, struct es_descriptor_s * );
119 void input_GatherPES( struct input_thread_s *, struct data_packet_s *,
120 struct es_descriptor_s *, boolean_t, boolean_t );
121 es_descriptor_t * input_ParsePS( struct input_thread_s *,
122 struct data_packet_s * );
123 void input_DemuxPS( struct input_thread_s *, struct data_packet_s * );
124 void input_DemuxTS( struct input_thread_s *, struct data_packet_s * );
125 void input_DemuxPSI( input_thread_t *, data_packet_t *, es_descriptor_t *,
126 boolean_t, boolean_t );