servicemp3.cpp: more simple/flexible streaming detection
[enigma2.git] / lib / dvb / lowlevel / eit.h
1
2 /*
3  * EVENT INFORMATION TABLE
4  *
5  * Copyright (C) 1998  Thomas Mirlacher
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  * 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  * 
21  * The author may be reached as dent@cosy.sbg.ac.at, or
22  * Thomas Mirlacher, Jakob-Haringerstr. 2, A-5020 Salzburg,
23  * Austria
24  *
25  *------------------------------------------------------------
26  *
27  */
28
29 #ifndef __EIT_H__
30 #define __EIT_H__
31
32 // Service Description Section
33 #include <sys/types.h>
34
35 typedef struct {
36         u_char  table_id                        : 8;
37
38 #if BYTE_ORDER == BIG_ENDIAN
39         u_char  section_syntax_indicator        : 1;
40         u_char                                  : 3;
41         u_char  section_length_hi               : 4;
42 #else
43         u_char  section_length_hi               : 4;
44         u_char                                  : 3;
45         u_char  section_syntax_indicator        : 1;
46 #endif
47
48         u_char  section_length_lo               : 8;
49
50         u_char  service_id_hi                   : 8;
51         u_char  service_id_lo                   : 8;
52
53 #if BYTE_ORDER == BIG_ENDIAN
54         u_char                                  : 2;
55         u_char  version_number                  : 5;
56         u_char  current_next_indicator          : 1;
57 #else
58         u_char  current_next_indicator          : 1;
59         u_char  version_number                  : 5;
60         u_char                                  : 2;
61 #endif
62
63         u_char  section_number                  : 8;
64         u_char  last_section_number             : 8;
65         u_char  transport_stream_id_hi          : 8;
66         u_char  transport_stream_id_lo          : 8;
67         u_char  original_network_id_hi          : 8;
68         u_char  original_network_id_lo          : 8;
69         u_char  segment_last_section_number     : 8;
70         u_char  segment_last_table_id           : 8;
71 } eit_t;
72
73 #define EIT_SIZE 14
74
75 struct eit_loop_struct1 {
76         u_char  service_id_hi                   : 8;
77         u_char  service_id_lo                   : 8;
78
79 #if BYTE_ORDER == BIG_ENDIAN
80         u_char                                  : 6;
81         u_char  eit_schedule_flag               : 1;
82         u_char  eit_present_following_flag      : 1;
83
84         u_char  running_status                  : 3;
85         u_char  free_ca_mode                    : 1;
86         u_char  descriptors_loop_length_hi      : 4;
87 #else
88         u_char  eit_present_following_flag      : 1;
89         u_char  eit_schedule_flag               : 1;
90         u_char                                  : 6;
91
92         u_char  descriptors_loop_length_hi      : 4;
93         u_char  free_ca_mode                    : 1;
94         u_char  running_status                  : 3;
95 #endif
96
97         u_char  descriptors_loop_length_lo      : 8;
98 };
99
100 #define EIT_SHORT_EVENT_DESCRIPTOR 0x4d
101 #define EIT_SHORT_EVENT_DESCRIPTOR_SIZE 6
102
103 struct eit_short_event_descriptor_struct {
104         u_char  descriptor_tag                  : 8;
105         u_char  descriptor_length               : 8;
106         
107         u_char  language_code_1                 : 8;
108         u_char  language_code_2                 : 8;
109         u_char  language_code_3                 : 8;
110
111         u_char  event_name_length               : 8;
112 };
113         
114 #define EIT_EXTENDED_EVENT_DESCRIPOR 0x4e
115
116 typedef struct eit_event_struct {
117         u_char  event_id_hi                     : 8;
118         u_char  event_id_lo                     : 8;
119         
120         u_char  start_time_1                    : 8;
121         u_char  start_time_2                    : 8;
122         u_char  start_time_3                    : 8;
123         u_char  start_time_4                    : 8;
124         u_char  start_time_5                    : 8;
125
126         u_char  duration_1                      : 8;
127         u_char  duration_2                      : 8;
128         u_char  duration_3                      : 8;
129
130 #if BYTE_ORDER == BIG_ENDIAN
131         u_char  running_status                  : 3;
132         u_char  free_CA_mode                    : 1;
133         u_char  descriptors_loop_length_hi      : 4;
134 #else
135         u_char  descriptors_loop_length_hi      : 4;
136         u_char  free_CA_mode                    : 1;
137         u_char  running_status                  : 3;
138 #endif
139
140         u_char  descriptors_loop_length_lo      : 8;
141         
142 } eit_event_t;
143 #define EIT_LOOP_SIZE 12
144
145 #define EIT_EXTENDED_EVENT_DESCRIPOR 0x4e
146
147 struct eit_extended_descriptor_struct {
148         u_char descriptor_tag : 8;
149         u_char descriptor_length : 8;
150 #if BYTE_ORDER == BIG_ENDIAN
151         u_char descriptor_number : 4;
152         u_char last_descriptor_number : 4;
153 #else
154         u_char last_descriptor_number : 4;
155         u_char descriptor_number : 4;
156 #endif
157         u_char iso_639_2_language_code_1 : 8;
158         u_char iso_639_2_language_code_2 : 8;
159         u_char iso_639_2_language_code_3 : 8;
160 };
161
162
163 #endif