]> git.sesse.net Git - vlc/blob - src/input/mpeg_system.h
f1f18555b9868cfea1deabc7112e4244d25e8bad
[vlc] / src / input / mpeg_system.h
1 /*****************************************************************************
2  * Constants
3  *****************************************************************************/
4 #define TS_PACKET_SIZE      188                       /* Size of a TS packet */
5 #define PSI_SECTION_SIZE    4096            /* Maximum size of a PSI section */
6 #define PADDING_PACKET_SIZE 100 /* Size of the NULL packet inserted in case
7                                  * of data loss (this should be < 188).      */
8
9
10 /*****************************************************************************
11  * psi_section_t
12  *****************************************************************************
13  * Describes a PSI section. Beware, it doesn't contain pointers to the TS
14  * packets that contain it as for a PES, but the data themselves
15  *****************************************************************************/
16 typedef struct psi_section_s
17 {
18     byte_t                  buffer[PSI_SECTION_SIZE];
19
20     /* Is there a section being decoded ? */
21     boolean_t               b_running_section;
22
23     u16                     i_length;
24     u16                     i_current_position;
25 } psi_section_t;
26
27 /*****************************************************************************
28  * es_ts_data_t: extension of es_descriptor_t
29  *****************************************************************************/
30 typedef struct es_ts_data_s
31 {
32     boolean_t               b_psi;   /* Does the stream have to be handled by
33                                       *                    the PSI decoder ? */
34     psi_section_t *         p_psi_section;                    /* PSI packets */
35
36     /* Markers */
37     int                     i_continuity_counter;
38 } es_ts_data_t;
39
40 /*****************************************************************************
41  * pgrm_ts_data_t: extension of pgrm_descriptor_t
42  *****************************************************************************/
43 typedef struct pgrm_ts_data_s
44 {
45     u16                     i_pcr_pid;             /* PCR ES, for TS streams */
46 } pgrm_ts_data_t;
47
48 /*****************************************************************************
49  * stream_ts_data_t: extension of stream_descriptor_t
50  *****************************************************************************/
51 typedef struct stream_ts_data_s
52 {
53     /* Program Association Table status */
54     u8                      i_PAT_version;                 /* version number */
55     boolean_t               b_is_PAT_complete;      /* Is the PAT complete ? */
56     u8                      i_known_PAT_sections;
57                                      /* Number of section we received so far */
58     byte_t                  a_known_PAT_sections[32];
59                                                 /* Already received sections */
60
61     /* Program Map Table status */
62     boolean_t               b_is_PMT_complete;      /* Is the PMT complete ? */
63     u8                      i_known_PMT_sections;
64                                      /* Number of section we received so far */
65     byte_t                  a_known_PMT_sections[32];
66                                                 /* Already received sections */
67
68     /* Service Description Table status */
69     u8                      i_SDT_version;                 /* version number */
70     boolean_t               b_is_SDT_complete;      /* Is the SDT complete ? */
71     u8                      i_known_SDT_sections;
72                                      /* Number of section we received so far */
73     byte_t                  a_known_SDT_sections[32];
74                                                 /* Already received sections */
75 } stream_ts_data_t;
76
77 /*****************************************************************************
78  * stream_ps_data_t: extension of stream_descriptor_t
79  *****************************************************************************/
80 typedef struct stream_ps_data_s
81 {
82     u8                      i_PSM_version;
83     boolean_t               b_is_PSM_complete;
84 } stream_ps_data_t;
85
86
87 /*****************************************************************************
88  * Prototypes
89  *****************************************************************************/
90 void input_DecodePES( struct input_thread_s *, struct es_descriptor_s * );
91 void input_ParsePES( struct input_thread_s *, struct es_descriptor_s * );
92 void input_GatherPES( struct input_thread_s *, struct data_packet_s *,
93                       struct es_descriptor_s *, boolean_t, boolean_t );
94 void input_DemuxPS( struct input_thread_s *, struct data_packet_s * );
95 void input_DemuxTS( struct input_thread_s *, struct data_packet_s * );