libdvbv5  1.20.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 
147  struct dvb_table_header header;
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  if (_eit && _eit->event) \
164  for( struct dvb_table_eit_event *_event = _eit->event; _event; _event = _event->next ) \
165 
166 struct dvb_v5_fe_parms;
167 
169 extern const char *dvb_eit_running_status_name[8];
170 
171 #ifdef __cplusplus
172 extern "C" {
173 #endif
174 
191 ssize_t dvb_table_eit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
192  ssize_t buflen, struct dvb_table_eit **table);
193 
200 void dvb_table_eit_free(struct dvb_table_eit *table);
201 
210  struct dvb_table_eit *table);
211 
220 void dvb_time(const uint8_t data[5], struct tm *tm);
221 
222 #ifdef __cplusplus
223 }
224 #endif
225 
226 #endif
dvb_table_eit_event::bitfield2
uint16_t bitfield2
Definition: eit.h:113
dvb_eit_running_status_name
const char * dvb_eit_running_status_name[8]
Converts a running_status field into string.
dvb_table_eit::event
struct dvb_table_eit_event * event
Definition: eit.h:152
dvb_table_eit_event::free_CA_mode
uint16_t free_CA_mode
Definition: eit.h:116
dvb_table_eit_event::event_id
uint16_t event_id
Definition: eit.h:106
dvb_time
void dvb_time(const uint8_t data[5], struct tm *tm)
Converts a DVB EIT formatted timestamp into struct tm.
dvb_table_eit::last_table_id
uint8_t last_table_id
Definition: eit.h:151
dvb_table_eit_event::desc_length
uint16_t desc_length
Definition: eit.h:115
dvb_table_eit_init
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.
dvb_table_eit_event::next
struct dvb_table_eit_event * next
Definition: eit.h:121
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:117
dvb_table_eit_event
DVB EIT event table.
Definition: eit.h:105
dvb_table_eit_free
void dvb_table_eit_free(struct dvb_table_eit *table)
Frees all data allocated by the DVB EIT table parser.
dvb_table_eit_print
void dvb_table_eit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_eit *table)
Prints the content of the DVB EIT table.
dvb_table_eit::header
struct dvb_table_header header
Definition: eit.h:147
dvb_table_eit::network_id
uint16_t network_id
Definition: eit.h:149
dvb_table_eit_event::running_status
uint16_t running_status
Definition: eit.h:117
dvb_table_eit_event::duration
uint32_t duration
Definition: eit.h:123
dvb_table_eit_event::descriptor
struct dvb_desc * descriptor
Definition: eit.h:120
dvb_table_header
Header of a MPEG-TS table.
Definition: header.h:103
dvb_table_eit
DVB EIT table.
Definition: eit.h:146
dvb_table_eit_event::start
struct tm start
Definition: eit.h:122
dvb_desc
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:117
dvb_table_eit::transport_id
uint16_t transport_id
Definition: eit.h:148
dvb_table_eit_event::dvbduration
uint8_t dvbduration[3]
Definition: eit.h:111
dvb_table_eit_event::dvbstart
uint8_t dvbstart[5]
Definition: eit.h:109
header.h
Provides the MPEG TS table headers.
dvb_table_eit::last_segment
uint8_t last_segment
Definition: eit.h:150
dvb_table_eit_event::bitfield1
uint16_t bitfield1
Definition: eit.h:108
dvb_table_eit_event::service_id
uint16_t service_id
Definition: eit.h:124