libdvbv5: lib/include/libdvbv5/nit.h Source File

libdvbv5 1.26.0 Library to work with Digital TV devices on Linux

nit.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
21#ifndef _NIT_H
22#define _NIT_H
23
24#include <stdint.h>
25#include <unistd.h> /* ssize_t */
26
27#include <libdvbv5/header.h>
28#include <libdvbv5/descriptors.h>
29
61#define DVB_TABLE_NIT 0x40
62#define DVB_TABLE_NIT2 0x41
63#define DVB_TABLE_NIT_PID 0x10
64
79 union dvb_table_nit_transport_header {
80 uint16_t bitfield;
81 struct {
82 uint16_t transport_length:12;
83 uint16_t reserved:4;
84 } __attribute__((packed));
85} __attribute__((packed));
86
109 struct dvb_table_nit_transport {
110 uint16_t transport_id;
111 uint16_t network_id;
112 union {
113 uint16_t bitfield;
114 struct {
115 uint16_t desc_length:12;
116 uint16_t reserved:4;
117 } __attribute__((packed));
118 } __attribute__((packed));
119 struct dvb_desc *descriptor;
120 struct dvb_table_nit_transport *next;
121} __attribute__((packed));
122
143 struct dvb_table_nit {
144 struct dvb_table_header header;
145 union {
146 uint16_t bitfield;
147 struct {
148 uint16_t desc_length:12;
149 uint16_t reserved:4;
150 } __attribute__((packed));
151 } __attribute__((packed));
152 struct dvb_desc *descriptor;
153 struct dvb_table_nit_transport *transport;
154} __attribute__((packed));
155
164 typedef void nit_handler_callback_t(struct dvb_table_nit *nit,
165 struct dvb_desc *desc,
166 void *priv);
167
177 typedef void nit_tran_handler_callback_t(struct dvb_table_nit *nit,
178 struct dvb_table_nit_transport *tran,
179 struct dvb_desc *desc,
180 void *priv);
181
189#define dvb_nit_transport_foreach( _tran, _nit ) \
190 if (_nit && _nit->transport) \
191 for (struct dvb_table_nit_transport *_tran = _nit->transport; _tran; _tran = _tran->next) \
192
193struct dvb_v5_fe_parms;
194
195#ifdef __cplusplus
196extern "C" {
197#endif
198
215ssize_t dvb_table_nit_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf,
216 ssize_t buflen, struct dvb_table_nit **table);
217
224 void dvb_table_nit_free(struct dvb_table_nit *table);
225
233 void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table);
234
264 void dvb_table_nit_descriptor_handler(
265 struct dvb_v5_fe_parms *parms,
266 struct dvb_table_nit *table,
267 enum descriptors descriptor,
268 nit_handler_callback_t *call_nit,
269 nit_tran_handler_callback_t *call_tran,
270 void *priv);
271
272#ifdef __cplusplus
273}
274#endif
275
276#endif
descriptors.h
Provides a way to handle MPEG-TS descriptors found on Digital TV streams.
descriptors
descriptors
Definition descriptors.h:592
nit_handler_callback_t
void nit_handler_callback_t(struct dvb_table_nit *nit, struct dvb_desc *desc, void *priv)
typedef for a callback used when a NIT table entry is found
Definition nit.h:164
dvb_table_nit_print
void dvb_table_nit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table)
Prints the content of the NIT table.
dvb_table_nit_descriptor_handler
void dvb_table_nit_descriptor_handler(struct dvb_v5_fe_parms *parms, struct dvb_table_nit *table, enum descriptors descriptor, nit_handler_callback_t *call_nit, nit_tran_handler_callback_t *call_tran, void *priv)
For each entry at NIT and NIT transport tables, call a callback.
dvb_table_nit_init
ssize_t dvb_table_nit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, struct dvb_table_nit **table)
Initializes and parses NIT table.
dvb_table_nit_free
void dvb_table_nit_free(struct dvb_table_nit *table)
Frees all data allocated by the NIT table parser.
nit_tran_handler_callback_t
void nit_tran_handler_callback_t(struct dvb_table_nit *nit, struct dvb_table_nit_transport *tran, struct dvb_desc *desc, void *priv)
typedef for a callback used when a NIT transport table entry is found
Definition nit.h:177
header.h
Provides the MPEG TS table headers.
dvb_desc
Linked list containing the several descriptors found on a MPEG-TS table.
Definition descriptors.h:117
dvb_table_header
Header of a MPEG-TS table.
Definition header.h:103
dvb_table_nit_transport
MPEG-TS NIT transport table.
Definition nit.h:109
dvb_table_nit_transport::network_id
uint16_t network_id
Definition nit.h:111
dvb_table_nit_transport::reserved
uint16_t reserved
Definition nit.h:116
dvb_table_nit_transport::descriptor
struct dvb_desc * descriptor
Definition nit.h:119
dvb_table_nit_transport::desc_length
uint16_t desc_length
Definition nit.h:115
dvb_table_nit_transport::transport_id
uint16_t transport_id
Definition nit.h:110
dvb_table_nit_transport::bitfield
uint16_t bitfield
Definition nit.h:113
dvb_table_nit_transport::next
struct dvb_table_nit_transport * next
Definition nit.h:120
dvb_table_nit
MPEG-TS NIT table.
Definition nit.h:143
dvb_table_nit::descriptor
struct dvb_desc * descriptor
Definition nit.h:152
dvb_table_nit::desc_length
uint16_t desc_length
Definition nit.h:148
dvb_table_nit::transport
struct dvb_table_nit_transport * transport
Definition nit.h:153
dvb_table_nit::bitfield
uint16_t bitfield
Definition nit.h:146
dvb_table_nit::reserved
uint16_t reserved
Definition nit.h:149
dvb_table_nit::header
struct dvb_table_header header
Definition nit.h:144
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition dvb-fe.h:117
dvb_table_nit_transport_header
MPEG-TS NIT transport header.
Definition nit.h:79
dvb_table_nit_transport_header::transport_length
uint16_t transport_length
Definition nit.h:82
dvb_table_nit_transport_header::bitfield
uint16_t bitfield
Definition nit.h:80
dvb_table_nit_transport_header::reserved
uint16_t reserved
Definition nit.h:83