libdvbv5  1.11.0
Library to work with Digital TV devices on Linux
eit.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2012 - Mauro Carvalho Chehab
3  * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation version 2.1 of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18  *
19  */
20 
40 #ifndef _EIT_H
41 #define _EIT_H
42 
43 #include <stdint.h>
44 #include <unistd.h> /* ssize_t */
45 #include <time.h>
46 
47 #include <libdvbv5/header.h>
48 
68 #define DVB_TABLE_EIT 0x4E
69 #define DVB_TABLE_EIT_OTHER 0x4F
70 #define DVB_TABLE_EIT_PID 0x12
71 
72 #define DVB_TABLE_EIT_SCHEDULE 0x50
73 #define DVB_TABLE_EIT_SCHEDULE_OTHER 0x60
74 
106  uint16_t event_id;
107  union {
108  uint16_t bitfield1; /* first 2 bytes are MJD, they need to be bswapped */
109  uint8_t dvbstart[5];
110  } __attribute__((packed));
111  uint8_t dvbduration[3];
112  union {
113  uint16_t bitfield2;
114  struct {
115  uint16_t desc_length:12;
116  uint16_t free_CA_mode:1;
117  uint16_t running_status:3;
118  } __attribute__((packed));
119  } __attribute__((packed));
122  struct tm start;
123  uint32_t duration;
124  uint16_t service_id;
125 } __attribute__((packed));
126 
148  uint16_t transport_id;
149  uint16_t network_id;
150  uint8_t last_segment;
151  uint8_t last_table_id;
153 } __attribute__((packed));
154 
162 #define dvb_eit_event_foreach(_event, _eit) \
163  for( struct dvb_table_eit_event *_event = _eit->event; _event; _event = _event->next ) \
164 
165 struct dvb_v5_fe_parms;
166 
168 extern const char *dvb_eit_running_status_name[8];
169 
170 #ifdef __cplusplus
171 extern "C" {
172 #endif
173 
190 ssize_t dvb_table_eit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
191  ssize_t buflen, struct dvb_table_eit **table);
192 
199 void dvb_table_eit_free(struct dvb_table_eit *table);
200 
208 void dvb_table_eit_print(struct dvb_v5_fe_parms *parms,
209  struct dvb_table_eit *table);
210 
219 void dvb_time(const uint8_t data[5], struct tm *tm);
220 
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 #endif
uint16_t free_CA_mode
Definition: eit.h:116
ssize_t dvb_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, struct dvb_table_eit **table)
Initializes and parses EIT table.
Header of a MPEG-TS table.
Definition: header.h:92
struct tm start
Definition: eit.h:122
Provides the MPEG TS table headers.
uint16_t service_id
Definition: eit.h:124
uint16_t bitfield1
Definition: eit.h:108
uint16_t bitfield2
Definition: eit.h:113
uint16_t network_id
Definition: eit.h:149
uint16_t desc_length
Definition: eit.h:115
struct dvb_table_header header
Definition: eit.h:147
uint16_t event_id
Definition: eit.h:106
DVB EIT table.
Definition: eit.h:146
struct dvb_table_eit_event * next
Definition: eit.h:121
uint8_t last_segment
Definition: eit.h:150
void dvb_table_eit_free(struct dvb_table_eit *table)
Frees all data allocated by the DVB EIT table parser.
uint16_t transport_id
Definition: eit.h:148
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:117
struct dvb_table_eit_event * event
Definition: eit.h:152
uint16_t running_status
Definition: eit.h:117
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:117
const char * dvb_eit_running_status_name[8]
Converts a running_status field into string.
uint8_t last_table_id
Definition: eit.h:151
DVB EIT event table.
Definition: eit.h:105
void dvb_table_eit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_eit *table)
Prints the content of the DVB EIT table.
void dvb_time(const uint8_t data[5], struct tm *tm)
Converts a DVB EIT formatted timestamp into struct tm.
uint32_t duration
Definition: eit.h:123
uint8_t dvbstart[5]
Definition: eit.h:109
struct dvb_desc * descriptor
Definition: eit.h:120
uint8_t dvbduration[3]
Definition: eit.h:111