libdvbv5  1.11.0
Library to work with Digital TV devices on Linux
atsc_eit.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 - Andre Roth <neolynx@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation version 2.1 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
17  *
18  */
19 
39 #ifndef _ATSC_EIT_H
40 #define _ATSC_EIT_H
41 
42 #include <stdint.h>
43 #include <unistd.h> /* ssize_t */
44 #include <time.h>
45 
46 #include <libdvbv5/atsc_header.h>
47 
53 #define ATSC_TABLE_EIT 0xCB
54 
82  union {
83  uint16_t bitfield;
84  struct {
85  uint16_t event_id:14;
86  uint16_t one:2;
87  } __attribute__((packed));
88  } __attribute__((packed));
89  uint32_t start_time;
90  union {
91  uint32_t bitfield2;
92  struct {
93  uint32_t title_length:8;
94  uint32_t duration:20;
95  uint32_t etm:2;
96  uint32_t one2:2;
97  uint32_t :2;
98  } __attribute__((packed));
99  } __attribute__((packed));
102  struct tm start;
103  uint16_t source_id;
104 } __attribute__((packed));
105 
122  uint16_t bitfield;
123  struct {
124  uint16_t desc_length:12;
125  uint16_t reserved:4;
126  } __attribute__((packed));
127 } __attribute__((packed));
128 
149  uint8_t events;
151 } __attribute__((packed));
152 
160 #define atsc_eit_event_foreach(_event, _eit) \
161  for( struct atsc_table_eit_event *_event = _eit->event; _event; _event = _event->next ) \
162 
163 struct dvb_v5_fe_parms;
164 
165 #ifdef __cplusplus
166 extern "C" {
167 #endif
168 
185 ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
186  ssize_t buflen, struct atsc_table_eit **table);
187 
194 void atsc_table_eit_free(struct atsc_table_eit *table);
195 
203 void atsc_table_eit_print(struct dvb_v5_fe_parms *parms,
204  struct atsc_table_eit *table);
205 
214 void atsc_time(const uint32_t start_time, struct tm *tm);
215 
216 #ifdef __cplusplus
217 }
218 #endif
219 
220 #endif
Header of a MPEG-TS table.
Definition: header.h:92
struct atsc_table_eit_event * next
Definition: atsc_eit.h:101
struct dvb_desc * descriptor
Definition: atsc_eit.h:100
uint16_t bitfield
Definition: atsc_eit.h:83
void atsc_time(const uint32_t start_time, struct tm *tm)
Converts an ATSC EIT formatted timestamp into struct tm.
uint16_t event_id
Definition: atsc_eit.h:85
ATSC EIT descriptor length.
Definition: atsc_eit.h:121
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:117
struct atsc_table_eit_event * event
Definition: atsc_eit.h:150
void atsc_table_eit_print(struct dvb_v5_fe_parms *parms, struct atsc_table_eit *table)
Prints the content of the ATSC EIT table.
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:117
uint32_t title_length
Definition: atsc_eit.h:93
uint32_t start_time
Definition: atsc_eit.h:89
ATSC EIT event table.
Definition: atsc_eit.h:81
uint32_t bitfield2
Definition: atsc_eit.h:91
uint8_t events
Definition: atsc_eit.h:149
struct dvb_table_header header
Definition: atsc_eit.h:147
ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, struct atsc_table_eit **table)
Initializes and parses ATSC EIT table.
void atsc_table_eit_free(struct atsc_table_eit *table)
Frees all data allocated by the ATSC EIT table parser.
uint8_t protocol_version
Definition: atsc_eit.h:148
uint16_t source_id
Definition: atsc_eit.h:103
ATSC EIT table.
Definition: atsc_eit.h:146
uint32_t duration
Definition: atsc_eit.h:94
Provides some common ATSC stuff.