libdvbv5  1.6.3
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
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation version 2
8  * of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  *
20  */
21 
41 #ifndef _EIT_H
42 #define _EIT_H
43 
44 #include <stdint.h>
45 #include <unistd.h> /* ssize_t */
46 #include <time.h>
47 
48 #include <libdvbv5/header.h>
49 
67 #define DVB_TABLE_EIT 0x4E
68 #define DVB_TABLE_EIT_OTHER 0x4F
69 #define DVB_TABLE_EIT_PID 0x12
70 
71 #define DVB_TABLE_EIT_SCHEDULE 0x50 /* - 0x5F */
72 #define DVB_TABLE_EIT_SCHEDULE_OTHER 0x60 /* - 0x6F */
73 
105  uint16_t event_id;
106  union {
107  uint16_t bitfield1; /* first 2 bytes are MJD, they need to be bswapped */
108  uint8_t dvbstart[5];
109  } __attribute__((packed));
110  uint8_t dvbduration[3];
111  union {
112  uint16_t bitfield2;
113  struct {
114  uint16_t desc_length:12;
115  uint16_t free_CA_mode:1;
116  uint16_t running_status:3;
117  } __attribute__((packed));
118  } __attribute__((packed));
121  struct tm start;
122  uint32_t duration;
123  uint16_t service_id;
124 } __attribute__((packed));
125 
147  uint16_t transport_id;
148  uint16_t network_id;
149  uint8_t last_segment;
150  uint8_t last_table_id;
152 } __attribute__((packed));
153 
161 #define dvb_eit_event_foreach(_event, _eit) \
162  for( struct dvb_table_eit_event *_event = _eit->event; _event; _event = _event->next ) \
163 
164 struct dvb_v5_fe_parms;
165 
167 extern const char *dvb_eit_running_status_name[8];
168 
169 #ifdef __cplusplus
170 extern "C" {
171 #endif
172 
189 ssize_t dvb_table_eit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
190  ssize_t buflen, struct dvb_table_eit **table);
191 
198 void dvb_table_eit_free(struct dvb_table_eit *table);
199 
207 void dvb_table_eit_print(struct dvb_v5_fe_parms *parms,
208  struct dvb_table_eit *table);
209 
218 void dvb_time(const uint8_t data[5], struct tm *tm);
219 
220 #ifdef __cplusplus
221 }
222 #endif
223 
224 #endif
uint16_t free_CA_mode
Definition: eit.h:115
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:93
struct tm start
Definition: eit.h:121
Provides the MPEG TS table headers.
uint16_t service_id
Definition: eit.h:123
uint16_t bitfield1
Definition: eit.h:107
uint16_t bitfield2
Definition: eit.h:112
uint16_t network_id
Definition: eit.h:148
uint16_t desc_length
Definition: eit.h:114
struct dvb_table_header header
Definition: eit.h:146
uint16_t event_id
Definition: eit.h:105
DVB EIT table.
Definition: eit.h:145
struct dvb_table_eit_event * next
Definition: eit.h:120
uint8_t last_segment
Definition: eit.h:149
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:147
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:118
struct dvb_table_eit_event * event
Definition: eit.h:151
uint16_t running_status
Definition: eit.h:116
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:118
const char * dvb_eit_running_status_name[8]
Converts a running_status field into string.
uint8_t last_table_id
Definition: eit.h:150
DVB EIT event table.
Definition: eit.h:104
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:122
uint8_t dvbstart[5]
Definition: eit.h:108
struct dvb_desc * descriptor
Definition: eit.h:119
uint8_t dvbduration[3]
Definition: eit.h:110