]> git.sesse.net Git - vlc/blob - src/input/mpeg_system.h
* Big cleanup of the PS input plugin ;
[vlc] / src / input / mpeg_system.h
1 /*****************************************************************************
2  * mpeg_system.h: structures of the input used to parse MPEG-1, MPEG-2 PS
3  * and TS system layers
4  *****************************************************************************
5  * Copyright (C) 1999, 2000 VideoLAN
6  * $Id: mpeg_system.h,v 1.2 2000/12/20 16:04:31 massiot Exp $
7  *
8  * Authors:
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
24
25 /*****************************************************************************
26  * Constants
27  *****************************************************************************/
28 #define TS_PACKET_SIZE      188                       /* Size of a TS packet */
29 #define PSI_SECTION_SIZE    4096            /* Maximum size of a PSI section */
30 #define PADDING_PACKET_SIZE 100 /* Size of the NULL packet inserted in case
31                                  * of data loss (this should be < 188).      */
32
33
34 /*****************************************************************************
35  * psi_section_t
36  *****************************************************************************
37  * Describes a PSI section. Beware, it doesn't contain pointers to the TS
38  * packets that contain it as for a PES, but the data themselves
39  *****************************************************************************/
40 typedef struct psi_section_s
41 {
42     byte_t                  buffer[PSI_SECTION_SIZE];
43
44     /* Is there a section being decoded ? */
45     boolean_t               b_running_section;
46
47     u16                     i_length;
48     u16                     i_current_position;
49 } psi_section_t;
50
51 /*****************************************************************************
52  * es_ts_data_t: extension of es_descriptor_t
53  *****************************************************************************/
54 typedef struct es_ts_data_s
55 {
56     boolean_t               b_psi;   /* Does the stream have to be handled by
57                                       *                    the PSI decoder ? */
58     psi_section_t *         p_psi_section;                    /* PSI packets */
59
60     /* Markers */
61     int                     i_continuity_counter;
62 } es_ts_data_t;
63
64 /*****************************************************************************
65  * pgrm_ts_data_t: extension of pgrm_descriptor_t
66  *****************************************************************************/
67 typedef struct pgrm_ts_data_s
68 {
69     u16                     i_pcr_pid;             /* PCR ES, for TS streams */
70 } pgrm_ts_data_t;
71
72 /*****************************************************************************
73  * stream_ts_data_t: extension of stream_descriptor_t
74  *****************************************************************************/
75 typedef struct stream_ts_data_s
76 {
77     /* Program Association Table status */
78     u8                      i_PAT_version;                 /* version number */
79     boolean_t               b_is_PAT_complete;      /* Is the PAT complete ? */
80     u8                      i_known_PAT_sections;
81                                      /* Number of section we received so far */
82     byte_t                  a_known_PAT_sections[32];
83                                                 /* Already received sections */
84
85     /* Program Map Table status */
86     boolean_t               b_is_PMT_complete;      /* Is the PMT complete ? */
87     u8                      i_known_PMT_sections;
88                                      /* Number of section we received so far */
89     byte_t                  a_known_PMT_sections[32];
90                                                 /* Already received sections */
91
92     /* Service Description Table status */
93     u8                      i_SDT_version;                 /* version number */
94     boolean_t               b_is_SDT_complete;      /* Is the SDT complete ? */
95     u8                      i_known_SDT_sections;
96                                      /* Number of section we received so far */
97     byte_t                  a_known_SDT_sections[32];
98                                                 /* Already received sections */
99 } stream_ts_data_t;
100
101 /*****************************************************************************
102  * stream_ps_data_t: extension of stream_descriptor_t
103  *****************************************************************************/
104 typedef struct stream_ps_data_s
105 {
106     u8                      i_PSM_version;
107     boolean_t               b_is_PSM_complete;
108 } stream_ps_data_t;
109
110
111 /*****************************************************************************
112  * Prototypes
113  *****************************************************************************/
114 void input_DecodePES( struct input_thread_s *, struct es_descriptor_s * );
115 void input_ParsePES( struct input_thread_s *, struct es_descriptor_s * );
116 void input_GatherPES( struct input_thread_s *, struct data_packet_s *,
117                       struct es_descriptor_s *, boolean_t, boolean_t );
118 es_descriptor_t * input_ParsePS( struct input_thread_s *,
119                                  struct data_packet_s * );
120 void input_DemuxPS( struct input_thread_s *, struct data_packet_s * );
121 void input_DemuxTS( struct input_thread_s *, struct data_packet_s * );