libdvbv5  1.16.3
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 
147  struct dvb_table_header header;
149  uint8_t events;
151 } __attribute__((packed));
152 
160 #define atsc_eit_event_foreach(_event, _eit) \
161  if (_eit && _eit->event) \
162  for( struct atsc_table_eit_event *_event = _eit->event; _event; _event = _event->next ) \
163 
164 struct dvb_v5_fe_parms;
165 
166 #ifdef __cplusplus
167 extern "C" {
168 #endif
169 
186 ssize_t atsc_table_eit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf,
187  ssize_t buflen, struct atsc_table_eit **table);
188 
196 
205  struct atsc_table_eit *table);
206 
215 void atsc_time(const uint32_t start_time, struct tm *tm);
216 
217 #ifdef __cplusplus
218 }
219 #endif
220 
221 #endif
atsc_table_eit_event::source_id
uint16_t source_id
Definition: atsc_eit.h:103
atsc_table_eit::protocol_version
uint8_t protocol_version
Definition: atsc_eit.h:148
atsc_table_eit_event::one2
uint32_t one2
Definition: atsc_eit.h:96
atsc_table_eit_event::bitfield2
uint32_t bitfield2
Definition: atsc_eit.h:91
atsc_table_eit_event::bitfield
uint16_t bitfield
Definition: atsc_eit.h:83
atsc_table_eit_event::title_length
uint32_t title_length
Definition: atsc_eit.h:93
atsc_table_eit_event::start_time
uint32_t start_time
Definition: atsc_eit.h:89
atsc_table_eit_event::etm
uint32_t etm
Definition: atsc_eit.h:95
atsc_table_eit_desc_length
ATSC EIT descriptor length.
Definition: atsc_eit.h:121
atsc_table_eit_init
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.
atsc_time
void atsc_time(const uint32_t start_time, struct tm *tm)
Converts an ATSC EIT formatted timestamp into struct tm.
atsc_table_eit_event::start
struct tm start
Definition: atsc_eit.h:102
atsc_table_eit_event
ATSC EIT event table.
Definition: atsc_eit.h:81
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition: dvb-fe.h:117
atsc_table_eit_free
void atsc_table_eit_free(struct atsc_table_eit *table)
Frees all data allocated by the ATSC EIT table parser.
atsc_header.h
Provides some common ATSC stuff.
atsc_table_eit_desc_length::desc_length
uint16_t desc_length
Definition: atsc_eit.h:124
atsc_table_eit_desc_length::reserved
uint16_t reserved
Definition: atsc_eit.h:125
atsc_table_eit::event
struct atsc_table_eit_event * event
Definition: atsc_eit.h:150
atsc_table_eit::events
uint8_t events
Definition: atsc_eit.h:149
atsc_table_eit::header
struct dvb_table_header header
Definition: atsc_eit.h:147
dvb_table_header
Header of a MPEG-TS table.
Definition: header.h:103
atsc_table_eit_event::duration
uint32_t duration
Definition: atsc_eit.h:94
atsc_table_eit_event::next
struct atsc_table_eit_event * next
Definition: atsc_eit.h:101
dvb_desc
Linked list containing the several descriptors found on a MPEG-TS table.
Definition: descriptors.h:117
atsc_table_eit_desc_length::bitfield
uint16_t bitfield
Definition: atsc_eit.h:122
atsc_table_eit_event::one
uint16_t one
Definition: atsc_eit.h:86
atsc_table_eit_event::descriptor
struct dvb_desc * descriptor
Definition: atsc_eit.h:100
atsc_table_eit_event::event_id
uint16_t event_id
Definition: atsc_eit.h:85
atsc_table_eit_print
void atsc_table_eit_print(struct dvb_v5_fe_parms *parms, struct atsc_table_eit *table)
Prints the content of the ATSC EIT table.
atsc_table_eit
ATSC EIT table.
Definition: atsc_eit.h:146